local

package
v0.23.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const TransportName = "local"

Variables

View Source
var ErrNotSubscribed = errors.New("topic is not subscribed")

Functions

This section is empty.

Types

type Local

type Local struct {
	// contains filtered or unexported fields
}

Local is a simple implementation of the transport.Transport interface using local channels.

func New

func New(author []byte, queue int, topics map[string]transport.Message) *Local

New returns a new instance of the Local structure. The created transport can queue as many unread messages as defined in the queue argument. The list of supported subscriptions must be given as a map in the topics argument, where the key is the name of the subscription topic, and the value of the map is type of the message given as a nil pointer, e.g.: (*Message)(nil).

func (*Local) Broadcast

func (l *Local) Broadcast(topic string, message transport.Message) error

Broadcast implements the transport.Transport interface.

func (*Local) Messages

func (l *Local) Messages(topic string) <-chan transport.ReceivedMessage

Messages implements the transport.Transport interface.

func (*Local) Start

func (l *Local) Start(ctx context.Context) error

Start implements the transport.Transport interface.

func (*Local) Wait

func (l *Local) Wait() <-chan error

Wait implements the transport.Transport interface.

func (*Local) WithAuthor added in v0.11.0

func (l *Local) WithAuthor(author []byte) *Local

Jump to

Keyboard shortcuts

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