Skip to main content

Membership

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

pub fn initial(n: u8) -> Self

pub fn from_entry(e: &Entry) -> Option<Self>

From a committed reconfiguration entry.

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 start(&self) -> Op

The op of the entry that began this epoch.

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>

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

§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Membership

§

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

Formats the value using the given formatter. Read more
§

impl Eq for Membership

§

impl PartialEq for Membership

§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
§

impl StructuralPartialEq for Membership

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.