Documentation ¶
Index ¶
- Constants
- Variables
- type Event
- type Events
- type EventsCB
- type EventsCBData
- type ExitChan
- type FolderChangeArg
- type FolderStatus
- type STEvent
- type SyncThing
- func (s *SyncThing) ConfigGet() (config.Configuration, error)
- func (s *SyncThing) ConfigSet(cfg config.Configuration) error
- func (s *SyncThing) Connect() error
- func (s *SyncThing) FolderChange(f FolderChangeArg) (string, error)
- func (s *SyncThing) FolderConfigGet(folderID string) (stconfig.FolderConfiguration, error)
- func (s *SyncThing) FolderDelete(id string) error
- func (s *SyncThing) FolderScan(folderID string, subpath string) error
- func (s *SyncThing) FolderStatus(folderID string) (*FolderStatus, error)
- func (s *SyncThing) IDGet() (string, error)
- func (s *SyncThing) IsConfigInSync() (bool, error)
- func (s *SyncThing) IsFolderInSync(folderID string) (bool, error)
- func (s *SyncThing) NewEventListener() *Events
- func (s *SyncThing) Start() (*exec.Cmd, error)
- func (s *SyncThing) StartInotify() (*exec.Cmd, error)
- func (s *SyncThing) Stop()
- func (s *SyncThing) StopInotify()
Constants ¶
Variables ¶
var EventsAll string = EventFolderCompletion + "|" + EventFolderSummary + "|" + EventFolderPaused + "|" + EventFolderResumed + "|" + EventFolderErrors + "|" + EventStateChanged
Functions ¶
This section is empty.
Types ¶
type Events ¶ added in v1.0.0
type Events struct { MonitorTime time.Duration Debug bool // contains filtered or unexported fields }
Events .
func (*Events) Register ¶ added in v1.0.0
func (e *Events) Register(evName string, cb EventsCB, filterID string, data *EventsCBData) (int, error)
Register Add a listener on an event
type EventsCB ¶ added in v1.0.0
type EventsCB func(ev Event, cbData *EventsCBData)
type EventsCBData ¶ added in v1.0.0
type EventsCBData map[string]interface{}
type ExitChan ¶
type ExitChan struct {
// contains filtered or unexported fields
}
ExitChan Channel used for process exit
type FolderChangeArg ¶
FolderChangeArg argument structure used by FolderChange
type FolderStatus ¶ added in v1.0.0
type FolderStatus struct { GlobalFiles int `json:"globalFiles"` GlobalDirectories int `json:"globalDirectories"` GlobalSymlinks int `json:"globalSymlinks"` GlobalDeleted int `json:"globalDeleted"` GlobalBytes int64 `json:"globalBytes"` LocalFiles int `json:"localFiles"` LocalDirectories int `json:"localDirectories"` LocalSymlinks int `json:"localSymlinks"` LocalDeleted int `json:"localDeleted"` LocalBytes int64 `json:"localBytes"` NeedFiles int `json:"needFiles"` NeedDirectories int `json:"needDirectories"` NeedSymlinks int `json:"needSymlinks"` NeedDeletes int `json:"needDeletes"` NeedBytes int64 `json:"needBytes"` InSyncFiles int `json:"inSyncFiles"` InSyncBytes int64 `json:"inSyncBytes"` State string `json:"state"` StateChanged time.Time `json:"stateChanged"` Sequence int64 `json:"sequence"` IgnorePatterns bool `json:"ignorePatterns"` }
FolderStatus Information about the current status of a folder.
type STEvent ¶ added in v1.0.0
type STEvent struct { // Per-subscription sequential event ID. Named "id" for backwards compatibility with the REST API SubscriptionID int `json:"id"` // Global ID of the event across all subscriptions GlobalID int `json:"globalID"` Time time.Time `json:"time"` Type string `json:"type"` Data map[string]interface{} `json:"data"` }
type SyncThing ¶
type SyncThing struct { BaseURL string APIKey string Home string STCmd *exec.Cmd STICmd *exec.Cmd MyID string Connected bool Events *Events // contains filtered or unexported fields }
SyncThing .
func NewSyncThing ¶
NewSyncThing creates a new instance of Syncthing
func (*SyncThing) ConfigGet ¶
func (s *SyncThing) ConfigGet() (config.Configuration, error)
ConfigGet returns the current Syncthing configuration
func (*SyncThing) ConfigSet ¶
func (s *SyncThing) ConfigSet(cfg config.Configuration) error
ConfigSet set Syncthing configuration
func (*SyncThing) FolderChange ¶
func (s *SyncThing) FolderChange(f FolderChangeArg) (string, error)
FolderChange is called when configuration has changed
func (*SyncThing) FolderConfigGet ¶ added in v1.0.0
func (s *SyncThing) FolderConfigGet(folderID string) (stconfig.FolderConfiguration, error)
FolderConfigGet Returns the configuration of a specific folder
func (*SyncThing) FolderDelete ¶
FolderDelete is called to delete a folder config
func (*SyncThing) FolderScan ¶ added in v1.0.0
FolderScan Request immediate folder scan. Scan all folders if folderID param is empty
func (*SyncThing) FolderStatus ¶ added in v1.0.0
func (s *SyncThing) FolderStatus(folderID string) (*FolderStatus, error)
FolderStatus Returns all information about the current
func (*SyncThing) IsConfigInSync ¶ added in v1.0.0
IsConfigInSync Returns true if configuration is in sync
func (*SyncThing) IsFolderInSync ¶ added in v1.0.0
IsFolderInSync Returns true when folder is in sync
func (*SyncThing) NewEventListener ¶ added in v1.0.0
NewEventListener Create a new instance of Event listener
func (*SyncThing) StartInotify ¶
StartInotify Starts syncthing-inotify process
func (*SyncThing) StopInotify ¶
func (s *SyncThing) StopInotify()
StopInotify Stops syncthing process