pub struct SyncManager<Net> { /* private fields */ }Expand description
Simplified sync manager
Implementations§
Source§impl<Net: ExchangeInterface + Clone> SyncManager<Net>
impl<Net: ExchangeInterface + Clone> SyncManager<Net>
pub fn new(store: Node, network: Net) -> Self
pub fn with_config(store: Node, network: Net, config: SyncConfig) -> Self
Sourcepub async fn bootstrap(&self) -> Result<()>
pub async fn bootstrap(&self) -> Result<()>
Bootstrap: Sync from all peers and recover next_seq before starting local operations This is critical after data loss to avoid sequence number reuse
Sourcepub async fn start_sync_tasks(self: Arc<Self>)
pub async fn start_sync_tasks(self: Arc<Self>)
Start periodic log exchange with peers
Sourcepub fn handle_sync(&self, msg: SyncMessage) -> Result<SyncResponse>
pub fn handle_sync(&self, msg: SyncMessage) -> Result<SyncResponse>
Handle incoming sync message (bidirectional sync)
Protocol:
- Request contains only sender’s own logs (entries from sender_id)
- sender_ack serves dual purpose: progress report + “since” parameter
- Response contains logs from ALL nodes based on sender_ack
Auto Trait Implementations§
impl<Net> Freeze for SyncManager<Net>where
Net: Freeze,
impl<Net> RefUnwindSafe for SyncManager<Net>where
Net: RefUnwindSafe,
impl<Net> Send for SyncManager<Net>where
Net: Send,
impl<Net> Sync for SyncManager<Net>where
Net: Sync,
impl<Net> Unpin for SyncManager<Net>where
Net: Unpin,
impl<Net> UnwindSafe for SyncManager<Net>where
Net: UnwindSafe,
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