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:
- 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.
- On intermediate nodes, the ErasedUnbound object is relayed. The muation is applied on its bindings field, if needed.
- 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.
- Erased
Unbound - Unbound, with its message type M erased through serialization.
- Indexed
Erased Unbound - 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 isBind
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 isUnbind
can extract a set of parameters from itself, and store inBindings
. The extracted parameters inBindings
can be independently manipulated, and then later reconstituted (rebound) into aT
-typed object again.