pub struct SyncSimulator {
syncers: Vec<DAGSyncer<MemoryDAGStore>>,
}Expand description
Simulator for testing sync between multiple replicas.
Fields§
§syncers: Vec<DAGSyncer<MemoryDAGStore>>Syncers for each replica.
Implementations§
Source§impl SyncSimulator
impl SyncSimulator
Create a simulator where all replicas share the same genesis.
Sourcepub fn syncer(&self, idx: usize) -> &DAGSyncer<MemoryDAGStore>
pub fn syncer(&self, idx: usize) -> &DAGSyncer<MemoryDAGStore>
Get a reference to a syncer.
Sourcepub fn syncer_mut(&mut self, idx: usize) -> &mut DAGSyncer<MemoryDAGStore>
pub fn syncer_mut(&mut self, idx: usize) -> &mut DAGSyncer<MemoryDAGStore>
Get a mutable reference to a syncer.
Sourcepub fn sync_pair(&mut self, from: usize, to: usize)
pub fn sync_pair(&mut self, from: usize, to: usize)
Perform one sync round between two replicas.
Sourcepub fn full_sync_round(&mut self)
pub fn full_sync_round(&mut self)
Perform a full sync round (all pairs).
Sourcepub fn is_converged(&self) -> bool
pub fn is_converged(&self) -> bool
Check if all replicas have converged (same heads).
Sourcepub fn replica_count(&self) -> usize
pub fn replica_count(&self) -> usize
Get the number of replicas.
Auto Trait Implementations§
impl Freeze for SyncSimulator
impl RefUnwindSafe for SyncSimulator
impl Send for SyncSimulator
impl Sync for SyncSimulator
impl Unpin for SyncSimulator
impl UnwindSafe for SyncSimulator
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