parallelize

package
v1.24.11 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 3 Imported by: 16

Documentation

Index

Constants

View Source
const DefaultParallelism int = 16

DefaultParallelism is the default parallelism used in scheduler.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorChannel

type ErrorChannel struct {
	// contains filtered or unexported fields
}

ErrorChannel supports non-blocking send and receive operation to capture error. A maximum of one error is kept in the channel and the rest of the errors sent are ignored, unless the existing error is received and the channel becomes empty again.

func NewErrorChannel

func NewErrorChannel() *ErrorChannel

NewErrorChannel returns a new ErrorChannel.

func (*ErrorChannel) ReceiveError

func (e *ErrorChannel) ReceiveError() error

ReceiveError receives an error from channel without blocking on the receiver.

func (*ErrorChannel) SendError

func (e *ErrorChannel) SendError(err error)

SendError sends an error without blocking the sender.

func (*ErrorChannel) SendErrorWithCancel

func (e *ErrorChannel) SendErrorWithCancel(err error, cancel context.CancelFunc)

SendErrorWithCancel sends an error without blocking the sender and calls cancel function.

type Parallelizer

type Parallelizer struct {
	// contains filtered or unexported fields
}

Parallelizer holds the parallelism for scheduler.

func NewParallelizer

func NewParallelizer(p int) Parallelizer

NewParallelizer returns an object holding the parallelism.

func (Parallelizer) Until

func (p Parallelizer) Until(ctx context.Context, pieces int, doWorkPiece workqueue.DoWorkPieceFunc)

Until is a wrapper around workqueue.ParallelizeUntil to use in scheduling algorithms.

Jump to

Keyboard shortcuts

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