4 "github.com/iotbzh/xds-server/lib/xdsconfig"
5 uuid "github.com/satori/go.uuid"
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.
13 type STFolderDisable struct {
14 globalConfig *xdsconfig.Config
18 // NewFolderSTDisable Create a new instance of STFolderDisable
19 func NewFolderSTDisable(gc *xdsconfig.Config) *STFolderDisable {
27 func (f *STFolderDisable) NewUID(suffix string) string {
28 return uuid.NewV1().String() + "_" + suffix
32 func (f *STFolderDisable) Add(cfg FolderConfig) (*FolderConfig, error) {
34 f.config.Status = StatusDisable
35 f.config.IsInSync = false
39 // GetConfig Get public part of folder config
40 func (f *STFolderDisable) GetConfig() FolderConfig {
44 // GetFullPath returns the full path of a directory (from server POV)
45 func (f *STFolderDisable) GetFullPath(dir string) string {
49 // ConvPathCli2Svr Convert path from Client to Server
50 func (f *STFolderDisable) ConvPathCli2Svr(s string) string {
54 // ConvPathSvr2Cli Convert path from Server to Client
55 func (f *STFolderDisable) ConvPathSvr2Cli(s string) string {
60 func (f *STFolderDisable) Remove() error {
64 // RegisterEventChange requests registration for folder change event
65 func (f *STFolderDisable) RegisterEventChange(cb *EventCB, data *EventCBData) error {
69 // UnRegisterEventChange remove registered callback
70 func (f *STFolderDisable) UnRegisterEventChange() error {
74 // Sync Force folder files synchronization
75 func (f *STFolderDisable) Sync() error {
79 // IsInSync Check if folder files are in-sync
80 func (f *STFolderDisable) IsInSync() (bool, error) {