async

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInterrupted = errors.New(`interrupted`)

Functions

func LogPanicTrace

func LogPanicTrace(logger log.Logger)

Types

type Fn

type Fn func(*Opts) error

Fn is a function that can be run asynchronously.

type Opts

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

Opts contains options for running a function.

func (*Opts) Ready

func (opts *Opts) Ready()

Ready signals that the function is ready to run.

func (*Opts) Stopping

func (opts *Opts) Stopping() <-chan struct{}

Stopping returns a channel that can be used to signal that the function should stop.

type RunGroup

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

RunGroup runs a group of functions asynchronously.

func NewRunGroup

func NewRunGroup(logger log.Logger, fns ...Fn) *RunGroup

func (*RunGroup) Add

func (tg *RunGroup) Add(fn Fn) *RunGroup

Add adds a function to the RunGroup. The function will be executed when the Run method is called. Note: RunGroup does not support dynamically adding functions to a running group.

func (*RunGroup) Ready

func (tg *RunGroup) Ready() error

func (*RunGroup) Run

func (tg *RunGroup) Run() error

func (*RunGroup) Stop

func (tg *RunGroup) Stop()

Jump to

Keyboard shortcuts

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