[−]Struct lmdb::EnvironmentFlags
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 fn empty() -> EnvironmentFlags
Returns an empty set of flags.
pub fn all() -> EnvironmentFlags
Returns the set containing all flags.
pub fn bits(&self) -> c_uint
Returns the raw value of the flags currently stored.
pub fn from_bits(bits: c_uint) -> Option<EnvironmentFlags>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
pub fn from_bits_truncate(bits: c_uint) -> EnvironmentFlags
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
pub fn is_empty(&self) -> bool
Returns true
if no flags are currently stored.
pub fn is_all(&self) -> bool
Returns true
if all flags are currently set.
pub fn intersects(&self, other: EnvironmentFlags) -> bool
Returns true
if there are flags common to both self
and other
.
pub 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 Clone for EnvironmentFlags
fn clone(&self) -> EnvironmentFlags
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Eq for EnvironmentFlags
impl Extend<EnvironmentFlags> for EnvironmentFlags
fn extend<T: IntoIterator<Item = EnvironmentFlags>>(&mut self, iterator: T)
impl PartialOrd<EnvironmentFlags> for EnvironmentFlags
fn partial_cmp(&self, other: &EnvironmentFlags) -> Option<Ordering>
fn lt(&self, other: &EnvironmentFlags) -> bool
fn le(&self, other: &EnvironmentFlags) -> bool
fn gt(&self, other: &EnvironmentFlags) -> bool
fn ge(&self, other: &EnvironmentFlags) -> bool
impl Copy for EnvironmentFlags
impl PartialEq<EnvironmentFlags> for EnvironmentFlags
fn eq(&self, other: &EnvironmentFlags) -> bool
fn ne(&self, other: &EnvironmentFlags) -> bool
impl Default for EnvironmentFlags
[src]
fn default() -> EnvironmentFlags
[src]
impl Ord for EnvironmentFlags
fn cmp(&self, other: &EnvironmentFlags) -> Ordering
default fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
default fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
default fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Restrict a value to a certain interval. Read more
impl Binary for EnvironmentFlags
impl Debug for EnvironmentFlags
impl UpperHex for EnvironmentFlags
impl LowerHex for EnvironmentFlags
impl Octal 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 SubAssign<EnvironmentFlags> for EnvironmentFlags
fn sub_assign(&mut self, other: EnvironmentFlags)
Disables all flags enabled in the set.
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 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 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 BitAndAssign<EnvironmentFlags> for EnvironmentFlags
fn bitand_assign(&mut self, other: EnvironmentFlags)
Disables all flags disabled in the set.
impl BitOrAssign<EnvironmentFlags> for EnvironmentFlags
fn bitor_assign(&mut self, other: EnvironmentFlags)
Adds the set of flags.
impl BitXorAssign<EnvironmentFlags> for EnvironmentFlags
fn bitxor_assign(&mut self, other: EnvironmentFlags)
Toggles the set of flags.
impl Hash for EnvironmentFlags
fn hash<__H: Hasher>(&self, state: &mut __H)
default fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl FromIterator<EnvironmentFlags> for EnvironmentFlags
fn from_iter<T: IntoIterator<Item = EnvironmentFlags>>(
iterator: T
) -> EnvironmentFlags
iterator: T
) -> EnvironmentFlags
Auto Trait Implementations
impl Send for EnvironmentFlags
impl Sync for EnvironmentFlags
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto 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<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,