[][src]Struct raft::Progress

pub struct Progress {
    pub matched: u64,
    pub next_idx: u64,
    pub state: ProgressState,
    pub paused: bool,
    pub pending_snapshot: u64,
    pub recent_active: bool,
    pub ins: Inflights,
    pub is_learner: bool,
}

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.

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.

is_learner: bool

Indicates the Progress is a learner or not.

Methods

impl Progress[src]

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 optimistic_update(&mut self, n: u64)[src]

Optimistically advance the index

pub fn maybe_decr_to(&mut self, rejected: u64, last: u64) -> bool[src]

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.

Trait Implementations

impl Clone for Progress[src]

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

Performs copy-assignment from source. Read more

impl Default for Progress[src]

impl Debug for Progress[src]

Auto Trait Implementations

impl Send for Progress

impl Sync for Progress

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

impl<T, U> TryInto 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> Any for T where
    T: 'static + ?Sized
[src]