pub struct SyncManager { /* private fields */ }Expand description
Manages synchronization across replicas
Implementations§
Source§impl SyncManager
impl SyncManager
Sourcepub fn new(replica_set: Arc<ReplicaSet>, log: Arc<ReplicationLog>) -> Self
pub fn new(replica_set: Arc<ReplicaSet>, log: Arc<ReplicationLog>) -> Self
Create a new sync manager
Sourcepub fn set_sync_mode(&self, mode: SyncMode)
pub fn set_sync_mode(&self, mode: SyncMode)
Set the synchronization mode
Sourcepub fn set_sync_timeout(&mut self, timeout: Duration)
pub fn set_sync_timeout(&mut self, timeout: Duration)
Set the sync timeout
Sourcepub async fn replicate(&self, data: Vec<u8>) -> Result<LogEntry>
pub async fn replicate(&self, data: Vec<u8>) -> Result<LogEntry>
Replicate data to all replicas according to sync mode
Sourcepub async fn catchup(
&self,
replica_id: &str,
from_sequence: u64,
) -> Result<Vec<LogEntry>>
pub async fn catchup( &self, replica_id: &str, from_sequence: u64, ) -> Result<Vec<LogEntry>>
Catch up a lagging replica
Sourcepub fn current_position(&self) -> u64
pub fn current_position(&self) -> u64
Get the current log position
Sourcepub fn verify_entry(&self, sequence: u64) -> Result<bool>
pub fn verify_entry(&self, sequence: u64) -> Result<bool>
Verify log entry integrity
Auto Trait Implementations§
impl Freeze for SyncManager
impl !RefUnwindSafe for SyncManager
impl Send for SyncManager
impl Sync for SyncManager
impl Unpin for SyncManager
impl !UnwindSafe for SyncManager
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