Struct openraft::metrics::RaftMetrics
source · pub struct RaftMetrics<NID, N>{Show 13 fields
pub running_state: Result<(), Fatal<NID>>,
pub id: NID,
pub current_term: u64,
pub vote: Vote<NID>,
pub last_log_index: Option<u64>,
pub last_applied: Option<LogId<NID>>,
pub snapshot: Option<LogId<NID>>,
pub purged: Option<LogId<NID>>,
pub state: ServerState,
pub current_leader: Option<NID>,
pub millis_since_quorum_ack: Option<u64>,
pub membership_config: Arc<StoredMembership<NID, N>>,
pub replication: Option<BTreeMap<NID, Option<LogId<NID>>>>,
}
Expand description
A set of metrics describing the current state of a Raft node.
Fields§
§running_state: Result<(), Fatal<NID>>
§id: NID
The ID of the Raft node.
current_term: u64
The current term of the Raft node.
vote: Vote<NID>
The last accepted vote.
last_log_index: Option<u64>
The last log index has been appended to this Raft node’s log.
last_applied: Option<LogId<NID>>
The last log index has been applied to this Raft node’s state machine.
snapshot: Option<LogId<NID>>
The id of the last log included in snapshot. If there is no snapshot, it is (0,0).
purged: Option<LogId<NID>>
The last log id that has purged from storage, inclusive.
purged
is also the first log id Openraft knows, although the corresponding log entry has
already been deleted.
state: ServerState
The state of the Raft node.
current_leader: Option<NID>
The current cluster leader.
millis_since_quorum_ack: Option<u64>
For a leader, it is the elapsed time in milliseconds since the most recently acknowledged timestamp by a quorum.
It is None
if this node is not leader, or the leader is not yet acknowledged by a quorum.
Being acknowledged means receiving a reply of
AppendEntries
(AppendEntriesRequest.vote.committed == true
).
Receiving a reply of RequestVote
(RequestVote.vote.committed == false
) does not count,
because a node will not maintain a lease for a vote with committed == false
.
This duration is used by the application to assess the likelihood that the leader has lost synchronization with the cluster. A longer duration without acknowledgment may suggest a higher probability of the leader being partitioned from the cluster.
membership_config: Arc<StoredMembership<NID, N>>
The current membership config of the cluster.
replication: Option<BTreeMap<NID, Option<LogId<NID>>>>
The replication states. It is Some() only when this node is leader.
Implementations§
source§impl<NID, N> RaftMetrics<NID, N>
impl<NID, N> RaftMetrics<NID, N>
pub fn new_initial(id: NID) -> Self
Trait Implementations§
source§impl<NID, N> Clone for RaftMetrics<NID, N>
impl<NID, N> Clone for RaftMetrics<NID, N>
source§fn clone(&self) -> RaftMetrics<NID, N>
fn clone(&self) -> RaftMetrics<NID, N>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<NID, N> Debug for RaftMetrics<NID, N>
impl<NID, N> Debug for RaftMetrics<NID, N>
source§impl<'de, NID, N> Deserialize<'de> for RaftMetrics<NID, N>
impl<'de, NID, N> Deserialize<'de> for RaftMetrics<NID, N>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<NID, N> Display for RaftMetrics<NID, N>
impl<NID, N> Display for RaftMetrics<NID, N>
source§impl<NID, N> MessageSummary<RaftMetrics<NID, N>> for RaftMetrics<NID, N>
impl<NID, N> MessageSummary<RaftMetrics<NID, N>> for RaftMetrics<NID, N>
source§impl<NID, N> PartialEq<Metric<NID>> for RaftMetrics<NID, N>
impl<NID, N> PartialEq<Metric<NID>> for RaftMetrics<NID, N>
Metric can be compared with RaftMetrics by comparing the corresponding field of RaftMetrics.
source§impl<NID, N> PartialEq for RaftMetrics<NID, N>
impl<NID, N> PartialEq for RaftMetrics<NID, N>
source§fn eq(&self, other: &RaftMetrics<NID, N>) -> bool
fn eq(&self, other: &RaftMetrics<NID, N>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<NID, N> PartialOrd<Metric<NID>> for RaftMetrics<NID, N>
impl<NID, N> PartialOrd<Metric<NID>> for RaftMetrics<NID, N>
Metric can be compared with RaftMetrics by comparing the corresponding field of RaftMetrics.
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more