Documentation ¶
Index ¶
- Variables
- type EventBus
- func (bus *EventBus) SendInternal(ctx context.Context, ns *namespace.Namespace, ...) error
- func (bus *EventBus) SetSendTimeout(timeout time.Duration)
- func (bus *EventBus) Start()
- func (bus *EventBus) Subscribe(ctx context.Context, ns *namespace.Namespace, pattern string) (<-chan *eventlogger.Event, context.CancelFunc, error)
- func (bus *EventBus) WithPlugin(ns *namespace.Namespace, eventPluginInfo *logical.EventPluginInfo) (*pluginEventBus, error)
Constants ¶
This section is empty.
Variables ¶
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 (*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 ¶
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.