async

package
v0.102.2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtomicGroup

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

AtomicGroup terminates as soon as first goroutine terminates..

func NewAtomicGroup

func NewAtomicGroup(parent context.Context) *AtomicGroup

func (*AtomicGroup) Add

func (d *AtomicGroup) Add(cmd Command)

Go spawns function in a goroutine and stores results or errors.

func (*AtomicGroup) Error

func (d *AtomicGroup) Error() error

Error stores an error that was reported by any of the downloader. Should be called after Wait.

func (*AtomicGroup) Stop

func (d *AtomicGroup) Stop()

func (*AtomicGroup) Wait

func (d *AtomicGroup) Wait()

Wait for all downloaders to finish.

func (*AtomicGroup) WaitAsync

func (d *AtomicGroup) WaitAsync() <-chan struct{}

type Command

type Command func(context.Context) error

type FiniteCommand

type FiniteCommand struct {
	Interval time.Duration
	Runable  func(context.Context) error
}

FiniteCommand terminates when error is nil.

func (FiniteCommand) Run

func (c FiniteCommand) Run(ctx context.Context) error

type Group

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

func NewGroup

func NewGroup(parent context.Context) *Group

func (*Group) Add

func (g *Group) Add(cmd Command)

func (*Group) Stop

func (g *Group) Stop()

func (*Group) Wait

func (g *Group) Wait()

func (*Group) WaitAsync

func (g *Group) WaitAsync() <-chan struct{}

type InfiniteCommand

type InfiniteCommand struct {
	Interval time.Duration
	Runable  func(context.Context) error
}

InfiniteCommand runs until context is closed.

func (InfiniteCommand) Run

func (c InfiniteCommand) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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