Trait openraft::log_id::RaftLogId

source ·
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§

source

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>)

Update the log id it contains.

Provided Methods§

source

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.

Implementors§

source§

impl<C> RaftLogId<<C as RaftTypeConfig>::NodeId> for Entry<C>
where C: RaftTypeConfig,

source§

impl<NID: NodeId> RaftLogId<NID> for LogId<NID>