eventbus

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package eventbus provides internal fan-out event delivery to multiple subscribers. It is the mechanism behind monitor.MultiSink.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

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

Bus delivers monitor.Event values sequentially to all registered subscribers. Errors from individual subscribers are joined and returned from Publish. All methods are safe for concurrent use.

func New

func New() *Bus

New returns an empty Bus ready for use.

func (*Bus) Publish

func (b *Bus) Publish(ctx context.Context, ev monitor.Event) error

Publish delivers ev to every currently registered subscriber in registration order. Delivery is sequential. A subscriber error does not stop delivery to remaining subscribers. All errors are joined and returned.

func (*Bus) Subscribe

func (b *Bus) Subscribe(sink monitor.EventSink) (unsubscribe func())

Subscribe registers sink for future events and returns a function that removes the registration. Calling the returned function more than once is safe and has no effect after the first call.

Jump to

Keyboard shortcuts

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