pub trait LogBackend {
// Required methods
fn append(&mut self, bytes: &[u8]) -> Result<(), LogError>;
fn sync(&mut self) -> Result<(), LogError>;
fn truncate(&mut self, new_len: u64) -> Result<(), LogError>;
fn read_all(&mut self) -> Result<Vec<u8>, LogError>;
fn len(&self) -> u64;
fn last_checkpoint_end(&mut self) -> Result<u64, LogError>;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
The filesystem primitives a Store needs from its underlying log.
The production implementation is CanonicalLog; tests and crash-
injection harnesses implement this trait to arm failures on
specific operations (see store::tests::FaultyLog).
Required Methods§
Sourcefn truncate(&mut self, new_len: u64) -> Result<(), LogError>
fn truncate(&mut self, new_len: u64) -> Result<(), LogError>
Truncate the log to new_len bytes (and fsync the truncation).
§Errors
LogError::TruncateBeyondEndifnew_len > self.len().LogError::Ioon other failures.