pub struct SyncChannelManager { /* private fields */ }Expand description
Manager for sync channels to all peers
Automatically creates and manages persistent channels for each connected peer.
Implementations§
Source§impl SyncChannelManager
impl SyncChannelManager
Sourcepub fn new(
transport: Arc<dyn SyncTransport>,
coordinator: Arc<AutomergeSyncCoordinator>,
) -> SyncChannelManager
pub fn new( transport: Arc<dyn SyncTransport>, coordinator: Arc<AutomergeSyncCoordinator>, ) -> SyncChannelManager
Create a new channel manager
Sourcepub async fn get_channel(
&self,
peer_id: PublicKey,
) -> Result<Arc<SyncChannel>, Error>
pub async fn get_channel( &self, peer_id: PublicKey, ) -> Result<Arc<SyncChannel>, Error>
Get or create a channel to a peer
Sourcepub async fn send_to_peer(
&self,
peer_id: PublicKey,
batch: &SyncBatch,
) -> Result<(), Error>
pub async fn send_to_peer( &self, peer_id: PublicKey, batch: &SyncBatch, ) -> Result<(), Error>
Send batch to a peer through persistent channel
Sourcepub async fn broadcast(&self, batch: &SyncBatch) -> Result<(), Error>
pub async fn broadcast(&self, batch: &SyncBatch) -> Result<(), Error>
Broadcast batch to all connected peers
Sourcepub async fn send_delta_sync(
&self,
peer_id: PublicKey,
doc_key: &str,
message: &Message,
) -> Result<usize, Error>
pub async fn send_delta_sync( &self, peer_id: PublicKey, doc_key: &str, message: &Message, ) -> Result<usize, Error>
Send a delta sync message to a specific peer through persistent channel
Packages the message into a SyncBatch and sends it.
Sourcepub async fn send_state_snapshot(
&self,
peer_id: PublicKey,
doc_key: &str,
state_bytes: Vec<u8>,
) -> Result<usize, Error>
pub async fn send_state_snapshot( &self, peer_id: PublicKey, doc_key: &str, state_bytes: Vec<u8>, ) -> Result<usize, Error>
Send a state snapshot to a specific peer through persistent channel
Sourcepub async fn send_tombstone(
&self,
peer_id: PublicKey,
tombstone_msg: &TombstoneSyncMessage,
) -> Result<usize, Error>
pub async fn send_tombstone( &self, peer_id: PublicKey, tombstone_msg: &TombstoneSyncMessage, ) -> Result<usize, Error>
Send a tombstone to a specific peer through persistent channel
Sourcepub async fn send_tombstone_batch(
&self,
peer_id: PublicKey,
tombstones: &[TombstoneSyncMessage],
) -> Result<usize, Error>
pub async fn send_tombstone_batch( &self, peer_id: PublicKey, tombstones: &[TombstoneSyncMessage], ) -> Result<usize, Error>
Send multiple tombstones to a specific peer through persistent channel
Sourcepub async fn broadcast_delta_sync(
&self,
doc_key: &str,
message: &Message,
) -> Result<(), Error>
pub async fn broadcast_delta_sync( &self, doc_key: &str, message: &Message, ) -> Result<(), Error>
Broadcast a delta sync message to all connected peers
Sourcepub async fn broadcast_state_snapshot(
&self,
doc_key: &str,
state_bytes: Vec<u8>,
) -> Result<(), Error>
pub async fn broadcast_state_snapshot( &self, doc_key: &str, state_bytes: Vec<u8>, ) -> Result<(), Error>
Broadcast a state snapshot to all connected peers
Sourcepub async fn broadcast_tombstone(
&self,
tombstone_msg: &TombstoneSyncMessage,
) -> Result<(), Error>
pub async fn broadcast_tombstone( &self, tombstone_msg: &TombstoneSyncMessage, ) -> Result<(), Error>
Broadcast a tombstone to all connected peers
Sourcepub async fn remove_channel(&self, peer_id: &PublicKey)
pub async fn remove_channel(&self, peer_id: &PublicKey)
Remove channel for a peer (e.g., on disconnect)
Sourcepub fn channel_count(&self) -> usize
pub fn channel_count(&self) -> usize
Get number of active channels
Sourcepub fn stats(&self) -> ChannelManagerStats
pub fn stats(&self) -> ChannelManagerStats
Get statistics for all channels
Auto Trait Implementations§
impl Freeze for SyncChannelManager
impl !RefUnwindSafe for SyncChannelManager
impl Send for SyncChannelManager
impl Sync for SyncChannelManager
impl Unpin for SyncChannelManager
impl UnsafeUnpin for SyncChannelManager
impl !UnwindSafe for SyncChannelManager
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
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>
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>
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