#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.dim: usizeVector dimension; 0 disables the vector layer entirely. Max 4096.
max_bytes: usizeTotal ceiling for all byte pools (the wasm32 passport: ≤ 2 GiB).
max_text: usizeMaximum fact text length in bytes.
max_blob: usizeMaximum single blob length in bytes.
shards_facts: usizeShard count of the facts arena (power of two).
shards_entities: usizeShard count of the entities arena (power of two).
shards_edges: usizeShard count of each edge arena (power of two).
shards_temporal: usizeShard count of the temporal arena (power of two).
shards_postings: usizeShard count of the postings arena (power of two).
bm25_k1: f32BM25 k1 (term-frequency saturation).
bm25_b: f32BM25 b (length normalization), in [0, 1].
rrf_k: u32The RRF rank constant (score += w / (rrf_k + rank)).
w_bm25: f32RRF weight of the lexical (BM25) source.
w_vec: f32RRF weight of the vector source.
w_graph: f32RRF weight of the graph source.
w_time: f32RRF weight of the temporal-range source.
w_recency: f32Strength of the recency boost (0 disables it).
half_life_days: u32Recency half-life in days.
graph_depth: u32Graph expansion depth limit.
graph_decay: f32Per-hop weight decay of graph candidates, in (0, 1].
similar_cos: f32Cosine threshold for vector-based similar-detection, in [0, 1].
similar_jaccard: f32Jaccard threshold for lexical similar-detection, in [0, 1].
hnsw_m: usizeHNSW: neighbors per node on upper levels.
hnsw_m0: usizeHNSW: neighbors per node on level 0.
hnsw_ef_construction: usizeHNSW: beam width during construction.
hnsw_ef_search: usizeHNSW: default beam width during search (per-query override exists).
flat_to_hnsw: usizeVector count at which maintain switches Flat → HNSW.
db_uuid: u128Database 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
impl Config
Sourcepub fn validate(&self) -> Result<(), Error>
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.
Sourcepub fn encode(&self, out: &mut Vec<u8>)
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).
Sourcepub fn decode(bytes: &[u8]) -> Result<Config, Error>
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.