pub struct SyncCoordinator { /* private fields */ }Expand description
Sync coordinator for managing multi-device state
Implementations§
Source§impl SyncCoordinator
impl SyncCoordinator
Sourcepub fn register_device(&self, device_id: DeviceId) -> SyncResult<()>
pub fn register_device(&self, device_id: DeviceId) -> SyncResult<()>
Sourcepub fn unregister_device(&self, device_id: &DeviceId) -> SyncResult<()>
pub fn unregister_device(&self, device_id: &DeviceId) -> SyncResult<()>
Sourcepub fn update_device_status(
&self,
device_id: &DeviceId,
status: DeviceStatus,
) -> SyncResult<()>
pub fn update_device_status( &self, device_id: &DeviceId, status: DeviceStatus, ) -> SyncResult<()>
Sourcepub fn get_device(&self, device_id: &DeviceId) -> Option<DeviceMetadata>
pub fn get_device(&self, device_id: &DeviceId) -> Option<DeviceMetadata>
Sourcepub fn list_devices(&self) -> Vec<DeviceMetadata>
pub fn list_devices(&self) -> Vec<DeviceMetadata>
Lists all registered devices
Sourcepub fn list_online_devices(&self) -> Vec<DeviceMetadata>
pub fn list_online_devices(&self) -> Vec<DeviceMetadata>
Lists all online devices
Sourcepub fn cleanup_stale_devices(&self, timeout_secs: u64) -> usize
pub fn cleanup_stale_devices(&self, timeout_secs: u64) -> usize
Sourcepub fn start_sync_session(
&self,
target_device: DeviceId,
) -> SyncResult<SyncSession>
pub fn start_sync_session( &self, target_device: DeviceId, ) -> SyncResult<SyncSession>
Sourcepub fn complete_sync_session(&self, session_id: &str) -> SyncResult<()>
pub fn complete_sync_session(&self, session_id: &str) -> SyncResult<()>
Sourcepub fn active_sessions(&self) -> Vec<SyncSession>
pub fn active_sessions(&self) -> Vec<SyncSession>
Gets active sync sessions
Sourcepub fn completed_sessions(&self) -> Vec<SyncSession>
pub fn completed_sessions(&self) -> Vec<SyncSession>
Gets completed sync sessions
Sourcepub fn sync_crdt<T: Crdt>(
&self,
local_crdt: &mut T,
remote_crdt: &T,
) -> SyncResult<()>
pub fn sync_crdt<T: Crdt>( &self, local_crdt: &mut T, remote_crdt: &T, ) -> SyncResult<()>
Synchronizes CRDT state with another device
§Arguments
local_crdt- Local CRDT stateremote_crdt- Remote CRDT state
Sourcepub fn create_delta(&self, base: &[u8], target: &[u8]) -> SyncResult<Delta>
pub fn create_delta(&self, base: &[u8], target: &[u8]) -> SyncResult<Delta>
Sourcepub fn apply_delta(&self, base: &[u8], delta: &Delta) -> SyncResult<Vec<u8>>
pub fn apply_delta(&self, base: &[u8], delta: &Delta) -> SyncResult<Vec<u8>>
Sourcepub fn update_device_clock(
&self,
device_id: &DeviceId,
clock: VectorClock,
) -> SyncResult<()>
pub fn update_device_clock( &self, device_id: &DeviceId, clock: VectorClock, ) -> SyncResult<()>
Sourcepub fn compare_device_clocks(
&self,
device1: &DeviceId,
device2: &DeviceId,
) -> SyncResult<ClockOrdering>
pub fn compare_device_clocks( &self, device1: &DeviceId, device2: &DeviceId, ) -> SyncResult<ClockOrdering>
Auto Trait Implementations§
impl Freeze for SyncCoordinator
impl !RefUnwindSafe for SyncCoordinator
impl Send for SyncCoordinator
impl Sync for SyncCoordinator
impl Unpin for SyncCoordinator
impl UnsafeUnpin for SyncCoordinator
impl !UnwindSafe for SyncCoordinator
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