pub trait RaftLogId<NID: NodeId> {
// Required methods
fn get_log_id(&self) -> &LogId<NID>;
fn set_log_id(&mut self, log_id: &LogId<NID>);
// Provided method
fn leader_id(&self) -> &CommittedLeaderId<NID> { ... }
}
Expand description
Defines API to operate an object that contains a log-id, such as a log entry or a log id.
Required Methods§
sourcefn get_log_id(&self) -> &LogId<NID>
fn get_log_id(&self) -> &LogId<NID>
Return a reference to the log-id it stores.
sourcefn 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.
Provided Methods§
sourcefn leader_id(&self) -> &CommittedLeaderId<NID>
fn leader_id(&self) -> &CommittedLeaderId<NID>
Returns a reference to the leader id that proposed this log id.
When a LeaderId
is committed, some of its data can be discarded.
For example, a leader id in standard raft is (term, node_id)
, but a log id does not have
to store the node_id
, because in standard raft there is at most one leader that can be
established.