Struct raft::Progress [−][src]
The progress of catching up from a restart.
Fields
matched: u64
How much state is matched.
next_idx: u64
The next index to apply
state: ProgressState
When in ProgressStateProbe, leader sends at most one replication message per heartbeat interval. It also probes actual progress of the follower.
When in ProgressStateReplicate, leader optimistically increases next to the latest entry sent after sending replication message. This is an optimized state for fast replicating log entries to the follower.
When in ProgressStateSnapshot, leader should have sent out snapshot before and stop sending any replication message.
paused: bool
Paused is used in ProgressStateProbe. When Paused is true, raft should pause sending replication message to this peer.
pending_snapshot: u64
This field is used in ProgressStateSnapshot. If there is a pending snapshot, the pendingSnapshot will be set to the index of the snapshot. If pendingSnapshot is set, the replication process of this Progress will be paused. raft will not resend snapshot until the pending one is reported to be failed.
pending_request_snapshot: u64
This field is used in request snapshot. If there is a pending request snapshot, this will be set to the request index of the snapshot.
recent_active: bool
This is true if the progress is recently active. Receiving any messages from the corresponding follower indicates the progress is active. RecentActive can be reset to false after an election timeout.
ins: Inflights
Inflights is a sliding window for the inflight messages. When inflights is full, no more message should be sent. When a leader sends out a message, the index of the last entry should be added to inflights. The index MUST be added into inflights in order. When a leader receives a reply, the previous inflights should be freed by calling inflights.freeTo.
commit_group_id: u64
Only logs replicated to different group will be committed if any group is configured.
committed_index: u64
Committed index in raft_log
Implementations
impl Progress
[src]
pub fn new(next_idx: u64, ins_size: usize) -> Self
[src]
Creates a new progress with the given settings.
pub fn become_probe(&mut self)
[src]
Changes the progress to a probe.
pub fn become_replicate(&mut self)
[src]
Changes the progress to a Replicate.
pub fn become_snapshot(&mut self, snapshot_idx: u64)
[src]
Changes the progress to a snapshot.
pub fn snapshot_failure(&mut self)
[src]
Sets the snapshot to failure.
pub fn maybe_snapshot_abort(&self) -> bool
[src]
Unsets pendingSnapshot if Match is equal or higher than the pendingSnapshot
pub fn maybe_update(&mut self, n: u64) -> bool
[src]
Returns false if the given n index comes from an outdated message. Otherwise it updates the progress and returns true.
pub fn update_committed(&mut self, committed_index: u64)
[src]
update committed_index.
pub fn optimistic_update(&mut self, n: u64)
[src]
Optimistically advance the index
pub fn maybe_decr_to(
&mut self,
rejected: u64,
match_hint: u64,
request_snapshot: u64
) -> bool
[src]
&mut self,
rejected: u64,
match_hint: u64,
request_snapshot: u64
) -> bool
Returns false if the given index comes from an out of order message. Otherwise it decreases the progress next index to min(rejected, last) and returns true.
pub fn is_paused(&self) -> bool
[src]
Determine whether progress is paused.
pub fn resume(&mut self)
[src]
Resume progress
pub fn pause(&mut self)
[src]
Pause progress.
pub fn update_state(&mut self, last: u64)
[src]
Update inflight msgs and next_idx
Trait Implementations
impl Clone for Progress
[src]
impl Debug for Progress
[src]
impl PartialEq<Progress> for Progress
[src]
impl StructuralPartialEq for Progress
[src]
Auto Trait Implementations
impl RefUnwindSafe for Progress
impl Send for Progress
impl Sync for Progress
impl Unpin for Progress
impl UnwindSafe for Progress
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>,