Documentation ¶
Overview ¶
Package distribute provides concurrency primitives, like limited distribution of work.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotEnoughConcurrency = fmt.Errorf("concurrency must be greater than zero")
Functions ¶
func OneToN ¶
func OneToN( ctx context.Context, sourceFn func(ctx context.Context, dataCh chan<- interface{}) error, workerFn func(ctx context.Context, data interface{}) error, concurrency int, ) error
OneToN distributes work to a limited number of worker functions. Data for the workers is provided by sourceFn and distributed to concurrency amount of workerFn functions. Note that concurrency must be greater than zero.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.