Expand description
§spacedb-query — SpaceDB Layer 4 (compute-to-data)
The environment forbids hauling data to a central brain, so SpaceDB inverts it: the query travels to the data; only the answer travels back. A query is a deterministic, fuel/memory-bounded WASM function that runs on the node holding the data — and because the runtime is deterministic, the result is corroboratable: a host that returns a different answer than its peers is caught.
M6-S1 ships the verifiable-compute core: FunctionRuntime (deterministic,
no-WASI WASM execution), the FunctionRun attestation, and corroborate.
The partition-aware planner + pinned-snapshot reads (S2) and the on-node vector
index (spacedb-vector, S3) build on this.
Open-core (MIT): built on wasmtime directly — the engine MATA’s
maestro-fn-runtime wraps — with no MATA dependency. Fanning corroboration
across independent marketplace hosts is the MATA seam; the runtime, the
attestation, and the comparison are here.
Structs§
- Coverage
- How much of the dataset the result actually covers — the honesty contract.
- CtxRights
- What the invoking capability lets the function do — checked on every host call. A function has exactly the caller’s rights, never more.
- Execution
- One execution: the answer the function produced, and the attestation proving it.
- Function
Ctx - The context one function invocation executes in: the pinned snapshot it reads, the write-set it accumulates, the rights it may exercise, and the collections it must be refused (zero-knowledge: the host holds ciphertext it provably cannot compute on — serving it to server-side code would break that promise).
- Function
Outcome - One completed function invocation: the execution (output + attestation, with the
snapshot hash bound into
input_digest) and the context carrying the write-set. - Function
Run - The deterministic record of one function execution. The fields are exactly what must match across honest hosts; nothing device-dependent (e.g. wall time) is included.
- Function
Runtime - A reusable compute-to-data engine. Construct once per host;
runis stateless apart from a compile cache keyed by the workload hash. - Pinned
Records - A
RecordSnapshotshared between the functions that run over it, with its content hash taken once. EveryFunctionCtxbuilt from it holds the same records (no clone per run) and the same hash (no re-hash per run). - Query
Outcome - The result of a query: the reduced output (if any shard contributed), the coverage, and the per-shard map attestations.
- Query
Plan - The query: a
mapover each shard’s snapshot and an associative/commutativereduceover the partials, both deployed as deterministic WASM. - RunLimits
- Per-invocation bounds. Both are deterministic — fuel is an instruction count; the memory cap is in whole MB — so they bound execution identically on every host.
- Shard
- One shard of a query’s data: a pinned snapshot, on a host that may be down.
- Snapshot
- A frozen view of one shard’s data at a frontier.
Enums§
- Corroboration
- The verdict of comparing two attestations of the same workload + input.
- Query
Error
Functions§
- corroborate
- Compare two attestations. Honest runs of the same
(workload, input)agree on all fields; any divergence (a wrong output, a padded fuel count) disagrees. - run_
query - Run
planovershards: map each reachable shard’s snapshot, then reduce the partials. Unreachable shards are skipped (lowering coverage, never failing the query); a map/reduce error on a reachable shard propagates (it signals a systemic deploy/ABI bug, since the same WASM runs everywhere).
Type Aliases§
- Query
Result - Record
Snapshot - A pinned record view:
(collection, record id) → value bytes, materialized at one frontier.BTreeMapso iteration (and every digest over it) is deterministic on every host.