pub trait PersistentCacheIo: Send + Sync {
// Required methods
fn write_atomic(&self, key: u64, frame: &[u8]) -> Result<(), IoError>;
fn remove(&self, key: u64) -> Result<(), IoError>;
fn clear(&self) -> Result<(), IoError>;
fn load(&self, key: u64) -> Result<Option<Vec<u8>>, IoError>;
fn exists(&self, key: u64) -> bool;
}Expand description
I/O abstraction the worker thread uses to publish and reload persistent
cache frames. Production code uses RealPersistentCacheIo; tests inject
recording/blocking/failing variants.
Required Methods§
Sourcefn write_atomic(&self, key: u64, frame: &[u8]) -> Result<(), IoError>
fn write_atomic(&self, key: u64, frame: &[u8]) -> Result<(), IoError>
Atomically write frame for key (write to temp + fsync + rename +
dir-sync). Errors are reported as IoError.
Sourcefn remove(&self, key: u64) -> Result<(), IoError>
fn remove(&self, key: u64) -> Result<(), IoError>
Remove the persistent frame for key, if any. Missing files are OK.
Sourcefn clear(&self) -> Result<(), IoError>
fn clear(&self) -> Result<(), IoError>
Delete every persistent frame in this cache. Used by clear.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".