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§
Required Methods§
Sourcefn set_read_client(&'a self, read_client: &'a dyn LogReadClient)
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.
Sourcefn read(
&self,
buffer: &'static mut [u8],
length: usize,
) -> Result<(), (ErrorCode, &'static mut [u8])>
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.
Sourcefn log_start(&self) -> Self::EntryID
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.
Sourcefn log_end(&self) -> Self::EntryID
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.
Sourcefn next_read_entry_id(&self) -> Self::EntryID
fn next_read_entry_id(&self) -> Self::EntryID
Returns the ID of the next entry to be read.