Struct sanakirja::MutTxn
[−]
[src]
pub struct MutTxn<'env, T> { /* fields omitted */ }
A mutable transaction.
Methods
impl<'env, T> MutTxn<'env, T>
[src]
fn mut_txn_begin<'txn>(&'txn mut self)
-> Result<MutTxn<'env, &'txn mut MutTxn<'env, T>>, Error>
-> Result<MutTxn<'env, &'txn mut MutTxn<'env, T>>, Error>
Start a mutable transaction.
fn alloc_page(&mut self) -> Result<MutPage, Error>
Allocate a single page.
impl<'env, T> MutTxn<'env, T>
[src]
fn put<R: Rng, K: Representable, V: Representable>(&mut self,
rng: &mut R,
db: &mut Db<K, V>,
key: K,
value: V)
-> Result<bool, Error>
rng: &mut R,
db: &mut Db<K, V>,
key: K,
value: V)
-> Result<bool, Error>
Insert a binding to a database, returning false
if and only
if the exact same binding (key and value) was already in the database.
impl<'env, T> MutTxn<'env, T>
[src]
fn del<R: Rng, K: Representable, V: Representable>(&mut self,
rng: &mut R,
db: &mut Db<K, V>,
key: K,
value: Option<V>)
-> Result<bool, Error>
rng: &mut R,
db: &mut Db<K, V>,
key: K,
value: Option<V>)
-> Result<bool, Error>
If value
is None
, delete the first binding associated to
key
from the database. Else, delete the specified binding if present.
impl<'env, T> MutTxn<'env, T>
[src]
fn create_db<K: Representable, V: Representable>(&mut self)
-> Result<Db<K, V>, Error>
-> Result<Db<K, V>, Error>
Creates a new database, complexity O(1).
fn set_root<K: Representable, V: Representable>(&mut self,
root: usize,
value: Db<K, V>)
root: usize,
value: Db<K, V>)
Sets the specified root to the given value. At most 508 different roots are allowed.
fn fork<R: Rng, K: Representable, V: Representable>(&mut self,
rng: &mut R,
db: &Db<K, V>)
-> Result<Db<K, V>, Error>
rng: &mut R,
db: &Db<K, V>)
-> Result<Db<K, V>, Error>
Fork a database, in O(log n), where n is the number of pages with reference count at least 2 (this complexity is also O(log |db|)).
fn drop<R: Rng, K: Representable, V: Representable>(&mut self,
rng: &mut R,
db: &Db<K, V>)
-> Result<(), Error>
rng: &mut R,
db: &Db<K, V>)
-> Result<(), Error>
Drop a database, in O(n).
Trait Implementations
impl<'env, T> Drop for MutTxn<'env, T>
[src]
impl<'a, 'env, T> Commit for MutTxn<'env, &'a mut MutTxn<'env, T>>
[src]
impl<'env> Commit for MutTxn<'env, ()>
[src]
fn commit(self) -> Result<(), Error>
Commit a transaction. This is guaranteed to be atomic: either the commit succeeds, and all the changes made during the transaction are written to disk. Or the commit doesn't succeed, and we're back to the state just before starting the transaction.
impl<'env, T> Transaction for MutTxn<'env, T>
[src]
fn iter<'a, K: Representable, V: Representable>(&'a self,
db: &'a Db<K, V>,
key: Option<(K, Option<V>)>)
-> Cursor<'a, Self, K, V>
db: &'a Db<K, V>,
key: Option<(K, Option<V>)>)
-> Cursor<'a, Self, K, V>
Iterate over a database, starting at the first value larger than or equal to (key, value)
(and at the smallest key, or smallest value if one or both of them is None
). Read more
fn rev_iter<'a, K: Representable, V: Representable>(&'a self,
db: &'a Db<K, V>,
key: Option<(K, Option<V>)>)
-> RevCursor<'a, Self, K, V>
db: &'a Db<K, V>,
key: Option<(K, Option<V>)>)
-> RevCursor<'a, Self, K, V>
Iterate over a database in the reverse order, starting from the last binding strictly before k
(or from the last binding in the table if k.is_none()
).
fn root<K: Representable, V: Representable>(&mut self,
root: usize)
-> Option<Db<K, V>>
root: usize)
-> Option<Db<K, V>>
Gets the specified root. At most 508 different roots are allowed.
fn get<'a, K: Representable, V: Representable>(&'a self,
root: &Db<K, V>,
key: K,
value: Option<V>)
-> Option<V>
root: &Db<K, V>,
key: K,
value: Option<V>)
-> Option<V>
Get the smallest value associated to key
, or returns the given binding if value
is Some(..)
and is associated to key
in the given database. Read more