[][src]Struct raft::Unstable

pub struct Unstable {
    pub snapshot: Option<Snapshot>,
    pub entries: Vec<Entry>,
    pub offset: u64,
    pub tag: String,
}

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 Default for Unstable[src]

impl PartialEq<Unstable> for Unstable[src]

impl Debug for Unstable[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,