task

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// region delay status
	Wait = iota
	Running
	AfterRunningDone
	AfterRunningErr
	Cancel
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Delay

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

func NewDelay

func NewDelay(duration time.Duration, delayFunc base.CtxFunc,
	ctx ...context.Context) (task *Delay, err error)

func (*Delay) Cancel

func (_self *Delay) Cancel() (err error)

func (*Delay) Status

func (_self *Delay) Status() int

type DelayPool

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

func NewDelayPool

func NewDelayPool() (*DelayPool, error)

func (*DelayPool) Cancel

func (_self *DelayPool) Cancel(delay *Delay) error

func (*DelayPool) Put

func (_self *DelayPool) Put(duration time.Duration, f base.CtxFunc,
	ctx ...context.Context) (dt *Delay, err error)

type Worker

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

func NewNumWorker

func NewNumWorker(key string, ef base.CtxEFunc, num int) (*Worker, error)

func NewWorker

func NewWorker(key string, ef base.CtxEFunc) (*Worker, error)

func (*Worker) Do

func (_self *Worker) Do(f base.FuncCtxE)

func (*Worker) DoOver

func (_self *Worker) DoOver() (err error)

func (*Worker) DoWait

func (_self *Worker) DoWait()

type WorkerGroup

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

func NewWorkerGroup

func NewWorkerGroup(ctx context.Context, workerChanSize int,
	hashWorker base.CtxFuncSE, errFunc base.CtxEFunc) (workerGroup *WorkerGroup, err error)

func (*WorkerGroup) Push

func (_self *WorkerGroup) Push(ctx context.Context, f base.FuncCtxE) (err error)

func (*WorkerGroup) PushOver

func (_self *WorkerGroup) PushOver() (err error)

func (*WorkerGroup) Wait

func (_self *WorkerGroup) Wait()

Jump to

Keyboard shortcuts

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