task

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cfg = struct {
	Debug bool
}{
	Debug: false,
}

Cfg config

Functions

This section is empty.

Types

type AsyncTask

type AsyncTask struct {
	ITask
	// contains filtered or unexported fields
}

AsyncTask struct

func NewAsyncTask

func NewAsyncTask(max int, maxDur time.Duration) *AsyncTask

NewAsyncTask init

func (*AsyncTask) CurSize

func (t *AsyncTask) CurSize() int

CurSize get current active task size

func (*AsyncTask) Do

func (t *AsyncTask) Do(name TFn, args ...interface{})

Do handle task

func (*AsyncTask) Size

func (t *AsyncTask) Size() int

Size get current task size

func (*AsyncTask) Stat

func (t *AsyncTask) Stat() Stat

Stat get current task state

func (*AsyncTask) Stop

func (t *AsyncTask) Stop()

Stop stop task

func (*AsyncTask) Wait

func (t *AsyncTask) Wait()

Wait wait for task done

type ITask added in v0.1.0

type ITask interface {
	Size() int
	CurSize() int
	Wait()
	Stat() Stat
	Do(name TFn, args ...interface{})
	Stop()
	// contains filtered or unexported methods
}

ITask interface

type Stat

type Stat struct {
	// QL queue length
	QL int `json:"q_l,omitempty"`

	// CurDur current duration
	CurDur float64 `json:"cur_dur,omitempty"`

	// MaxQ max queue
	MaxQ int `json:"max_q,omitempty"`

	// MaxDur max duration
	MaxDur float64 `json:"max_dur,omitempty"`
}

Stat stat struct

type TFn added in v0.1.0

type TFn func(...interface{}) func(...interface{}) (err error)

TFn task func

Jump to

Keyboard shortcuts

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