Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AllMessagesMap = MessageMap{ messages.PriceV0MessageName: (*messages.Price)(nil), messages.PriceV1MessageName: (*messages.Price)(nil), messages.DataPointV1MessageName: (*messages.DataPoint)(nil), messages.GreetV1MessageName: (*messages.Greet)(nil), messages.MuSigStartV1MessageName: (*messages.MuSigInitialize)(nil), messages.MuSigTerminateV1MessageName: (*messages.MuSigTerminate)(nil), messages.MuSigCommitmentV1MessageName: (*messages.MuSigCommitment)(nil), messages.MuSigPartialSignatureV1MessageName: (*messages.MuSigPartialSignature)(nil), messages.MuSigSignatureV1MessageName: (*messages.MuSigSignature)(nil), }
Functions ¶
func ReceivedMessageFields ¶ added in v0.13.5
func ReceivedMessageFields(p ReceivedMessage) log.Fields
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 MessageMap ¶ added in v0.12.0
func (MessageMap) Keys ¶ added in v0.12.0
func (mm MessageMap) Keys() []string
Keys returns a sorted list of keys.
func (MessageMap) SelectByTopic ¶ added in v0.12.0
func (mm MessageMap) SelectByTopic(topics ...string) (MessageMap, error)
SelectByTopic returns a new MessageMap with messages selected by topic. Empty topic list will yield an empty map.
type Meta ¶ added in v0.11.0
type Meta struct {
Transport string `json:"transport"`
Topic string `json:"topic"`
MessageID string `json:"messageID"`
PeerID string `json:"peerID"`
PeerAddr string `json:"peerAddr"`
ReceivedFromPeerID string `json:"receivedFromPeerID"`
ReceivedFromPeerAddr string `json:"receivedFromPeerAddr"`
UserAgent string `json:"userAgent"`
}
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
// Meta contains optional information about the message.
Meta Meta
}
ReceivedMessage contains a Message received from Transport.
type Service ¶ added in v0.11.0
type Service interface {
supervisor.Service
Transport
}
Service implements a mechanism for exchanging messages between Oracles.
type Transport ¶
type Transport interface {
// 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
}
Click to show internal directories.
Click to hide internal directories.