Skip to main content

Watcher

Struct Watcher 

Source
pub struct Watcher { /* private fields */ }
Expand description

A live watcher over one tree.

The watcher is movable to one consuming thread. It is intentionally not shareable: its private standard-library receiver enforces one ordered consumer for coalesced intents. Use a separate IndexHandle to serve concurrent readers and writers. Dropping the watcher stops the OS watch and shuts the worker thread down.

Implementations§

Source§

impl Watcher

Source

pub fn new(root: &Path, config: WatchConfig) -> Result<Self>

Start watching root recursively.

Source

pub fn next_observation(&self, timeout: Duration) -> Result<Option<Observation>>

Block for and verify the next coalesced intent, up to timeout.

Filesystem calls happen synchronously on this consuming thread and may have ordinary filesystem latency. A timeout, a stopped worker, and a panicked worker are distinct outcomes. The returned observation contains relative paths but no root identity; use Self::apply_next for the supported root-checked applying driver rather than applying it to an arbitrary index.

Source

pub fn apply_next( &self, index: &IndexHandle, scan_config: &ScanConfig, timeout: Duration, sink: &mut dyn FnMut(&Commit), ) -> Result<Option<WatchApplyReport>>

Apply one verified watch observation and close any invalidation loop it opens.

Restricted max_depth and one_filesystem scopes are rejected until the watch adapter can filter raw backend events against those boundaries.

Trait Implementations§

Source§

impl Drop for Watcher

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.