Documentation
¶
Overview ¶
Package watcher subscribes to filesystem changes and feeds them into a coalescer.
Why parent-directory watching? Kubernetes ConfigMap mounts use a `..data` symlink that is atomically swapped on update. Watching the target file directly loses events because the inode changes; watching the parent directory and reacting to CREATE / CHMOD on the symlink path is the recommended pattern. The Watcher detects the canonical K8s "..data" rename and tags it as a swap-commit so the coalescer can drain the burst on the SwapHint window instead of the full Quiet window.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher fans fsnotify events out to a Coalescer keyed by parent directory. It survives best-effort recovery: when a watched directory is deleted (e.g. a pod's volume re-mount), the Watcher attempts to re-Add it on the next event.
func New ¶
New starts an fsnotify watcher on the unique parent directories of the given paths and routes every event through co.
func (*Watcher) AddPath ¶
AddPath registers a path. If path is an existing directory, the directory itself is watched (non-recursively). Otherwise, the parent directory is watched — the K8s ConfigMap pattern, since the inode of the leaf file changes during atomic swap. Idempotent.