Trait LogReader

Source
pub trait LogReader:
    Send
    + Sized
    + 'static {
    // Required methods
    fn init(&mut self) -> impl Future<Output = LogStoreResult<()>> + Send + '_;
    fn start_from(
        &mut self,
        start_offset: Option<u64>,
    ) -> impl Future<Output = LogStoreResult<()>> + Send + '_;
    fn next_item(
        &mut self,
    ) -> impl Future<Output = LogStoreResult<(u64, LogStoreReadItem)>> + Send + '_;
    fn truncate(&mut self, offset: TruncateOffset) -> LogStoreResult<()>;
    fn rewind(&mut self) -> impl Future<Output = LogStoreResult<()>> + Send + '_;
}

Required Methods§

Source

fn init(&mut self) -> impl Future<Output = LogStoreResult<()>> + Send + '_

Initialize the log reader. Usually function as waiting for log writer to be initialized.

Source

fn start_from( &mut self, start_offset: Option<u64>, ) -> impl Future<Output = LogStoreResult<()>> + Send + '_

Consume log store from given start_offset or aligned start offset recorded previously.

Source

fn next_item( &mut self, ) -> impl Future<Output = LogStoreResult<(u64, LogStoreReadItem)>> + Send + '_

Emit the next item.

The implementation should ensure that the future is cancellation safe.

Source

fn truncate(&mut self, offset: TruncateOffset) -> LogStoreResult<()>

Mark that all items emitted so far have been consumed and it is safe to truncate the log from the current offset.

Source

fn rewind(&mut self) -> impl Future<Output = LogStoreResult<()>> + Send + '_

Reset the log reader to after the latest truncate offset

The return flag means whether the log store support rewind

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.

Implementors§