Skip to main content

DatabaseConfig

Struct DatabaseConfig 

Source
pub struct DatabaseConfig {
Show 15 fields pub allow_create: bool, pub sorted_duplicates: bool, pub transactional: bool, pub read_only: bool, pub temporary: bool, pub deferred_write: bool, pub override_btree_comparator: bool, pub override_duplicate_comparator: bool, pub exclusive: bool, pub node_max_entries: u32, pub replicated: bool, pub key_prefixing: bool, pub cache_mode: CacheMode, pub bin_delta: bool, pub use_existing_config: bool,
}
Expand description

Configuration for opening a database.

Specifies the configuration parameters used to open a database within an environment. Use the builder pattern to configure individual parameters.

Fields§

§allow_create: bool

Allow creation of a new database if it doesn’t exist.

§sorted_duplicates: bool

Whether the database supports sorted duplicates.

§transactional: bool

Whether the database supports transactions.

§read_only: bool

Open the database in read-only mode.

§temporary: bool

Whether this is a temporary database.

Temporary databases are not logged and are removed when closed.

§deferred_write: bool

Whether to use deferred write mode.

Deferred write databases delay writing to disk for better performance.

§override_btree_comparator: bool

Override the B-tree key comparator.

Inert as of v1.6.0: the public API has no setter for an actual comparator function, so this flag has nothing to consume. The flag and the ByteComparator trait are scheduled for removal in v2.0. Setting it to true does not change the on-disk byte order.

§override_duplicate_comparator: bool

Override the duplicate data comparator.

Inert as of v1.6.0 — see override_btree_comparator.

§exclusive: bool

Whether this database is exclusive to a single thread.

Inert as of v1.6.0: the noxu_dbi engine has no per-database thread-affinity enforcement; this flag is recorded but never consulted.

§node_max_entries: u32

Node maximum entries (0 = use default).

§replicated: bool

Whether this database participates in replication.

Inert as of v1.6.0: the noxu_dbi::DatabaseConfig has no replicated field; the replication scope is set at the env level via noxu-rep.

§key_prefixing: bool

Enable key prefix compression in BIN nodes.

Plumbed through to noxu_dbi::DatabaseConfig as of v1.6.0 .

§cache_mode: CacheMode

Per-database cache eviction hint.

Inert as of v1.6.0: the per-DB hint is not yet honoured by the evictor; the env-level cache mode is.

§bin_delta: bool

Write BIN-deltas to the log instead of full BINs (space optimization).

Inert as of v1.6.0: the engine always emits BIN-deltas where applicable.

§use_existing_config: bool

When true, opening an existing database reuses its stored config rather than applying this config.

Inert as of v1.6.0: the engine does not yet persist per-DB config across runs in a way that can be selectively re-applied.

Implementations§

Source§

impl DatabaseConfig

Source

pub fn new() -> Self

Creates a new DatabaseConfig with default settings.

Source

pub fn set_allow_create(&mut self, allow_create: bool) -> &mut Self

Sets whether to allow creation of a new database.

Source

pub fn set_sorted_duplicates(&mut self, sorted_duplicates: bool) -> &mut Self

Sets whether the database supports sorted duplicates.

Source

pub fn set_transactional(&mut self, transactional: bool) -> &mut Self

Sets whether the database supports transactions.

Source

pub fn set_read_only(&mut self, read_only: bool) -> &mut Self

Sets whether the database is read-only.

Source

pub fn set_temporary(&mut self, temporary: bool) -> &mut Self

Sets whether this is a temporary database.

Source

pub fn set_deferred_write(&mut self, deferred_write: bool) -> &mut Self

Sets whether to use deferred write mode.

Source

pub fn set_override_btree_comparator( &mut self, override_btree_comparator: bool, ) -> &mut Self

Sets whether to override the B-tree comparator.

Source

pub fn set_override_duplicate_comparator( &mut self, override_duplicate_comparator: bool, ) -> &mut Self

Sets whether to override the duplicate comparator.

Source

pub fn set_exclusive(&mut self, exclusive: bool) -> &mut Self

Sets whether the database is exclusive.

Source

pub fn set_node_max_entries(&mut self, node_max_entries: u32) -> &mut Self

Sets the node maximum entries.

Source

pub fn with_allow_create(self, allow_create: bool) -> Self

Builder-style method to set allow_create.

Source

pub fn with_sorted_duplicates(self, sorted_duplicates: bool) -> Self

Builder-style method to set sorted_duplicates.

Source

pub fn with_transactional(self, transactional: bool) -> Self

Builder-style method to set transactional.

Source

pub fn with_read_only(self, read_only: bool) -> Self

Builder-style method to set read_only.

Source

pub fn with_temporary(self, temporary: bool) -> Self

Builder-style method to set temporary.

Source

pub fn with_deferred_write(self, deferred_write: bool) -> Self

Builder-style method to set deferred_write.

Source

pub fn set_replicated(&mut self, replicated: bool) -> &mut Self

Sets whether this database participates in replication.

Source

pub fn with_replicated(self, replicated: bool) -> Self

Builder-style method to set replicated.

Source

pub fn set_key_prefixing(&mut self, key_prefixing: bool) -> &mut Self

Sets whether key prefix compression is enabled.

Source

pub fn with_key_prefixing(self, key_prefixing: bool) -> Self

Builder-style method to set key_prefixing.

Source

pub fn set_cache_mode(&mut self, cache_mode: CacheMode) -> &mut Self

Sets the per-database cache eviction mode.

Source

pub fn with_cache_mode(self, cache_mode: CacheMode) -> Self

Builder-style method to set cache_mode.

Source

pub fn set_bin_delta(&mut self, bin_delta: bool) -> &mut Self

Sets whether BIN-deltas are written to the log.

Source

pub fn with_bin_delta(self, bin_delta: bool) -> Self

Builder-style method to set bin_delta.

Source

pub fn set_use_existing_config(&mut self, v: bool) -> &mut Self

Sets whether to reuse existing config when opening an existing database.

Source

pub fn with_use_existing_config(self, v: bool) -> Self

Builder-style method to set use_existing_config.

Trait Implementations§

Source§

impl Clone for DatabaseConfig

Source§

fn clone(&self) -> DatabaseConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DatabaseConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DatabaseConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for DatabaseConfig

Source§

impl PartialEq for DatabaseConfig

Source§

fn eq(&self, other: &DatabaseConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for DatabaseConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more