[][src]Struct tari_storage::lmdb_store::LMDBBuilder

pub struct LMDBBuilder { /* fields omitted */ }

A builder for LMDBStore

Example

Create a new LMDB database of 500MB in the db directory with two named databases: "db1" and "db2"

let mut store = LMDBBuilder::new()
    .set_path(env::temp_dir())
    .set_environment_size(500)
    .set_max_number_of_databases(10)
    .add_database("db1", db::CREATE)
    .add_database("db2", db::CREATE)
    .build()
    .unwrap();

Implementations

impl LMDBBuilder[src]

pub fn new() -> LMDBBuilder[src]

Create a new LMDBStore builder. Set up the database by calling set_nnnn and then create the database with build(). The default values for the database parameters are:

ParameterDefault
path./store/
size64 MB
named DBsnone

pub fn set_path<P: AsRef<Path>>(self, path: P) -> LMDBBuilder[src]

Set the directory where the LMDB database exists, or must be created. Note: The directory must exist already; it is not created for you. If it does not exist, build() will return LMDBError::InvalidPath.

pub fn set_environment_size(self, size: usize) -> LMDBBuilder[src]

Sets the size of the environment, in MB. The actual memory will only be allocated when #build() is called

pub fn set_max_number_of_databases(self, size: usize) -> LMDBBuilder[src]

Sets the maximum number of databases (tables) in the environment. If this value is less than the number of DBs that will be created when the environment is built, this value will be ignored.

pub fn add_database(self, name: &str, flags: Flags) -> LMDBBuilder[src]

Add an additional named database to the LMDB environment.If add_database isn't called at least once, only the default database is created.

pub fn build(self) -> Result<LMDBStore, LMDBError>[src]

Create a new LMDBStore instance and open the underlying database environment

Trait Implementations

impl Default for LMDBBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Clear for T where
    T: InitializableFromZeroed + ?Sized

impl<T> From<T> for T[src]

impl<T> InitializableFromZeroed for T where
    T: Default

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SafeBorrow<T> for T where
    T: ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,