Trait openraft::storage::RaftLogReader
source · pub trait RaftLogReader<C>: OptionalSend + OptionalSync + 'static + Sendwhere
C: RaftTypeConfig,{
// Required method
fn try_get_log_entries<RB: RangeBounds<u64> + Clone + Debug + OptionalSend>(
&mut self,
range: RB,
) -> impl Future<Output = Result<Vec<C::Entry>, StorageError<C::NodeId>>> + Send;
// Provided method
fn limited_get_log_entries(
&mut self,
start: u64,
end: u64,
) -> impl Future<Output = Result<Vec<C::Entry>, StorageError<C::NodeId>>> + Send { ... }
}
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 try_get_log_entries<RB: RangeBounds<u64> + Clone + Debug + OptionalSend>(
&mut self,
range: RB,
) -> impl Future<Output = Result<Vec<C::Entry>, StorageError<C::NodeId>>> + Send
fn try_get_log_entries<RB: RangeBounds<u64> + Clone + Debug + OptionalSend>( &mut self, range: RB, ) -> impl Future<Output = Result<Vec<C::Entry>, StorageError<C::NodeId>>> + Send
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.
Provided Methods§
sourcefn limited_get_log_entries(
&mut self,
start: u64,
end: u64,
) -> impl Future<Output = Result<Vec<C::Entry>, StorageError<C::NodeId>>> + Send
fn limited_get_log_entries( &mut self, start: u64, end: u64, ) -> impl Future<Output = Result<Vec<C::Entry>, StorageError<C::NodeId>>> + Send
Returns log entries within range [start, end)
, end
is exclusive,
potentially limited by implementation-defined constraints.
If the specified range is too large, the implementation may return only the first few log entries to ensure the result is not excessively large.
It must not return empty result if the input range is not empty.
The default implementation just returns the full range of log entries.