bcast

package
v0.0.0-...-58fde17 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bcast

type Bcast[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](msg <-chan T) *Bcast[T]

func (*Bcast[T]) Close

func (b *Bcast[T]) Close()

Close stops further broadcasting. Existing subscribers will be closed. Multiple Close calls are safe.

func (*Bcast[T]) Run

func (b *Bcast[T]) Run(ctx context.Context, lg *slog.Logger)

This should be called in a goroutine. It will exit when both - Close has being called on Bcast - the msg channel is closed This should be run in a separate goroutine

func (*Bcast[T]) Subscribe

func (b *Bcast[T]) Subscribe() <-chan T

func (*Bcast[T]) Unsubscribe

func (b *Bcast[T]) Unsubscribe(ch <-chan T)

Jump to

Keyboard shortcuts

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