Documentation
¶
Overview ¶
Package broadcast provides a concurrent-producer, multi-consumer ring buffer for broadcasting state snapshots.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Topic ¶
type Topic[T any] struct { // contains filtered or unexported fields }
Topic is a multi-consumer ring buffer with serialized concurrent publishers. Consumers maintain private cursors.
func NewTopic ¶
NewTopic creates a topic with a power-of-two capacity. It returns nil when the requested capacity exceeds the supported maximum; use NewTopicChecked when the caller needs the error.
func NewTopicChecked ¶ added in v0.37.0
NewTopicChecked creates a topic and reports unsupported capacities.
func (*Topic[T]) Publish ¶
func (t *Topic[T]) Publish(msg T)
Publish stores a message and increments the sequence. Concurrent publishers are serialized; consumers may read concurrently with publishers.