Skip to main content

KVStore

Trait KVStore 

Source
pub trait KVStore<E> {
    // Required methods
    fn create_bucket(&mut self, key: &[u8]) -> Result<(), E>;
    fn delete_record(&mut self, key: &[u8]) -> Result<(), E>;
    fn list_records(&self, from: &[u8], to: &[u8]) -> Result<Vec<Vec<u8>>, E>;
    fn store_record(&mut self, key: &[u8], value: &[u8]) -> Result<(), E>;
    fn fetch_record(&self, key: &[u8]) -> Result<Vec<u8>, E>;
    fn exists(&self, key: &[u8]) -> Result<bool, E>;
}
Expand description

A Key-Value Store Backend Interface.

Any Type that implements this interface can be used to run a graph database.

Required Methods§

Source

fn create_bucket(&mut self, key: &[u8]) -> Result<(), E>

creates a new bucket

Source

fn delete_record(&mut self, key: &[u8]) -> Result<(), E>

delete a data record (could also be a bucket)

Source

fn list_records(&self, from: &[u8], to: &[u8]) -> Result<Vec<Vec<u8>>, E>

list all records in between from and to

if to is empty it searches everything till the first change of from

Source

fn store_record(&mut self, key: &[u8], value: &[u8]) -> Result<(), E>

store a data record

Source

fn fetch_record(&self, key: &[u8]) -> Result<Vec<u8>, E>

fetch a data record

Source

fn exists(&self, key: &[u8]) -> Result<bool, E>

check if an entry exists in the database

Implementors§