Expand description
Inter-thread communication primitives.
Each session::Session owns a dedicated background
thread that processes Commands serially. The HTTP / WebSocket /
MCP-side handlers run on the tokio runtime and need to ship a
Command into that thread plus get a stream of Responses back.
CentralCommand is the thin abstraction that wires that up: a single
[tokio::sync::mpsc::unbounded_channel] from handlers to the background
loop, plus a per-request reply channel attached to each command. This
keeps every request’s responses isolated from every other request’s,
while still serialising work inside a session.
Structs§
- Central
Command - This struct contains the senders and receivers necessary to communicate between both threads.
Constants§
- THREADS_
COMMUNICATION_ ERROR - Panic message used when a receiver yields
None(the background thread dropped the sender, which means it crashed or exited unexpectedly). - THREADS_
SENDER_ ERROR - Panic message used when a
sendinto the inter-thread channel fails (the receiver was dropped before we could deliver the message).
Type Aliases§
- Thread
Receiver 🔒 - Custom type for the thread receiver, so clippy doesn’t complain about long types.