Skip to main content

hd_watch/
lib.rs

1//! # hd-watch
2//!
3//! File system watcher with debouncing and DAG invalidation for hyperdocker.
4//!
5//! This crate monitors the host filesystem for changes and feeds them into the
6//! Merkle DAG invalidation pipeline. It uses `notify` for cross-platform file
7//! watching, applies configurable path filters (respecting `.gitignore`-style
8//! patterns), and debounces rapid changes to avoid thrashing.
9//!
10//! ## Key Types
11//!
12//! - [`FileWatcher`] - Main watcher that monitors directories for changes
13//! - [`PathFilter`] - Configurable filter for include/exclude path patterns
14//! - [`Debouncer`] - Batches rapid filesystem events into coalesced changes
15//! - [`PathMap`] - Maps host paths to DAG node paths
16//!
17//! ## Example
18//!
19//! ```no_run
20//! use hd_watch::{FileWatcher, PathFilter};
21//! use std::path::Path;
22//!
23//! let filter = PathFilter::new(vec!["src/**".into()], vec!["target/**".into()]);
24//! let mut watcher = FileWatcher::new(Path::new("."), filter).unwrap();
25//! for change in watcher.poll_changes() {
26//!     println!("changed: {:?}", change);
27//! }
28//! ```
29
30pub mod pathmap;
31pub mod filter;
32pub mod debounce;
33pub mod watcher;
34
35pub use pathmap::PathMap;
36pub use filter::PathFilter;
37pub use debounce::{Debouncer, RawChange, ChangeKind};
38pub use watcher::{FileWatcher, WatchError};