pub trait LogRead<'a> {
    type EntryID;

    fn set_read_client(&'a self, read_client: &'a dyn LogReadClient);
    fn read(
        buffer: &'static mut [u8],
        length: usize
    ) -> Result<(), (ErrorCode, &'static mut [u8])>; fn log_start(&self) -> Self::EntryID; fn log_end(&self) -> Self::EntryID; fn next_read_entry_id(&self) -> Self::EntryID; fn seek(&self, entry: Self::EntryID) -> Result<(), ErrorCode>; fn get_size(&self) -> usize; }
Expand description

An interface for reading from log storage.

Required Associated Types

Unique identifier for log entries.

Required Methods

Set the client for reading from a log. The client will be called when reading operations complete.

Read the next entry from the log. The log advances to the next entry after a successful read. State does not change in the event of a failure.

Returns the entry ID at the start of the log. This is the ID of the oldest remaining entry.

Returns the entry ID at the end of the log. This is the ID of the next entry to be appended.

fn next_read_entry_id(&self) -> Self::EntryID

Returns the ID of the next entry to be read.

Seek to the entry with the given entry ID and begin reading from there. Fails without modifying the read position if the given entry ID is invalid or no longer in the log.

Get approximate log capacity in bytes.