openraft 0.10.0-alpha.18

Advanced Raft consensus
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use crate::entry::RaftEntry;
use crate::log_id::ref_log_id::RefLogId;

pub(crate) trait RaftEntryExt: RaftEntry {
    /// Returns a lightweight [`RefLogId`] that contains the log id information.
    fn ref_log_id(&self) -> RefLogId<'_, Self::CommittedLeaderId> {
        let (leader_id, index) = self.log_id_parts();
        RefLogId::new(leader_id, index)
    }
}

impl<T> RaftEntryExt for T where T: RaftEntry {}