distribute

package
v0.0.0-...-7635d6e Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 3 Imported by: 0

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.

Jump to

Keyboard shortcuts

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