pub struct MutTxn<'env, T> { /* private fields */ }
Expand description
A mutable transaction.
Implementations§
source§impl<'env, T> MutTxn<'env, T>
impl<'env, T> MutTxn<'env, T>
sourcepub fn mut_txn_begin<'txn>(
&'txn mut self
) -> Result<MutTxn<'env, &'txn mut MutTxn<'env, T>>, Error>
pub fn mut_txn_begin<'txn>(
&'txn mut self
) -> Result<MutTxn<'env, &'txn mut MutTxn<'env, T>>, Error>
Start a mutable transaction.
sourcepub fn alloc_page(&mut self) -> Result<MutPage, Error>
pub fn alloc_page(&mut self) -> Result<MutPage, Error>
Allocate a single page.
source§impl<'env, T> MutTxn<'env, T>
impl<'env, T> MutTxn<'env, T>
sourcepub 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>
pub 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>
Insert a binding to a database, returning false
if and only
if the exact same binding (key and value) was already in the database.
source§impl<'env, T> MutTxn<'env, T>
impl<'env, T> MutTxn<'env, T>
sourcepub 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>
pub 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>
If value
is None
, delete one of the bindings associated to
key
from the database (without any specific
preference). Else, delete the specified binding if present.
source§impl<'env, T> MutTxn<'env, T>
impl<'env, T> MutTxn<'env, T>
sourcepub fn create_db<K: Representable, V: Representable>(
&mut self
) -> Result<Db<K, V>, Error>
pub fn create_db<K: Representable, V: Representable>(
&mut self
) -> Result<Db<K, V>, Error>
Creates a new database, complexity O(1).
sourcepub fn set_root<K: Representable, V: Representable>(
&mut self,
root: usize,
value: Db<K, V>
)
pub fn set_root<K: Representable, V: Representable>(
&mut self,
root: usize,
value: Db<K, V>
)
Sets the specified root to the given value. At most 508 different roots are allowed.
sourcepub fn fork<R: Rng, K: Representable, V: Representable>(
&mut self,
rng: &mut R,
db: &Db<K, V>
) -> Result<Db<K, V>, Error>
pub fn fork<R: Rng, K: Representable, V: Representable>(
&mut self,
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|)).
sourcepub fn drop<R: Rng, K: Representable, V: Representable>(
&mut self,
rng: &mut R,
db: &Db<K, V>
) -> Result<(), Error>
pub fn drop<R: Rng, K: Representable, V: Representable>(
&mut self,
rng: &mut R,
db: &Db<K, V>
) -> Result<(), Error>
Drop a database, in O(n).
Trait Implementations§
source§impl<'env, T> Transaction for MutTxn<'env, T>
impl<'env, T> Transaction for MutTxn<'env, T>
source§fn iter<'a, K: Representable, V: Representable>(
&'a self,
db: &'a Db<K, V>,
key: Option<(K, Option<V>)>
) -> Cursor<'a, Self, K, V> ⓘ
fn iter<'a, K: Representable, V: Representable>(
&'a self,
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 moresource§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> ⓘ
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> ⓘ
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()
).source§fn root<K: Representable, V: Representable>(
&mut self,
root: usize
) -> Option<Db<K, V>>
fn root<K: Representable, V: Representable>(
&mut self,
root: usize
) -> Option<Db<K, V>>
Gets the specified root. At most 508 different roots are allowed.
source§fn get<'a, K: Representable, V: Representable>(
&'a self,
root: &Db<K, V>,
key: K,
value: Option<V>
) -> Option<V>
fn get<'a, K: Representable, V: Representable>(
&'a self,
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