pub enum Served<'a> {
Reply {
opcode: u8,
len: usize,
more_chunks: bool,
},
Subscribe(SubscribeRequest<'a>),
Silent,
Unhandled {
opcode: u8,
},
}Expand description
What the caller should do with the result of a dispatch.
Deliberately not #[non_exhaustive]. Every variant demands a different action from the
caller, so a wildcard arm is a silent bug rather than forward compatibility: a node that
matched _ => {} would answer a new action with silence. Adding a variant here is a
breaking change, and should be.
Variants§
Reply
Send buf[..len] back on the same exchange, with this opcode.
Fields
more_chunks: boolWhether the message set MoreChunkedMessages (§10.2.3).
When set, the read is not finished: §10.2.3 requires the client’s StatusResponse
before the next message, so the caller sends this one, waits for it, and dispatches
again with the same ReadCursor.
Subscribe(SubscribeRequest<'a>)
A SubscribeRequest, decoded and handed on.
Subscriptions are the one action whose state is not the dispatcher’s: it lives in
SubscriptionTable, outlives the exchange,
and is driven by a reporting engine rather than by a reply. So this is where the
dispatcher stops.
Silent
Nothing to send: the action was suppressed or groupcast (§8.7.2.3).
Unhandled
Not an action this layer serves — a response opcode, or one from a newer revision.
The one that matters in practice is StatusResponse: §10.2.3 makes it the client’s
acknowledgement of a chunk, so a caller holding a ReadCursor that is not
ReadCursor::is_done answers it by dispatching the same read again rather than by
treating it as a new action.
§8.2.5.1 makes an unexpected action INVALID_ACTION, but a response opcode on an
exchange this node initiated is not unexpected at all, and the dispatcher cannot tell
the two apart without knowing which role it holds. So it says what it saw and lets the
caller, which does know, decide.