Documentation ¶
Overview ¶
Package types implements the packet and handshake messages for the tree routing algorithm.
The messages have been implemented in this isolated package so that it does not create cycle imports when importing the serde formats.
Documentation Last Review: 06.10.2020
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHandshakeFormat ¶
func RegisterHandshakeFormat(f serde.Format, e serde.FormatEngine)
RegisterHandshakeFormat registers the engine for the provided format.
func RegisterPacketFormat ¶
func RegisterPacketFormat(c serde.Format, f serde.FormatEngine)
RegisterPacketFormat registers the engine for the provided format.
Types ¶
type Handshake ¶
type Handshake struct {
// contains filtered or unexported fields
}
Handshake is a message to send the initial parameters of a routing table.
- implements serde.Message
func NewHandshake ¶
NewHandshake returns a new handshake message.
func (Handshake) GetAddresses ¶
GetAddresses returns the list of addresses to route.
type HandshakeFactory ¶
type HandshakeFactory struct {
// contains filtered or unexported fields
}
HandshakeFactory is a factory to serialize and deserialize handshake messages.
- implements router.HandshakeFactory
func NewHandshakeFactory ¶
func NewHandshakeFactory(addrFac mino.AddressFactory) HandshakeFactory
NewHandshakeFactory creates a new factory.
func (HandshakeFactory) Deserialize ¶
Deserialize implements serde.Factory. It populates the handshake if appropriate, otherwise it returns an error.
func (HandshakeFactory) HandshakeOf ¶
HandshakeOf implements router.HandshakeFactory. It populates the handshake if appropriate, otherwise it returns an error.
type Packet ¶
type Packet struct {
// contains filtered or unexported fields
}
Packet describes a tree routing packet
- implements router.Packet
func (*Packet) Add ¶
Add appends the address to the destination list, only if it does not exist already.
func (*Packet) GetDestination ¶
GetDestination implements router.Packet. It returns a list of addresses where the packet should be send to.
func (*Packet) GetMessage ¶
GetMessage implements router.Packet. It returns the byte buffer of the message.
func (*Packet) GetSource ¶
GetSource implements router.Packet. It returns the source address of the packet.
type PacketFactory ¶
type PacketFactory struct {
// contains filtered or unexported fields
}
PacketFactory is a factory for the packet.
- implements serde.Factory
func NewPacketFactory ¶
func NewPacketFactory(f mino.AddressFactory) PacketFactory
NewPacketFactory returns a factory for the packet.
func (PacketFactory) Deserialize ¶
Deserialize implements serde.Factory. It populates the packet associated with the data if appropriate, otherwise it returns an error.