Trait mmtkvdb::Env

source ·
pub trait Env: AsRef<EnvRo> {
    // Required methods
    fn txn_ro(&self) -> Result<TxnRo<'_>>;
    fn max_keysize(&self) -> usize;
    fn valid_keysize<'kr, K, KRef>(&self, key: KRef) -> bool
       where K: ?Sized + Storable + 'kr,
             KRef: StorableRef<'kr, K>;
    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;
    fn clear_stale_readers(&self) -> Result<usize>;

    // Provided methods
    fn as_env_ro(&self) -> &EnvRo { ... }
    fn clone_ro(&self) -> EnvRo { ... }
}
Expand description

Read-write or read-only handle for accessing environment that stores key-value databases

This trait is implemented by EnvRo and EnvRw and provides the methods for read-only access to the environment. Read-write access is performed by methods directly implemented on EnvRw.

Required Methods§

source

fn txn_ro(&self) -> Result<TxnRo<'_>>

Start read-only transaction

source

fn max_keysize(&self) -> usize

Get maximum size of keys and duplicate data

source

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

source

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.
  • Implementation of Storable for the used keys and values must behave the same as when the database was created.
source

fn clear_stale_readers(&self) -> Result<usize>

Clear stale readers

Refer to LMDB’s documentation when to clear stale readers

Provided Methods§

source

fn as_env_ro(&self) -> &EnvRo

Reference conversion to EnvRo

To obtain an owned EnvRo, you can use Env::clone_ro as a shorthand for .as_env_ro().clone().

source

fn clone_ro(&self) -> EnvRo

Clone as EnvRo

Implementors§