mirror of
https://github.com/ModernRelay/omnigraph.git
synced 2026-07-24 03:51:02 +02:00
Add stored-query registry loader and GraphHandle wiring
Add a `queries` module: QueryRegistry loads each declared `.gq` entry,
parses it, and selects the query whose symbol matches the manifest key,
asserting the two agree (key == `query <name>` symbol). Identity is the
query name; a key/symbol mismatch is a load-time error. Errors are
collected, not fail-fast, so a bad registry surfaces every broken entry
at once. Schema type-checking is deliberately left to a separate pass so
the loader stays callable without an open engine.
Thread an `Option<Arc<QueryRegistry>>` through GraphHandle alongside the
per-graph policy; the URI-canonicalizing clone propagates it. Production
openers default to None for now — the boot path loads and attaches the
registry in a later change.
- QueryRegistry::{from_specs, load, lookup, iter}; StoredQuery::is_mutation
- GraphHandle.queries field, propagated on canonical clone
- registry unit tests: identity match/mismatch, multi-query selection,
per-entry parse errors, error collection, mutation classification
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
edb40947d1
commit
fe111db396
5 changed files with 295 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ pub mod config;
|
|||
pub mod graph_id;
|
||||
pub mod identity;
|
||||
pub mod policy;
|
||||
pub mod queries;
|
||||
pub mod registry;
|
||||
pub mod workload;
|
||||
|
||||
|
|
@ -436,6 +437,9 @@ impl AppState {
|
|||
uri,
|
||||
engine: Arc::new(db),
|
||||
policy: policy_engine,
|
||||
// Stored-query registry is wired in by the boot path;
|
||||
// single-mode construction defaults to "no stored queries".
|
||||
queries: None,
|
||||
});
|
||||
Self {
|
||||
routing: GraphRouting::Single { handle },
|
||||
|
|
@ -1146,6 +1150,8 @@ async fn open_single_graph(cfg: GraphStartupConfig) -> Result<Arc<GraphHandle>>
|
|||
uri,
|
||||
engine: Arc::new(db),
|
||||
policy: policy_arc,
|
||||
// Stored-query registry is loaded + checked by the boot path.
|
||||
queries: None,
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue