Struct raft::ProgressTracker [−][src]
ProgressTracker
contains several Progress
es,
which could be Leader
, Follower
and Learner
.
Implementations
impl ProgressTracker
[src]
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]
voters: usize,
learners: usize,
max_inflight: usize,
logger: Logger
) -> Self
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]
&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 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]
&self,
votes: &HashMap<u64, bool, BuildHasherDefault<FxHasher>>
) -> VoteResult
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]
&self,
potential_quorum: &HashSet<u64, BuildHasherDefault<FxHasher>>
) -> bool
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]
&mut self,
conf: Configuration,
changes: MapChange,
next_idx: u64
)
Applies configuration and updates progress map to match the configuration.
Trait Implementations
impl Clone for ProgressTracker
[src]
fn clone(&self) -> ProgressTracker
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,