Struct raft::ProgressTracker[][src]

pub struct ProgressTracker { /* fields omitted */ }

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

Implementations

impl ProgressTracker[src]

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

The current configuration state of the cluster.

impl ProgressTracker[src]

pub fn new(max_inflight: usize, logger: Logger) -> Self[src]

Creates a new ProgressTracker.

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

Create a progress set with the specified sizes already reserved.

pub fn enable_group_commit(&mut self, enable: bool)[src]

Configures group commit.

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

Whether enable group commit.

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

Returns true if (and only if) there is only one voting member (i.e. the leader) in the current configuration.

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 maximal_committed_index(&mut self) -> (u64, bool)[src]

Returns the maximal committed index for the cluster. The bool flag indicates whether the index is computed by group commit algorithm successfully.

Eg. If the matched indexes are [2,2,2,4,5], it will return 2. If the matched indexes and groups are [(1, 1), (2, 2), (3, 2)], it will return 1.

pub fn reset_votes(&mut self)[src]

Prepares for a new round of vote counting via recordVote.

pub fn record_vote(&mut self, id: u64, vote: bool)[src]

Records that the node with the given id voted for this Raft instance if v == true (and declined it otherwise).

pub fn tally_votes(&self) -> (usize, usize, VoteResult)[src]

TallyVotes returns the number of granted and rejected Votes, and whether the election outcome is known.

pub fn vote_result(
    &self,
    votes: &HashMap<u64, bool, BuildHasherDefault<FxHasher>>
) -> VoteResult
[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, BuildHasherDefault<FxHasher>>
) -> 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 apply_conf(
    &mut self,
    conf: Configuration,
    changes: MapChange,
    next_idx: u64
)
[src]

Applies configuration and updates progress map to match the configuration.

Trait Implementations

impl Clone for ProgressTracker[src]

Auto Trait Implementations

impl RefUnwindSafe for ProgressTracker

impl Send for ProgressTracker

impl Sync for ProgressTracker

impl Unpin for ProgressTracker

impl UnwindSafe for ProgressTracker

Blanket Implementations

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

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]