transport

package
v0.4.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2022 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message interface {
	MarshallBinary() ([]byte, error)
	UnmarshallBinary([]byte) error
}

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 ID of 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 interface{}
	// Error contains an optional error returned by transport.
	Error error
}

ReceivedMessage contains a Message received from Transport with an additional data.

type Transport

type Transport interface {
	// Broadcast sends a message with a given topic.
	Broadcast(topic string, message Message) error
	// Messages returns a channel that will deliver incoming messages.
	// In case of an error, error will be returned in a ReceivedMessage
	// structure.
	Messages(topic string) chan ReceivedMessage
	// Start starts listening for messages.
	Start() error
	// Wait waits until the context is canceled or until an error occurs.
	Wait() chan error
}

Transport is the interface for different implementations of a publish–subscribe messaging solutions for the Oracle network.

Directories

Path Synopsis
pb
p2p

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL