xdsserver

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2018 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSDKInfo

func GetSDKInfo(scriptDir, url, filename, md5sum string, log *logrus.Logger) (xsapiv1.SDK, error)

GetSDKInfo Used get-sdk-info script to extract SDK get info from a SDK file/tarball

func ListCrossSDK

func ListCrossSDK(scriptDir string, log *logrus.Logger) ([]xsapiv1.SDK, error)

ListCrossSDK List all available and installed SDK (call "db-dump" script)

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
	LogSillyf     func(format string, args ...interface{})
	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 {
	*Context
	// contains filtered or unexported fields
}

CrossSDK Hold SDK config

func NewCrossSDK

func NewCrossSDK(ctx *Context, sdk xsapiv1.SDK, scriptDir string) (*CrossSDK, error)

NewCrossSDK creates a new instance of CrossSDK

func (*CrossSDK) AbortInstallRemove

func (s *CrossSDK) AbortInstallRemove(timeout int) error

AbortInstallRemove abort an install or remove command

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

func (*CrossSDK) Install

func (s *CrossSDK) Install(file string, force bool, timeout int, args []string, sess *ClientSession) error

Install a SDK (non blocking command, IOW run in background)

func (*CrossSDK) Remove

func (s *CrossSDK) Remove(timeout int, sess *ClientSession) error

Remove Used to remove/uninstall a SDK

type EventDef

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

EventDef Definition on one event

type Events

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

Events Hold registered events per context

func NewEvents

func NewEvents(ctx *Context) *Events

NewEvents creates an instance of Events

func (*Events) Emit

func (e *Events) Emit(evName string, data interface{}, fromSid string) error

Emit Used to manually emit an event

func (*Events) GetList

func (e *Events) GetList() []string

GetList returns the list of all supported events

func (*Events) Register

func (e *Events) Register(evName, sessionID string) error

Register Used by a client/session to register to a specific (or all) event(s)

func (*Events) UnRegister

func (e *Events) UnRegister(evName, sessionID string) error

UnRegister Used by a client/session to un-register event(s)

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) 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
	Setup(prj xsapiv1.FolderConfig) (*xsapiv1.FolderConfig, error)  // Local setup of the 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
	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) Remove

func (f *PathMap) Remove() error

Remove a folder

func (*PathMap) Setup

Setup Setup local project config

func (*PathMap) Sync

func (f *PathMap) Sync() error

Sync Force folder files synchronization

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
	SdksFamilies map[string]*xsapiv1.SDKFamilyConfig
	// 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) AbortInstall

func (s *SDKs) AbortInstall(id string, timeout int) (*xsapiv1.SDK, error)

AbortInstall Used to abort SDK installation

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) GetByPath

func (s *SDKs) GetByPath(path string) (*xsapiv1.SDK, error)

GetByPath Find a SDK from path

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) Install

func (s *SDKs) Install(id, filepath string, force bool, timeout int, args []string, sess *ClientSession) (*xsapiv1.SDK, error)

Install Used to install a new SDK

func (*SDKs) Remove

func (s *SDKs) Remove(id string, timeout int, sess *ClientSession) (*xsapiv1.SDK, error)

Remove Used to uninstall a 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)

func (*SDKs) Stop

func (s *SDKs) Stop()

Stop SDKs management

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) Remove

func (f *STFolder) Remove() error

Remove a folder

func (*STFolder) Setup

Setup Setup local project config

func (*STFolder) Sync

func (f *STFolder) Sync() error

Sync Force folder files synchronization

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) Remove

func (f *STFolderDisable) Remove() error

Remove a folder

func (*STFolderDisable) Setup

Setup Setup local project config

func (*STFolderDisable) Sync

func (f *STFolderDisable) Sync() error

Sync Force folder files synchronization

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