[][src]Trait kernel::hil::log::LogRead

pub trait LogRead<'a> {
    type EntryID;
    fn set_read_client(&'a self, read_client: &'a dyn LogReadClient);
fn read(
        &self,
        buffer: &'static mut [u8],
        length: usize
    ) -> Result<(), (ReturnCode, Option<&'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) -> ReturnCode;
fn get_size(&self) -> usize; }

An interface for reading from log storage.

Associated Types

type EntryID

Unique identifier for log entries.

Loading content...

Required methods

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.

fn read(
    &self,
    buffer: &'static mut [u8],
    length: usize
) -> Result<(), (ReturnCode, Option<&'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.

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.

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.

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

Returns the ID of the next entry to be read.

fn seek(&self, entry: Self::EntryID) -> ReturnCode

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.

fn get_size(&self) -> usize

Get approximate log capacity in bytes.

Loading content...

Implementors

Loading content...