Expand description
Background WebAssembly workers for Oxide guest modules.
A worker is a separate .wasm module instantiated on its own OS thread with
its own Wasmtime [Store], fuel budget, and linear memory. It never shares
Rust types or memory with the spawning guest — communication is pure message
passing of byte slices, mirroring the rest of the FFI boundary.
The spawning (“parent”) guest calls:
api_spawn_worker(url)→ handleapi_worker_post_message(handle, bytes)— parent → worker inboxapi_worker_recv(handle)— drain one message from the worker’s outboxapi_worker_terminate(handle)
The worker module exports start_app() (run once on spawn) and optionally
on_message(len) (run for each inbound message). Inside on_message it reads
the payload with api_worker_message_read and replies with api_worker_post.
All of this is driven by polling from the guest’s frame loop, matching the WebSocket / fetch / RTC subsystems.
Structs§
- Worker
State - Registry of workers spawned by one guest. Lazily created on first spawn.
Functions§
- register_
worker_ functions - Register all
api_worker_*/api_spawn_workerhost functions.