utils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2018 License: Apache-2.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 EventListener

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

EventListener receives events from an EventWaiter.

func (*EventListener) Close

func (l *EventListener) Close()

Close stops listening for more events.

func (*EventListener) Inbox

func (l *EventListener) Inbox() <-chan eh.Event

Inbox returns the channel that events will be delivered on so that you can integrate into your own select() if needed.

func (*EventListener) Wait

func (l *EventListener) Wait(ctx context.Context) (eh.Event, error)

Wait waits for the event to arrive.

type EventWaiter

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

EventWaiter waits for certain events to match a criteria.

func NewEventWaiter

func NewEventWaiter() *EventWaiter

NewEventWaiter returns a new EventWaiter.

func (*EventWaiter) Listen

func (w *EventWaiter) Listen(ctx context.Context, match func(eh.Event) bool) (*EventListener, error)

Listen waits unil the match function returns true for an event, or the context deadline expires. The match function can be used to filter or otherwise select interesting events by analysing the event data.

func (*EventWaiter) Notify

func (w *EventWaiter) Notify(ctx context.Context, event eh.Event)

Notify implements the eventhorizon.EventObserver.Notify method which forwards events to the waiters so that they can match the events.

Jump to

Keyboard shortcuts

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