3 // FolderType definition
12 // Folder Status definition
14 StatusErrorConfig = "ErrorConfig"
15 StatusDisable = "Disable"
16 StatusEnable = "Enable"
19 // IFOLDER Folder interface
20 type IFOLDER interface {
21 Add(cfg FolderConfig) (*FolderConfig, error) // Add a new folder
22 GetConfig() FolderConfig // Get folder public configuration
23 GetFullPath(dir string) string // Get folder full path
24 Remove() error // Remove a folder
25 Sync() error // Force folder files synchronization
26 IsInSync() (bool, error) // Check if folder files are in-sync
29 // FolderConfig is the config for one folder
30 type FolderConfig struct {
32 Label string `json:"label"`
33 ClientPath string `json:"path"`
34 Type FolderType `json:"type"`
35 Status string `json:"status"`
36 DefaultSdk string `json:"defaultSdk"`
38 // Not exported fields from REST API point of view
39 RootPath string `json:"-"`
41 // FIXME: better to define an equivalent to union data and then implement
42 // UnmarshalJSON/MarshalJSON to decode/encode according to Type value
43 // Data interface{} `json:"data"`
45 // Specific data depending on which Type is used
46 DataPathMap PathMapConfig `json:"dataPathMap,omitempty"`
47 DataCloudSync CloudSyncConfig `json:"dataCloudSync,omitempty"`
50 // PathMapConfig Path mapping specific data
51 type PathMapConfig struct {
52 ServerPath string `json:"serverPath"`
55 // CloudSyncConfig CloudSync (AKA Syncthing) specific data
56 type CloudSyncConfig struct {
57 SyncThingID string `json:"syncThingID"`
58 BuilderSThgID string `json:"builderSThgID"`