Skip to main content

Module watch

Module watch 

Source
Expand description

Scope-mode change source (ADR-0024), the JournalSource second implementation that pairs with the folder-walk scanner.

Phase 1 (this file): a no-op journal. The walk builds the index once and it stays static until the app restarts (the user’s manual re-index). read_blocking never reports a change — it parks briefly and returns a benign empty batch so the worker can re-check its stop flag, exactly like the idle path of the USN journal. The walk snapshot is stamped with journal_id == 0, which snapshot_decision always restores (no USN cursor to validate), so a restart reloads the snapshot rather than re-walking.

Phase 2 (planned): replace read_blocking with one overlapped ReadDirectoryChangesW handle per root behind a single IOCP, translating FILE_NOTIFY_INFORMATION into synthesized UsnRecords (path → synthetic FRN via scan::walk_id), with buffer-overflow → re-walk and a periodic re-walk fallback for network/cloud roots.

Structs§

NullStatFetcher 🔒
A stat fetcher that knows nothing — apply never calls it in Phase 1.
WatcherJournalSource 🔒
Non-elevated change source for scope mode. Holds the configured roots for Phase 2’s watchers; Phase 1 keeps them only to log/identify the session.

Constants§

IDLE_PARK 🔒
How long the no-op read_blocking parks between benign wakeups. Bounds shutdown latency (the worker re-checks stop on each wakeup) at the cost of one cheap timer per scope slot; Phase 2 replaces the park with an IOCP wait that returns the instant a watched root changes.
WALK_JOURNAL_ID 🔒
Synthetic journal identity for a walk snapshot. 0 makes snapshot_decision always restore a loaded walk snapshot (there is no USN retention window to fall outside of).