task

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 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,
}

default config

Functions

func InitDebugLog

func InitDebugLog()

Types

type AsyncTask

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

func NewAsyncTask

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

func (*AsyncTask) CurSize

func (t *AsyncTask) CurSize() int

ATLen current active task size

func (*AsyncTask) Do

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

func (*AsyncTask) Size

func (t *AsyncTask) Size() int

func (*AsyncTask) Stat

func (t *AsyncTask) Stat() Stat

func (*AsyncTask) Stop

func (t *AsyncTask) Stop()

func (*AsyncTask) Wait

func (t *AsyncTask) Wait()

type Stat

type Stat struct {
	QL     int     `json:"q_l,omitempty"`
	CurDur float64 `json:"cur_dur,omitempty"`
	MaxQ   int     `json:"max_q,omitempty"`
	MaxDur float64 `json:"max_dur,omitempty"`
}

type TaskDef

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

type TaskFn

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

Jump to

Keyboard shortcuts

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