pub struct AntiEntropyCluster<S: Lattice + Clone> {
replicas: Vec<DeltaReplica<S, S>>,
network: NetworkSimulator<S>,
}Expand description
Anti-entropy coordinator for a cluster of replicas
Fields§
§replicas: Vec<DeltaReplica<S, S>>All replicas in the cluster
network: NetworkSimulator<S>Network simulator
Implementations§
Source§impl<S: Lattice + Clone> AntiEntropyCluster<S>
impl<S: Lattice + Clone> AntiEntropyCluster<S>
Sourcepub fn new(n: usize, config: NetworkConfig) -> Self
pub fn new(n: usize, config: NetworkConfig) -> Self
Create a new cluster with n replicas
Sourcepub fn replica(&self, idx: usize) -> &DeltaReplica<S, S>
pub fn replica(&self, idx: usize) -> &DeltaReplica<S, S>
Get replica by index
Sourcepub fn replica_mut(&mut self, idx: usize) -> &mut DeltaReplica<S, S>
pub fn replica_mut(&mut self, idx: usize) -> &mut DeltaReplica<S, S>
Get mutable replica by index
Sourcepub fn mutate<F>(&mut self, replica_idx: usize, mutator: F) -> S
pub fn mutate<F>(&mut self, replica_idx: usize, mutator: F) -> S
Perform a mutation on a specific replica
Sourcepub fn initiate_sync(&mut self, from_idx: usize, to_idx: usize)
pub fn initiate_sync(&mut self, from_idx: usize, to_idx: usize)
Initiate sync from one replica to another
Sourcepub fn process_one(&mut self) -> bool
pub fn process_one(&mut self) -> bool
Process one network message
Sourcepub fn drain_network(&mut self)
pub fn drain_network(&mut self)
Run until network is empty
Sourcepub fn full_sync_round(&mut self)
pub fn full_sync_round(&mut self)
Full sync: every replica syncs with every other replica
Sourcepub fn is_converged(&self) -> bool
pub fn is_converged(&self) -> bool
Check if all replicas have converged
Sourcepub fn retransmit_and_process(&mut self)
pub fn retransmit_and_process(&mut self)
Retransmit lost messages and process
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for AntiEntropyCluster<S>
impl<S> RefUnwindSafe for AntiEntropyCluster<S>where
S: RefUnwindSafe,
impl<S> Send for AntiEntropyCluster<S>where
S: Send,
impl<S> Sync for AntiEntropyCluster<S>where
S: Sync,
impl<S> Unpin for AntiEntropyCluster<S>where
S: Unpin,
impl<S> UnwindSafe for AntiEntropyCluster<S>where
S: 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