weave-agentfs-watch · crate
Source declarations, signatures and documentation for crate.
Reviewed implementation boundary: into_stream drops its watcher owner; debounce/coalescing settings are unused and event channels are unbounded in the checked implementation. See /libraries/agentfs-watch/overview.
Source: sigil/weave/local/agentfs-watch/src/lib.rs. SHA-256: 41be3e764da366b3d49f34d47602a5dacd78cea2692bd000e8cb13e7da96327f.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
::WatchError
#[derive(Debug, Error)]
pub enum WatchError {
#[error("notify error: {0}")]
Notify(#[from] notify::Error),
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("invalid config: {0}")]
InvalidConfig(String),
}Source line: 25.
::EventType
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum EventType {
Created,
Modified,
Deleted,
Renamed,
}Source line: 36.
::WatchEvent
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct WatchEvent {
pub id: String,
pub r#type: EventType,
pub path: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub old_path: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub is_dir: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub inode: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub device: Option<String>,
pub ts_monotonic_ns: u128,
#[serde(skip_serializing_if = "Option::is_none")]
pub ts_wall_clock: Option<DateTime<Utc>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub coalesced: Option<bool>
}Source line: 44.
::EventBatch
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct EventBatch {
pub batch_id: String,
pub sequence: u64,
pub events: Vec<WatchEvent>,
#[serde(skip_serializing_if = "Option::is_none")]
pub emitted_at: Option<DateTime<Utc>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub source: Option<String>
}Source line: 64.
::BackpressurePolicy
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum BackpressurePolicy {
Block,
DropOldest,
DropNew,
}Source line: 76.
::RestartConfig
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct RestartConfig {
pub enabled: bool,
pub min_backoff_ms: u64,
pub max_backoff_ms: u64,
pub jitter: f64
}Source line: 83.
::WatchConfig
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct WatchConfig {
pub roots: Vec<PathBuf>,
#[serde(default = "default_true")]
pub recursive: bool,
#[serde(default)]
pub include: Vec<String>,
#[serde(default)]
pub exclude: Vec<String>,
#[serde(default = "default_debounce_ms")]
pub debounce_ms: u64,
#[serde(default = "default_coalesce_window_ms")]
pub coalesce_window_ms: u64,
#[serde(default = "default_batch_max_items")]
pub batch_max_items: usize,
#[serde(default = "default_batch_max_ms")]
pub batch_max_ms: u64,
#[serde(default = "default_queue_capacity")]
pub queue_capacity: usize,
#[serde(default = "default_backpressure")]
pub backpressure_policy: BackpressurePolicy,
#[serde(default)]
pub restart: RestartConfig
}Source line: 102.
::WatcherBuilder
pub struct WatcherBuilder {
}Source line: 148.
::WatcherBuilder::new
pub fn new() -> Self;Source line: 159.
::WatcherBuilder::roots
pub fn roots<I, P>(mut self, roots: I) -> Self
where
I: IntoIterator<Item = P>,
P: Into<PathBuf>,;Source line: 177.
::WatcherBuilder::include_globs
pub fn include_globs<I, S>(mut self, globs: I) -> Self
where
I: IntoIterator<Item = S>,
S: Into<String>,;Source line: 185.
::WatcherBuilder::exclude_globs
pub fn exclude_globs<I, S>(mut self, globs: I) -> Self
where
I: IntoIterator<Item = S>,
S: Into<String>,;Source line: 193.
::WatcherBuilder::debounce_ms
pub fn debounce_ms(mut self, v: u64) -> Self;Source line: 201.
::WatcherBuilder::coalesce_window_ms
pub fn coalesce_window_ms(mut self, v: u64) -> Self;Source line: 205.
::WatcherBuilder::batch_max_items
pub fn batch_max_items(mut self, v: usize) -> Self;Source line: 209.
::WatcherBuilder::batch_max_ms
pub fn batch_max_ms(mut self, v: u64) -> Self;Source line: 213.
::WatcherBuilder::queue_capacity
pub fn queue_capacity(mut self, v: usize) -> Self;Source line: 217.
::WatcherBuilder::backpressure
pub fn backpressure(mut self, v: BackpressurePolicy) -> Self;Source line: 221.
::WatcherBuilder::recursive
pub fn recursive(mut self, v: bool) -> Self;Source line: 225.
::WatcherBuilder::build
pub fn build(self) -> Result<Watcher, WatchError>;Source line: 229.
::Watcher
pub struct Watcher {
}Source line: 234.
::Watcher::builder
pub fn builder() -> WatcherBuilder;Source line: 243.
::Watcher::includes
pub fn includes(&self) -> Option<&GlobSet>;Source line: 247.
::Watcher::excludes
pub fn excludes(&self) -> Option<&GlobSet>;Source line: 250.
::Watcher::config
pub fn config(&self) -> &WatchConfig;Source line: 253.
::Watcher::new
pub fn new(config: WatchConfig) -> Result<Self, WatchError>;Source line: 257.
::Watcher::into_stream
pub fn into_stream(self) -> impl Stream<Item = EventBatch>;Source line: 469.