Skip to main content

Module pump

Module pump 

Source
Expand description

The two tasks that move frames, and the dispatcher between them.

  • The writer drains the outgoing channel onto the socket, one frame at a time, and ends when the channel closes.
  • The reader decodes frames and hands each NodeEvent to dispatch, then closes the session when the socket ends.

dispatch is deliberately a free function over shared state rather than a method on a task: the testing harness calls it directly to inject an event, and the operator runtime will call it to fan one event out to several operators. There is exactly one implementation of “what does this event mean to a node”, and everything uses it.

§What the node never sees

Three events are handled entirely inside the session and are not delivered to the node’s stream:

EventHandled by
RegisteredThe init handshake, before the pump starts
ExtValueWhoever called crate::Node::ext_load
RouteUpgrade / RouteDowngradeThe RouteTable, which also sends the ack (§6.3)
InputRouteUpgrade / InputRouteDowngradeThe InputRouteTable, which attaches or detaches the ring (§6.3)

Everything else reaches the node, because everything else is something a node might reasonably act on.

The two route pairs are the same handshake seen from its two ends, and neither reaches the node’s stream: a route changing plane is not an event an application acts on, it is a change in how the events it does act on are carried. What a node sees is crate::Payload::is_zero_copy turning true.

Structs§

SessionTasks
The join handles of a running session.

Functions§

dispatch
Turns one NodeEvent into whatever it means for this node.
handle_frame
Decodes one frame and dispatches it.
spawn
Starts the reader and writer tasks for an established link.