[]Struct rkv::EnvironmentFlags

pub struct EnvironmentFlags { /* fields omitted */ }

Environment options.

Methods

impl EnvironmentFlags

pub const FIXED_MAP: EnvironmentFlags

Use a fixed address for the mmap region. This flag must be specified when creating the environment, and is stored persistently in the environment. If successful, the memory map will always reside at the same virtual address and pointers used to reference data items in the database will be constant across multiple invocations. This option may not always work, depending on how the operating system has allocated memory to shared libraries and other uses. The feature is highly experimental.

pub const NO_SUB_DIR: EnvironmentFlags

By default, LMDB creates its environment in a directory whose pathname is given in path, and creates its data and lock files under that directory. With this option, path is used as-is for the database main data file. The database lock file is the path with -lock appended.

pub const WRITE_MAP: EnvironmentFlags

Use a writeable memory map unless READ_ONLY is set. This is faster and uses fewer mallocs, but loses protection from application bugs like wild pointer writes and other bad updates into the database. Incompatible with nested transactions. Processes with and without WRITE_MAP on the same environment do not cooperate well.

pub const READ_ONLY: EnvironmentFlags

Open the environment in read-only mode. No write operations will be allowed. When opening an environment, LMDB will still modify the lock file - except on read-only filesystems, where LMDB does not use locks.

pub const NO_META_SYNC: EnvironmentFlags

Flush system buffers to disk only once per transaction, omit the metadata flush. Defer that until the system flushes files to disk, or next non-READ_ONLY commit or Environment::sync. This optimization maintains database integrity, but a system crash may undo the last committed transaction. I.e. it preserves the ACI (atomicity, consistency, isolation) but not D (durability) database property.

This flag may be changed at any time using Environment::set_flags.

pub const NO_SYNC: EnvironmentFlags

Don't flush system buffers to disk when committing a transaction. This optimization means a system crash can corrupt the database or lose the last transactions if buffers are not yet flushed to disk. The risk is governed by how often the system flushes dirty buffers to disk and how often Environment::sync is called. However, if the filesystem preserves write order and the WRITE_MAP flag is not used, transactions exhibit ACI (atomicity, consistency, isolation) properties and only lose D (durability). I.e. database integrity is maintained, but a system crash may undo the final transactions. Note that (NO_SYNC | WRITE_MAP) leaves the system with no hint for when to write transactions to disk, unless Environment::sync is called. (MAP_ASYNC | WRITE_MAP) may be preferable.

This flag may be changed at any time using Environment::set_flags.

pub const MAP_ASYNC: EnvironmentFlags

When using WRITE_MAP, use asynchronous flushes to disk. As with NO_SYNC, a system crash can then corrupt the database or lose the last transactions. Calling Environment::sync ensures on-disk database integrity until next commit.

This flag may be changed at any time using Environment::set_flags.

pub const NO_TLS: EnvironmentFlags

Don't use thread-local storage. Tie reader locktable slots to transaction objects instead of to threads. I.e. RoTransaction::reset keeps the slot reserved for the transaction object. A thread may use parallel read-only transactions. A read-only transaction may span threads if the user synchronizes its use. Applications that multiplex many the user synchronizes its use. Applications that multiplex many user threads over individual OS threads need this option. Such an application must also serialize the write transactions in an OS thread, since LMDB's write locking is unaware of the user threads.

pub const NO_LOCK: EnvironmentFlags

Do not do any locking. If concurrent access is anticipated, the caller must manage all concurrency themself. For proper operation the caller must enforce single-writer semantics, and must ensure that no readers are using old transactions while a writer is active. The simplest approach is to use an exclusive lock so that no readers may be active at all when a writer begins.

pub const NO_READAHEAD: EnvironmentFlags

Turn off readahead. Most operating systems perform readahead on read requests by default. This option turns it off if the OS supports it. Turning it off may help random read performance when the DB is larger than RAM and system RAM is full. The option is not implemented on Windows.

pub const NO_MEM_INIT: EnvironmentFlags

Do not initialize malloc'd memory before writing to unused spaces in the data file. By default, memory for pages written to the data file is obtained using malloc. While these pages may be reused in subsequent transactions, freshly malloc'd pages will be initialized to zeroes before use. This avoids persisting leftover data from other code (that used the heap and subsequently freed the memory) into the data file. Note that many other system libraries may allocate and free memory from the heap for arbitrary uses. E.g., stdio may use the heap for file I/O buffers. This initialization step has a modest performance cost so some applications may want to disable it using this flag. This option can be a problem for applications which handle sensitive data like passwords, and it makes memory checkers like Valgrind noisy. This flag is not needed with WRITE_MAP, which writes directly to the mmap instead of using malloc for pages. The initialization is also skipped if writing with reserve; the caller is expected to overwrite all of the memory that was reserved in that case.

