Trait openraft::storage::RaftLogReader
source · pub trait RaftLogReader<C>: Send + Sync + 'staticwhere
C: RaftTypeConfig,{
// Required methods
fn get_log_state<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<LogState<C>, StorageError<C::NodeId>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn try_get_log_entries<'life0, 'async_trait, RB>(
&'life0 mut self,
range: RB
) -> Pin<Box<dyn Future<Output = Result<Vec<Entry<C>>, StorageError<C::NodeId>>> + Send + 'async_trait>>
where RB: 'async_trait + RangeBounds<u64> + Clone + Debug + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
A trait defining the interface for a Raft log subsystem.
This interface is accessed read-only from replica streams.
Typically, the log reader implementation as such will be hidden behind an Arc<T>
and
this interface implemented on the Arc<T>
. It can be co-implemented with RaftStorage
interface on the same cloneable object, if the underlying state machine is anyway synchronized.
Required Methods§
sourcefn get_log_state<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<LogState<C>, StorageError<C::NodeId>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_log_state<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<LogState<C>, StorageError<C::NodeId>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Returns the last deleted log id and the last log id.
The impl should not consider the applied log id in state machine.
The returned last_log_id
could be the log id of the last present log entry, or the
last_purged_log_id
if there is no entry at all.
sourcefn try_get_log_entries<'life0, 'async_trait, RB>(
&'life0 mut self,
range: RB
) -> Pin<Box<dyn Future<Output = Result<Vec<Entry<C>>, StorageError<C::NodeId>>> + Send + 'async_trait>>where
RB: 'async_trait + RangeBounds<u64> + Clone + Debug + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
fn try_get_log_entries<'life0, 'async_trait, RB>( &'life0 mut self, range: RB ) -> Pin<Box<dyn Future<Output = Result<Vec<Entry<C>>, StorageError<C::NodeId>>> + Send + 'async_trait>>where RB: 'async_trait + RangeBounds<u64> + Clone + Debug + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,
Get a series of log entries from storage.
The start value is inclusive in the search and the stop value is non-inclusive: [start, stop)
.
Entry that is not found is allowed.