async

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: MIT Imports: 0 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Outcome

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

func NewCompositeOutcome

func NewCompositeOutcome(outcomes ...Outcome) Outcome

func NewErrorOutcome

func NewErrorOutcome(err error) Outcome

func NewOutcome

func NewOutcome() Outcome

func NewValueOutcome

func NewValueOutcome(value interface{}) Outcome

func (Outcome) IsAvailable

func (o Outcome) IsAvailable() bool

func (Outcome) OnError

func (o Outcome) OnError(callback func(err error)) Outcome

func (Outcome) OnSuccess

func (o Outcome) OnSuccess(callback func(value interface{})) Outcome

func (Outcome) Record

func (o Outcome) Record(result Result)

func (Outcome) Wait

func (o Outcome) Wait() Result

type Result

type Result struct {
	Value interface{}
	Err   error
}

type Task

type Task func() Result

func VoidTask

func VoidTask(callback func() error) Task

type Worker

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

func NewWorker

func NewWorker(capacity int) *Worker

func (*Worker) ProcessAll

func (w *Worker) ProcessAll()

func (*Worker) ProcessTryMultiple

func (w *Worker) ProcessTryMultiple(count int) bool

func (*Worker) ProcessTrySingle

func (w *Worker) ProcessTrySingle() bool

func (*Worker) Schedule

func (w *Worker) Schedule(task Task) Outcome

func (*Worker) Shutdown

func (w *Worker) Shutdown()

func (*Worker) Wait

func (w *Worker) Wait(task Task) Result

Jump to

Keyboard shortcuts

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