pub struct MemoryPersistence { /* private fields */ }Expand description
In-memory persistence backend, useful for tests.
Implementations§
Trait Implementations§
Source§impl Default for MemoryPersistence
impl Default for MemoryPersistence
Source§impl RaftPersistence for MemoryPersistence
impl RaftPersistence for MemoryPersistence
Source§fn save_state(&self, term: Term, voted_for: Option<NodeId>) -> RaftResult<()>
fn save_state(&self, term: Term, voted_for: Option<NodeId>) -> RaftResult<()>
Save persistent state (current_term, voted_for)
Source§fn load_state(&self) -> RaftResult<(Term, Option<NodeId>)>
fn load_state(&self) -> RaftResult<(Term, Option<NodeId>)>
Load persistent state; returns (term, voted_for)
Source§fn append_entries(&self, entries: &[LogEntry]) -> RaftResult<()>
fn append_entries(&self, entries: &[LogEntry]) -> RaftResult<()>
Append log entries to persistent storage
Source§fn truncate_log_from(&self, index: LogIndex) -> RaftResult<()>
fn truncate_log_from(&self, index: LogIndex) -> RaftResult<()>
Truncate log from index (inclusive) onward
Source§fn last_log_index(&self) -> RaftResult<LogIndex>
fn last_log_index(&self) -> RaftResult<LogIndex>
Get the last persisted log index (0 if empty)
Source§fn save_applied_index(&self, index: LogIndex) -> RaftResult<()>
fn save_applied_index(&self, index: LogIndex) -> RaftResult<()>
Save the applied index to durable storage. Read more
Source§fn load_applied_index(&self) -> RaftResult<LogIndex>
fn load_applied_index(&self) -> RaftResult<LogIndex>
Load the previously persisted applied index (0 if not set).
Source§fn sync(&self) -> RaftResult<()>
fn sync(&self) -> RaftResult<()>
Sync all data to durable storage
Auto Trait Implementations§
impl !Freeze for MemoryPersistence
impl !RefUnwindSafe for MemoryPersistence
impl Send for MemoryPersistence
impl Sync for MemoryPersistence
impl Unpin for MemoryPersistence
impl UnsafeUnpin for MemoryPersistence
impl UnwindSafe for MemoryPersistence
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more