pubsub

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProducerClosed error = errors.New("producer closed")
)

Functions

This section is empty.

Types

type Producer added in v0.4.0

type Producer[T any] interface {
	Emit(v T)
	Attach(Sender[T]) error
	Detach(Sender[T])
	Run(ctx context.Context) error
	Stop()
}

func NewProducer added in v0.4.0

func NewProducer[T any](size int, processMsg func(T) (T, bool)) Producer[T]

type Sender added in v0.4.0

type Sender[T any] interface {
	Send(ctx context.Context, v T) error
	Close()
}

type Subscriber

type Subscriber[T any] interface {
	Receive() <-chan T
	Close()
}

func NewSubscriber

func NewSubscriber[T any, K any](p Producer[K], processIncoming func(K) (T, bool)) Subscriber[T]

Jump to

Keyboard shortcuts

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