e93649457a166c8aeefa53aff6185bb33ffa56a2
[src/xds/xds-server.git] / lib / folder / folder-st-disable.go
1 package folder
2
3 import (
4         "github.com/iotbzh/xds-server/lib/xdsconfig"
5         uuid "github.com/satori/go.uuid"
6 )
7
8 // IFOLDER interface implementation for disabled Syncthing folders
9 // It's a "fallback" interface used to keep syncthing folders config even
10 // when syncthing is not running.
11
12 // STFolderDisable .
13 type STFolderDisable struct {
14         globalConfig *xdsconfig.Config
15         config       FolderConfig
16 }
17
18 // NewFolderSTDisable Create a new instance of STFolderDisable
19 func NewFolderSTDisable(gc *xdsconfig.Config) *STFolderDisable {
20         f := STFolderDisable{
21                 globalConfig: gc,
22         }
23         return &f
24 }
25
26 // NewUID Get a UUID
27 func (f *STFolderDisable) NewUID(suffix string) string {
28         uuid := uuid.NewV1().String()
29         if len(suffix) > 0 {
30                 uuid += "_" + suffix
31         }
32         return uuid
33 }
34
35 // Add a new folder
36 func (f *STFolderDisable) Add(cfg FolderConfig) (*FolderConfig, error) {
37         f.config = cfg
38         f.config.Status = StatusDisable
39         f.config.IsInSync = false
40         return &f.config, nil
41 }
42
43 // GetConfig Get public part of folder config
44 func (f *STFolderDisable) GetConfig() FolderConfig {
45         return f.config
46 }
47
48 // GetFullPath returns the full path of a directory (from server POV)
49 func (f *STFolderDisable) GetFullPath(dir string) string {
50         return ""
51 }
52
53 // ConvPathCli2Svr Convert path from Client to Server
54 func (f *STFolderDisable) ConvPathCli2Svr(s string) string {
55         return ""
56 }
57
58 // ConvPathSvr2Cli Convert path from Server to Client
59 func (f *STFolderDisable) ConvPathSvr2Cli(s string) string {
60         return ""
61 }
62
63 // Remove a folder
64 func (f *STFolderDisable) Remove() error {
65         return nil
66 }
67
68 // Update update some fields of a folder
69 func (f *STFolderDisable) Update(cfg FolderConfig) (*FolderConfig, error) {
70         return nil, nil
71 }
72
73 // RegisterEventChange requests registration for folder change event
74 func (f *STFolderDisable) RegisterEventChange(cb *EventCB, data *EventCBData) error {
75         return nil
76 }
77
78 // UnRegisterEventChange remove registered callback
79 func (f *STFolderDisable) UnRegisterEventChange() error {
80         return nil
81 }
82
83 // Sync Force folder files synchronization
84 func (f *STFolderDisable) Sync() error {
85         return nil
86 }
87
88 // IsInSync Check if folder files are in-sync
89 func (f *STFolderDisable) IsInSync() (bool, error) {
90         return false, nil
91 }