Skip to main content

Config

Struct Config 

Source
#[non_exhaustive]
pub struct Config {
Show 28 fields pub dim: usize, pub max_bytes: usize, pub max_text: usize, pub max_blob: usize, pub shards_facts: usize, pub shards_entities: usize, pub shards_edges: usize, pub shards_temporal: usize, pub shards_postings: usize, pub bm25_k1: f32, pub bm25_b: f32, pub rrf_k: u32, pub w_bm25: f32, pub w_vec: f32, pub w_graph: f32, pub w_time: f32, pub w_recency: f32, pub half_life_days: u32, pub graph_depth: u32, pub graph_decay: f32, pub similar_cos: f32, pub similar_jaccard: f32, pub hnsw_m: usize, pub hnsw_m0: usize, pub hnsw_ef_construction: usize, pub hnsw_ef_search: usize, pub flat_to_hnsw: usize, pub db_uuid: u128,
}
Expand description

Full engine configuration with the defaults.

Plain data: construct with Config::default, override fields, then let the engine call Config::validate (it is also callable directly — useful for surfacing config errors early in wrappers).

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§dim: usize

Vector dimension; 0 disables the vector layer entirely. Max 4096.

§max_bytes: usize

Total ceiling for all byte pools (the wasm32 passport: ≤ 2 GiB).

§max_text: usize

Maximum fact text length in bytes.

§max_blob: usize

Maximum single blob length in bytes.

§shards_facts: usize

Shard count of the facts arena (power of two).

§shards_entities: usize

Shard count of the entities arena (power of two).

§shards_edges: usize

Shard count of each edge arena (power of two).

§shards_temporal: usize

Shard count of the temporal arena (power of two).

§shards_postings: usize

Shard count of the postings arena (power of two).

§bm25_k1: f32

BM25 k1 (term-frequency saturation).

§bm25_b: f32

BM25 b (length normalization), in [0, 1].

§rrf_k: u32

The RRF rank constant (score += w / (rrf_k + rank)).

§w_bm25: f32

RRF weight of the lexical (BM25) source.

§w_vec: f32

RRF weight of the vector source.

§w_graph: f32

RRF weight of the graph source.

§w_time: f32

RRF weight of the temporal-range source.

§w_recency: f32

Strength of the recency boost (0 disables it).

§half_life_days: u32

Recency half-life in days.

§graph_depth: u32

Graph expansion depth limit.

§graph_decay: f32

Per-hop weight decay of graph candidates, in (0, 1].

§similar_cos: f32

Cosine threshold for vector-based similar-detection, in [0, 1].

§similar_jaccard: f32

Jaccard threshold for lexical similar-detection, in [0, 1].

§hnsw_m: usize

HNSW: neighbors per node on upper levels.

§hnsw_m0: usize

HNSW: neighbors per node on level 0.

§hnsw_ef_construction: usize

HNSW: beam width during construction.

§hnsw_ef_search: usize

HNSW: default beam width during search (per-query override exists).

§flat_to_hnsw: usize

Vector count at which maintain switches Flat → HNSW.

§db_uuid: u128

Database lineage identity. Minted once by the host at creation (the no_std core has no RNG) and persisted in every snapshot; it survives maintain and re-saves, so external holders of ids can tell “same database” from “a different one”. 0 means an unnamed (ephemeral/test) database. On open, 0 here adopts whatever the snapshot stores; a nonzero value must match the stored one or the open fails with ConfigMismatch.

Implementations§

Source§

impl Config

Source

pub fn validate(&self) -> Result<(), Error>

Checks every field against its documented range.

Returns Error::ConfigMismatch naming the offending field. The engine calls this on every construction path; wrappers may call it earlier to fail fast.

Source

pub fn encode(&self, out: &mut Vec<u8>)

Appends the fixed binary form of the config to out — the config block of the snapshot. Layout, all little-endian, in field-declaration order: usize fields as u64, f32 fields as their IEEE 754 bits, then rrf_k/half_life_days/graph_depth as u32, db_uuid as a u128, then 8 reserved zero bytes; exactly ENCODED_LEN bytes. Encoding is lossless and canonical (float bits round-trip exactly).

Source

pub fn decode(bytes: &[u8]) -> Result<Config, Error>

Decodes a config block written by Config::encode and runs Config::validate on the result.

The input is untrusted: a wrong length or nonzero reserved bytes are Error::Corrupt; out-of-range field values surface as the same Error::ConfigMismatch a hand-built config would get.

All size fields are stored as fixed-width u64, so the block is identical on 32-bit and 64-bit builds of the engine. A value that overflows this platform’s usize means the database was created with limits only a 64-bit address space can hold (e.g. max_bytes beyond 4 GiB on a wasm64 or native host) — the file is not corrupt, this host is too small for it, hence Error::ConfigMismatch.

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<(), Error>

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

impl Default for Config

Source§

fn default() -> Config

The defaults table.

Source§

impl PartialEq for Config

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq 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.