xdsserver

package
v1.0.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2017 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIService

type APIService struct {
	*Context
	// contains filtered or unexported fields
}

APIService .

func NewAPIV1

func NewAPIV1(ctx *Context) *APIService

NewAPIV1 creates a new instance of API service

type ClientSession

type ClientSession struct {
	ID       string
	WSID     string // only one WebSocket per client/session
	MaxAge   int64
	IOSocket *socketio.Socket
	// contains filtered or unexported fields
}

ClientSession contains the info of a user/client session

type Context

type Context struct {
	ProgName      string
	Cli           *cli.Context
	Config        *xdsconfig.Config
	Log           *logrus.Logger
	LogLevelSilly bool
	SThg          *st.SyncThing
	SThgCmd       *exec.Cmd
	SThgInotCmd   *exec.Cmd

	WWWServer *WebServer

	Exit chan os.Signal
	// contains filtered or unexported fields
}

Context holds the XDS server context

func NewXdsServer

func NewXdsServer(cliCtx *cli.Context) *Context

NewXdsServer Create a new instance of XDS server

func (*Context) Run

func (ctx *Context) Run() (int, error)

Run Main function called to run XDS Server

type CrossSDK

type CrossSDK struct {
	// contains filtered or unexported fields
}

CrossSDK Hold SDK config

func NewCrossSDK

func NewCrossSDK(path string) (*CrossSDK, error)

NewCrossSDK creates a new instance of Syncthing

func (*CrossSDK) Get

func (s *CrossSDK) Get() *xsapiv1.SDK

Get Return SDK definition

func (*CrossSDK) GetEnvCmd

func (s *CrossSDK) GetEnvCmd() []string

GetEnvCmd returns the command used to initialized the environment

type FolderEventCB

type FolderEventCB func(cfg *xsapiv1.FolderConfig, data *FolderEventCBData)

type FolderEventCBData

type FolderEventCBData map[string]interface{}

type Folders

type Folders struct {
	*Context
	// contains filtered or unexported fields
}

Folders Represent a an XDS folders

func FoldersNew

func FoldersNew(ctx *Context) *Folders

FoldersNew Create a new instance of Model Folders

func (*Folders) Add

Add adds a new folder

func (*Folders) Delete

func (f *Folders) Delete(id string) (xsapiv1.FolderConfig, error)

Delete deletes a specific folder

func (*Folders) ForceSync

func (f *Folders) ForceSync(id string) error

ForceSync Force the synchronization of a folder

func (*Folders) Get

func (f *Folders) Get(id string) *IFOLDER

Get returns the folder config or nil if not existing

func (*Folders) GetConfigArr

func (f *Folders) GetConfigArr() []xsapiv1.FolderConfig

GetConfigArr returns the config of all folders as an array

func (*Folders) IsFolderInSync

func (f *Folders) IsFolderInSync(id string) (bool, error)

IsFolderInSync Returns true when folder is in sync

func (*Folders) LoadConfig

func (f *Folders) LoadConfig() error

LoadConfig Load folders configuration from disk

func (*Folders) RegisterEventChange

func (f *Folders) RegisterEventChange(id string, cb *FolderEventCB, data *FolderEventCBData) error

RegisterEventChange requests registration for folder event change

func (*Folders) ResolveID

func (f *Folders) ResolveID(id string) (string, error)

ResolveID Complete a Folder ID (helper for user that can use partial ID value)

func (*Folders) SaveConfig

func (f *Folders) SaveConfig() error

SaveConfig Save folders configuration to disk

func (*Folders) Update

func (f *Folders) Update(id string, cfg xsapiv1.FolderConfig) (*xsapiv1.FolderConfig, error)

Update Update a specific folder

type IFOLDER

type IFOLDER interface {
	NewUID(suffix string) string                                          // Get a new folder UUID
	Add(cfg xsapiv1.FolderConfig) (*xsapiv1.FolderConfig, error)          // Add a new folder
	GetConfig() xsapiv1.FolderConfig                                      // Get folder public configuration
	GetFullPath(dir string) string                                        // Get folder full path
	ConvPathCli2Svr(s string) string                                      // Convert path from Client to Server
	ConvPathSvr2Cli(s string) string                                      // Convert path from Server to Client
	Remove() error                                                        // Remove a folder
	Update(cfg xsapiv1.FolderConfig) (*xsapiv1.FolderConfig, error)       // Update a new folder
	RegisterEventChange(cb *FolderEventCB, data *FolderEventCBData) error // Request events registration (sent through WS)
	UnRegisterEventChange() error                                         // Un-register events
	Sync() error                                                          // Force folder files synchronization
	IsInSync() (bool, error)                                              // Check if folder files are in-sync
}

