pub struct EnvBuilder { /* private fields */ }
Expand description

Handle on an uninitialised LMDB environment to allow configuring pre-open options.

Implementations

Allocates a new, uninitialised environment.

Set the size of the memory map to use for this environment.

The size should be a multiple of the OS page size. The default is 10485760 bytes. The size of the memory map is also the maximum size of the database. The value should be chosen as large as possible, to accommodate future growth of the database.

The new size takes effect immediately for the current process but will not be persisted to any others until a write transaction has been committed by the current process. Also, only mapsize increases are persisted into the environment.

See also Environment::set_mapsize().

Set the maximum number of threads/reader slots for the environment.

This defines the number of slots in the lock table that is used to track readers in the the environment. The default is 126. Starting a read-only transaction normally ties a lock table slot to the current thread until the environment closes or the thread exits. If NOTLS is in use, starting a transaction instead ties the slot to the transaction object until it or the Environment object is destroyed.

Set the maximum number of named databases for the environment.

This function is only needed if multiple databases will be used in the environment. Simpler applications that use the environment as a single unnamed database can ignore this option.

Currently a moderate number of slots are cheap but a huge number gets expensive: 7-120 words per transaction, and every mdb_dbi_open() does a linear search of the opened slots.

Opens the file or directory at path with the given flags and, on UNIX, permissions given by mode.

path is a &str for convenience, and must be convertable to a CString. The non-use of &OsStr or AsRef<Path> as normally used in std is deliberate, since the path must be convertable to a byte string. But as a result there is no way to address files whose names are not valid UTF-8 through this call.

Unsafety

It is the caller’s responsibility to ensure that the underlying file will be used properly. Since LMDB is built on memory-mapping, these responsibilities run quite deep and vary based on flags.

  • The caller must ensure that no other process writes to the file in any way except going through LMDB. If this is violated, segfaults can occur, or immutable references can be observed to have their referent mutated asynchronously.

  • If the caller uses flags which suppress locking, the caller must additionally ensure that LMDB’s locking requirements are upheld.

  • If the caller uses flags that result in the creation of a sparse file, the caller must ensure there is actually sufficient disk space for all pages of the file or else a segfault may occur.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Given ptr, which was obtained from a prior call to Self::borrow(), return a value with the same nominal lifetime which is guaranteed to survive mutations to Self. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.