Skip to main content

Crate urna_runtime

Crate urna_runtime 

Source
Expand description

mmap-backed runtime for .urna files.

Owns the mmap so MmapUrnaFile is 'static. Section metadata is parsed once at open time using UrnaView, then the mmap is moved into Self and embeddings are read directly from &self._mmap[offset..].

Supports float32 / float16 / int8 dtypes with a SIMD dispatcher (AVX2 / NEON / scalar). Optional ANN (hnsw) and lexical (bm25) sections rerank into the exact cosine path so the final score is always the real cosine value.

Re-exports§

pub use error::RuntimeError;
pub use simd::SimdBackend;

Modules§

ann
Pure-Rust HNSW index for approximate nearest neighbor search.
bm25
tiny BM25 inverted index for the hybrid search path.
error
graph
chunk-to-chunk graph runtime (G1). mirrors ann: a flat csr is parsed off the graph_adjacency (0x0C) section at open time and walked with zero allocation. bounded_bfs GENERATES candidate chunk ordinals seeded from the exact-cosine top-k; the candidates are handed to the SAME mandatory exact rerank (score_subset) so a graph edge can never leak into a returned score. recall stays f32::NAN (we never lie).
simd
SIMD-accelerated dot products for the search hot path.

Structs§

MmapUrnaFile
SearchExplain
ADDITIVE per-search provenance, attached to every SearchResult. zero format bytes, no URNA_FORMAT_VERSION bump: it is computed entirely in the runtime from the search path and the open file. feeds the lens --disclose explain honesty line and the agent-native retrieve() answer-pack. the load-bearing field is rerank_source.
SearchHit
SearchResult

Enums§

DType
Runtime view of the embeddings section dtype.
RerankSourceKind
What precision the mandatory exact-cosine rerank read its vectors from. the honesty backbone of --disclose explain and retrieve(): every returned score IS a real cosine, but at WHICH precision depends on whether a full-precision embeddings_fp (0x09) slab is present.

Functions§

apply_blob_span_overlay
The per-chunk source spans as a query reports them: the decoded 0x03 spans with the 0x16 overlay applied, exactly what MmapUrnaFile::open does. urna cite resolves through this so a media corpus cites the blob uri and its byte range, the span search hits and retrieve print, and not the row ordinal the forge writes into 0x03. without the overlay (or the blobs_present capability) the spans are left as decoded.