Documentation
¶
Overview ¶
Package fswatch turns inotify events into coalesced change ticks, the Go counterpart of the `notify` crate watchers the Rust services use (the mail service's recursive maildir watch, the brightness sysfs watch). Consumers only need "something under here changed", so the events themselves are not surfaced: each burst is one tick.
The reader blocks in poll(2) on the inotify fd and an eventfd, so an idle watcher costs nothing and Close wakes it without a timeout.
Index ¶
Constants ¶
const Changes uint32 = unix.IN_CREATE | unix.IN_MODIFY | unix.IN_DELETE | unix.IN_MOVED_FROM | unix.IN_MOVED_TO | unix.IN_ATTRIB | unix.IN_DELETE_SELF | unix.IN_MOVE_SELF
Changes is the event mask that counts as a change for a directory tree: files created, written, removed, renamed (maildir flags are renames), or their metadata changed. It matches notify's Create | Modify | Remove kinds.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher is one inotify instance.
func New ¶
New starts a watcher for mask. With recursive set, Add walks the whole tree and directories created later are watched as they appear, which is what a recursive notify watcher does.