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 uuid := uuid.NewV1().String()
36 func (f *STFolderDisable) Add(cfg FolderConfig) (*FolderConfig, error) {
38 f.config.Status = StatusDisable
39 f.config.IsInSync = false
43 // GetConfig Get public part of folder config
44 func (f *STFolderDisable) GetConfig() FolderConfig {
48 // GetFullPath returns the full path of a directory (from server POV)
49 func (f *STFolderDisable) GetFullPath(dir string) string {
53 // ConvPathCli2Svr Convert path from Client to Server
54 func (f *STFolderDisable) ConvPathCli2Svr(s string) string {
58 // ConvPathSvr2Cli Convert path from Server to Client
59 func (f *STFolderDisable) ConvPathSvr2Cli(s string) string {
64 func (f *STFolderDisable) Remove() error {
68 // RegisterEventChange requests registration for folder change event
69 func (f *STFolderDisable) RegisterEventChange(cb *EventCB, data *EventCBData) error {
73 // UnRegisterEventChange remove registered callback
74 func (f *STFolderDisable) UnRegisterEventChange() error {
78 // Sync Force folder files synchronization
79 func (f *STFolderDisable) Sync() error {
83 // IsInSync Check if folder files are in-sync
84 func (f *STFolderDisable) IsInSync() (bool, error) {