Skip to main content

Module watch

Module watch 

Source
Expand description

notify-based file-watch on the broker SQLite at state/mailbox.db.

Replaces (or augments) the 1s long-poll established in PR-UI-2: when the platform supports notify (Linux inotify / macOS FSEvents / Windows ReadDirectoryChangesW), the run loop refreshes immediately on a mailbox.db-WAL/SHM write event. Platforms without notify support fall back to the 1s poll — same shape as the truecolor-detection capability fallback in PR-UI-1.

The watcher writes to a shared AtomicBool “dirty” flag rather than emitting events through a channel, because the run loop already has its own poll cadence and we just need the watcher to say “something changed, refresh sooner than the deadline.”

Structs§

Watch
Spawn a notify watcher rooted at the broker’s state/ directory. Returns None on platforms (or filesystems) where notify can’t bring up a recommended watcher — the run loop then falls back to the 1s poll. The returned Watch keeps the underlying watcher alive; drop it to stop watching.