events

package
v0.0.0-...-bc5839e Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Events

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

Events is pubsub channel for events generated by the engine.

func NewEvents

func NewEvents() *Events

NewEvents return a new Events instance

func (*Events) Publish

func (e *Events) Publish(ctx context.Context, action string, eventType types.EventType, actor *types.EventsActor) error

Publish 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 (*Events) Subscribe

func (e *Events) Subscribe(ctx context.Context, since, until time.Time, ef *Filter) ([]types.EventsMessage, <-chan *types.EventsMessage, <-chan error)

Subscribe to events on the Events. 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 Args. Only events that match *any* of the provided filters will be sent on the channel.

type Filter

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

Filter uses to filter out pouch events from a stream

func NewFilter

func NewFilter(filter filters.Args) *Filter

NewFilter initializes a new Filter.

func (*Filter) Match

func (ef *Filter) Match(ev types.EventsMessage) bool

Match returns true when the event ev is included by the filters

Jump to

Keyboard shortcuts

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