Module message

Source
Expand description

This module provides a framework for mutating serialized messages without the need to deserialize them. This capability is useful when sending messages to a remote destination throughout intermeidate nodes, where the intermediate nodes do not contain the message’s type information.

Briefly, it works by following these steps:

  1. On the sender side, mutable information is extracted from the typed message through Unbind, and stored in a Bindings object. This object is bundled with the serialized message in an ErasedUnbound object, which is sent over the wire.
  2. On intermediate nodes, the ErasedUnbound object is relayed. The muation is applied on its bindings field, if needed.
  3. One the receiver side, the ErasedUnbound object is received as IndexedErasedUnbound, where the type information is restored. Mutated information contained in its bindings field is applied to the message through Bind, which results in the final typed message.

One main use case of this framework is to mutate the reply ports of a muticast message, so the replies can be relayed through intermediate nodes, rather than directly sent to the original sender. Therefore, a Castable trait is defined, which collects requirements for message types using multicast.

Structs§

Bindings
Information extracted from a message through Unbind, which can be merged back to the message through Bind.
ErasedUnbound
Unbound, with its message type M erased through serialization.
IndexedErasedUnbound
Type used for indexing an erased unbound. Has the same serialized representation as ErasedUnbound.
Unbound
An object contains a message, and its bindings extracted through Unbind.

Traits§

Bind
An object T that is Bind can bind a set of externally provided parameters into itself.
Castable
This trait collects the necessary requirements for messages that are can be cast.
Unbind
An object T that is Unbind can extract a set of parameters from itself, and store in Bindings. The extracted parameters in Bindings can be independently manipulated, and then later reconstituted (rebound) into a T-typed object again.