Expand description
Worker pool with isolation primitives (plan #36).
Borrowed from MAX’s serve/worker_interface/. The serving
pattern: engines run in workers (eventually subprocesses); a
main router forwards requests via IPC. One worker crashing
doesn’t take the server down.
This module ships the in-process layer (testable, deterministic)
plus the trait surface that a future SubprocessWorker will
implement. The IPC plumbing (stdin/stdout JSON-lines, recovery
on crash) is intentionally out of scope until a serving binary
consumes it; we’d rather build it once against a real consumer
than build it twice.
Structs§
- InProcess
Worker - In-process worker — runs the handler closure inline. Useful for tests and for single-process serving. Tracks in-flight / completed / errored counts atomically.
- Worker
Health - Worker
Id - Stable worker identifier.
- Worker
Pool - Pool of workers. Generic over
(Req, Resp); works with theWorkertrait directly.
Enums§
- Dispatch
Policy - Pool dispatch policy.
- Worker
Error
Traits§
- Worker
- Trait every worker implements.
ReqandRespare caller-defined; the future subprocess flavour will use a serde-friendly wire type as both parameters.