aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xdsserver/folder-st-disable.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-29 08:54:00 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-29 11:10:30 +0100
commit2f7828d01f4c4ca2909f95f098627cd5475ed225 (patch)
treeb5e71920b813b95cae3e32044be08b99223348ec /lib/xdsserver/folder-st-disable.go
parent5caebfb4b7c3b73988f067082b219ce5b7f409ba (diff)
Refit source files to have a public xs-apiv1 lib package.
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'lib/xdsserver/folder-st-disable.go')
-rw-r--r--lib/xdsserver/folder-st-disable.go91
1 files changed, 91 insertions, 0 deletions
diff --git a/lib/xdsserver/folder-st-disable.go b/lib/xdsserver/folder-st-disable.go
new file mode 100644
index 0000000..64b1efc
--- /dev/null
+++ b/lib/xdsserver/folder-st-disable.go
@@ -0,0 +1,91 @@
+package xdsserver
+
+import (
+ "github.com/iotbzh/xds-server/lib/xsapiv1"
+ uuid "github.com/satori/go.uuid"
+)
+
+// IFOLDER interface implementation for disabled Syncthing folders
+// It's a "fallback" interface used to keep syncthing folders config even
+// when syncthing is not running.
+
+// STFolderDisable .
+type STFolderDisable struct {
+ *Context
+ config xsapiv1.FolderConfig
+}
+
+// NewFolderSTDisable Create a new instance of STFolderDisable
+func NewFolderSTDisable(ctx *Context) *STFolderDisable {
+ f := STFolderDisable{
+ Context: ctx,
+ }
+ return &f
+}
+
+// NewUID Get a UUID
+func (f *STFolderDisable) NewUID(suffix string) string {
+ uuid := uuid.NewV1().String()
+ if len(suffix) > 0 {
+ uuid += "_" + suffix
+ }
+ return uuid
+}
+
+// Add a new folder
+func (f *STFolderDisable) Add(cfg xsapiv1.FolderConfig) (*xsapiv1.FolderConfig, error) {
+ f.config = cfg
+ f.config.Status = xsapiv1.StatusDisable
+ f.config.IsInSync = false
+ return &f.config, nil
+}
+
+// GetConfig Get public part of folder config
+func (f *STFolderDisable) GetConfig() xsapiv1.FolderConfig {
+ return f.config
+}
+
+// GetFullPath returns the full path of a directory (from server POV)
+func (f *STFolderDisable) GetFullPath(dir string) string {
+ return ""
+}
+
+// ConvPathCli2Svr Convert path from Client to Server
+func (f *STFolderDisable) ConvPathCli2Svr(s string) string {
+ return ""
+}
+
+// ConvPathSvr2Cli Convert path from Server to Client
+func (f *STFolderDisable) ConvPathSvr2Cli(s string) string {
+ return ""
+}
+
+// Remove a folder
+func (f *STFolderDisable) Remove() error {
+ return nil
+}
+
+// Update update some fields of a folder
+func (f *STFolderDisable) Update(cfg xsapiv1.FolderConfig) (*xsapiv1.FolderConfig, error) {
+ return nil, nil
+}
+
+// RegisterEventChange requests registration for folder change event
+func (f *STFolderDisable) RegisterEventChange(cb *FolderEventCB, data *FolderEventCBData) error {
+ return nil
+}
+
+// UnRegisterEventChange remove registered callback
+func (f *STFolderDisable) UnRegisterEventChange() error {
+ return nil
+}
+
+// Sync Force folder files synchronization
+func (f *STFolderDisable) Sync() error {
+ return nil
+}
+
+// IsInSync Check if folder files are in-sync
+func (f *STFolderDisable) IsInSync() (bool, error) {
+ return false, nil
+}