Skip to main content

Coordinator

Struct Coordinator 

Source
pub struct Coordinator<'a> { /* private fields */ }
Expand description

A source paired with an engine.

Implementations§

Source§

impl<'a> Coordinator<'a>

Source

pub fn new( engine: &'a mut dyn EngineClient, source: &'a mut dyn SyncSource, ) -> Self

Source

pub fn sync_in(&mut self) -> Result<SyncInSummary>

source → engine: the source’s full current scope.

Source

pub fn reconcile(&mut self, paths: &[String]) -> Result<SyncInSummary>

source → engine for a set of paths: fetch each; present items go to observe_many in one call, gone paths to observe_delete one by one.

Source

pub fn sync_out(&mut self, cursor: i64) -> Result<SyncOutSummary>

engine → source: page changes_since(cursor); for every digest whose origin is not observed, every revision’s doc is re-read by path and written, or removed when it no longer reads; follows truncated pages; returns the final cursor. A source without write-through exports nothing and returns cursor unchanged.

Source

pub fn watch_in(&mut self) -> Result<Option<Receiver<Vec<String>>>>

Live source → engine: subscribe when the source can watch; None otherwise. Drive the stream with Coordinator::handle_batches or call Coordinator::reconcile per received batch.

Source

pub fn handle_batches( &mut self, batches: &Receiver<Vec<String>>, on_summary: impl FnMut(SyncInSummary), on_error: impl FnMut(Error), )

Reconcile every batch the stream yields until it closes (the adapter exited or unwatch ran), reporting each summary or error.

Source

pub fn stop_watch(&mut self) -> Result<()>

Stop the watch stream.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Coordinator<'a>

§

impl<'a> !Send for Coordinator<'a>

§

impl<'a> !Sync for Coordinator<'a>

§

impl<'a> !UnwindSafe for Coordinator<'a>

§

impl<'a> Freeze for Coordinator<'a>

§

impl<'a> Unpin for Coordinator<'a>

§

impl<'a> UnsafeUnpin for Coordinator<'a>

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> Same for T

Source§

type Output = T

Should always be Self
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.