Struct lmdb_rs_m::core::Database [−][src]
pub struct Database<'a> { /* fields omitted */ }
Database
Methods
impl<'a> Database<'a>
[src]
impl<'a> Database<'a>
pub fn stat(&'a self) -> MdbResult<MDB_stat>
[src]
pub fn stat(&'a self) -> MdbResult<MDB_stat>
Retrieves current db's statistics.
pub fn get<V: FromMdbValue + 'a>(&'a self, key: &ToMdbValue) -> MdbResult<V>
[src]
pub fn get<V: FromMdbValue + 'a>(&'a self, key: &ToMdbValue) -> MdbResult<V>
Retrieves a value by key. In case of DbAllowDups it will be the first value
pub fn set(&self, key: &ToMdbValue, value: &ToMdbValue) -> MdbResult<()>
[src]
pub fn set(&self, key: &ToMdbValue, value: &ToMdbValue) -> MdbResult<()>
Sets value for key. In case of DbAllowDups it will add a new item
pub fn append<K: ToMdbValue, V: ToMdbValue>(
&self,
key: &K,
value: &V
) -> MdbResult<()>
[src]
pub fn append<K: ToMdbValue, V: ToMdbValue>(
&self,
key: &K,
value: &V
) -> MdbResult<()>
Appends new key-value pair to database, starting a new page instead of splitting an existing one if necessary. Requires that key be >= all existing keys in the database (or will return KeyExists error).
pub fn append_duplicate<K: ToMdbValue, V: ToMdbValue>(
&self,
key: &K,
value: &V
) -> MdbResult<()>
[src]
pub fn append_duplicate<K: ToMdbValue, V: ToMdbValue>(
&self,
key: &K,
value: &V
) -> MdbResult<()>
Appends new value for the given key (requires DbAllowDups), starting a new page instead of splitting an existing one if necessary. Requires that value be >= all existing values for the given key (or will return KeyExists error).
pub fn insert(&self, key: &ToMdbValue, value: &ToMdbValue) -> MdbResult<()>
[src]
pub fn insert(&self, key: &ToMdbValue, value: &ToMdbValue) -> MdbResult<()>
Set value for key. Fails if key already exists, even when duplicates are allowed.
pub fn del(&self, key: &ToMdbValue) -> MdbResult<()>
[src]
pub fn del(&self, key: &ToMdbValue) -> MdbResult<()>
Deletes value for key.
pub fn del_item(&self, key: &ToMdbValue, data: &ToMdbValue) -> MdbResult<()>
[src]
pub fn del_item(&self, key: &ToMdbValue, data: &ToMdbValue) -> MdbResult<()>
Should be used only with DbAllowDups. Deletes corresponding (key, value)
pub fn new_cursor(&'a self) -> MdbResult<Cursor<'a>>
[src]
pub fn new_cursor(&'a self) -> MdbResult<Cursor<'a>>
Returns a new cursor
pub fn del_db(self) -> MdbResult<()>
[src]
pub fn del_db(self) -> MdbResult<()>
Deletes current db, also moves it out
pub fn clear(&self) -> MdbResult<()>
[src]
pub fn clear(&self) -> MdbResult<()>
Removes all key/values from db
pub fn iter(&'a self) -> MdbResult<CursorIterator<'a, CursorIter>>
[src]
pub fn iter(&'a self) -> MdbResult<CursorIterator<'a, CursorIter>>
Returns an iterator for all values in database
pub fn keyrange_from<'c, K: ToMdbValue + 'c>(
&'c self,
start_key: &'c K
) -> MdbResult<CursorIterator<'c, CursorFromKeyIter>>
[src]
pub fn keyrange_from<'c, K: ToMdbValue + 'c>(
&'c self,
start_key: &'c K
) -> MdbResult<CursorIterator<'c, CursorFromKeyIter>>
Returns an iterator through keys starting with start_key (>=), start_key is included
pub fn keyrange_to<'c, K: ToMdbValue + 'c>(
&'c self,
end_key: &'c K
) -> MdbResult<CursorIterator<'c, CursorToKeyIter>>
[src]
pub fn keyrange_to<'c, K: ToMdbValue + 'c>(
&'c self,
end_key: &'c K
) -> MdbResult<CursorIterator<'c, CursorToKeyIter>>
Returns an iterator through keys less than end_key, end_key is not included
pub fn keyrange_from_to<'c, K: ToMdbValue + 'c>(
&'c self,
start_key: &'c K,
end_key: &'c K
) -> MdbResult<CursorIterator<'c, CursorKeyRangeIter>>
[src]
pub fn keyrange_from_to<'c, K: ToMdbValue + 'c>(
&'c self,
start_key: &'c K,
end_key: &'c K
) -> MdbResult<CursorIterator<'c, CursorKeyRangeIter>>
Returns an iterator through keys start_key <= x < end_key
. This is, start_key is
included in the iteration, while end_key is kept excluded.
pub fn keyrange<'c, K: ToMdbValue + 'c>(
&'c self,
start_key: &'c K,
end_key: &'c K
) -> MdbResult<CursorIterator<'c, CursorKeyRangeIter>>
[src]
pub fn keyrange<'c, K: ToMdbValue + 'c>(
&'c self,
start_key: &'c K,
end_key: &'c K
) -> MdbResult<CursorIterator<'c, CursorKeyRangeIter>>
Returns an iterator for values between start_key and end_key (included). Currently it works only for unique keys (i.e. it will skip multiple items when DB created with ffi::MDB_DUPSORT). Iterator is valid while cursor is valid
pub fn item_iter<'c, 'db: 'c, K: ToMdbValue>(
&'db self,
key: &'c K
) -> MdbResult<CursorIterator<'c, CursorItemIter<'c>>>
[src]
pub fn item_iter<'c, 'db: 'c, K: ToMdbValue>(
&'db self,
key: &'c K
) -> MdbResult<CursorIterator<'c, CursorItemIter<'c>>>
Returns an iterator for all items (i.e. values with same key)
pub fn set_compare(
&self,
cmp_fn: extern "C" fn(_: *const MDB_val, _: *const MDB_val) -> c_int
) -> MdbResult<()>
[src]
pub fn set_compare(
&self,
cmp_fn: extern "C" fn(_: *const MDB_val, _: *const MDB_val) -> c_int
) -> MdbResult<()>
Sets the key compare function for this database.
Warning: This function must be called before any data access functions are used, otherwise data corruption may occur. The same comparison function must be used by every program accessing the database, every time the database is used.
If not called, keys are compared lexically, with shorter keys collating before longer keys.
Setting lasts for the lifetime of the underlying db handle.
pub fn set_dupsort(
&self,
cmp_fn: extern "C" fn(_: *const MDB_val, _: *const MDB_val) -> c_int
) -> MdbResult<()>
[src]
pub fn set_dupsort(
&self,
cmp_fn: extern "C" fn(_: *const MDB_val, _: *const MDB_val) -> c_int
) -> MdbResult<()>
Sets the value comparison function for values of the same key in this database.
Warning: This function must be called before any data access functions are used, otherwise data corruption may occur. The same dupsort function must be used by every program accessing the database, every time the database is used.
If not called, values are compared lexically, with shorter values collating before longer values.
Only used when DbAllowDups is true. Setting lasts for the lifetime of the underlying db handle.