Skip to main content

Dispatcher

Struct Dispatcher 

Source
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>

Source

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.

Source

pub const fn timed(&mut self) -> &mut TimedWindows<W>

The Timed windows, for the reaping and session-teardown a node owes them.

Source

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.

Trait Implementations§

Source§

impl<const W: usize> Debug for Dispatcher<W>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<const W: usize> Forget for Dispatcher<W>

§

impl<const W: usize> Freeze for Dispatcher<W>
where TimedWindows<W>: Freeze,

§

impl<const W: usize> Move for Dispatcher<W>

§

impl<const W: usize> RefUnwindSafe for Dispatcher<W>

§

impl<const W: usize> Send for Dispatcher<W>
where TimedWindows<W>: Send,

§

impl<const W: usize> Sync for Dispatcher<W>
where TimedWindows<W>: Sync,

§

impl<const W: usize> Unpin for Dispatcher<W>
where TimedWindows<W>: Unpin,

§

impl<const W: usize> UnsafeUnpin for Dispatcher<W>

§

impl<const W: usize> UnwindSafe for Dispatcher<W>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.