pub struct SyncEngine { /* private fields */ }Expand description
Sync engine for managing real-time synchronization
Implementations§
Source§impl SyncEngine
impl SyncEngine
Sourcepub fn subscribe(
&self,
workspace_id: Uuid,
client_id: Uuid,
) -> Result<Receiver<ChangeEvent>>
pub fn subscribe( &self, workspace_id: Uuid, client_id: Uuid, ) -> Result<Receiver<ChangeEvent>>
Subscribe a client to a workspace
Sourcepub fn unsubscribe(&self, workspace_id: Uuid, client_id: Uuid) -> Result<()>
pub fn unsubscribe(&self, workspace_id: Uuid, client_id: Uuid) -> Result<()>
Unsubscribe a client from a workspace
Sourcepub fn publish_change(&self, event: ChangeEvent) -> Result<()>
pub fn publish_change(&self, event: ChangeEvent) -> Result<()>
Publish a change event
Sourcepub fn get_state(&self, workspace_id: Uuid) -> Option<SyncState>
pub fn get_state(&self, workspace_id: Uuid) -> Option<SyncState>
Get current state for a workspace
Sourcepub fn update_state(&self, workspace_id: Uuid, new_state: Value) -> Result<()>
pub fn update_state(&self, workspace_id: Uuid, new_state: Value) -> Result<()>
Update state for a workspace
Sourcepub fn get_connections(&self, workspace_id: Uuid) -> Vec<Uuid>
pub fn get_connections(&self, workspace_id: Uuid) -> Vec<Uuid>
Get connected clients for a workspace
Sourcepub fn connection_count(&self) -> usize
pub fn connection_count(&self) -> usize
Get total number of connections
Sourcepub fn has_connections(&self, workspace_id: Uuid) -> bool
pub fn has_connections(&self, workspace_id: Uuid) -> bool
Check if a workspace has any active connections
Sourcepub fn cleanup_inactive(&self)
pub fn cleanup_inactive(&self)
Clean up inactive workspaces (no connections)
Auto Trait Implementations§
impl Freeze for SyncEngine
impl !RefUnwindSafe for SyncEngine
impl Send for SyncEngine
impl Sync for SyncEngine
impl Unpin for SyncEngine
impl !UnwindSafe for SyncEngine
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