Struct sync15::clients_engine::Engine

source ·
pub struct Engine<'a> {
    pub command_processor: &'a dyn CommandProcessor,
    pub interruptee: &'a dyn Interruptee,
    pub recent_clients: HashMap<String, RemoteClient>,
}

Fields§

§command_processor: &'a dyn CommandProcessor§interruptee: &'a dyn Interruptee§recent_clients: HashMap<String, RemoteClient>

Implementations§

source§

impl<'a> Engine<'a>

source

pub fn new<'b>( command_processor: &'b dyn CommandProcessor, interruptee: &'b dyn Interruptee ) -> Engine<'b>

Creates a new clients engine that delegates to the given command processor to apply incoming commands.

source

pub fn sync( &mut self, storage_client: &Sync15StorageClient, global_state: &GlobalState, root_sync_key: &KeyBundle, should_refresh_client: bool ) -> Result<()>

Syncs the clients collection. This works a little differently than other collections:

  1. It can’t be disabled or declined.
  2. The sync ID and last sync time aren’t meaningful, since we always fetch all client records on every sync. As such, the LocalCollStateMachine that we use for other engines doesn’t apply to it.
  3. It doesn’t persist state directly, but relies on the sync manager to persist device settings, and process commands.
  4. Failing to sync the clients collection is fatal, and aborts the sync.

For these reasons, we implement this engine directly in the sync15 crate, and provide a specialized sync method instead of implementing sync15::Store.

source

pub fn local_client_id(&self) -> String

source

pub fn get_client_data(&self) -> ClientData

Auto Trait Implementations§

§

impl<'a> Freeze for Engine<'a>

§

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

§

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

§

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

§

impl<'a> Unpin for Engine<'a>

§

impl<'a> !UnwindSafe for Engine<'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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V