Documentation
¶
Index ¶
- type APIService
- type ClientSession
- type Context
- type EventCB
- type EventDef
- type Events
- type IPROJECT
- type OnConnectedCB
- type PathMap
- func (p *PathMap) Add(cfg xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
- func (p *PathMap) Delete() error
- func (p *PathMap) GetProject() *xaapiv1.ProjectConfig
- func (p *PathMap) GetServer() *XdsServer
- func (p *PathMap) IsInSync() (bool, error)
- func (p *PathMap) Setup(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
- func (p *PathMap) Sync() error
- func (p *PathMap) Update(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
- type Projects
- func (p *Projects) Add(newP xaapiv1.ProjectConfig, fromSid, requestURL string) (*xaapiv1.ProjectConfig, error)
- func (p *Projects) Delete(id, fromSid string) (xaapiv1.ProjectConfig, error)
- func (p *Projects) ForceSync(id string) error
- func (p *Projects) Get(id string) *IPROJECT
- func (p *Projects) GetProjectArr() []xaapiv1.ProjectConfig
- func (p *Projects) GetProjectArrUnsafe() []xaapiv1.ProjectConfig
- func (p *Projects) Init(server *XdsServer) error
- func (p *Projects) IsProjectInSync(id string) (bool, error)
- func (p *Projects) ResolveID(id string) (string, error)
- func (p *Projects) Update(id string, prj xaapiv1.ProjectConfig, fromSid string) (*xaapiv1.ProjectConfig, error)
- type STProject
- func (p *STProject) Add(cfg xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
- func (p *STProject) Delete() error
- func (p *STProject) GetProject() *xaapiv1.ProjectConfig
- func (p *STProject) GetServer() *XdsServer
- func (p *STProject) IsInSync() (bool, error)
- func (p *STProject) Setup(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
- func (p *STProject) Sync() error
- func (p *STProject) Update(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
- type Sessions
- func (s *Sessions) Get(c *gin.Context) *ClientSession
- func (s *Sessions) GetID(c *gin.Context) string
- func (s *Sessions) IOSocketGet(sid string) *socketio.Socket
- func (s *Sessions) Middleware() gin.HandlerFunc
- func (s *Sessions) Stop()
- func (s *Sessions) UpdateIOSocket(sid string, so *socketio.Socket) error
- type WebServer
- type XdsServer
- func (xs *XdsServer) Close() error
- func (xs *XdsServer) CommandAdd(cmdID string, data interface{}) error
- func (xs *XdsServer) CommandDelete(cmdID string) error
- func (xs *XdsServer) CommandExec(args *xsapiv1.ExecArgs, res *xsapiv1.ExecResult) error
- func (xs *XdsServer) CommandGet(cmdID string) interface{}
- func (xs *XdsServer) CommandSignal(args *xsapiv1.ExecSignalArgs, res *xsapiv1.ExecSigResult) error
- func (xs *XdsServer) Connect() error
- func (xs *XdsServer) ConnectOn(f OnConnectedCB) error
- func (xs *XdsServer) EventEmit(message string, args ...interface{}) error
- func (xs *XdsServer) EventOff(evName string, id uuid.UUID) error
- func (xs *XdsServer) EventOn(evName string, privData interface{}, f EventCB) (uuid.UUID, error)
- func (xs *XdsServer) EventRegister(evName string, filter string) error
- func (xs *XdsServer) FolderAdd(fld *xsapiv1.FolderConfig, res interface{}) error
- func (xs *XdsServer) FolderDelete(id string) error
- func (xs *XdsServer) FolderSync(id string) error
- func (xs *XdsServer) FolderToProject(fPrj xsapiv1.FolderConfig) xaapiv1.ProjectConfig
- func (xs *XdsServer) FolderUpdate(fld *xsapiv1.FolderConfig, resFld *xsapiv1.FolderConfig) error
- func (xs *XdsServer) GetFolders(folders *[]xsapiv1.FolderConfig) error
- func (xs *XdsServer) GetVersion(res interface{}) error
- func (xs *XdsServer) IsTempoID() bool
- func (xs *XdsServer) PassthroughDelete(url string)
- func (xs *XdsServer) PassthroughGet(url string)
- func (xs *XdsServer) PassthroughPost(url string)
- func (xs *XdsServer) ProjectToFolder(pPrj xaapiv1.ProjectConfig) *xsapiv1.FolderConfig
- func (xs *XdsServer) SendCommand(cmd string, body []byte, res interface{}) error
- func (xs *XdsServer) SetAPIRouterGroup(r *gin.RouterGroup)
- func (xs *XdsServer) SetLoggerOutput(out io.Writer)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIService ¶ added in v1.0.0
type APIService struct { *Context // contains filtered or unexported fields }
APIService .
func NewAPIV1 ¶ added in v1.0.0
func NewAPIV1(ctx *Context) *APIService
NewAPIV1 creates a new instance of API service
func (*APIService) AddXdsServer ¶ added in v1.0.0
func (s *APIService) AddXdsServer(cfg xdsconfig.XDSServerConf) (*XdsServer, error)
AddXdsServer Add a new XDS Server to the list of a server
func (*APIService) DelXdsServer ¶ added in v1.0.0
func (s *APIService) DelXdsServer(id string) error
DelXdsServer Delete an XDS Server from the list of a server
func (*APIService) Stop ¶ added in v1.0.0
func (s *APIService) Stop()
Stop Used to stop/close created services
type ClientSession ¶ added in v1.0.0
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 Config *xdsconfig.Config Log *logrus.Logger LogLevelSilly bool LogSillyf func(format string, args ...interface{}) SThg *st.SyncThing SThgCmd *exec.Cmd SThgInotCmd *exec.Cmd Exit chan os.Signal // contains filtered or unexported fields }
Context holds the Agent context structure
type EventCB ¶ added in v1.0.0
type EventCB func(privData interface{}, evtData interface{}) error
EventCB Event emitter callback
type EventDef ¶ added in v1.0.0
type EventDef struct {
// contains filtered or unexported fields
}
EventDef Definition on one event
type Events ¶ added in v1.0.0
type Events struct { *Context // contains filtered or unexported fields }
Events Hold registered events per context
func (*Events) Register ¶ added in v1.0.0
Register Used by a client/session to register to a specific (or all) event(s)
func (*Events) UnRegister ¶ added in v1.0.0
UnRegister Used by a client/session to unregister event(s)
type IPROJECT ¶ added in v1.0.0
type IPROJECT interface { Add(cfg xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error) // Add a new project Setup(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error) // Local setup of the project Delete() error // Delete a project GetProject() *xaapiv1.ProjectConfig // Get project public configuration Update(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error) // Update project configuration GetServer() *XdsServer // Get XdsServer that holds this project Sync() error // Force project files synchronization IsInSync() (bool, error) // Check if project files are in-sync }
IPROJECT Project interface
type OnConnectedCB ¶ added in v1.0.0
OnConnectedCB connect callback
type PathMap ¶ added in v1.0.0
type PathMap struct { *Context // contains filtered or unexported fields }
PathMap .
func NewProjectPathMap ¶ added in v1.0.0
NewProjectPathMap Create a new instance of PathMap
func (*PathMap) Add ¶ added in v1.0.0
func (p *PathMap) Add(cfg xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
Add a new project
func (*PathMap) GetProject ¶ added in v1.0.0
func (p *PathMap) GetProject() *xaapiv1.ProjectConfig
GetProject Get public part of project config
func (*PathMap) Setup ¶ added in v1.0.0
func (p *PathMap) Setup(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
Setup Setup local project config
func (*PathMap) Update ¶ added in v1.0.0
func (p *PathMap) Update(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
Update Update some field of a project
type Projects ¶ added in v1.0.0
type Projects struct { *Context SThg *st.SyncThing // contains filtered or unexported fields }
Projects Represent a an XDS Projects
func NewProjects ¶ added in v1.0.0
NewProjects Create a new instance of Project Model
func (*Projects) Add ¶ added in v1.0.0
func (p *Projects) Add(newP xaapiv1.ProjectConfig, fromSid, requestURL string) (*xaapiv1.ProjectConfig, error)
Add adds a new folder
func (*Projects) Delete ¶ added in v1.0.0
func (p *Projects) Delete(id, fromSid string) (xaapiv1.ProjectConfig, error)
Delete deletes a specific folder
func (*Projects) GetProjectArr ¶ added in v1.0.0
func (p *Projects) GetProjectArr() []xaapiv1.ProjectConfig
GetProjectArr returns the config of all folders as an array
func (*Projects) GetProjectArrUnsafe ¶ added in v1.0.0
func (p *Projects) GetProjectArrUnsafe() []xaapiv1.ProjectConfig
GetProjectArrUnsafe Same as GetProjectArr without mutex protection
func (*Projects) IsProjectInSync ¶ added in v1.0.0
IsProjectInSync Returns true when folder is in sync
func (*Projects) ResolveID ¶ added in v1.0.0
ResolveID Complete a Project ID (helper for user that can use partial ID value)
func (*Projects) Update ¶ added in v1.0.0
func (p *Projects) Update(id string, prj xaapiv1.ProjectConfig, fromSid string) (*xaapiv1.ProjectConfig, error)
Update Update some field of a project
type STProject ¶ added in v1.0.0
type STProject struct { *Context // contains filtered or unexported fields }
STProject .
func NewProjectST ¶ added in v1.0.0
NewProjectST Create a new instance of STProject
func (*STProject) Add ¶ added in v1.0.0
func (p *STProject) Add(cfg xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
Add a new project
func (*STProject) GetProject ¶ added in v1.0.0
func (p *STProject) GetProject() *xaapiv1.ProjectConfig
GetProject Get public part of project config
func (*STProject) Setup ¶ added in v1.0.0
func (p *STProject) Setup(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
Setup Setup local project config
func (*STProject) Update ¶ added in v1.0.0
func (p *STProject) Update(prj xaapiv1.ProjectConfig) (*xaapiv1.ProjectConfig, error)
Update Update some field of a project
type Sessions ¶ added in v1.0.0
type Sessions struct { *Context // contains filtered or unexported fields }
Sessions holds client sessions
func NewClientSessions ¶ added in v1.0.0
NewClientSessions .
func (*Sessions) Get ¶ added in v1.0.0
func (s *Sessions) Get(c *gin.Context) *ClientSession
Get returns the client session for a specific ID
func (*Sessions) IOSocketGet ¶ added in v1.0.0
IOSocketGet Get socketio definition from sid
func (*Sessions) Middleware ¶ added in v1.0.0
func (s *Sessions) Middleware() gin.HandlerFunc
Middleware is used to managed session
func (*Sessions) UpdateIOSocket ¶ added in v1.0.0
UpdateIOSocket updates the IO Socket definition for of a session
type WebServer ¶ added in v1.0.0
type WebServer struct { *Context // contains filtered or unexported fields }
WebServer .
func NewWebServer ¶ added in v1.0.0
NewWebServer creates an instance of WebServer
type XdsServer ¶ added in v1.0.0
type XdsServer struct { *Context ID string BaseURL string APIURL string PartialURL string ConnRetry int Connected bool Disabled bool ServerConfig *xsapiv1.APIConfig // Events management CBOnError func(error) CBOnDisconnect func(error) // contains filtered or unexported fields }
XdsServer .
func NewXdsServer ¶ added in v1.0.0
func NewXdsServer(ctx *Context, conf xdsconfig.XDSServerConf) *XdsServer
NewXdsServer creates an instance of XdsServer
func (*XdsServer) CommandAdd ¶ added in v1.0.0
CommandAdd Add a new command to the list of running commands
func (*XdsServer) CommandDelete ¶ added in v1.0.0
CommandDelete Delete a command from the command list
func (*XdsServer) CommandExec ¶ added in v1.0.0
CommandExec Send POST request to execute a command
func (*XdsServer) CommandGet ¶ added in v1.0.0
CommandGet Retrieve a command data
func (*XdsServer) CommandSignal ¶ added in v1.0.0
func (xs *XdsServer) CommandSignal(args *xsapiv1.ExecSignalArgs, res *xsapiv1.ExecSigResult) error
CommandSignal Send POST request to send a signal to a command
func (*XdsServer) ConnectOn ¶ added in v1.0.0
func (xs *XdsServer) ConnectOn(f OnConnectedCB) error
ConnectOn Register a callback on events reception
func (*XdsServer) EventOff ¶ added in v1.0.0
EventOff Un-register a (or all) callbacks associated to an event
func (*XdsServer) EventRegister ¶ added in v1.0.0
EventRegister Post a request to register to an XdsServer event
func (*XdsServer) FolderAdd ¶ added in v1.0.0
func (xs *XdsServer) FolderAdd(fld *xsapiv1.FolderConfig, res interface{}) error
FolderAdd Send POST request to add a folder
func (*XdsServer) FolderDelete ¶ added in v1.0.0
FolderDelete Send DELETE request to delete a folder
func (*XdsServer) FolderSync ¶ added in v1.0.0
FolderSync Send POST request to force synchronization of a folder
func (*XdsServer) FolderToProject ¶ added in v1.0.0
func (xs *XdsServer) FolderToProject(fPrj xsapiv1.FolderConfig) xaapiv1.ProjectConfig
FolderToProject Convert Folder structure to Project structure
func (*XdsServer) FolderUpdate ¶ added in v1.0.0
func (xs *XdsServer) FolderUpdate(fld *xsapiv1.FolderConfig, resFld *xsapiv1.FolderConfig) error
FolderUpdate Send PUT request to update a folder
func (*XdsServer) GetFolders ¶ added in v1.0.0
func (xs *XdsServer) GetFolders(folders *[]xsapiv1.FolderConfig) error
GetFolders Send GET request to get current folder configuration
func (*XdsServer) GetVersion ¶ added in v1.0.0
GetVersion Send Get request to retrieve XDS Server version
func (*XdsServer) PassthroughDelete ¶ added in v1.0.0
PassthroughDelete Used to declare a route that sends directly a Delete request to XDS Server
func (*XdsServer) PassthroughGet ¶ added in v1.0.0
PassthroughGet Used to declare a route that sends directly a GET request to XDS Server
func (*XdsServer) PassthroughPost ¶ added in v1.0.0
PassthroughPost Used to declare a route that sends directly a POST request to XDS Server
func (*XdsServer) ProjectToFolder ¶ added in v1.0.0
func (xs *XdsServer) ProjectToFolder(pPrj xaapiv1.ProjectConfig) *xsapiv1.FolderConfig
ProjectToFolder Convert Project structure to Folder structure
func (*XdsServer) SendCommand ¶ added in v1.0.0
SendCommand Send a command to XDS Server
func (*XdsServer) SetAPIRouterGroup ¶ added in v1.0.0
func (xs *XdsServer) SetAPIRouterGroup(r *gin.RouterGroup)
SetAPIRouterGroup .
func (*XdsServer) SetLoggerOutput ¶ added in v1.0.0
SetLoggerOutput Set logger ou