pub struct LogEntry {
pub term: Term,
pub index: Index,
pub kind: EntryKind,
pub command: Vec<u8>,
}Expand description
A single entry in the replicated log.
The command is opaque bytes: for a
Normal entry the protocol replicates and orders it but
never interprets it, and the application’s state machine decodes it on apply;
for a Config entry the bytes encode the new voting
membership. Each entry records the term in which the
leader created it and its index in the log, which
together identify it uniquely.
§Examples
use raft_io::LogEntry;
let entry = LogEntry::new(2, 7, b"put k v".to_vec());
assert_eq!(entry.term, 2);
assert_eq!(entry.index, 7);
assert_eq!(entry.command, b"put k v");Fields§
§term: TermTerm in which the leader created this entry.
index: Index1-based position of this entry in the log.
kind: EntryKindWhether this is a normal command or a configuration change.
command: Vec<u8>Opaque bytes: an application command, or an encoded member set for a
Config entry.
Implementations§
Trait Implementations§
Source§impl Deserialize for LogEntry
impl Deserialize for LogEntry
impl Eq for LogEntry
Source§impl Serialize for LogEntry
impl Serialize for LogEntry
impl StructuralPartialEq for LogEntry
Auto Trait Implementations§
impl Freeze for LogEntry
impl RefUnwindSafe for LogEntry
impl Send for LogEntry
impl Sync for LogEntry
impl Unpin for LogEntry
impl UnsafeUnpin for LogEntry
impl UnwindSafe for LogEntry
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