pub struct WorkerExchange {
pub handle: Handle,
pub senders: HashMap<WorkerId, LinkSender>,
pub receivers: Vec<LinkReceiver>,
}Expand description
This worker’s exchange endpoints for a multi-process run: one LinkSender per peer worker it
sends to, and one LinkReceiver per peer it receives from (established by the membership
handshake before start). Graph::start runs with none of this — a single-worker run where
every edge is a local SyncSender; the multi-process path is Graph::start_worker, which
derives the actual edge wiring from the placement.
The mechanism is identical either way — an out-edge is a bounded SyncSender, drained by the
dest task (local) or by an OutboundBridge (remote); an InboundBridge delivers a decoded
(edge, msg) into the local dest inbox exactly as a local outlet would. Edge ids agree across
workers because every worker builds the same graph in the same order, so the edge on the wire
names the same logical edge — and thus the same dest task — on both ends.
Fields§
§handle: HandleThe tokio runtime the bridges drive (block_on). Must be multi-threaded: its workers run
the links’ socket tasks while the bridge threads block on them.
senders: HashMap<WorkerId, LinkSender>A link to each peer worker this worker sends edges to, keyed by that worker’s id.
receivers: Vec<LinkReceiver>A link from each peer this worker receives edges from; each delivers its frames as
(edge, msg) into local inboxes, routed by the edge’s target task.