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
sourceimpl 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<K>(&self, key: &K) -> bool where
K: ?Sized + Storable,
pub fn valid_keysize<K>(&self, key: &K) -> bool where
K: ?Sized + Storable,
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 DbOptions<K, V, C, Option<CString>>> + ExactSizeIterator>
) -> Result<Vec<Db<K, V, C>>, Error> 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 DbOptions<K, V, C, Option<CString>>> + ExactSizeIterator>
) -> Result<Vec<Db<K, V, C>>, Error> 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: &DbOptions<K, V, C, Option<CString>>
) -> Result<Db<K, V, C>, Error> where
K: ?Sized + Storable,
V: ?Sized + Storable,
C: Constraint,
pub unsafe fn open_db<K, V, C>(
&self,
options: &DbOptions<K, V, C, Option<CString>>
) -> Result<Db<K, V, C>, Error> 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<(), Error>
pub fn clear_stale_readers(&self) -> Result<(), Error>
Clear stale readers
Refer to LMDB’s documentation when to clear stale readers
Trait Implementations
impl Eq for EnvRo
impl StructuralEq for EnvRo
impl StructuralPartialEq for EnvRo
Auto Trait Implementations
impl RefUnwindSafe for EnvRo
impl Send for EnvRo
impl Sync for EnvRo
impl Unpin for EnvRo
impl UnwindSafe for EnvRo
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more