Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrWatchBudget = errors.New("watch budget exhausted; observing a partial tree")
ErrWatchBudget reports that the directory cap was reached. Directories registered before the cap keep working.
Functions ¶
This section is empty.
Types ¶
type Ignorer ¶
Ignorer prunes paths from observation. Prune must be cheap — it is asked once per directory of a full tree walk. Ignored may consult the repository and is used only for paths that appear while the watcher is running.
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
func (*Watcher) Add ¶
Add watches root and its non-ignored descendants. ignore may be nil, which watches everything except .git; real workspaces must pass their repository's rules or ignored build trees pin a descriptor per file until the service exits.
func (*Watcher) Remove ¶ added in v0.1.2
Remove stops watching root and everything under it.
The Watcher only ever grew before this, because nothing could take a repository back: a workspace disconnected while the service was running kept a descriptor open on every directory in it - and kept waking the scanner on edits to a repository Overgent no longer coordinates - until the service was restarted. It returns how many directories it released, which is what the disconnect path reports.
Paths are taken from the backend's own watch list rather than by walking the tree again: a directory deleted since it was added still holds its descriptor, and a fresh walk would not find it to release it.