Struct raft::storage::MemStorageCore [−][src]
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]
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]
&mut self,
idx: u64,
cs: Option<ConfState>
) -> Result<()>
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]
fn default() -> 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]
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>,