bus

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package bus is a fan-out event bus with bounded per-subscriber queues. A slow subscriber loses events (and is told so) instead of stalling the proxy.

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 publishes flow events to subscribers.

func New

func New() *Bus

New creates a bus.

func (*Bus) Publish

func (b *Bus) Publish(ev flow.Event)

Publish stamps and fans out an event. Never blocks.

func (*Bus) Seq

func (b *Bus) Seq() uint64

Seq returns the last published sequence number.

func (*Bus) Subscribe

func (b *Bus) Subscribe(size int, filter func(flow.Event) bool) *Subscriber

Subscribe registers a subscriber with the given queue size. filter may be nil.

type Subscriber

type Subscriber struct {
	C chan flow.Event
	// contains filtered or unexported fields
}

Subscriber receives events on C. If its queue fills, older events are dropped and a single EvDropped event is coalesced in front.

func (*Subscriber) Close

func (s *Subscriber) Close()

Close unsubscribes. C is closed; pending events are discarded.

Jump to

Keyboard shortcuts

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