pub struct SyncService { /* private fields */ }Expand description
Sync service for managing real-time synchronization
Implementations§
Source§impl SyncService
impl SyncService
pub fn new(config: SyncConfig) -> Self
Sourcepub fn register_session(
&mut self,
session: DeviceSession,
) -> Result<(), SyncError>
pub fn register_session( &mut self, session: DeviceSession, ) -> Result<(), SyncError>
Register a device session
Sourcepub fn remove_session(&mut self, device_id: &str) -> Result<(), SyncError>
pub fn remove_session(&mut self, device_id: &str) -> Result<(), SyncError>
Remove a device session
Sourcepub fn get_active_sessions(&self, _user_id: Uuid) -> Vec<&DeviceSession>
pub fn get_active_sessions(&self, _user_id: Uuid) -> Vec<&DeviceSession>
Get all active sessions for a user
Sourcepub async fn broadcast_event(
&self,
_user_id: Uuid,
_event: SyncEvent,
_exclude_device: Option<&str>,
) -> Result<(), SyncError>
pub async fn broadcast_event( &self, _user_id: Uuid, _event: SyncEvent, _exclude_device: Option<&str>, ) -> Result<(), SyncError>
Broadcast sync event to all devices except sender
Sourcepub fn resolve_conflict(
&self,
local: &Value,
remote: &Value,
local_timestamp: DateTime<Utc>,
remote_timestamp: DateTime<Utc>,
strategy: ConflictResolution,
) -> Value
pub fn resolve_conflict( &self, local: &Value, remote: &Value, local_timestamp: DateTime<Utc>, remote_timestamp: DateTime<Utc>, strategy: ConflictResolution, ) -> Value
Resolve conflict using specified strategy
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SyncService
impl RefUnwindSafe for SyncService
impl Send for SyncService
impl Sync for SyncService
impl Unpin for SyncService
impl UnwindSafe for SyncService
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