pub struct BidirectionalSyncEngine { /* private fields */ }Expand description
Bidirectional sync engine
Implementations§
Source§impl BidirectionalSyncEngine
impl BidirectionalSyncEngine
pub fn new(config: BidirectionalSyncConfig) -> Self
Sourcepub fn check_status(
&self,
session_id: &str,
local_session: &ChatSession,
remote_session: Option<&ChatSession>,
) -> SyncStatus
pub fn check_status( &self, session_id: &str, local_session: &ChatSession, remote_session: Option<&ChatSession>, ) -> SyncStatus
Check sync status for a session
Sourcepub fn sync_session(
&mut self,
local_session: &mut ChatSession,
remote_session: Option<&ChatSession>,
push_fn: impl FnOnce(&ChatSession) -> Result<()>,
pull_fn: impl FnOnce() -> Result<Option<ChatSession>>,
) -> Result<SyncResult>
pub fn sync_session( &mut self, local_session: &mut ChatSession, remote_session: Option<&ChatSession>, push_fn: impl FnOnce(&ChatSession) -> Result<()>, pull_fn: impl FnOnce() -> Result<Option<ChatSession>>, ) -> Result<SyncResult>
Sync a session bidirectionally
Sourcepub fn get_conflicts(&self) -> &[SyncConflict]
pub fn get_conflicts(&self) -> &[SyncConflict]
Get all unresolved conflicts
Sourcepub fn resolve_conflict_manually(
&mut self,
conflict_id: &str,
resolution: ConflictStrategy,
resolved_session: ChatSession,
) -> Result<()>
pub fn resolve_conflict_manually( &mut self, conflict_id: &str, resolution: ConflictStrategy, resolved_session: ChatSession, ) -> Result<()>
Resolve a conflict manually
Sourcepub fn get_state(&self, session_id: &str) -> Option<&SessionSyncState>
pub fn get_state(&self, session_id: &str) -> Option<&SessionSyncState>
Get sync state for a session
Auto Trait Implementations§
impl Freeze for BidirectionalSyncEngine
impl RefUnwindSafe for BidirectionalSyncEngine
impl Send for BidirectionalSyncEngine
impl Sync for BidirectionalSyncEngine
impl Unpin for BidirectionalSyncEngine
impl UnwindSafe for BidirectionalSyncEngine
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more