pub struct MemLogStore<C: RaftTypeConfig<NodeId = NodeId>> { /* private fields */ }Expand description
In-memory Raft log store (v2 API).
Implements RaftLogReader and RaftLogStorage.
Implementations§
Source§impl<C: RaftTypeConfig<NodeId = NodeId>> MemLogStore<C>
impl<C: RaftTypeConfig<NodeId = NodeId>> MemLogStore<C>
Trait Implementations§
Source§impl<C: RaftTypeConfig<NodeId = NodeId>> Clone for MemLogStore<C>
impl<C: RaftTypeConfig<NodeId = NodeId>> Clone for MemLogStore<C>
Source§impl<C: RaftTypeConfig<NodeId = NodeId>> Default for MemLogStore<C>
impl<C: RaftTypeConfig<NodeId = NodeId>> Default for MemLogStore<C>
Source§impl<C> RaftLogReader<C> for MemLogStore<C>
impl<C> RaftLogReader<C> for MemLogStore<C>
Source§async fn try_get_log_entries<RB: RangeBounds<u64> + Clone + Debug + OptionalSend>(
&mut self,
range: RB,
) -> Result<Vec<C::Entry>, StorageError<NodeId>>
async fn try_get_log_entries<RB: RangeBounds<u64> + Clone + Debug + OptionalSend>( &mut self, range: RB, ) -> Result<Vec<C::Entry>, StorageError<NodeId>>
Get a series of log entries from storage. Read more
Source§fn limited_get_log_entries(
&mut self,
start: u64,
end: u64,
) -> impl Future<Output = Result<Vec<<C as RaftTypeConfig>::Entry>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
fn limited_get_log_entries( &mut self, start: u64, end: u64, ) -> impl Future<Output = Result<Vec<<C as RaftTypeConfig>::Entry>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
Returns log entries within range
[start, end), end is exclusive,
potentially limited by implementation-defined constraints. Read moreSource§impl<C> RaftLogStorage<C> for MemLogStore<C>
impl<C> RaftLogStorage<C> for MemLogStore<C>
Source§type LogReader = MemLogReader<C>
type LogReader = MemLogReader<C>
Log reader type. Read more
Source§async fn get_log_state(&mut self) -> Result<LogState<C>, StorageError<NodeId>>
async fn get_log_state(&mut self) -> Result<LogState<C>, StorageError<NodeId>>
Returns the last deleted log id and the last log id. Read more
Source§async fn get_log_reader(&mut self) -> Self::LogReader
async fn get_log_reader(&mut self) -> Self::LogReader
Get the log reader. Read more
Source§async fn save_vote(
&mut self,
vote: &Vote<NodeId>,
) -> Result<(), StorageError<NodeId>>
async fn save_vote( &mut self, vote: &Vote<NodeId>, ) -> Result<(), StorageError<NodeId>>
Save vote to storage. Read more
Source§async fn read_vote(
&mut self,
) -> Result<Option<Vote<NodeId>>, StorageError<NodeId>>
async fn read_vote( &mut self, ) -> Result<Option<Vote<NodeId>>, StorageError<NodeId>>
Return the last saved vote by
Self::save_vote.Source§async fn save_committed(
&mut self,
committed: Option<LogId<NodeId>>,
) -> Result<(), StorageError<NodeId>>
async fn save_committed( &mut self, committed: Option<LogId<NodeId>>, ) -> Result<(), StorageError<NodeId>>
Saves the last committed log id to storage. Read more
Source§async fn read_committed(
&mut self,
) -> Result<Option<LogId<NodeId>>, StorageError<NodeId>>
async fn read_committed( &mut self, ) -> Result<Option<LogId<NodeId>>, StorageError<NodeId>>
Return the last saved committed log id by
Self::save_committed.Source§async fn append<I>(
&mut self,
entries: I,
callback: LogFlushed<C>,
) -> Result<(), StorageError<NodeId>>
async fn append<I>( &mut self, entries: I, callback: LogFlushed<C>, ) -> Result<(), StorageError<NodeId>>
Append log entries and call the
callback once logs are persisted on disk. Read moreAuto Trait Implementations§
impl<C> Freeze for MemLogStore<C>
impl<C> !RefUnwindSafe for MemLogStore<C>
impl<C> Send for MemLogStore<C>
impl<C> Sync for MemLogStore<C>
impl<C> Unpin for MemLogStore<C>
impl<C> UnsafeUnpin for MemLogStore<C>
impl<C> !UnwindSafe for MemLogStore<C>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<C, LR> RaftLogReaderExt<C> for LRwhere
C: RaftTypeConfig,
LR: RaftLogReader<C>,
impl<C, LR> RaftLogReaderExt<C> for LRwhere
C: RaftTypeConfig,
LR: RaftLogReader<C>,
Source§fn try_get_log_entry(
&mut self,
log_index: u64,
) -> impl Future<Output = Result<Option<<C as RaftTypeConfig>::Entry>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
fn try_get_log_entry( &mut self, log_index: u64, ) -> impl Future<Output = Result<Option<<C as RaftTypeConfig>::Entry>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
Try to get an log entry. Read more
Source§fn get_log_entries<RB>(
&mut self,
range: RB,
) -> impl Future<Output = Result<Vec<<C as RaftTypeConfig>::Entry>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
fn get_log_entries<RB>( &mut self, range: RB, ) -> impl Future<Output = Result<Vec<<C as RaftTypeConfig>::Entry>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
Get a series of log entries from storage. Read more
Source§fn get_log_id(
&mut self,
log_index: u64,
) -> impl Future<Output = Result<LogId<<C as RaftTypeConfig>::NodeId>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
fn get_log_id( &mut self, log_index: u64, ) -> impl Future<Output = Result<LogId<<C as RaftTypeConfig>::NodeId>, StorageError<<C as RaftTypeConfig>::NodeId>>> + Send
Get the log id of the entry at
index.Source§impl<C, T> RaftLogStorageExt<C> for Twhere
T: RaftLogStorage<C>,
C: RaftTypeConfig,
impl<C, T> RaftLogStorageExt<C> for Twhere
T: RaftLogStorage<C>,
C: RaftTypeConfig,
Source§fn blocking_append<I>(
&mut self,
entries: I,
) -> impl Future<Output = Result<(), StorageError<<C as RaftTypeConfig>::NodeId>>> + Sendwhere
I: IntoIterator<Item = <C as RaftTypeConfig>::Entry> + OptionalSend,
<I as IntoIterator>::IntoIter: OptionalSend,
fn blocking_append<I>(
&mut self,
entries: I,
) -> impl Future<Output = Result<(), StorageError<<C as RaftTypeConfig>::NodeId>>> + Sendwhere
I: IntoIterator<Item = <C as RaftTypeConfig>::Entry> + OptionalSend,
<I as IntoIterator>::IntoIter: OptionalSend,
Blocking mode append log entries to the storage. Read more