Skip to main content

Module core

Module core 

Source
Expand description

I/O-free query core: parse + solve + the v1 JSON wire shape, with no commitment to where the bytes go. Both the WASI/CLI shell (entry.rs, sink = stdout) and the Tier-2 reactor (reactor.rs, sink = a linear-memory buffer) call into here, so the JSON shape and the exhausted rule have a single source and can’t drift between the two transports (docs/design/done/WASM_TIER2_PLAN.md A1 / WASM.md finding #6). The shared core INVOCATION.md’s resident mode also wants is the same one.

Enums§

QueryResult
Outcome of running one query, with the prefixed message the v1 contract puts on the wire for the two failure classes. The caller maps these to its own surface — exit codes 2/3 for the CLI, an {"error":...} object for the reactor — but the message bytes are produced once, here.

Functions§

exhausted
The v1 exhausted flag: the search ran to completion unless a --limit stopped it exactly at the cap. Single-sourced so the CLI and the reactor compute it identically (finding #4 — the spike hard-coded true).
run_query
Parse q against the program in m, then solve it. The caller must have already reset per-query state and set the per-query limits; this consumes m.error on the error path so the message can be returned.
write_error_json
v1 error object: {"error":"<escaped message>"}. No trailing newline — the CLI appends one for stdout, the reactor returns the bytes as-is.
write_solutions_json
v1 success object: {"count":N,"exhausted":B,"solutions":[…]}, keys in serde_json sorted order. output, when Some, inserts an "output" field (sorts between exhausted and solutions) carrying captured write/1 bytes — the reactor uses it (no stdout in an isolate, D4); the CLI passes None because its output already streamed to stdout, keeping native bytes byte-identical to v1.