0a4a17e8e39e43280ceeea50121cf9259f35771f
[src/xds/xds-agent.git] / lib / agent / project-interface.go
1 package agent
2
3 // ProjectType definition
4 type ProjectType string
5
6 const (
7         TypePathMap   = "PathMap"
8         TypeCloudSync = "CloudSync"
9         TypeCifsSmb   = "CIFS"
10 )
11
12 // Project Status definition
13 const (
14         StatusErrorConfig = "ErrorConfig"
15         StatusDisable     = "Disable"
16         StatusEnable      = "Enable"
17         StatusPause       = "Pause"
18         StatusSyncing     = "Syncing"
19 )
20
21 // IPROJECT Project interface
22 type IPROJECT interface {
23         Add(cfg ProjectConfig) (*ProjectConfig, error)           // Add a new project
24         Delete() error                                           // Delete a project
25         GetProject() *ProjectConfig                              // Get project public configuration
26         UpdateProject(prj ProjectConfig) (*ProjectConfig, error) // Update project configuration
27         GetServer() *XdsServer                                   // Get XdsServer that holds this project
28         Sync() error                                             // Force project files synchronization
29         IsInSync() (bool, error)                                 // Check if project files are in-sync
30 }
31
32 // ProjectConfig is the config for one project
33 type ProjectConfig struct {
34         ID         string      `json:"id"`
35         ServerID   string      `json:"serverId"`
36         Label      string      `json:"label"`
37         ClientPath string      `json:"clientPath"`
38         ServerPath string      `json:"serverPath"`
39         Type       ProjectType `json:"type"`
40         Status     string      `json:"status"`
41         IsInSync   bool        `json:"isInSync"`
42         DefaultSdk string      `json:"defaultSdk"`
43 }