backend

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2019 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// Subscribe returns a new Subscription iterator for `topic`.
	Subscribe(ctx context.Context, topic string) (Subscription, error)
	// PublishEvent sends `data` to all listening remotes on `topic`.
	PublishEvent(topic string, data []byte) error
}

Backend is the backend that backends of the event subsystem must fulfill.

type Message

type Message interface {
	// Data is the data that is sent alongside the message.
	Data() []byte
	// Source is the addr of the remote.
	Source() string
}

Message is returned by Subscribe. It encapsulates a single event message coming from another remote.

type Subscription

type Subscription interface {
	io.Closer

	// Next blocks until receiving a new message or fails with
	// context.Canceled if the cancel func was called.
	Next(ctx context.Context) (Message, error)
}

Subscription is an iterator like interface for accessing and listening for messages from other remotes.

Jump to

Keyboard shortcuts

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