errgroup

package
v0.0.0-...-36737ed Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoundedGroup

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

BoundedGroup wraps an errgroup to be concurrently bounded. The behaviour is the same, the only addition is that the goroutines are not started until they acquire a semaphore.

func NewBoundedGroup

func NewBoundedGroup(ctx context.Context, n uint64) (*BoundedGroup, context.Context)

NewBoundedGroup creates a new errgroup that is concurrently bounded by N.

func (*BoundedGroup) Go

func (g *BoundedGroup) Go(f func() error)

Go calls the function f in a new goroutine after acquiring a semaphore. If the goroutine hasn't started yet and the underlying errgroup's context is cancelled, the function f will never be invoked.

func (*BoundedGroup) Wait

func (g *BoundedGroup) Wait() error

Wait blocks until all functions calls from the Go method have returned, then returns the first non-nil error (if any) from them.

Jump to

Keyboard shortcuts

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