pub struct EnvRo { /* private fields */ }
Expand description
Read-only handle for accessing environment that stores key-value databases
An environment can be opened using EnvBuilder
.
Use EnvRo::open_db
to retrieve database handles
and EnvRo::txn_ro
to start a read-only transaction.
It’s possible to clone the handle, in which case the environment will be closed when the last handle is dropped.
It’s also possible to create a read-only handle from a read-write handle
(EnvRw
) by invoking .clone()
, which clones the
referenced EnvRo
through deref coercion (see
example for EnvBuilder
).
Implementations§
source§impl EnvRo
impl 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