pub enum WALRecord<T: Types> {
SaveVote(T::Vote),
Append(T::LogId, T::LogPayload),
Commit(T::LogId),
TruncateAfter(Option<T::LogId>),
PurgeUpto(T::LogId),
State(RaftLogState<T>),
}Expand description
WALRecord represents different types of records that can be written to the Write-Ahead Log (WAL). Each variant corresponds to a specific operation in the Raft protocol.
Variants§
SaveVote(T::Vote)
Save vote change.
Append(T::LogId, T::LogPayload)
Append new log entry.
Commit(T::LogId)
Save committed log id.
TruncateAfter(Option<T::LogId>)
Truncate log entries after the specified log id.
PurgeUpto(T::LogId)
Purge log entries up to (and including) the specified log id.
State(RaftLogState<T>)
Save a snapshot of the complete state of the Raft log.
Trait Implementations§
Source§impl<T: Types> Decode for WALRecord<T>
Implements decoding for WALRecord
Reads the record type, payload, and verifies the checksum
impl<T: Types> Decode for WALRecord<T>
Implements decoding for WALRecord Reads the record type, payload, and verifies the checksum
Source§impl<T: Types> Encode for WALRecord<T>
Implements encoding for WALRecord
Each record is encoded as:
impl<T: Types> Encode for WALRecord<T>
Implements encoding for WALRecord Each record is encoded as:
- 4 bytes: record type
- variable bytes: record payload
- 4 bytes: checksum
impl<T: Eq + Types> Eq for WALRecord<T>
impl<T: Types> StructuralPartialEq for WALRecord<T>
Auto Trait Implementations§
impl<T> Freeze for WALRecord<T>
impl<T> RefUnwindSafe for WALRecord<T>where
<T as Types>::Vote: RefUnwindSafe,
<T as Types>::LogId: RefUnwindSafe,
<T as Types>::LogPayload: RefUnwindSafe,
<T as Types>::UserData: RefUnwindSafe,
impl<T> Send for WALRecord<T>
impl<T> Sync for WALRecord<T>
impl<T> Unpin for WALRecord<T>
impl<T> UnwindSafe for WALRecord<T>where
<T as Types>::Vote: UnwindSafe,
<T as Types>::LogId: UnwindSafe,
<T as Types>::LogPayload: UnwindSafe,
<T as Types>::UserData: 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