async

package
v0.0.0-...-07a4714 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWorkerClosed = errors.New("worker: worker closed")
)

Functions

func New

func New(funcOpts ...funcOption) (Async, Service)

func WithCapacity

func WithCapacity(capacity int) funcOption

func WithProcessNum

func WithProcessNum(num int) funcOption

func WithStartHandler

func WithStartHandler(f func()) funcOption

func WithStopHandler

func WithStopHandler(f func()) funcOption

Types

type Async

type Async interface {
	Submit(task TaskHandler)
	SeqSubmit(id string, task TaskHandler)
}

type Options

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

type Service

type Service interface {
	Run()
	Stop(ctx context.Context) error
}

type TaskHandler

type TaskHandler func()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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