This flag may be changed at any time using Environment::set_flags.

pub const fn empty() -> EnvironmentFlags

Returns an empty set of flags

pub const fn all() -> EnvironmentFlags

Returns the set containing all flags.

pub const fn bits(&self) -> u32

Returns the raw value of the flags currently stored.

pub fn from_bits(bits: u32) -> Option<EnvironmentFlags>

Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.

pub const fn from_bits_truncate(bits: u32) -> EnvironmentFlags

Convert from underlying bit representation, dropping any bits that do not correspond to flags.

pub const fn is_empty(&self) -> bool

Returns true if no flags are currently stored.

pub const fn is_all(&self) -> bool

Returns true if all flags are currently set.

pub const fn intersects(&self, other: EnvironmentFlags) -> bool

Returns true if there are flags common to both self and other.

pub const fn contains(&self, other: EnvironmentFlags) -> bool

Returns true all of the flags in other are contained within self.

pub fn insert(&mut self, other: EnvironmentFlags)

Inserts the specified flags in-place.

pub fn remove(&mut self, other: EnvironmentFlags)

Removes the specified flags in-place.

pub fn toggle(&mut self, other: EnvironmentFlags)

Toggles the specified flags in-place.

pub fn set(&mut self, other: EnvironmentFlags, value: bool)

Inserts or removes the specified flags depending on the passed value.

Trait Implementations

impl BitOrAssign<EnvironmentFlags> for EnvironmentFlags

fn bitor_assign(&mut self, other: EnvironmentFlags)

Adds the set of flags.

impl SubAssign<EnvironmentFlags> for EnvironmentFlags

fn sub_assign(&mut self, other: EnvironmentFlags)

Disables all flags enabled in the set.

impl BitOr<EnvironmentFlags> for EnvironmentFlags

type Output = EnvironmentFlags

The resulting type after applying the | operator.

fn bitor(self, other: EnvironmentFlags) -> EnvironmentFlags

Returns the union of the two sets of flags.

impl BitXor<EnvironmentFlags> for EnvironmentFlags

type Output = EnvironmentFlags

The resulting type after applying the ^ operator.

fn bitxor(self, other: EnvironmentFlags) -> EnvironmentFlags

Returns the left flags, but with all the right flags toggled.

impl Not for EnvironmentFlags

type Output = EnvironmentFlags

The resulting type after applying the ! operator.

fn not(self) -> EnvironmentFlags

Returns the complement of this set of flags.

impl Eq for EnvironmentFlags

impl BitAndAssign<EnvironmentFlags> for EnvironmentFlags

fn bitand_assign(&mut self, other: EnvironmentFlags)

Disables all flags disabled in the set.

impl Debug for EnvironmentFlags

impl PartialEq<EnvironmentFlags> for EnvironmentFlags

impl LowerHex for EnvironmentFlags

impl Sub<EnvironmentFlags> for EnvironmentFlags

type Output = EnvironmentFlags

The resulting type after applying the - operator.

fn sub(self, other: EnvironmentFlags) -> EnvironmentFlags

Returns the set difference of the two sets of flags.

impl Extend<EnvironmentFlags> for EnvironmentFlags

impl PartialOrd<EnvironmentFlags> for EnvironmentFlags

impl Ord for EnvironmentFlags

impl UpperHex for EnvironmentFlags

impl Clone for EnvironmentFlags

impl Binary for EnvironmentFlags

impl BitAnd<EnvironmentFlags> for EnvironmentFlags

type Output = EnvironmentFlags

The resulting type after applying the & operator.

fn bitand(self, other: EnvironmentFlags) -> EnvironmentFlags

Returns the intersection between the two sets of flags.

impl FromIterator<EnvironmentFlags> for EnvironmentFlags

impl Default for EnvironmentFlags[src]

impl Octal for EnvironmentFlags

impl Hash for EnvironmentFlags

impl BitXorAssign<EnvironmentFlags> for EnvironmentFlags

fn bitxor_assign(&mut self, other: EnvironmentFlags)

Toggles the set of flags.

impl Copy for EnvironmentFlags

Auto Trait Implementations

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

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

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<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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