pub struct LogId<NID: NodeId> {
pub leader_id: CommittedLeaderId<NID>,
pub index: u64,
}
Expand description
The identity of a raft log.
The log id serves as unique identifier for a log entry across the system. It is composed of two parts: a leader id, which refers to the leader that proposed this log, and an integer index.
Fields§
§leader_id: CommittedLeaderId<NID>
The id of the leader that proposed this log
index: u64
The index of a log in the storage.
Log index is a consecutive integer.
Implementations§
source§impl<NID: NodeId> LogId<NID>
impl<NID: NodeId> LogId<NID>
sourcepub fn new(leader_id: CommittedLeaderId<NID>, index: u64) -> Self
pub fn new(leader_id: CommittedLeaderId<NID>, index: u64) -> Self
Creates a log id proposed by a committed leader with leader_id
at the given index.
sourcepub fn committed_leader_id(&self) -> &CommittedLeaderId<NID>
pub fn committed_leader_id(&self) -> &CommittedLeaderId<NID>
Returns the leader id that proposed this log.
Trait Implementations§
source§impl<'de, NID: NodeId> Deserialize<'de> for LogId<NID>
impl<'de, NID: NodeId> Deserialize<'de> for LogId<NID>
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<NID: Ord + NodeId> Ord for LogId<NID>
impl<NID: Ord + NodeId> Ord for LogId<NID>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<NID: PartialEq + NodeId> PartialEq for LogId<NID>
impl<NID: PartialEq + NodeId> PartialEq for LogId<NID>
source§impl<NID: PartialOrd + NodeId> PartialOrd for LogId<NID>
impl<NID: PartialOrd + NodeId> PartialOrd for LogId<NID>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<NID: NodeId> RaftLogId<NID> for LogId<NID>
impl<NID: NodeId> RaftLogId<NID> for LogId<NID>
source§fn get_log_id(&self) -> &LogId<NID>
fn get_log_id(&self) -> &LogId<NID>
Return a reference to the log-id it stores.
source§fn set_log_id(&mut self, log_id: &LogId<NID>)
fn set_log_id(&mut self, log_id: &LogId<NID>)
Update the log id it contains.
source§fn leader_id(&self) -> &CommittedLeaderId<NID>
fn leader_id(&self) -> &CommittedLeaderId<NID>
Returns a reference to the leader id that proposed this log id. Read more
impl<NID: Copy + NodeId> Copy for LogId<NID>
impl<NID: Eq + NodeId> Eq for LogId<NID>
impl<NID: NodeId> StructuralPartialEq for LogId<NID>
Auto Trait Implementations§
impl<NID> Freeze for LogId<NID>where
NID: Freeze,
impl<NID> RefUnwindSafe for LogId<NID>where
NID: RefUnwindSafe,
impl<NID> Send for LogId<NID>
impl<NID> Sync for LogId<NID>
impl<NID> Unpin for LogId<NID>where
NID: Unpin,
impl<NID> UnwindSafe for LogId<NID>where
NID: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more