Struct nihdb::Store
[−]
[src]
pub struct Store { /* fields omitted */ }
Methods
impl Store
[src]
fn create(dir: &str) -> Result<(), Error>
[src]
Creates a new store in a new directory.
fn open(dir: &str, threshold: usize) -> Result<Store, Error>
[src]
Opens the store.
threshold
is an upper bound on the size of unflushed data.
fn insert(&mut self, key: &[u8], val: &[u8]) -> Result<bool, Error>
[src]
Inserts a key/value pair into the store if the key is not already present. Returns true if an insertion happened.
fn replace(&mut self, key: &[u8], val: &[u8]) -> Result<bool, Error>
[src]
Replaces an existing key/value pair in the store. If the key is not present, does nothing and returns false.
fn put(&mut self, key: &[u8], val: &[u8]) -> Result<(), Error>
[src]
Puts a key/value pair into the store, replacing the value if the key is
already present. Compare to insert
or replace
.
fn remove(&mut self, key: &[u8]) -> Result<bool, Error>
[src]
Removes a key/value pair from the store. Returns true if the key was present.
fn sync(&mut self) -> Result<(), Error>
[src]
Ensures that all preceding write operations have been written to disk (if you trust your kernel and your disk).
fn flush(&mut self) -> Result<(), Error>
[src]
Flushes any buffered write operations to disk.
fn exists(&mut self, key: &[u8]) -> Result<bool, Error>
[src]
Returns true if a key/value pair is present, for the given key.
fn get(&mut self, key: &[u8]) -> Result<Option<Vec<u8>>, Error>
[src]
Gets the value for the specified key/value pair, or None
if the key
does not exist.
fn range_directed<'a>(
&'a self,
interval: &Interval<Vec<u8>>,
direction: Direction
) -> Result<StoreIter<'a>, Error>
[src]
&'a self,
interval: &Interval<Vec<u8>>,
direction: Direction
) -> Result<StoreIter<'a>, Error>
Produces a store iterator for iterating the store over the given interval, in the given direction.
fn range<'a>(
&'a self,
interval: &Interval<Vec<u8>>
) -> Result<StoreIter<'a>, Error>
[src]
&'a self,
interval: &Interval<Vec<u8>>
) -> Result<StoreIter<'a>, Error>
Creates a StoreIter for iterating forwards through the interval.
fn range_descending<'a>(
&'a self,
interval: &Interval<Vec<u8>>
) -> Result<StoreIter<'a>, Error>
[src]
&'a self,
interval: &Interval<Vec<u8>>
) -> Result<StoreIter<'a>, Error>
Creates a StoreIter for iterating backwards through the interval.
fn next(
&self,
iter: &mut StoreIter
) -> Result<Option<(Vec<u8>, Vec<u8>)>, Error>
[src]
&self,
iter: &mut StoreIter
) -> Result<Option<(Vec<u8>, Vec<u8>)>, Error>
Produces the next key/value pair from the StoreIter. Returns None to mark the end of iteration.