Documentation
¶
Overview ¶
Package watcher turns file changes on the host into container actions.
The watching happens on the host, deliberately and unavoidably. The FUSE and virtiofs inotify patches were never merged, so a file edited on the host does not reliably produce an inotify event inside a container: Vite, chokidar, webpack and nodemon all miss changes made from the editor. The usual workaround is to make every watcher poll, which costs real CPU per watcher per service per bay -- five bays of a JavaScript monorepo is a fan spinning for nothing.
So devbay watches with the platform's own mechanism, on the side of the mount where it works, and tells the container what to do. That is what makes `watch:` a real field rather than a decorative one.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReloaderFunc ¶
ReloaderFunc adapts a function to Reloader.
type Watcher ¶
type Watcher struct {
// Log receives one line per action. Never nil after New.
Log func(format string, args ...any)
// contains filtered or unexported fields
}
Watcher reacts to changes under one worktree.
func New ¶
func New(root string, m *manifest.Manifest, rel Reloader, log func(string, ...any)) (*Watcher, error)
New builds a watcher for a worktree.
func (*Watcher) Match ¶
Match reports which services care about a path, relative to the worktree.
Exported because it is the part worth testing directly: a glob that matches nothing is a watch that silently never fires, which is the failure mode this whole package exists to remove.