Report an error when sdkid not found.
[src/xds/xds-server.git] / lib / model / folder.go
index e461f9c..56a46b1 100644 (file)
@@ -3,7 +3,7 @@ package model
 import (
        "fmt"
 
-       "github.com/iotbzh/xds-server/lib/common"
+       common "github.com/iotbzh/xds-common/golib"
        "github.com/iotbzh/xds-server/lib/syncthing"
        "github.com/iotbzh/xds-server/lib/xdsconfig"
 )
@@ -48,7 +48,7 @@ func (c *Folder) UpdateAll(newCfg xdsconfig.Config) error {
                                Label:        f.Label,
                                RelativePath: f.RelativePath,
                                SyncThingID:  f.SyncThingID,
-                               ShareRootDir: c.ShareRootDir,
+                               ShareRootDir: c.FileConf.ShareRootDir,
                        }); err != nil {
                                return err
                        }
@@ -62,7 +62,7 @@ func (c *Folder) UpdateAll(newCfg xdsconfig.Config) error {
 func (c *Folder) UpdateFolder(newFolder xdsconfig.FolderConfig) (xdsconfig.FolderConfig, error) {
        // rootPath should not be empty
        if newFolder.RootPath == "" {
-               newFolder.RootPath = c.Conf.ShareRootDir
+               newFolder.RootPath = c.Conf.FileConf.ShareRootDir
        }
 
        // Sanity check of folder settings
@@ -98,3 +98,13 @@ func (c *Folder) DeleteFolder(id string) (xdsconfig.FolderConfig, error) {
 
        return fld, err
 }
+
+// ForceSync Force the synchronization of a folder
+func (c *Folder) ForceSync(id string) error {
+       return c.SThg.FolderScan(id, "")
+}
+
+// IsFolderInSync Returns true when folder is in sync
+func (c *Folder) IsFolderInSync(id string) (bool, error) {
+       return c.SThg.IsFolderInSync(id)
+}