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§
- Inline
Runner - The default, SYNCHRONOUS runner: runs on submit, stashes the reply for an immediate poll. Behavior-identical to the pre-seam in-process run.
- Measure
Query - A per-object MEASUREMENT request routed to the runner (which owns the warm
registry). The runner resolves
ownerto its resident handle and measures bykind; the reply is the object-info JSON fragment MINUS the main-injectedname/creatingFeaturefields. Tagged with a monotonicidso the main side can pair the reply with its pending request. - Measure
Reply - A completed
MeasureQuery: the object-info measurement fields as a JSON fragment (WITHOUTname/creatingFeature, which the main thread injects from its eager provenance), tagged with the requestid. - Mesh
Import Reply - Completed off-thread reconstruction. Success carries validated STEP and diagnostics for a preview or an ordinary IMPORT3D history insertion.
- Mesh
Import Request - A mesh reconstruction request. The byte payload moves to the native thread or is serialized to the browser worker; no parsing or fitting happens on UI.
- RunProgress
- A feature about to EXECUTE inside an in-flight run (cached replays are instant and are not reported): which one, of how many, under which generation. Posted by the runner before the kernel starts the feature, so the UI can name what it is waiting on — and, after a cancel, what it was waiting on.
- RunReply
- A completed history run, tagged with the
generationit was submitted under so the applier can drop stale replies (a newer run that finished first). Theoutputis theSceneRunnerdelta to apply to the display scene. - Step
Probe Reply - The probe’s answer: the parsed assembly (
Some), no structure (None), or a parse failure. The assembly crosses back to the main side whole — its JSON is large (74 MB for the file above) but the trip costs a third of a second against the seconds the parse took. - Step
Probe Request - A STEP text to PROBE for product structure on the runner — the parse that
brep_kernel::read_step_assemblyperforms, which builds every product’s bodies and takes seconds on a real assembly (8.3 s natively for a 5 MB, 140-product file), so it must not run on the browser’s main thread. - StlConversion
Options - Controls recognition and STEP topology construction.
- StlConversion
Output - STEP text and its complete conversion report.
- Thread
Runner - The persistent-thread runner.
submit_*/resetpushCommands down the channel;poll_*first DRAIN every readyReplyinto the two demux buffers, then pop the matching one. TheSceneRunner(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 theSendcommand/reply payloads.
Enums§
- Command
- A command sent main → runner (thread channel OR worker
postMessage) over one ordered stream (so aResetbefore aRunstays before it).Runcarries the whole request; the driver coalesces consecutiveRuns to shed a slider drag’s backlog (the thread inthread_main, the worker’s main side inWorkerRunner). - Conversion
Policy - Whether an unprovable analytic conversion may preserve the mesh as a repaired faceted STEP solid.
- Measure
Kind - Which exact measurement a
MeasureQuerywants, mirroring the object-info kinds (crate::metadata): a whole solid, one named face, or one named edge. - Mesh
Import Format - Mesh encoding accepted by the off-thread reconstruction channel.
- Reply
- A reply sent runner → main; the main side demuxes it into per-kind buffers.
Traits§
- History
Runner - 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
Commandagainstrunnerand return theReplyit 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 wasmWorkerRunner’sworker_entrycalls it perpostMessageon the worker.Run→ aReply::Run;Query→ aReply::Query;Resetdrops 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.