Struct raft::Progress[][src]

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,
    pub commit_group_id: u64,
    pub committed_index: u64,
}
Expand description

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

Creates a new progress with the given settings.

Changes the progress to a probe.

Changes the progress to a Replicate.

Changes the progress to a snapshot.

Sets the snapshot to failure.

Unsets pendingSnapshot if Match is equal or higher than the pendingSnapshot

Returns false if the given n index comes from an outdated message. Otherwise it updates the progress and returns true.

update committed_index.

Optimistically advance the index

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.

Determine whether progress is paused.

Resume progress

Pause progress.

Update inflight msgs and next_idx

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.