AntiEntropyCluster

Struct AntiEntropyCluster 

Source
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>

Source

pub fn new(n: usize, config: NetworkConfig) -> Self

Create a new cluster with n replicas

Source

pub fn replica(&self, idx: usize) -> &DeltaReplica<S, S>

Get replica by index

Source

pub fn replica_mut(&mut self, idx: usize) -> &mut DeltaReplica<S, S>

Get mutable replica by index

Source

pub fn mutate<F>(&mut self, replica_idx: usize, mutator: F) -> S
where F: FnOnce(&S) -> S,

Perform a mutation on a specific replica

Source

pub fn initiate_sync(&mut self, from_idx: usize, to_idx: usize)

Initiate sync from one replica to another

Source

pub fn process_one(&mut self) -> bool

Process one network message

Source

pub fn drain_network(&mut self)

Run until network is empty

Source

pub fn broadcast(&mut self, from_idx: usize)

Broadcast delta from one replica to all others

Source

pub fn full_sync_round(&mut self)

Full sync: every replica syncs with every other replica

Source

pub fn is_converged(&self) -> bool

Check if all replicas have converged

Source

pub fn retransmit_and_process(&mut self)

Retransmit lost messages and process

Source

pub fn len(&self) -> usize

Get number of replicas

Source

pub fn is_empty(&self) -> bool

Check if cluster is empty

Trait Implementations§

Source§

impl<S: Debug + Lattice + Clone> Debug for AntiEntropyCluster<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V