events

package
v1.0.39 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

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
}

A generic fan-out event dispatcher

func NewBus

func NewBus(log *logger.Logger) *Bus

Creates an empty event bus

func (*Bus) Emit

func (b *Bus) Emit(ctx context.Context, event Event)

Delivers an event to all registered handlers in registration order

func (*Bus) Subscribe

func (b *Bus) Subscribe(h Handler)

Registers a handler to receive every emitted event

type Event

type Event struct {
	Type     v1.TriggeredEventType
	ServerID string
	Data     map[string]any
}

A single server lifecycle event

type Handler

type Handler func(ctx context.Context, event Event)

Handler reacts to an emitted event NOTE: Handlers are invoked synchronously and must return promptly!

Jump to

Keyboard shortcuts

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