[][src]Struct raft::storage::MemStorageCore

pub struct MemStorageCore { /* fields omitted */ }

The Memory Storage Core instance holds the actual state of the storage struct. To access this value, use the rl and wl functions on the main MemStorage implementation.

Methods

impl MemStorageCore[src]

pub fn set_hardstate(&mut self, hs: HardState)[src]

Saves the current HardState.

pub fn set_conf_state(
    &mut self,
    cs: ConfState,
    pending_membership_change: Option<(ConfState, u64)>
)
[src]

Saves the current conf state.

pub fn apply_snapshot(&mut self, snapshot: Snapshot) -> Result<()>[src]

Overwrites the contents of this Storage object with those of the given snapshot.

pub fn create_snapshot(
    &mut self,
    idx: u64,
    cs: Option<ConfState>,
    pending_membership_change: Option<ConfChange>,
    data: Vec<u8>
) -> Result<&Snapshot>
[src]

Makes a snapshot which can be retrieved with snapshot() and can be used to reconstruct the state at that point. If any configuration changes have been made since the last compaction, the result of the last apply_conf_change must be passed in.

pub fn compact(&mut self, compact_index: u64) -> Result<()>[src]

Discards all log entries prior to compact_index. It is the application's responsibility to not attempt to compact an index greater than RaftLog.applied.

pub fn append(&mut self, ents: &[Entry]) -> Result<()>[src]

Append the new entries to storage. TODO: ensure the entries are continuous and entries[0].get_index() > self.entries[0].get_index()

Trait Implementations

impl Default for MemStorageCore[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.