kernel::hil::log

Trait LogWrite

Source
pub trait LogWrite<'a> {
    // Required methods
    fn set_append_client(&'a self, append_client: &'a dyn LogWriteClient);
    fn append(
        &self,
        buffer: &'static mut [u8],
        length: usize,
    ) -> Result<(), (ErrorCode, &'static mut [u8])>;
    fn sync(&self) -> Result<(), ErrorCode>;
    fn erase(&self) -> Result<(), ErrorCode>;
}
Expand description

An interface for writing to log storage.

Required Methods§

Source

fn set_append_client(&'a self, append_client: &'a dyn LogWriteClient)

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

Source

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

Append an entry to the end of the log. May fail if the entry is too large.

Source

fn sync(&self) -> Result<(), ErrorCode>

Sync log to storage, making all entries persistent (not including any entries that were previously overwritten). There is no guarantee that any changes to the log are persistent until it is synced. In the event of an error, not all pages may be synced, but the log will remain in a valid state.

Source

fn erase(&self) -> Result<(), ErrorCode>

Erase the entire log. In the event of a failure, only some pages may be erased, but the log will remain in a valid state.

Implementors§