Struct sherwood::KvHandle [-] [+] [src]

pub struct KvHandle<T> {
    // some fields omitted
}

ForestDB key value store

Methods

impl<Access> KvHandle<Access>

fn get_value<K>(&self, key: &K) -> FdbResult<Vec<u8>> where K: AsRef<[u8]>

Sets a value for key (plain KV mode)

fn key_iter<T, U>(&self, range: T, skip_deleted: bool) -> FdbResult<Iterator<U>> where T: KeyRange

Creates a new iterator through key range

fn seq_iter<T, U>(&self, range: T, skip_deleted: bool) -> FdbResult<Iterator<U>> where T: SeqRange

Creates a new iterator through range of seq numbers

fn get_doc<'l>(&self, loc: Location<'l>) -> FdbResult<Doc>

Retrieves whole document specified by location

fn get_meta<'l>(&self, loc: Location<'l>) -> FdbResult<Meta>

Retrieves only meta data from document Note: it doesn't support retrieval through offset and will panic if corresponding location is used

fn seq_num(&self) -> FdbResult<u64>

Returns max seq number of current store

fn snapshot(&self, seq_num: u64) -> FdbResult<KvHandle<ReadOnly>>

Creates a snapshot on specified seq_num

impl KvHandle<ReadWrite>

fn set_value<K, V>(&self, key: &K, value: &V) -> FdbResult<()> where K: AsRef<[u8]>, V: AsRef<[u8]>

Retrieves a value by key (plain KV mode)

fn del_value<K>(&self, key: &K) -> FdbResult<()> where K: AsRef<[u8]>

Deletes a value by key (plain KV mode)

fn set_doc(&self, doc: &Doc) -> FdbResult<()>

Sets the document

fn del_doc(&self, doc: &Doc) -> FdbResult<()>

Deletes the document

It's equivalent to

doc.deleted = 1;
store.set(doc)

fn del_meta(&self, meta: &Meta) -> FdbResult<()>

Deletes the document specified by available meta

fn rollback(&self, seq_num: u64) -> FdbResult<()>

Rollbacks kv handle to specified seq num

fn clear(&self) -> FdbResult<()>

Clears KV store, i.e. deletes all docs

Trait Implementations

impl<T> Clone for KvHandle<T>

fn clone(&self) -> KvHandle<T>

fn clone_from(&mut self, source: &Self)