pub trait Contiguous: Send + Sync {
type Item;
// Required methods
fn bounds(&self) -> Range<u64>;
fn replay(
&self,
start_pos: u64,
buffer: NonZeroUsize,
) -> impl Future<Output = Result<impl Stream<Item = Result<(u64, Self::Item), Error>> + Send + '_, Error>> + Send;
fn read(
&self,
position: u64,
) -> impl Future<Output = Result<Self::Item, Error>> + Send;
// Provided method
fn size(&self) -> u64 { ... }
}Expand description
Core trait for contiguous journals supporting sequential append operations.
A contiguous journal maintains a consecutively increasing position counter where each appended item receives a unique position starting from 0.
Required Associated Types§
Required Methods§
Sourcefn bounds(&self) -> Range<u64>
fn bounds(&self) -> Range<u64>
Returns [start, end) where start and end - 1 are the indices of the oldest and newest
retained operations respectively.
Sourcefn replay(
&self,
start_pos: u64,
buffer: NonZeroUsize,
) -> impl Future<Output = Result<impl Stream<Item = Result<(u64, Self::Item), Error>> + Send + '_, Error>> + Send
fn replay( &self, start_pos: u64, buffer: NonZeroUsize, ) -> impl Future<Output = Result<impl Stream<Item = Result<(u64, Self::Item), Error>> + Send + '_, Error>> + Send
Return a stream of all items in the journal starting from start_pos.
Each item is yielded as a tuple (position, item) where position is the item’s
stable position in the journal.
§Errors
Returns an error if start_pos exceeds the journal size or if any storage/decoding
errors occur during replay.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.