eventbus

package
v1.14.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotStarted = errors.New("event broker has not been started")
)

Functions

This section is empty.

Types

type EventBus

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

EventBus contains the main logic of running an event broker for Vault. Start() must be called before the EventBus will accept events for sending.

func NewEventBus

func NewEventBus(logger hclog.Logger) (*EventBus, error)

func (*EventBus) SendInternal

func (bus *EventBus) SendInternal(ctx context.Context, ns *namespace.Namespace, pluginInfo *logical.EventPluginInfo, eventType logical.EventType, data *logical.EventData) error

SendInternal sends an event to the event bus and routes it to all relevant subscribers. This function does *not* wait for all subscribers to acknowledge before returning. This function is meant to be used by trusted internal code, so it can specify details like the namespace and plugin info. Events from plugins should be routed through WithPlugin(), which will populate the namespace and plugin info automatically.

func (*EventBus) SetSendTimeout

func (bus *EventBus) SetSendTimeout(timeout time.Duration)

SetSendTimeout sets the timeout of sending events. If the events are not accepted by the underlying channel before this timeout, then the channel closed.

func (*EventBus) Start

func (bus *EventBus) Start()

Start starts the event bus, allowing events to be written. It is not possible to stop or restart the event bus. It is safe to call Start() multiple times.

func (*EventBus) Subscribe

func (bus *EventBus) Subscribe(ctx context.Context, ns *namespace.Namespace, pattern string) (<-chan *eventlogger.Event, context.CancelFunc, error)

func (*EventBus) WithPlugin

func (bus *EventBus) WithPlugin(ns *namespace.Namespace, eventPluginInfo *logical.EventPluginInfo) (*pluginEventBus, error)

Jump to

Keyboard shortcuts

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