Struct raft::Unstable [−][src]
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.
logger: Logger
The tag to use when logging.
Implementations
impl Unstable
[src]
pub fn new(offset: u64, logger: Logger) -> 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_entries(&mut self, index: u64, term: u64)
[src]
Clears the unstable entries and moves the stable offset up to the last index, if there is any.
pub fn stable_snap(&mut self, index: u64)
[src]
Clears the unstable snapshot.
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.
Panics
Panics if truncate logs to the entry before snapshot
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
Auto Trait Implementations
impl RefUnwindSafe for Unstable
impl Send for Unstable
impl Sync for Unstable
impl Unpin for Unstable
impl UnwindSafe for Unstable
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> 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.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,