Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message interface {
// MarshallBinary serializes the message into a byte slice.
MarshallBinary() ([]byte, error)
// UnmarshallBinary deserializes the message from a byte slice.
UnmarshallBinary([]byte) error
}
Message is a message that can be sent over transport.
type ReceivedMessage ¶
type ReceivedMessage struct {
// Message contains the message content. It is nil when the Error field
// is not nil.
Message Message
// Author is the author of the message.
Author []byte
// Data contains an optional data associated with the message. A type of
// the data is different depending on a transport implementation.
Data any
// Error contains an optional error returned by transport layer.
Error error
}
ReceivedMessage contains a Message received from Transport.
type Transport ¶
type Transport interface {
supervisor.Service
// Broadcast sends a message with a given topic.
Broadcast(topic string, message Message) error
// Messages returns a channel for incoming messages. A new channel is
// created for each call, therefore this method should not be used in
// loops. In case of an error, an error will be returned in the
// ReceivedMessage structure.
Messages(topic string) <-chan ReceivedMessage
}
Transport implements a mechanism for exchanging messages between Oracles.
Click to show internal directories.
Click to hide internal directories.