Executors
WBS dispatches Tasks to Executors. An Executor knows how to do particular types of Tasks, and can provide any additional context.
Executors are the small set of built-in operations that can touch the outside world or run programs. They are the only place where a computation can do something non-deterministic (like use the network), and each is designed so that its successful outputs are fully determined by its inputs.
The persistent task cache and single-flight coordination live in
src/sys/exec.zig: its Executor wraps the concrete executor behind a
Backend interface and owns the cache. The executors under src/exec are
backend implementations and never touch LMDB or the task cache.
Want Executor
Tasks directly related to planning, building, or manipulating files are executed by the Want Executor.
Here are a few examples:
want.pickextracts a subpath from a WantFS instance and returns a new instance containing just the subpath shifted to the root.want.placeis the inverse of pick: it mounts a segment under a path, prefixing every entry's path.want.assemblefsassembles named single-file segments into one tree.want.buildbuilds a want module provided as a WantFS instance.want.planis the planning portion of the build, separated so that it can be cached separately.
I/O Executor
This executor performs all input and output tasks. If something is incoming or outgoing to/from the build system, then it goes through this executor.
Linux Executor
This executor spawns Linux containers to execute tasks. Think of this as "Linux as a Service".
VM Executor
This executor runs hardware virtual machines with crosvm (https://crosvm.dev).
vm.amd64 boots an amd64 guest from a kernel, an optional initrd, any block
devices the task provides, and any virtio-fs shares it exposes (read-only
snapshots of stored trees, fresh host-disk scratch, or a named cache
persisted across runs), all as WantFS segments.
A task may declare at most one output — a fresh disk or an empty share — which
is captured back into WantFS when the guest stops.
A task may also declare network interfaces. Each becomes a virtio-net device
whose queues crosvm exports to a vhost-user-net backend the executor runs; the
backend moves the frames to the userspace IPv4 stack (usnet), so a guest
reaches the host network with no TAP and no host networking privileges. The
internet and log capability ports resolve exactly as for linux.cspawn,
and a task with a network interface is never cached.
Every run also attaches a vhost-user-console device with two ports named
stdout and stderr. A guest's init can open them (the vmzig init does) so
the process's two streams land in the job's stdout and stderr logs rather
than being merged into the serial console; the kernel's serial console and
crosvm's own diagnostics go to console and vmm.
Think of this as "Linux as a Service", with the guest kernel coming from the
task instead of the host.
Wasm Executor
This executor runs WebAssembly programs.
MVM Executor
This executor performs computations defined in the Mycelium format.
Mycelium Procs can be applied to data with mvm.apply.
Mycelium Lazys can be evaluated with mvm.eval.
All of the want files are evaluated using this executor.
Spore Executor
This executor calls into the Spore compiler. It is used to compile want files, module configuration files, and Spore libraries into Mycelium programs, which can be executed by the MVM executor.