Expand description
The query binding (spec/surface/README.md §1): a DataContext over
the store, so the oqx in-memory engine reproduces the whole OQX surface
— roots, intrinsics, reach-through, structural relations, the edge graph,
the row functions — without a bespoke compiler. Port of
packages/core/src/oqx-js/context.ts.
Rows are the store’s raw column objects (blobs as hex) carrying a hidden
tag column (TAG_KEY) naming their target; get routes field /
attribute / relation resolution per target, lazily querying the store.
Row functions (text, under, …) arrive as methods on the row — the
runner rewrites them to $it.fn(…) — since a free function sees no row.
The tier-3 planner (crate::planner) hands the rows its SQL produced
back through StoreContext::with_rows_root: the context then serves them
as the residual query’s oqx::ROWS_ROOT scan, while every other root,
relation, intrinsic and row function still reaches the store — the
reference’s rowsRoot context option.
Errors travel the engine’s channel: a failure inside a property read or a
row function — a bare target name, a store failure — is the
Err of get / call_method (an eval-stage OqxError, since oqx
0.13), which aborts the run exactly like a throw from the reference’s
get; the runner maps it to filter_invalid with the same message. The
one seam still without a channel is root (the engine reads a named root
for the top-level source and for a caret that reaches the root scope), so
a store failure during a root scan is kept in StoreContext::take_root_failure
and the runner reports it after the run.
One seam differs from the reference and is bridged here:
- the Rust engine expands
entries(x)in row position itself (never viacall_function), so the_data/_frontmatter/_inlinesource handles are materialized eagerly as plain objects — one key per top-level property in key order, valued by the scalar-vs-list rule — instead of the reference’s lazy handle._frontmatter.<k>andentries(_frontmatter)read the same values either way.
Structs§
- Semantic
Vec - A query phrase’s embedding: the model whose cache to read and the vector as a float32 little-endian blob.
- Store
Context - The store-backed context for one repo.
Enums§
- Target
- The five root collections (
spec/surface§1.1): the four live row kinds and, since 4.7,revisions— the history target, one row per revision of the repository’s documents (therevisions×commitsjoin). The reference splits the name in two (Target, the four kinds its planner pushes down and its unknown-names pass first keyed by;Kind/Root, all five); here one enum tags every row, and the planner declines the fifth (crate::planner::root_targetis five-wide,compileplans four).
Constants§
- ABSENT_
KEY - The value of a statically SINGLE relation that has no row —
_dston an external or dangling link,_blockon a node without one (oqx 0.20, SEMANTICS §3): an object the engine treats as one row with no rows (to_rowsempty,is_singletrue), so_dst { _title }is absent rather than[], while as a VALUE it is absent (materialize), so_dst == null,has(_dst)and_dst._titleread as before. The port of the reference’sABSENT_SINGLE. - ALL_
TARGETS - The five root collections, in the order the root object lists them
(
spec/surface§1.1;revisionsthe fifth since 4.7). - LAZY_
KEY - The key marking a LAZY OWNER row (foreign-key elimination,
spec/surface§1, 3.0): the owner a reach-through hands out (_docon a block, node or edge;_blockon a node) carries only the columns the child row already knows —doc_id+path(from the child’sdoc_id/src_docand__path), orblock_id+doc_id+__path— tagged with the owner’s target, plus this key.getanswers_id,_path, the owner’s own foreign keys, its relations and its properties (which need only the id) from those columns and runs NO statement, exactly like the bare_doc_id; the first read of anything else (_format,_hash,_text, …) loads the full row ([StoreContext::owner_full], memoized per run). The port of the reference’slazyOwnerProxy. The marker is a tagged row to everything else (identity,render_row_values,materialize, hits) and the hidden key is stripped with the tag. - SCAN_
KEY - The key of a lazy ROOT SCAN marker:
{ "__oqx_scan": "docs" }stands for^docs/ a baredocsat the root until the engine reads it in row position (to_rows) or is about to observe it as a value (materialize— an operand, an argument, a projected item, a key), or probes it throughindex_for, in which case the scan never runs. The marker never reaches the language: the engine materializes every value it observes, so==,in,entries(…),size(…), truthiness,distinctandorder bysee the rows exactly as the reference’sProxyarray shows them. AValuehas no identity or laziness of its own, so this is the port of that handle. - SOURCE_
HANDLES - The source handles of a document (§1.2):
_datais the merged authored view (frontmatter + inline), the other two one source each. - TAG_KEY
- The hidden column tagging a store row with its target.
Functions§
- attributes
- The engine attributes per kind (
spec/surface§1.2 table). - glob_
to_ like - A
*glob as aLIKEpattern withESCAPE '\';escape_backslashalso escapes\(the list surfaces do,withindoes not). - handle_
source - The
properties.sourcea handle narrows a read to:_data→ both authored sources (None),_frontmatter/_inline→ that source. - reach_
throughs - The reach-through handles per kind (§1.2) — each a statically single row
of another kind:
_doc(the owning document; a revision’s current row; a link’s source),_block(a node’s or link’s source block),_dst(a link’s destination document). - render_
row_ values - §1.4 rows as values (1.2): a store row that surfaces as a VALUE in a result
tree — a nested
collect { }/first { }/single { }with an empty projection, or avaluesitem that is a row — renders as{ _id, _path }(5.0: the hit envelope’s own keys, spelled as the attributes; the target’s id column as a string; the owning document’s path in the reference form, §1 “Paths”: a docs row’spath, every other row’s__pathjoin column, rooted), never the store row. Everything else recurses, dropping the hidden tag asstrip_tags. - scan_of
- The target of a lazy root-scan marker, if
vis one. - strip_
tags - Strip the hidden tag from a value tree (the wire form never carries it).
- target_
of - The tag of a store row, if it is one.