async

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 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 Eventual added in v0.3.0

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

func FailedEventual added in v0.3.0

func FailedEventual(err error) Eventual

func ImmediateEventual added in v0.3.0

func ImmediateEventual(err error) Eventual

func NewCompositeEventual added in v0.3.0

func NewCompositeEventual(eventuals ...Eventual) Eventual

func NewEventual added in v0.3.0

func NewEventual() (Eventual, func(error))

func SuccessfulEventual added in v0.3.0

func SuccessfulEventual() Eventual

func (Eventual) Done added in v0.3.0

func (e Eventual) Done() bool

func (Eventual) Wait added in v0.3.0

func (e Eventual) Wait() error

type Func added in v0.3.0

type Func func() error

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 Processor added in v0.3.0

type Processor interface {
	Queue(fn Func) Eventual
}

type Queue added in v0.3.0

type Queue interface {
	Schedule(fn Func)
}

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) Queue added in v0.3.0

func (w *Worker) Queue(fn Func) Eventual

func (*Worker) Schedule

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

func (*Worker) ScheduleFunc added in v0.3.0

func (w *Worker) ScheduleFunc(fn func() error) Eventual

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