Trait kernel::hil::log::LogRead

source ·
pub trait LogRead<'a> {
    type EntryID;

    // Required methods
    fn set_read_client(&'a self, read_client: &'a dyn LogReadClient);
    fn read(
        &self,
        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§

source

type EntryID

Unique identifier for log entries.

Required Methods§

source

fn set_read_client(&'a self, read_client: &'a dyn LogReadClient)

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

source

fn read( &self, buffer: &'static mut [u8], length: usize ) -> Result<(), (ErrorCode, &'static mut [u8])>

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.

source

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

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

source

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

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

source

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

Returns the ID of the next entry to be read.

source

fn seek(&self, entry: Self::EntryID) -> Result<(), ErrorCode>

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.

source

fn get_size(&self) -> usize

Get approximate log capacity in bytes.

Implementors§