[][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 pending_request_snapshot: u64,
    pub recent_active: bool,
    pub ins: Inflights,
}

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.

Methods

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

Optimistically advance the index

pub fn maybe_decr_to(
    &mut self,
    rejected: u64,
    last: u64,
    request_snapshot: 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.

pub fn update_state(&mut self, last: u64)[src]

Update inflight msgs and next_idx

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 PartialEq<Progress> for Progress[src]

impl Debug for Progress[src]

Auto Trait Implementations

Blanket Implementations

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

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

type Owned = T

The resulting type after obtaining ownership.

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

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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

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

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,