Skip to main content

Store

Trait Store 

Source
pub trait Store {
    // Required methods
    fn len(&self) -> Result<u64, DbError>;
    fn read_exact_at(
        &mut self,
        offset: u64,
        buf: &mut [u8],
    ) -> Result<(), DbError>;
    fn write_all_at(&mut self, offset: u64, buf: &[u8]) -> Result<(), DbError>;
    fn sync(&mut self) -> Result<(), DbError>;
    fn truncate(&mut self, len: u64) -> Result<(), DbError>;

    // Provided method
    fn is_empty(&self) -> Result<bool, DbError> { ... }
}
Expand description

Random-access byte image of a ModelVault database (length, read, write, sync).

Implemented by FileStore (real files) and VecStore (in-memory snapshots). A future read-only store split is deferred until a second consumer needs a smaller surface.

Required Methods§

Source

fn len(&self) -> Result<u64, DbError>

Source

fn read_exact_at(&mut self, offset: u64, buf: &mut [u8]) -> Result<(), DbError>

Source

fn write_all_at(&mut self, offset: u64, buf: &[u8]) -> Result<(), DbError>

Source

fn sync(&mut self) -> Result<(), DbError>

Source

fn truncate(&mut self, len: u64) -> Result<(), DbError>

Shrink or grow the logical file to len bytes (used for crash recovery truncation).

Provided Methods§

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§