pub struct EnvRw { /* private fields */ }
Expand description
Read-write handle for accessing environment that stores key-value databases
An environment can be opened using EnvBuilder
.
EnvRw
coerces to EnvRo
through Deref
coercion, thus all methods
of EnvRo
are available for EnvRw
as well.
Use EnvRo::open_db
or EnvRw::create_db
to retrieve database handles
and EnvRw::txn_rw
to start a read-write transaction.
It’s possible to create a read-only handle from a read-write handle by
invoking .clone()
, which clones the referenced EnvRo
through deref coercion (see
example for EnvBuilder
).
Implementations§
source§impl EnvRw
impl EnvRw
sourcepub fn nestable_txns(&self) -> bool
pub fn nestable_txns(&self) -> bool
Check if transactions are nestable
See TxnRw::nested
.
sourcepub unsafe fn create_dbs<'a, K, V, C>(
&mut self,
options: impl IntoIterator<IntoIter = impl Iterator<Item = &'a DbSpec<K, V, C>> + ExactSizeIterator>
) -> Result<Vec<Db<K, V, C>>>where
K: ?Sized + Storable + 'a,
V: ?Sized + Storable + 'a,
C: Constraint,
pub unsafe fn create_dbs<'a, K, V, C>(
&mut self,
options: impl IntoIterator<IntoIter = impl Iterator<Item = &'a DbSpec<K, V, C>> + ExactSizeIterator>
) -> Result<Vec<Db<K, V, C>>>where
K: ?Sized + Storable + 'a,
V: ?Sized + Storable + 'a,
C: Constraint,
Open databases in environment and create if non-existing
SAFETY: If a database exists already, it must have been created with compatible options.
sourcepub unsafe fn create_db<K, V, C>(
&mut self,
options: &DbSpec<K, V, C>
) -> Result<Db<K, V, C>>where
K: ?Sized + Storable,
V: ?Sized + Storable,
C: Constraint,
pub unsafe fn create_db<K, V, C>(
&mut self,
options: &DbSpec<K, V, C>
) -> Result<Db<K, V, C>>where
K: ?Sized + Storable,
V: ?Sized + Storable,
C: Constraint,
Open database in environment and create if non-existing
SAFETY: If a database exists already, it must have been created with compatible options.
Methods from Deref<Target = EnvRo>§
sourcepub fn max_keysize(&self) -> usize
pub fn max_keysize(&self) -> usize
Get maximum size of keys and duplicate data
sourcepub fn valid_keysize<'kr, K, KRef>(&self, key: KRef) -> boolwhere
K: ?Sized + Storable + 'kr,
KRef: StorableRef<'kr, K>,
pub fn valid_keysize<'kr, K, KRef>(&self, key: KRef) -> boolwhere
K: ?Sized + Storable + 'kr,
KRef: StorableRef<'kr, K>,
Checks if key or duplicate data has valid size
sourcepub unsafe fn open_dbs<'a, K, V, C>(
&self,
options: impl IntoIterator<IntoIter = impl Iterator<Item = &'a DbSpec<K, V, C>> + ExactSizeIterator>
) -> Result<Vec<Db<K, V, C>>>where
K: ?Sized + Storable + 'a,
V: ?Sized + Storable + 'a,
C: Constraint,
pub unsafe fn open_dbs<'a, K, V, C>(
&self,
options: impl IntoIterator<IntoIter = impl Iterator<Item = &'a DbSpec<K, V, C>> + ExactSizeIterator>
) -> Result<Vec<Db<K, V, C>>>where
K: ?Sized + Storable + 'a,
V: ?Sized + Storable + 'a,
C: Constraint,
Open databases in environment
SAFETY: If a database exists already, it must have been created with compatible options.
sourcepub unsafe fn open_db<K, V, C>(
&self,
options: &DbSpec<K, V, C>
) -> Result<Db<K, V, C>>where
K: ?Sized + Storable,
V: ?Sized + Storable,
C: Constraint,
pub unsafe fn open_db<K, V, C>(
&self,
options: &DbSpec<K, V, C>
) -> Result<Db<K, V, C>>where
K: ?Sized + Storable,
V: ?Sized + Storable,
C: Constraint,
Open database in environment
SAFETY: If a database exists already, it must have been created with compatible options.
sourcepub fn clear_stale_readers(&self) -> Result<()>
pub fn clear_stale_readers(&self) -> Result<()>
Clear stale readers
Refer to LMDB’s documentation when to clear stale readers