events

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

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

Broker fans out events to live subscribers and replays recent history to resuming ones. A single mutex guards nextID, history, AND subscribers so that Publish and subscribeFrom are strictly serialized: an event is either captured in a new subscriber's replay snapshot (published before the subscribe critical section) or fanned out to it (published after) — never both (which would double-deliver and break the client's per-frame ACK) and never neither (the delivery gap this collapse closes). Do not reintroduce a second lock: the fan-out below runs inside the critical section and relies on being serialized against subscriber registration/removal.

func NewBroker

func NewBroker() *Broker

func (*Broker) Publish

func (b *Broker) Publish(event protocol.Event)

func (*Broker) Subscribe

func (b *Broker) Subscribe(ctx context.Context) <-chan protocol.Event

func (*Broker) SubscribeFrom

func (b *Broker) SubscribeFrom(ctx context.Context, lastEventID string) <-chan protocol.Event

Jump to

Keyboard shortcuts

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