pub struct VolatileState {
pub commit_index: LogIndex,
pub last_applied: LogIndex,
}Expand description
Volatile state on all servers
Can be reconstructed from persistent state
Fields§
§commit_index: LogIndexIndex of highest log entry known to be committed (initialized to 0, increases monotonically)
last_applied: LogIndexIndex of highest log entry applied to state machine (initialized to 0, increases monotonically)
Implementations§
Source§impl VolatileState
impl VolatileState
Sourcepub fn update_commit_index(&mut self, index: LogIndex)
pub fn update_commit_index(&mut self, index: LogIndex)
Update commit index
Sourcepub fn apply_entries(&mut self, up_to_index: LogIndex)
pub fn apply_entries(&mut self, up_to_index: LogIndex)
Advance last_applied index
Sourcepub fn pending_entries(&self) -> u64
pub fn pending_entries(&self) -> u64
Get the number of entries that need to be applied
Trait Implementations§
Source§impl Clone for VolatileState
impl Clone for VolatileState
Source§fn clone(&self) -> VolatileState
fn clone(&self) -> VolatileState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VolatileState
impl Debug for VolatileState
Auto Trait Implementations§
impl Freeze for VolatileState
impl RefUnwindSafe for VolatileState
impl Send for VolatileState
impl Sync for VolatileState
impl Unpin for VolatileState
impl UnwindSafe for VolatileState
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