Struct Membership
pub struct Membership {
pub epoch: u64,
pub members: Vec<ReplicaId>,
pub entry: Option<Entry>,
pub previous: Vec<ReplicaId>,
}Expand description
The members of one epoch.
Membership change. Membership is fixed within an epoch. A change is a log entry (a reconfiguration body naming the next epoch’s members and addresses) that the primary proposes as the last entry of its epoch: it proposes nothing after it. Once that entry commits, every member of the new configuration that holds the log through it changes to the new epoch’s first view by an ordinary view change among the new members; members not in it retire; new members fetch the epoch and the log from the members, and take part in no view change until they hold the log through the entry. A change requires that a quorum of the new members are members now (so a quorum of the new epoch starts with the whole committed log): one step can add or remove members, or replace a minority, but not replace a majority.
Fields§
§epoch: u64§members: Vec<ReplicaId>In order: the primary of the epoch’s view v is
members[(v - first_view(epoch)) % len].
entry: Option<Entry>The committed reconfiguration entry that began this epoch (none for epoch 0).
previous: Vec<ReplicaId>The members this replica knew before (they hold the committed log
through entry and serve it to members catching up into the epoch).
Implementations§
§impl Membership
impl Membership
pub fn initial(n: u8) -> Self
pub fn from_entry(e: &Entry) -> Option<Self>
pub fn from_entry(e: &Entry) -> Option<Self>
From a committed reconfiguration entry.
pub fn addresses(&self) -> Vec<(ReplicaId, String)>
pub fn addresses(&self) -> Vec<(ReplicaId, String)>
Every member’s address, as the reconfiguration entry names them (empty for epoch 0, whose addresses the host configures).
pub fn contains(&self, id: ReplicaId) -> bool
pub fn quorum(&self) -> usize
pub fn primary_of(&self, view: u64) -> ReplicaId
pub fn next(
&self,
primary: ReplicaId,
members: &[(ReplicaId, String)],
) -> Result<Vec<(ReplicaId, String)>, &'static str>
pub fn next( &self, primary: ReplicaId, members: &[(ReplicaId, String)], ) -> Result<Vec<(ReplicaId, String)>, &'static str>
Checks a requested membership for the next epoch and orders it: the
current primary first if it stays (it then leads the new epoch’s
first view), the other current members next, new members last.
Trait Implementations§
§impl Clone for Membership
impl Clone for Membership
§fn clone(&self) -> Membership
fn clone(&self) -> Membership
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more