[−][src]Struct raft::ProgressSet
ProgressSet
contains several Progress
es,
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 voters(
&self
) -> impl Iterator<Item = (&u64, &Progress)>
[src]
&self
) -> impl Iterator<Item = (&u64, &Progress)>
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]
&self
) -> impl Iterator<Item = (&u64, &Progress)>
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]
&mut self
) -> impl Iterator<Item = (&u64, &mut Progress)>
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]
&mut self
) -> impl Iterator<Item = (&u64, &mut Progress)>
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]
&self
) -> impl ExactSizeIterator<Item = (&u64, &Progress)>
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]
&mut self
) -> impl ExactSizeIterator<Item = (&u64, &mut Progress)>
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]
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]
&self,
votes: impl IntoIterator<Item = (&'a u64, &'a bool)>
) -> CandidacyStatus
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 commited the changes.
Trait Implementations
impl Default for ProgressSet
[src]
fn default() -> ProgressSet
[src]
impl Clone for ProgressSet
[src]
fn clone(&self) -> ProgressSet
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl Send for ProgressSet
impl !Sync for ProgressSet
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,