IFOLDER Folder interface

type PathMap

type PathMap struct {
	*Context
	// contains filtered or unexported fields
}

PathMap .

func NewFolderPathMap

func NewFolderPathMap(ctx *Context) *PathMap

NewFolderPathMap Create a new instance of PathMap

func (*PathMap) Add

Add a new folder

func (*PathMap) ConvPathCli2Svr

func (f *PathMap) ConvPathCli2Svr(s string) string

ConvPathCli2Svr Convert path from Client to Server

func (*PathMap) ConvPathSvr2Cli

func (f *PathMap) ConvPathSvr2Cli(s string) string

ConvPathSvr2Cli Convert path from Server to Client

func (*PathMap) GetConfig

func (f *PathMap) GetConfig() xsapiv1.FolderConfig

GetConfig Get public part of folder config

func (*PathMap) GetFullPath

func (f *PathMap) GetFullPath(dir string) string

GetFullPath returns the full path of a directory (from server POV)

func (*PathMap) IsInSync

func (f *PathMap) IsInSync() (bool, error)

IsInSync Check if folder files are in-sync

func (*PathMap) NewUID

func (f *PathMap) NewUID(suffix string) string

NewUID Get a UUID

func (*PathMap) RegisterEventChange

func (f *PathMap) RegisterEventChange(cb *FolderEventCB, data *FolderEventCBData) error

RegisterEventChange requests registration for folder change event

func (*PathMap) Remove

func (f *PathMap) Remove() error

Remove a folder

func (*PathMap) Sync

func (f *PathMap) Sync() error

Sync Force folder files synchronization

func (*PathMap) UnRegisterEventChange

func (f *PathMap) UnRegisterEventChange() error

UnRegisterEventChange remove registered callback

func (*PathMap) Update

Update update some fields of a folder

type RegisteredCB

type RegisteredCB struct {
	// contains filtered or unexported fields
}

RegisteredCB Hold registered callbacks

type SDKs

type SDKs struct {
	*Context
	Sdks map[string]*CrossSDK
	// contains filtered or unexported fields
}

SDKs List of installed SDK

func NewSDKs

func NewSDKs(ctx *Context) (*SDKs, error)

NewSDKs creates a new instance of SDKs

func (*SDKs) Get

func (s *SDKs) Get(id string) *xsapiv1.SDK

Get returns an SDK from id

func (*SDKs) GetAll

func (s *SDKs) GetAll() []xsapiv1.SDK

GetAll returns all existing SDKs

func (*SDKs) GetEnvCmd

func (s *SDKs) GetEnvCmd(id string, defaultID string) []string

GetEnvCmd returns the command used to initialized the environment for an SDK

func (*SDKs) ResolveID

func (s *SDKs) ResolveID(id string) (string, error)

ResolveID Complete an SDK ID (helper for user that can use partial ID value)

type STFolder

type STFolder struct {
	*Context
	// contains filtered or unexported fields
}

STFolder .

func NewFolderST

func NewFolderST(ctx *Context, sthg *st.SyncThing) *STFolder

NewFolderST Create a new instance of STFolder

func (*STFolder) Add

Add a new folder

func (*STFolder) ConvPathCli2Svr

func (f *STFolder) ConvPathCli2Svr(s string) string

ConvPathCli2Svr Convert path from Client to Server

func (*STFolder) ConvPathSvr2Cli

func (f *STFolder) ConvPathSvr2Cli(s string) string

ConvPathSvr2Cli Convert path from Server to Client

func (*STFolder) GetConfig

func (f *STFolder) GetConfig() xsapiv1.FolderConfig

GetConfig Get public part of folder config

func (*STFolder) GetFullPath

func (f *STFolder) GetFullPath(dir string) string

