Documentation ¶
Overview ¶
Package watcher provides a way of watching for filesystem events and notifying observers when they occur.
Index ¶
- type CreateEvent
- type DeleteEvent
- type Event
- type FakeWatcher
- func (w *FakeWatcher) Add(name string) error
- func (w *FakeWatcher) Close() error
- func (w *FakeWatcher) Events() <-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 UpdateEvent
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateEvent ¶
type CreateEvent struct {
Pathname string
}
CreateEvent signifies a file was created in a watched directory.
type DeleteEvent ¶
type DeleteEvent struct {
Pathname string
}
DeleteEvent signifies a watched file was deleted.
type Event ¶
type Event interface { }
Event is a generalisation of events sent from the watcher to its listeners.
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) error
Add adds a watch to the FakeWatcher
func (*FakeWatcher) Events ¶
func (w *FakeWatcher) Events() <-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 ¶
LogWatcher implements a Watcher for watching real filesystems.
func NewLogWatcher ¶
func NewLogWatcher() (*LogWatcher, error)
NewLogWatcher returns a new LogWatcher, or returns an error.
func (*LogWatcher) Close ¶
func (w *LogWatcher) Close() (err error)
Close shuts down the LogWatcher. It is safe to call this from multiple clients because
func (*LogWatcher) Events ¶
func (w *LogWatcher) Events() <-chan Event
Events returns a new readable channel of events from this watcher.