syncutil

package
v0.9.10 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package syncutil provides utilities for working with asynchronous tasks and provides wrappers around the "sync" package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PipelineWaitGroup

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

PipelineWaitGroup is a wrapper around a WaitGroup that runs the actions of a list of steps, handles errors, and watches for context cancellation.

func NewPipelineWaitGroup

func NewPipelineWaitGroup() *PipelineWaitGroup

func (*PipelineWaitGroup) Add

Add adds a new Action to the waitgroup. The provided function will be run in parallel with all other added functions.

func (*PipelineWaitGroup) Wait

func (w *PipelineWaitGroup) Wait(ctx context.Context) error

Wait runs all provided functions (via Add(...)) and runs them in parallel and waits for them to finish. If they are not all finished before the provided timeout (via NewPipelineWaitGroup), then an error is returned. If any functions return an error, the first error encountered is returned.

type StepWaitGroup

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

StepWaitGroup is a wrapper around a WaitGroup that runs the actions of a list of steps, handles errors, and watches for context cancellation.

func NewStepWaitGroup

func NewStepWaitGroup() *StepWaitGroup

func (*StepWaitGroup) Add

func (w *StepWaitGroup) Add(f pipeline.Step, opts pipeline.ActionOpts)

Add adds a new Action to the waitgroup. The provided function will be run in parallel with all other added functions.

func (*StepWaitGroup) Wait

func (w *StepWaitGroup) Wait(ctx context.Context) error

Wait runs all provided functions (via Add(...)) and runs them in parallel and waits for them to finish. If they are not all finished before the provided timeout (via NewStepWaitGroup), then an error is returned. If any functions return an error, the first error encountered is returned.

type WaitGroup

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

func NewWaitGroup

func NewWaitGroup() *WaitGroup

func (*WaitGroup) Add

func (w *WaitGroup) Add(f WaitGroupFunc)

func (*WaitGroup) Wait

func (w *WaitGroup) Wait(ctx context.Context) error

type WaitGroupFunc

type WaitGroupFunc func(context.Context) error

Jump to

Keyboard shortcuts

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