[−][src]Struct tari_storage::lmdb_store::LMDBBuilder
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:
Parameter | Default |
---|---|
path | ./store/ |
size | 64 MB |
named DBs | none |
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]
fn default() -> LMDBBuilder
[src]
Auto Trait Implementations
impl RefUnwindSafe for LMDBBuilder
impl Send for LMDBBuilder
impl Sync for LMDBBuilder
impl Unpin for LMDBBuilder
impl UnwindSafe for LMDBBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Clear for T where
T: InitializableFromZeroed + ?Sized,
T: InitializableFromZeroed + ?Sized,
fn clear(&mut self)
impl<T> From<T> for T
[src]
impl<T> InitializableFromZeroed for T where
T: Default,
T: Default,
unsafe fn initialize(place: *mut T)
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SafeBorrow<T> for T where
T: ?Sized,
T: ?Sized,
fn borrow_replacement(ptr: &T) -> &T
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,