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§
Sourcefn set_append_client(&'a self, append_client: &'a dyn LogWriteClient)
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.
Sourcefn append(
&self,
buffer: &'static mut [u8],
length: usize,
) -> Result<(), (ErrorCode, &'static mut [u8])>
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.
Sourcefn sync(&self) -> Result<(), ErrorCode>
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.