plumber

package
v0.0.0-...-aa4546b Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithConfig

func ContextWithConfig(ctx context.Context, config Config) context.Context

func LaunchAndWait

func LaunchAndWait(
	ctx context.Context,
	rlatorNames []string,
	fns []Launchable,
	inputs []interface{},
) (outputs []interface{})

func OrDone

func OrDone[T any](ctx context.Context, c chan T) chan T

func Parallelize

func Parallelize[IT any, OT any](
	ctx context.Context,
	rlatorName string,
	fn func(context.Context, IT) OT,
	inputs ...IT,
) (outputs []OT)

func Regulated

func Regulated[IT any, OT any](
	ctx context.Context,
	rlatorName string,
	fn func(context.Context, IT) OT,
	input IT,
) (output OT)

func Retype

func Retype[OT any](inputs []interface{}) (outputs []OT)

func Untype

func Untype[IT any](inputs []IT) (outputs []interface{})

Types

type Config

type Config struct {
	PlizerEnabled  bool            // false globally disable parallelization
	RglatorsByName map[string]uint // number of parallelizable functions by name
	// contains filtered or unexported fields
}

func ConfigFromContext

func ConfigFromContext(ctx context.Context) (config Config, ok bool)

type Launchable

type Launchable func(ctx context.Context, input interface{}) (output interface{})

type Reducer

type Reducer interface {
	SetDbgOut(w io.Writer)
	Launch(label string, work ReducerWork) error
	Close() error
}

func NewReducer

func NewReducer(limit int, maxSleep time.Duration) Reducer

func NewUsReducer

func NewUsReducer(limit int, maxSleep time.Duration) Reducer

type ReducerWork

type ReducerWork func() error

Jump to

Keyboard shortcuts

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