eventstream

package
v0.0.0-...-fd00b2c Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUBSCRIBE cmd = iota
	SEND
	LEAVE
	SHUTDOWN
	INIT
)
View Source
const TIMEOUT = time.Millisecond * 100

Variables

This section is empty.

Functions

This section is empty.

Types

type EventStream

type EventStream[M any] struct {

	// FallbehindFn holds a function that is called when a subscriber falls behind
	// and isn't keeping up with SENDs
	FallbehindFn func(chan M, M)
	// contains filtered or unexported fields
}

func NewEventStream

func NewEventStream[M any](initial M) *EventStream[M]

func (*EventStream[M]) Leave

func (es *EventStream[M]) Leave(ch chan M)

func (*EventStream[M]) Send

func (es *EventStream[M]) Send(m M)

func (*EventStream[M]) Shutdown

func (es *EventStream[M]) Shutdown()

func (*EventStream[M]) Sub

func (es *EventStream[M]) Sub() chan M

func (*EventStream[M]) SubStream

func (es *EventStream[M]) SubStream(ctx context.Context) Stream[M]

type Stream

type Stream[T any] interface {
	Next() (T, error)
	Close() error
}

func NewStream

func NewStream[T any](ctx context.Context, p *EventStream[T]) Stream[T]

Jump to

Keyboard shortcuts

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