broadcast

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: MIT Imports: 4 Imported by: 1

README

broadcast

Go Reference Tests

A library that provides broadcast channels (one to many).

I'll write up some examples and docs later, for now I only extracted it from OvenCast which the package was originally created for.

Probably not production-ready.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

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

func NewChannel

func NewChannel[T any]() *Channel[T]

func (*Channel[T]) Broadcast

func (c *Channel[T]) Broadcast(ctx context.Context, m T) error

func (*Channel[T]) Ch

func (c *Channel[T]) Ch() chan<- T

func (*Channel[T]) Close

func (c *Channel[T]) Close(ctx context.Context) error

func (*Channel[T]) Run

func (c *Channel[T]) Run(ctx context.Context)

func (*Channel[T]) Running

func (c *Channel[T]) Running() bool

func (*Channel[T]) SubCount

func (c *Channel[T]) SubCount(ctx context.Context) (int, error)

func (*Channel[T]) Subscribe

func (c *Channel[T]) Subscribe(ctx context.Context) (Sub[T], error)

type Sub added in v0.1.2

type Sub[T any] interface {
	Ch() <-chan T
	Unsubscribe(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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