Skip to main content

StorageBackend

Trait StorageBackend 

Source
pub trait StorageBackend:
    Send
    + Sync
    + 'static {
    // Required methods
    fn get<P: AsRef<Path>>(&self, path: P) -> Result<Option<Vec<u8>>>;
    fn put<P: AsRef<Path>>(&self, path: P, value: &[u8]) -> Result<()>;
    fn delete<P: AsRef<Path>>(&self, path: P) -> Result<()>;
    fn batch_update<K, V, I>(&self, iter: I) -> Result<()>
       where K: AsRef<Path>,
             V: AsRef<[u8]>,
             I: IntoIterator<Item = (K, Option<V>)>;
}

Required Methods§

Source

fn get<P: AsRef<Path>>(&self, path: P) -> Result<Option<Vec<u8>>>

Retrieve the value at path.

Source

fn put<P: AsRef<Path>>(&self, path: P, value: &[u8]) -> Result<()>

Store a value at path.

Source

fn delete<P: AsRef<Path>>(&self, path: P) -> Result<()>

Delete the value at path, if it exists.

Source

fn batch_update<K, V, I>(&self, iter: I) -> Result<()>
where K: AsRef<Path>, V: AsRef<[u8]>, I: IntoIterator<Item = (K, Option<V>)>,

Execute in an atomic combination of put and delete operations.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§