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 Engine<'_>
impl Engine<'_>
sourcepub fn new<'b>(
command_processor: &'b dyn CommandProcessor,
interruptee: &'b dyn Interruptee,
) -> Engine<'b>
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.
sourcepub fn sync(
&mut self,
storage_client: &Sync15StorageClient,
global_state: &GlobalState,
root_sync_key: &KeyBundle,
should_refresh_client: bool,
) -> Result<()>
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:
- It can’t be disabled or declined.
- 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. - It doesn’t persist state directly, but relies on the sync manager to persist device settings, and process commands.
- 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
.
pub fn local_client_id(&self) -> String
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more