pub struct Dispatcher<const W: usize> { /* private fields */ }Expand description
The opcode-to-action layer of §8.7 and §8.8, and the state its rules need.
W is how many Timed transactions may be open at once — §8.7.4’s windows, one per
(session, exchange).
Implementations§
Source§impl<const W: usize> Dispatcher<W>
impl<const W: usize> Dispatcher<W>
Sourcepub const fn new(max_paths_per_invoke: u16) -> Self
pub const fn new(max_paths_per_invoke: u16) -> Self
A dispatcher that enforces max_paths_per_invoke on incoming invokes.
The value must be the one the node’s Basic Information cluster advertises (§11.1.5.23), or the node promises one thing and enforces another.
Zero is raised to one. §11.1.5.23 constrains the attribute to min 1, so zero is not a
value a node may advertise — but it is what an uninitialised field holds, and a
dispatcher that took it at its word would answer every invoke INVALID_ACTION and look
like a data-model fault rather than a typo.
Sourcepub const fn timed(&mut self) -> &mut TimedWindows<W>
pub const fn timed(&mut self) -> &mut TimedWindows<W>
The Timed windows, for the reaping and session-teardown a node owes them.
Sourcepub fn dispatch<'a, A: AccessControl, H: ClusterHandler>(
&mut self,
server: &Server<'_, A, H>,
request: Request<'a>,
ctx: &InteractionContext<'_>,
cursor: &mut ReadCursor,
scratch: &mut [u8],
buf: &mut [u8],
) -> Result<Served<'a>>
pub fn dispatch<'a, A: AccessControl, H: ClusterHandler>( &mut self, server: &Server<'_, A, H>, request: Request<'a>, ctx: &InteractionContext<'_>, cursor: &mut ReadCursor, scratch: &mut [u8], buf: &mut [u8], ) -> Result<Served<'a>>
Serves one message, returning what to send back.
ctx supplies the facts about the session that the action does not carry — the
accessing fabric, the clock, whether the transport is large-message capable. Its
timed field is overwritten from §8.7.4’s window
rather than read: whether an action is part of a Timed transaction is a property of the
exchange’s history, which only this layer knows, and a caller that set it by hand would
be guessing.
cursor carries a chunked read between messages and is ReadCursor::START for a new
one. One cursor belongs to one exchange.
§Errors
A malformed message is an Error — the decoders’ own verdict. §8.2.5.1
makes that INVALID_ACTION on the wire, which the caller sends; the dispatcher does not
invent a status for bytes it could not parse.