Documentation ¶
Index ¶
- func DisableDebug()
- func EnableDebug() chan string
- func NumberOfFileWatchers() int
- func NumberOfFolderWatchers() int
- type FileWatcher
- func (fileWatcher *FileWatcher) IsRunning() bool
- func (filewatcher *FileWatcher) Modified() chan bool
- func (filewatcher *FileWatcher) Moved() chan bool
- func (fileWatcher *FileWatcher) SetFile(filePath string)
- func (fileWatcher *FileWatcher) Start()
- func (fileWatcher *FileWatcher) Stop()
- func (filewatcher *FileWatcher) Stopped() chan bool
- func (fileWatcher *FileWatcher) String() string
- type FolderChange
- type FolderWatcher
- func (folderWatcher *FolderWatcher) ChangeDetails() chan *FolderChange
- func (folderWatcher *FolderWatcher) IsRunning() bool
- func (folderWatcher *FolderWatcher) Modified() chan bool
- func (folderWatcher *FolderWatcher) Moved() chan bool
- func (folderWatcher *FolderWatcher) Start()
- func (folderWatcher *FolderWatcher) Stop()
- func (folderWatcher *FolderWatcher) Stopped() chan bool
- func (folderWatcher *FolderWatcher) String() string
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableDebug ¶
func DisableDebug()
DisableDebug disables the debug mode for this package and closes the debug message channel.
func EnableDebug ¶
func EnableDebug() chan string
EnableDebug enables the debug mode for this package and returns a debug message channel.
func NumberOfFileWatchers ¶
func NumberOfFileWatchers() int
NumberOfFileWatchers returns the number of currently active file watchers.
func NumberOfFolderWatchers ¶
func NumberOfFolderWatchers() int
NumberOfFolderWatchers returns the number of currently active folder watchers.
Types ¶
type FileWatcher ¶
type FileWatcher struct {
// contains filtered or unexported fields
}
A FileWatcher can be used to determine if a given file has been modified or moved.
func NewFileWatcher ¶
func NewFileWatcher(filePath string, checkIntervalInSeconds int) *FileWatcher
NewFileWatcher creates a new file watcher for a given file path. The check interval in seconds defines how often the watcher shall check for changes (recommended: 1 - n seconds).
func (*FileWatcher) IsRunning ¶
func (fileWatcher *FileWatcher) IsRunning() bool
IsRunning returns a flag indicating whether the watcher is currently running.
func (*FileWatcher) Modified ¶
func (filewatcher *FileWatcher) Modified() chan bool
Modified returns a channel indicating if the file has been modified.
func (*FileWatcher) Moved ¶
func (filewatcher *FileWatcher) Moved() chan bool
Moved returns a channel indicating if the file has been moved.
func (*FileWatcher) SetFile ¶
func (fileWatcher *FileWatcher) SetFile(filePath string)
SetFile sets the file file for this file watcher.
func (*FileWatcher) Stopped ¶
func (filewatcher *FileWatcher) Stopped() chan bool
Stopped returns a channel indicating if the file watcher stopped.
func (*FileWatcher) String ¶
func (fileWatcher *FileWatcher) String() string
type FolderChange ¶
type FolderChange struct {
// contains filtered or unexported fields
}
FolderChange represents changes (new, moved and modified items) of a folder at a given time.
func (*FolderChange) Modified ¶
func (folderChange *FolderChange) Modified() []string
Modified returns the modified items of the current folder change.
func (*FolderChange) Moved ¶
func (folderChange *FolderChange) Moved() []string
Moved returns the moved items of the current folder change.
func (*FolderChange) New ¶
func (folderChange *FolderChange) New() []string
New returns the new items of the current folder change.
func (*FolderChange) String ¶
func (folderChange *FolderChange) String() string
func (*FolderChange) TimeStamp ¶
func (folderChange *FolderChange) TimeStamp() time.Time
TimeStamp retunrs the time stamp of the current folder change.
type FolderWatcher ¶
type FolderWatcher struct {
// contains filtered or unexported fields
}
A FolderWatcher can be used to watch a folder for modified or moved items.
func NewFolderWatcher ¶
func NewFolderWatcher(folderPath string, recurse bool, skipFile func(path string) bool, checkIntervalInSeconds int) *FolderWatcher
NewFolderWatcher creates a new folder watcher for the given folder path. The recurse flag indicates whether the watcher shall include sub folders of the the given folder path. The skipFile expression can be used to exclude certains files or folders. The check interval in seconds defines how often the watcher shall check for changes (recommended: 1 - n seconds).
func (*FolderWatcher) ChangeDetails ¶
func (folderWatcher *FolderWatcher) ChangeDetails() chan *FolderChange
ChangeDetails returns a model containing all changed during a given change interval.
func (*FolderWatcher) IsRunning ¶
func (folderWatcher *FolderWatcher) IsRunning() bool
IsRunning returns a flag indicating whether the watcher is currently running.
func (*FolderWatcher) Modified ¶
func (folderWatcher *FolderWatcher) Modified() chan bool
Modified returns a channel indicating if the current folder has been modified.
func (*FolderWatcher) Moved ¶
func (folderWatcher *FolderWatcher) Moved() chan bool
Moved returns a channel indicating if the current folder has been moved.
func (*FolderWatcher) Start ¶
func (folderWatcher *FolderWatcher) Start()
Start starts the watch process.
func (*FolderWatcher) Stop ¶
func (folderWatcher *FolderWatcher) Stop()
Stop stops the watch process.
func (*FolderWatcher) Stopped ¶
func (folderWatcher *FolderWatcher) Stopped() chan bool
Stopped returns a channel indicating if current folder watcher stopped.
func (*FolderWatcher) String ¶
func (folderWatcher *FolderWatcher) String() string
type Watcher ¶
type Watcher interface { // Modified returns a boolean channel which sends a flag indicating // whether a filesystem item has been modified. Modified() chan bool // Moved returns a boolean channel which sends a flag indicating // whether a filesystem item has moved. Moved() chan bool // Stopped returns a boolean channel which sends a flag indicating // whether the filesystem watcher has stopped. Stopped() chan bool // Start starts the watch-process. Start() // Stop stops any the watch-process. Stop() // IsRunning returns a flag indicating whether this // filesystem watcher is running or not. IsRunning() bool }
Watcher defines the base set of of functions for a file and folder watcher.