Trait rustdb::stg::Storage[][src]

pub trait Storage: Send + Sync {
    fn size(&self) -> u64;
fn read(&self, start: u64, data: &mut [u8]);
fn write(&self, start: u64, data: &[u8]);
fn commit(&self, size: u64); fn write_vec(&self, start: u64, data: Vec<u8>) { ... }
fn write_data(&self, start: u64, data: Data, off: usize, len: usize) { ... }
fn write_u64(&self, start: u64, value: u64) { ... }
fn read_u64(&self, start: u64) -> u64 { ... } }
Expand description

Interface for database storage.

Required methods

Get the size of the underlying storage. Note : this is valid initially and after a commit but is not defined after write is called.

Read data from storage.

Write byte slice to storage.

Finish write transaction, size is new size of underlying storage. If prepare is set true, the updates are saved but not applied (for atomic storage).

Provided methods

Write byte Vec to storage.

Write Data slice to storage.

Write u64 to storage.

Read u64 from storage.

Implementors