[−][src]Struct raft::Unstable
The unstable.entries[i] has raft log position i+unstable.offset. Note that unstable.offset may be less than the highest log position in storage; this means that the next write to storage might need to truncate the log before persisting unstable.entries.
Fields
snapshot: Option<Snapshot>
The incoming unstable snapshot, if any.
entries: Vec<Entry>
All entries that have not yet been written to storage.
offset: u64
The offset from the vector index.
tag: String
The tag to use when logging.
Methods
impl Unstable
[src]
pub fn new(offset: u64, tag: String) -> Unstable
[src]
Creates a new log of unstable entries.
pub fn maybe_first_index(&self) -> Option<u64>
[src]
Returns the index of the first possible entry in entries if it has a snapshot.
pub fn maybe_last_index(&self) -> Option<u64>
[src]
Returns the last index if it has at least one unstable entry or snapshot.
pub fn maybe_term(&self, idx: u64) -> Option<u64>
[src]
Returns the term of the entry at index idx, if there is any.
pub fn stable_to(&mut self, idx: u64, term: u64)
[src]
Moves the stable offset up to the index. Provided that the index is in the same election term.
pub fn stable_snap_to(&mut self, idx: u64)
[src]
Removes the snapshot from self if the index of the snapshot matches
pub fn restore(&mut self, snap: Snapshot)
[src]
From a given snapshot, restores the snapshot to self, but doesn't unpack.
pub fn truncate_and_append(&mut self, ents: &[Entry])
[src]
Append entries to unstable, truncate local block first if overlapped.
pub fn slice(&self, lo: u64, hi: u64) -> &[Entry]
[src]
Returns a slice of entries between the high and low.
Panics
Panics if the lo
or hi
are out of bounds.
Panics if lo > hi
.
pub fn must_check_outofbounds(&self, lo: u64, hi: u64)
[src]
Asserts the hi
and lo
values against each other and against the
entries themselves.
Trait Implementations
impl PartialEq<Unstable> for Unstable
[src]
impl Default for Unstable
[src]
impl Debug for Unstable
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,