Skip to main content

Module daemon_graph

Module daemon_graph 

Source
Expand description

In-process graph backing store for the loopback daemon /query route.

The live daemon graph is a fixed-capacity, zero-heap store backed by a caller-invisible [NQuin; MAX_GRAPH_QUINS] buffer. Cold-path ontology and file ingestion may still allocate while parsing, but the resident graph used by /query no longer relies on Vec or HashSet.

Structs§

DaemonGraphStore
InitGraphOptions
Controls which resident graph layers are seeded at daemon boot.
UpdateOutcome
Outcome of applying a SPARQL Update to the daemon graph.

Constants§

MAX_GRAPH_QUINS
Bench datasets (Schema.org ~18K quins) must fit for browser/native parity.

Functions§

apply_sparql_update
Apply a parsed SPARQL Update to the resident daemon graph.
apply_sparql_update_durable
Apply a SPARQL Update durably and signed: each net change is stamped and signed to the WAL (the append-only audit trail) with the caller’s real ed25519 key, then the full graph state is snapshotted for restart durability. This is the production write path; the key must come from the identity / key-vault layer — never a placeholder.
bump_graph_revision
Increment revision and notify SSE subscribers (Release ordering).
condition_label_for_subject_hash
Known condition subject hashes for Anatomy graph -> label mapping.
extend_with_ontology_quins
Extend the live graph with ontology quins from qualia-core-db::ontology_loader.
extend_with_ontology_quins_slice
Zero-heap resident update path for ontology insertion.
graph_lexicon_lookup
Resolve a term hash to its literal text via the resident graph’s lexicon. Used by the query path as the ingested-data resolver for TextResolver.
graph_quin_count
Number of Quins currently available to /query.
graph_read_guard
Read guard over the live graph (lock is process-static via OnceLock).
graph_revision
Monotonic Lamport-style revision counter for daemon graph mutations.
init_daemon_graph
Initialise or refresh the daemon graph from storage path.
init_daemon_graph_with_options
Initialise or refresh the daemon graph with explicit seeding policy.
load_graph_snapshot
Load the durable snapshot into the graph, if present. Returns the quin count loaded (0 if there is no snapshot). This is the authoritative last full state (defaults + index + committed updates) when it exists.
persist_graph_snapshot
Write the current full graph state to a flat-quin snapshot file. Called after a persisted SPARQL Update so the change survives a restart. Returns the quin count written.
replace_graph_from_flat_bytes
Replace the in-memory graph with flat 48-byte NQuin bytes (browser bench_load).
subscribe_graph_revisions
Subscribe to graph revision bumps (used by GET /tensor/events SSE).