GetFullPath returns the full path of a directory (from server POV)

func (*STFolder) IsInSync

func (f *STFolder) IsInSync() (bool, error)

IsInSync Check if folder files are in-sync

func (*STFolder) NewUID

func (f *STFolder) NewUID(suffix string) string

NewUID Get a UUID

func (*STFolder) RegisterEventChange

func (f *STFolder) RegisterEventChange(cb *FolderEventCB, data *FolderEventCBData) error

RegisterEventChange requests registration for folder event change

func (*STFolder) Remove

func (f *STFolder) Remove() error

Remove a folder

func (*STFolder) Sync

func (f *STFolder) Sync() error

Sync Force folder files synchronization

func (*STFolder) UnRegisterEventChange

func (f *STFolder) UnRegisterEventChange() error

UnRegisterEventChange remove registered callback

func (*STFolder) Update

Update update some fields of a folder

type STFolderDisable

type STFolderDisable struct {
	*Context
	// contains filtered or unexported fields
}

STFolderDisable .

func NewFolderSTDisable

func NewFolderSTDisable(ctx *Context) *STFolderDisable

NewFolderSTDisable Create a new instance of STFolderDisable

func (*STFolderDisable) Add

Add a new folder

func (*STFolderDisable) ConvPathCli2Svr

func (f *STFolderDisable) ConvPathCli2Svr(s string) string

ConvPathCli2Svr Convert path from Client to Server

func (*STFolderDisable) ConvPathSvr2Cli

func (f *STFolderDisable) ConvPathSvr2Cli(s string) string

ConvPathSvr2Cli Convert path from Server to Client

func (*STFolderDisable) GetConfig

func (f *STFolderDisable) GetConfig() xsapiv1.FolderConfig

GetConfig Get public part of folder config

func (*STFolderDisable) GetFullPath

func (f *STFolderDisable) GetFullPath(dir string) string

GetFullPath returns the full path of a directory (from server POV)

func (*STFolderDisable) IsInSync

func (f *STFolderDisable) IsInSync() (bool, error)

IsInSync Check if folder files are in-sync

func (*STFolderDisable) NewUID

func (f *STFolderDisable) NewUID(suffix string) string

NewUID Get a UUID

func (*STFolderDisable) RegisterEventChange

func (f *STFolderDisable) RegisterEventChange(cb *FolderEventCB, data *FolderEventCBData) error

RegisterEventChange requests registration for folder change event

func (*STFolderDisable) Remove

func (f *STFolderDisable) Remove() error

Remove a folder

func (*STFolderDisable) Sync

func (f *STFolderDisable) Sync() error

Sync Force folder files synchronization

func (*STFolderDisable) UnRegisterEventChange

func (f *STFolderDisable) UnRegisterEventChange() error

UnRegisterEventChange remove registered callback

func (*STFolderDisable) Update

Update update some fields of a folder

type Sessions

type Sessions struct {
	*Context
	// contains filtered or unexported fields
}

Sessions holds client sessions

func NewClientSessions

func NewClientSessions(ctx *Context, cookieMaxAge string) *Sessions

NewClientSessions .

func (*Sessions) Get

func (s *Sessions) Get(c *gin.Context) *ClientSession

Get returns the client session for a specific ID

func (*Sessions) IOSocketGet

func (s *Sessions) IOSocketGet(sid string) *socketio.Socket

IOSocketGet Get socketio definition from sid

func (*Sessions) Middleware

func (s *Sessions) Middleware() gin.HandlerFunc

Middleware is used to managed session

func (*Sessions) Stop

func (s *Sessions) Stop()

Stop sessions management

func (*Sessions) UpdateIOSocket

func (s *Sessions) UpdateIOSocket(sid string, so *socketio.Socket) error

UpdateIOSocket updates the IO Socket definition for of a session

type WebServer

type WebServer struct {
	*Context
	// contains filtered or unexported fields
}

WebServer .

func NewWebServer

func NewWebServer(ctx *Context) *WebServer

NewWebServer creates an instance of WebServer

func (*WebServer) Serve

func (s *WebServer) Serve() error

Serve starts a new instance of the Web Server

func (*WebServer) Stop

func (s *WebServer) Stop()

Stop web server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL