[][src]Struct raft::ProgressSet

pub struct ProgressSet { /* fields omitted */ }

ProgressSet contains several Progresses, which could be Leader, Follower and Learner.

Methods

impl ProgressSet[src]

pub fn configuration(&self) -> &Configuration[src]

The current configuration state of the cluster.

pub fn next_configuration(&self) -> &Option<Configuration>[src]

The pending configuration, which will be adopted after the Finalize entry is applied.

impl ProgressSet[src]

pub fn new() -> Self[src]

Creates a new ProgressSet.

pub fn with_capacity(voters: usize, learners: usize) -> Self[src]

Create a progress set with the specified sizes already reserved.

pub fn with_logger(self, logger: &Logger) -> Self[src]

Set a logger.

pub fn voters(&self) -> impl Iterator<Item = (&u64, &Progress)>[src]

Returns the status of voters.

Note: Do not use this for majority/quorum calculation. The Raft node may be transitioning to a new configuration and have two qourums. Use has_quorum instead.

pub fn learners(&self) -> impl Iterator<Item = (&u64, &Progress)>[src]

Returns the status of learners.

Note: Do not use this for majority/quorum calculation. The Raft node may be transitioning to a new configuration and have two qourums. Use has_quorum instead.

pub fn voters_mut(&mut self) -> impl Iterator<Item = (&u64, &mut Progress)>[src]

Returns the mutable status of voters.

Note: Do not use this for majority/quorum calculation. The Raft node may be transitioning to a new configuration and have two qourums. Use has_quorum instead.

pub fn learners_mut(&mut self) -> impl Iterator<Item = (&u64, &mut Progress)>[src]

Returns the mutable status of learners.

Note: Do not use this for majority/quorum calculation. The Raft node may be transitioning to a new configuration and have two qourums. Use has_quorum instead.

pub fn voter_ids(&self) -> HashSet<u64>[src]

Returns the ids of all known voters.

Note: Do not use this for majority/quorum calculation. The Raft node may be transitioning to a new configuration and have two qourums. Use has_quorum instead.

pub fn learner_ids(&self) -> HashSet<u64>[src]

Returns the ids of all known learners.

Note: Do not use this for majority/quorum calculation. The Raft node may be transitioning to a new configuration and have two qourums. Use has_quorum instead.

pub fn get(&self, id: u64) -> Option<&Progress>[src]

Grabs a reference to the progress of a node.

pub fn get_mut(&mut self, id: u64) -> Option<&mut Progress>[src]

Grabs a mutable reference to the progress of a node.

pub fn iter(&self) -> impl ExactSizeIterator<Item = (&u64, &Progress)>[src]

Returns an iterator across all the nodes and their progress.

Note: Do not use this for majority/quorum calculation. The Raft node may be transitioning to a new configuration and have two qourums. Use has_quorum instead.

pub fn iter_mut(
    &mut self
) -> impl ExactSizeIterator<Item = (&u64, &mut Progress)>
[src]

Returns a mutable iterator across all the nodes and their progress.

Note: Do not use this for majority/quorum calculation. The Raft node may be transitioning to a new configuration and have two qourums. Use has_quorum instead.

pub fn insert_voter(&mut self, id: u64, pr: Progress) -> Result<()>[src]

Adds a voter to the group.

Errors

  • id is in the voter set.
  • id is in the learner set.
  • There is a pending membership change.

pub fn insert_learner(&mut self, id: u64, pr: Progress) -> Result<()>[src]

Adds a learner to the group.

Errors

  • id is in the voter set.
  • id is in the learner set.
  • There is a pending membership change.

pub fn remove(&mut self, id: u64) -> Result<Option<Progress>>[src]

Removes the peer from the set of voters or learners.

Errors

  • There is a pending membership change.

pub fn promote_learner(&mut self, id: u64) -> Result<()>[src]

Promote a learner to a peer.

pub fn maximal_committed_index(&self) -> u64[src]

Returns the maximal committed index for the cluster.

Eg. If the matched indexes are [2,2,2,4,5], it will return 2.

pub fn candidacy_status<'a>(
    &self,
    votes: impl IntoIterator<Item = (&'a u64, &'a bool)>
) -> CandidacyStatus
[src]

Returns the Candidate's eligibility in the current election.

If it is still eligible, it should continue polling nodes and checking. Eventually, the election will result in this returning either Elected or Ineligible, meaning the election can be concluded.

pub fn quorum_recently_active(&mut self, perspective_of: u64) -> bool[src]

Determines if the current quorum is active according to the this raft node. Doing this will set the recent_active of each peer to false.

This should only be called by the leader.

pub fn has_quorum(&self, potential_quorum: &HashSet<u64>) -> bool[src]

Determine if a quorum is formed from the given set of nodes.

This is the only correct way to verify you have reached a quorum for the whole group.

pub fn is_in_membership_change(&self) -> bool[src]

Determine if the ProgressSet is represented by a transition state under Joint Consensus.

pub fn finalize_membership_change(&mut self) -> Result<()>[src]

Finalizes the joint consensus state and transitions solely to the new state.

This must be called only after calling begin_membership_change and after the majority of peers in both the current and the next state have committed the changes.

Trait Implementations

impl Clone for ProgressSet[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Default for ProgressSet[src]

Auto Trait Implementations

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

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