events

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package events contains a manager for dispatching and receiving arbitrary events.

Index

Constants

View Source
const (
	EnvoyConfigurationEvent_EVENT_DISCOVERY_REQUEST_ACK  = events.EnvoyConfigurationEvent_EVENT_DISCOVERY_REQUEST_ACK  // nolint
	EnvoyConfigurationEvent_EVENT_DISCOVERY_REQUEST_NACK = events.EnvoyConfigurationEvent_EVENT_DISCOVERY_REQUEST_NACK // nolint
	EnvoyConfigurationEvent_EVENT_DISCOVERY_RESPONSE     = events.EnvoyConfigurationEvent_EVENT_DISCOVERY_RESPONSE     // nolint
)

re-exported protobuf constants

Variables

This section is empty.

Functions

func Dispatch

func Dispatch(evt Event)

Dispatch dispatches an event to any event sinks.

func Unregister

func Unregister(sinkHandle EventSinkHandle)

Unregister unregisters a sink so it will no longer receive events.

Types

type EnvoyConfigurationEvent

type EnvoyConfigurationEvent = events.EnvoyConfigurationEvent

EnvoyConfigurationEvent re-exports events.EnvoyConfigurationEvent.

type Event

type Event interface {
	proto.Message
	GetTime() *timestamppb.Timestamp
	GetMessage() string
}

An Event is any protobuf message that has a time and message.

type EventSink

type EventSink func(Event)

An EventSink receives events.

type EventSinkHandle

type EventSinkHandle string

An EventSinkHandle is a reference to a registered EventSink so that it can be unregistered.

func Register

func Register(sink EventSink) EventSinkHandle

Register registers a new sink to receive events.

type LastError

type LastError = events.LastError

LastError re-exports events.LastError.

type Manager

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

A Manager manages the dispatching of events to event sinks.

func New

func New() *Manager

New creates a new Manager.

func (*Manager) Dispatch

func (mgr *Manager) Dispatch(evt Event)

Dispatch dispatches an event to any registered event sinks.

func (*Manager) Register

func (mgr *Manager) Register(sink EventSink) (handle EventSinkHandle)

Register registers an event sink to receive events.

func (*Manager) Unregister

func (mgr *Manager) Unregister(sinkHandle EventSinkHandle)

Unregister unregisters an event sink so it no longer receives events.

Jump to

Keyboard shortcuts

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