waiter

package
v0.15.5 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventHandler

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

EventHandler waits for certain events to match a criteria.

func NewEventHandler

func NewEventHandler() *EventHandler

NewEventHandler returns a new EventHandler.

func (*EventHandler) HandleEvent

func (h *EventHandler) HandleEvent(ctx context.Context, event eh.Event) error

HandleEvent implements the HandleEvent method of the eventhorizon.EventHandler interface. It forwards events to the waiters so that they can match the events.

func (*EventHandler) HandlerType

func (h *EventHandler) HandlerType() eh.EventHandlerType

HandlerType implements the HandlerType method of the eventhorizon.EventHandler interface.

func (*EventHandler) Listen

func (h *EventHandler) Listen(match func(eh.Event) bool) *EventListener

Listen waits until 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.

type EventListener

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

EventListener receives events from an EventHandler.

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 or the context to be cancelled.

Jump to

Keyboard shortcuts

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