Expand description
Monitoring files and directories.
This module contains FileWatcher
and related types, responsible for
monitoring changes to files and directories. Under the hood it is a
thin wrapper around some concrete type provided by the
notify
crate; the implementation is
platform dependent, and may be using kqueue, fsevent, or another
low-level monitoring system.
Our wrapper provides a few useful features:
-
All
watch
calls are associated with aWatchToken
; this allows for the same path to be watched multiple times, presumably by multiple interested parties. events are delivered once-per token. -
There is the option (via
FileWatcher::watch_filtered
) to include a predicate along with a path, to filter paths before delivery. -
We are integrated with the xi_rpc runloop; events are queued as they arrive, and an idle task is scheduled.
Structs§
- File
Watcher - Wrapper around a
notify::Watcher
. It runs the inner watcher in a separate thread, and communicates with it via anmpsc::channel
. - Watch
Token - Token provided to
FileWatcher
, to associate events with interested parties.
Constants§
- DEBOUNCE_
WAIT_ MILLIS - Delay for aggregating related file system events.
Traits§
- Notify
- A trait for types which can be notified of new events.
New events are accessible through the
FileWatcher
instance.