Expand description

Handlers are divided per (sub)protocol and per Downstream/Upstream. Each (sup)protocol defines a handler for both the Upstream node and the Downstream node Handlers are a trait called Parse[Downstream/Upstream][(sub)protocol] (eg. ParseDownstreamCommonMessages).

When implemented, the handler makes the handle_message_[(sub)protoco](..) (e.g. handle_message_common(..)) function available.

The trait requires the implementer to define one function for each message type that a role defined by the (sub)protocol and the Upstream/Downstream state could receive.

This function will always take a mutable ref to self, a message payload + message type, and the routing logic. Using parsers in crate::parser, the payload and message type are parsed in an actual SV2 message. Routing logic is used in order to select the correct Downstream/Upstream to which the message must be relayed/sent. Routing logic is used to update the request id when needed. After that, the specific function for the message type (implemented by the implementer) is called with the SV2 message and the remote that must receive the message.

A Result<SendTo_, Error> is returned and it is the duty of the implementer to send the message.

Modules§

Enums§

  • Message is a serializable entity that rapresent the meanings of communication between Remote(s) SendTo_ is used to add context to Message, it say what we need to do with that Message.