Documentation ¶
Overview ¶
Package watcher provides a way of watching for filesystem events and notifying observers when they occur.
Index ¶
- type Event
- type FakeWatcher
- func (w *FakeWatcher) Add(name string, handle int) error
- func (w *FakeWatcher) Close() error
- func (w *FakeWatcher) Events() (int, <-chan Event)
- func (w *FakeWatcher) InjectCreate(name string)
- func (w *FakeWatcher) InjectDelete(name string)
- func (w *FakeWatcher) InjectUpdate(name string)
- func (w *FakeWatcher) Remove(name string) error
- type LogWatcher
- type OpType
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeWatcher ¶
type FakeWatcher struct {
// contains filtered or unexported fields
}
FakeWatcher implements an in-memory Watcher.
func NewFakeWatcher ¶
func NewFakeWatcher() *FakeWatcher
NewFakeWatcher returns a fake Watcher for use in tests.
func (*FakeWatcher) Add ¶
func (w *FakeWatcher) Add(name string, handle int) error
Add adds a watch to the FakeWatcher
func (*FakeWatcher) Events ¶
func (w *FakeWatcher) Events() (int, <-chan Event)
Events returns a new channel of messages.
func (*FakeWatcher) InjectCreate ¶
func (w *FakeWatcher) InjectCreate(name string)
InjectCreate lets a test inject a fake creation event.
func (*FakeWatcher) InjectDelete ¶
func (w *FakeWatcher) InjectDelete(name string)
InjectDelete lets a test inject a fake deletion event.
func (*FakeWatcher) InjectUpdate ¶
func (w *FakeWatcher) InjectUpdate(name string)
InjectUpdate lets a test inject a fake update event.
func (*FakeWatcher) Remove ¶
func (w *FakeWatcher) Remove(name string) error
Remove removes a watch from the FakeWatcher
type LogWatcher ¶
type LogWatcher struct {
// contains filtered or unexported fields
}
LogWatcher implements a Watcher for watching real filesystems.
func NewLogWatcher ¶
func NewLogWatcher(pollInterval time.Duration, enableFsnotify bool) (*LogWatcher, error)
NewLogWatcher returns a new LogWatcher, or returns an error.
func (*LogWatcher) Add ¶
func (w *LogWatcher) Add(path string, handle int) error
Add adds a path to the list of watched items. If the path is already being watched, then nothing is changed -- the new handle does not replace the old one.
func (*LogWatcher) Close ¶
func (w *LogWatcher) Close() (err error)
Close shuts down the LogWatcher. It is safe to call this from multiple clients.
func (*LogWatcher) Events ¶
func (w *LogWatcher) Events() (int, <-chan Event)
Events returns a new readable channel of events from this watcher.
func (*LogWatcher) IsWatching ¶
func (w *LogWatcher) IsWatching(path string) bool
IsWatching indicates if the path is being watched. It includes both filenames and directories.
func (*LogWatcher) Remove ¶
func (w *LogWatcher) Remove(path string) error