Expand description
Local change detection — the snapshot/diff engine behind dbmd watch.
Poll-based and dependency-free by design: a snapshot stats the store’s
emit membership (every content file plus DB.md — emit::walk_rels,
so watch and emit can never disagree about what is observable), and a
diff of two snapshots yields the created / modified / removed set in
deterministic path order. No OS file-event API is used — kernel watchers
differ per platform, mis-report on network filesystems, and would be the
toolkit’s first such dependency; a bounded stat sweep per tick is simple,
portable, and honest about cost (the caller narrows big stores with a
prefix). Modification is detected by (byte length, mtime) — the
standard watcher tradeoff: a same-length rewrite inside one mtime
granule is invisible.
Everything here is pure observation: no locks are taken and nothing is written, so a watcher never blocks a writer.
Structs§
- Change
- One observed change.
- FileSig
- One observed file’s cheap identity: byte length plus mtime (absent where the filesystem reports none).
Enums§
- Change
Kind - What happened to one path between two snapshots.
Functions§
- diff
- Diff two snapshots into the created / modified / removed set, in deterministic store-path order.
- snapshot
- Snapshot the watched membership, optionally narrowed to a store-relative
prefix. A file that vanishes between the walk and its stat is simply absent from this snapshot (the next diff reports it removed) — a benign race, not an error.
Type Aliases§
- Snapshot
- A point-in-time view of the watched membership: store-relative path → signature, path-ordered.