events

package
v1.0.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2017 License: Apache-2.0, CC-BY-SA-4.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface{}

type Exchange

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

func NewExchange

func NewExchange() *Exchange

func (*Exchange) Forward

func (e *Exchange) Forward(ctx context.Context, envelope *events.Envelope) (err error)

Forward accepts an envelope to be direcly distributed on the exchange.

This is useful when an event is forwaded on behalf of another namespace or when the event is propagated on behalf of another publisher.

func (*Exchange) Publish

func (e *Exchange) Publish(ctx context.Context, topic string, event Event) (err error)

Publish packages and sends an event. The caller will be considered the initial publisher of the event. This means the timestamp will be calculated at this point and this method may read from the calling context.

func (*Exchange) Subscribe

func (e *Exchange) Subscribe(ctx context.Context, fs ...string) (ch <-chan *events.Envelope, errs <-chan error)

Subscribe to events on the exchange. Events are sent through the returned channel ch. If an error is encountered, it will be sent on channel errs and errs will be closed. To end the subscription, cancel the provided context.

Zero or more filters may be provided as strings. Only events that match *any* of the provided filters will be sent on the channel. The filters use the standard containerd filters package syntax.

type Forwarder

type Forwarder interface {
	Forward(ctx context.Context, envelope *events.Envelope) error
}

type Publisher

type Publisher interface {
	Publish(ctx context.Context, topic string, event Event) error
}

Publisher posts the event.

type Subscriber

type Subscriber interface {
	Subscribe(ctx context.Context, filters ...string) (ch <-chan *events.Envelope, errs <-chan error)
}

Jump to

Keyboard shortcuts

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