Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FileEvents ¶
type FileEvents []FileEvent
FileEvents is a slice of FileEvents
func (FileEvents) Bytes ¶
func (e FileEvents) Bytes() []byte
func (FileEvents) String ¶
func (e FileEvents) String() string
type FileUpdate ¶
FileUpdate is used by watchers to signal the state change of a file.
type FileUpdateStream ¶
type FileUpdateStream chan *FileUpdate
type FileWatcher ¶
type FileWatcher struct {
// contains filtered or unexported fields
}
FileWatcher recursively monitors changes in files in the given directory and sends out events based on their state changes. Only files conforming to validSuffix are monitored. The FileWatcher can be suspended for a single event at a time to eliminate updates by WatchStorage causing a loop.
func NewFileWatcher ¶
func NewFileWatcher(dir string) (w *FileWatcher, files []string, err error)
NewFileWatcher returns a list of files in the watched directory in addition to the generated FileWatcher, it can be used to populate MappedRawStorage fileMappings
func NewFileWatcherWithOptions ¶
func NewFileWatcherWithOptions(dir string, opts Options) (w *FileWatcher, files []string, err error)
NewFileWatcher returns a list of files in the watched directory in addition to the generated FileWatcher, it can be used to populate MappedRawStorage fileMappings
func (*FileWatcher) GetFileUpdateStream ¶
func (w *FileWatcher) GetFileUpdateStream() FileUpdateStream
GetFileUpdateStream gets the channel with FileUpdates
func (*FileWatcher) Suspend ¶
func (w *FileWatcher) Suspend(updateEvent FileEvent)
Suspend enables a one-time suspend of the given event, the FileWatcher will skip the given event once
type Options ¶
type Options struct { // ExcludeDirs specifies what directories to not watch ExcludeDirs []string // BatchTimeout specifies the duration to wait after last event before dispatching grouped inotify events BatchTimeout time.Duration // ValidExtensions specifies what file extensions to look at ValidExtensions []string }
Options specifies options for the FileWatcher