Trait leveldb::database::kv::KV [-] [+] [src]

pub trait KV<K: Key> {
    fn get<'a>(&self, options: ReadOptions<'a, K>, key: K) -> Result<Option<Vec<u8>>, Error>;
    fn put(&self, options: WriteOptions, key: K, value: &[u8]) -> Result<(), Error>;
    fn delete(&self, options: WriteOptions, key: K) -> Result<(), Error>;
}

Key-Value-Access to the leveldb database, providing a basic interface.

Required Methods

fn get<'a>(&self, options: ReadOptions<'a, K>, key: K) -> Result<Option<Vec<u8>>, Error>

get a value from the database.

The passed key will be compared using the comparator.

fn put(&self, options: WriteOptions, key: K, value: &[u8]) -> Result<(), Error>

put a binary value into the database.

If the key is already present in the database, it will be overwritten.

The passed key will be compared using the comparator.

The database will be synced to disc if options.sync == true. This is NOT the default.

fn delete(&self, options: WriteOptions, key: K) -> Result<(), Error>

delete a value from the database.

The passed key will be compared using the comparator.

The database will be synced to disc if options.sync == true. This is NOT the default.

Implementors