Skip to main content

Config

Struct Config 

Source
pub struct Config { /* private fields */ }
Expand description

Db open-time configuration. Construct via Config::default and modify with the builder methods.

Implementations§

Source§

impl Config

Source

pub fn cache_size(self, bytes: usize) -> Result<Self>

Set the pager’s LRU cache size, in bytes. Rounded down to the nearest 4 KiB page.

§Errors

Returns obj_core::Error::InvalidArgument if the resulting frame count is zero.

Source

pub fn sync_mode(self, mode: SyncMode) -> Self

Set the durability mode the WAL uses for every commit.

Source

pub fn busy_timeout(self, timeout: Duration) -> Self

Set the cross-process / in-process busy-lock timeout. WriteTxn::begin and ReadTxn::begin return Err(Error::Busy) if the relevant lock cannot be acquired within this budget.

Source

pub fn skip_open_check(self, skip: bool) -> Self

Skip the lightweight open-time integrity check (M11 #91).

By default (false), crate::Db::open / crate::Db::open_with run a fast subset of crate::Db::integrity_check before returning: file-header CRC, catalog root sanity, catalog B-tree CRC + invariants, and per-collection pointer-range validation. The walk is bounded to the catalog tree only — no per-collection deep walk — so the cost is essentially independent of the database’s total size.

Set to true to opt out. The knob exists for narrow use cases — fault-injection harnesses that deliberately open a corrupted DB to exercise downstream error paths, hot-reload tooling that re-opens the same file many times per second, or developer workflows that have just run a full Db::integrity_check and don’t want to repeat the catalog portion. Production callers SHOULD leave it on.

Skipping the open check does NOT bypass detection: a corrupted page surfaces on the first operation that touches it. Note also that the obj Db constructor performs an implicit Catalog::open_or_init that reads the catalog B-tree’s reserved row; a DB whose catalog tree is so corrupted that descend fails will still error out of the open path even with skip_open_check(true). The knob’s guarantee is “no EXTRA walk beyond what was already required to construct the Db handle.”

Source

pub fn cross_process_lock(self, enabled: bool) -> Self

Enable / disable the cross-process file lock layer.

When false, the Db opened with this config does NOT acquire OS-level byte-range locks on the database file. Used by the M6 #49 concurrent stress test where every thread shares one Db (and therefore one file descriptor): POSIX OFD locks are per-fd, so multiple threads on the same fd cannot use the lock to enforce inter-thread exclusion — that’s what the in-process write-serialization mutex is for.

Default: true (cross-process locking enabled).

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

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 Config

Source§

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

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

impl Default for Config

Source§

fn default() -> Self

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

impl Copy for Config

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V