worker

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrReject makes Worker ignore the element.
	ErrReject = errors.New("Reject")
)

Functions

This section is empty.

Types

type Chain

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

func NewChain

func NewChain[T any](workers []*Worker[T, T], n int) *Chain[T]

func (*Chain[T]) Start

func (j *Chain[T]) Start(ctx context.Context, inC <-chan T, outC chan<- T)

type Worker

type Worker[In, Out any] struct {
	// contains filtered or unexported fields
}

func New

func New[In, Out any](
	name string,
	n int,
	f func(context.Context, In) (Out, error),
) *Worker[In, Out]

func (*Worker[In, Out]) Start

func (w *Worker[In, Out]) Start(
	ctx context.Context,
	inC <-chan In,
	outC chan<- Out,
)

Jump to

Keyboard shortcuts

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