Trait tlfs_crdt::Storage[][src]

pub trait Storage: Send + Sync + 'static {
    fn append(&self, file: &str, chunk: &[u8]) -> Result<()>;
fn load(&self, file: &str, f: Box<dyn FnMut(&[u8])>) -> Result<()>;
fn mv(&self, from: &str, to: &str) -> Result<()>; }
Expand description

Trait for radixdb storage

basically supports append and rename

Required methods

appends to a file. Should only return when the data is safely on disk (flushed)! appending will usually be done in large chunks. appending to a non existing file creates it. appending an empty chunk is a noop.

load a file. The callback will get to look at the data and do something with it. loading a non-existing file is like loading an empty file. It will not create the file.

atomically move a file. target will be atomically overwritten. if the source file does not exist, the target file will be deleted.

Implementors