Skip to main content

Module file_watch

Module file_watch 

Source
Expand description

File watch: a path in a workspace changed, and a job on the file_watch source starts a run (docs/specs/SPEC_DRONE_REAL_WORLD_JOBS_2026_11_11.md §3.2).

A job’s filter names the folder (path, absolute, a project and not a home folder or a drive), optionally a glob the changed file’s name under it must match (**/*.rs; * and ? stay inside one folder level, ** crosses them) and a change (created, modified or removed). The shared FsWatchPool does the watching: one recursive watch per folder, however many jobs name it. Changes are debounced: the first matching change starts a batch, and the run starts once the folder has been quiet for two seconds (or the batch is thirty seconds old), with one event for all of it, so a save of fifty files is one run and not fifty.

The event carries names only: root, paths (names under the folder, at most twenty), count, first and change. Never file contents, and never a path outside the folder. A name is data somebody else chose: it is cut to 200 characters and loses control characters, and the run must treat it as text, not as an instruction. Files under a .git folder never count: a repository’s own bookkeeping is noise, not a change to the work.

Structs§

Batch
The changes one job has heard since its batch began.
Batches
Every job’s open batch.
FileWatch
Spec
A job’s file watch: the folder, the glob and the kind of change it wants.

Functions§

glob_matches
Whether name (folder levels joined by /) matches the glob: * and ? stay in one level, ** crosses any number. Table-driven, so the work is the pattern’s length times the name’s and never more, whatever the pattern.
identity_of
spawn
Start watching for the jobs in jobs: reads them now, again every thirty seconds and whenever the jobs change, and starts each due batch’s run through scheduler.
spec_of
What an enabled event job on file_watch watches, or None for any other job or a filter that does not read.
validate_filter
A file_watch trigger’s filter: a folder, and optionally a glob and a kind of change.

Type Aliases§

Identity
What tells one folder from another of the same path: the device and inode (on Windows the volume and file id), and when it was made.