Documentation
¶
Overview ¶
Package filewatch coalesces filesystem notifications for mounted configuration files.
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 watches the parent directories of a set of files. Watching directories, rather than resolved file targets, preserves notifications when Kubernetes swaps a projected volume's ..data symlink.
func New ¶
func New(paths []string, debounce, maxDebounce time.Duration, onChange func(), onError func(error)) (*Watcher, error)
New starts a watcher. Events are delayed until debounce has elapsed without a new event, but a continuous burst is delivered no later than maxDebounce after its first event -- with one exception: when the maxDebounce cap is what ends a burst and nothing is yet queued, the watcher grants one further debounce-length grace so an fsnotify event still in flight from the kernel to the delivery goroutine can merge into the same burst instead of starting a new one (issue #885). The effective worst-case delivery bound is therefore maxDebounce+debounce, granted at most once per burst. onError receives watcher errors; it must not assume an error is fatal. Paths are used only to select and deduplicate their parent directories.