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

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.

Implementations

impl MemStorageCore[src]

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

Saves the current HardState.

pub fn hard_state(&self) -> &HardState[src]

Get the hard state.

pub fn mut_hard_state(&mut self) -> &mut HardState[src]

Get the mut hard state.

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

Commit to an index.

Panics

Panics if there is no such entry in raft logs.

pub fn set_conf_state(&mut self, cs: ConfState)[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.

Panics

Panics if the snapshot index is less than the storage’s first index.

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.

Panics

Panics if compact_index is higher than Storage::last_index(&self) + 1.

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

Append the new entries to storage.

Panics

Panics if ents contains compacted entries, or there’s a gap between ents and the last received entry in the storage.

pub fn commit_to_and_set_conf_states(
    &mut self,
    idx: u64,
    cs: Option<ConfState>
) -> Result<()>
[src]

Commit to idx and set configuration to the given states. Only used for tests.

pub fn trigger_snap_unavailable(&mut self)[src]

Trigger a SnapshotTemporarilyUnavailable error.

Trait Implementations

impl Default for MemStorageCore[src]

Auto Trait Implementations

impl RefUnwindSafe for MemStorageCore

impl Send for MemStorageCore

impl Sync for MemStorageCore

impl Unpin for MemStorageCore

impl UnwindSafe for MemStorageCore

Blanket Implementations

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

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

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

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

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

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[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<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]