pub struct GattSyncProtocol { /* private fields */ }Expand description
GATT Sync Protocol coordinator
Ties together batching, delta encoding, and chunked transfer for efficient CRDT sync over BLE.
Implementations§
Source§impl GattSyncProtocol
impl GattSyncProtocol
Sourcepub fn new(node_id: NodeId, config: SyncConfig) -> Self
pub fn new(node_id: NodeId, config: SyncConfig) -> Self
Create a new sync protocol instance
Sourcepub fn with_defaults(node_id: NodeId) -> Self
pub fn with_defaults(node_id: NodeId) -> Self
Create with default config
Sourcepub fn vector_clock(&self) -> &VectorClock
pub fn vector_clock(&self) -> &VectorClock
Get the vector clock
Sourcepub fn remove_peer(&mut self, peer_id: &NodeId)
pub fn remove_peer(&mut self, peer_id: &NodeId)
Remove a peer
Sourcepub fn queue_operation(&mut self, op: CrdtOperation) -> bool
pub fn queue_operation(&mut self, op: CrdtOperation) -> bool
Queue a CRDT operation for sync
Sourcepub fn should_sync(&self) -> bool
pub fn should_sync(&self) -> bool
Check if we should sync now
Sourcepub fn prepare_sync(&mut self, peer_id: &NodeId) -> Vec<SyncChunk>
pub fn prepare_sync(&mut self, peer_id: &NodeId) -> Vec<SyncChunk>
Prepare a sync to a peer
Returns the chunks to send
Sourcepub fn next_tx_chunk(&mut self) -> Option<SyncChunk>
pub fn next_tx_chunk(&mut self) -> Option<SyncChunk>
Get next chunk to send (if any)
Sourcepub fn queue_chunks(&mut self, chunks: Vec<SyncChunk>)
pub fn queue_chunks(&mut self, chunks: Vec<SyncChunk>)
Queue chunks for sending
Sourcepub fn has_pending_tx(&self) -> bool
pub fn has_pending_tx(&self) -> bool
Check if there are chunks to send
Sourcepub fn process_received(
&mut self,
chunk: SyncChunk,
peer_id: &NodeId,
) -> Option<Vec<CrdtOperation>>
pub fn process_received( &mut self, chunk: SyncChunk, peer_id: &NodeId, ) -> Option<Vec<CrdtOperation>>
Process a received chunk
Returns decoded operations if message is complete
Sourcepub fn reset_peer(&mut self, peer_id: &NodeId)
pub fn reset_peer(&mut self, peer_id: &NodeId)
Reset sync state for a specific peer
Auto Trait Implementations§
impl Freeze for GattSyncProtocol
impl RefUnwindSafe for GattSyncProtocol
impl Send for GattSyncProtocol
impl Sync for GattSyncProtocol
impl Unpin for GattSyncProtocol
impl UnwindSafe for GattSyncProtocol
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