Skip to main content

Module runner

Module runner 

Source
Expand description

The history-run seam — the async RUN machine behind a trait, mirroring the platform-seam shape of brep-app/src/store.rs’s ModelStore (a trait with impls behind it, async surfaced via a poll idiom).

A history run is split SUBMIT → POLL/APPLY: HistoryRunner::submit_run kicks off a run tagged with a monotonic generation, and the completed RunReply is drained later via HistoryRunner::poll_run. The runner OWNS the SceneRunner — so a future thread/worker impl owns the resident registry that execute_history populates — and holds the delta baseline across reruns.

This slice ships the DEFAULT InlineRunner: it runs on submit_run and stashes the reply for an immediate poll_run, so the run stays synchronous and byte-identical to the pre-seam in-process run. A native-thread impl (M2b) and a wasm-worker impl (M3) slot in behind the SAME trait — submit_run defers the work and poll_run surfaces it a frame (or many) later, so the EngineState::pump caller never changes.

Structs§

InlineRunner
The default, SYNCHRONOUS runner: runs on submit, stashes the reply for an immediate poll. Behavior-identical to the pre-seam in-process run.
MeasureQuery
A per-object MEASUREMENT request routed to the runner (which owns the warm registry). The runner resolves owner to its resident handle and measures by kind; the reply is the object-info JSON fragment MINUS the main-injected name/creatingFeature fields. Tagged with a monotonic id so the main side can pair the reply with its pending request.
MeasureReply
A completed MeasureQuery: the object-info measurement fields as a JSON fragment (WITHOUT name/creatingFeature, which the main thread injects from its eager provenance), tagged with the request id.
RunReply
A completed history run, tagged with the generation it was submitted under so the applier can drop stale replies (a newer run that finished first). The output is the SceneRunner delta to apply to the display scene.
ThreadRunner
The persistent-thread runner. submit_*/reset push Commands down the channel; poll_* first DRAIN every ready Reply into the two demux buffers, then pop the matching one. The SceneRunner (and thus the kernel’s resident registry it warms) lives ENTIRELY on the thread — it is never shared — so the only cross-thread traffic is the Send command/reply payloads.

Enums§

Command
A command sent main → runner (thread channel OR worker postMessage) over one ordered stream (so a Reset before a Run stays before it). Run carries the whole request; the driver coalesces consecutive Runs to shed a slider drag’s backlog (the thread in thread_main, the worker’s main side in WorkerRunner).
MeasureKind
Which exact measurement a MeasureQuery wants, mirroring the object-info kinds (crate::metadata): a whole solid, one named face, or one named edge.
Reply
A reply sent runner → main; the main side demuxes it into per-kind buffers so poll_run/poll_query each pop their own stream.

Traits§

HistoryRunner
The history-run seam: SUBMIT a run, POLL for its completed reply, RESET the delta baseline, plus a QUERY channel for per-object measurements (routed to the runner so the warm registry answers them, never the cold main-side one). The Inline impl runs everything synchronously; a later thread/worker impl defers the work and surfaces the replies through the same poll idiom.

Functions§

process_command
Execute ONE Command against runner and return the Reply it produces, if any. The shared step both async drivers run: the native [thread_main] calls it for each (post-coalescing) command on the runner thread; the wasm WorkerRunner’s worker_entry calls it per postMessage on the worker. Run → a Reply::Run; Query → a Reply::Query; Reset drops the delta baseline AND the runner’s OWN kernel history cache (the resident registry lives with the runner — thread or worker — not on main) and yields no reply.