Documentation ¶
Index ¶
- Variables
- type StartFn
- type StopFn
- type Task
- type TaskHandler
- type Tasker
- func (t *Tasker) Add(ctx context.Context, f TaskHandler, p ...interface{})
- func (t *Tasker) AddWait(ctx context.Context, f TaskHandler, p ...interface{}) error
- func (t *Tasker) GetTaskNum() int
- func (t *Tasker) Init(opts ...TaskerOption)
- func (t *Tasker) IsRunning() bool
- func (t *Tasker) ResetTimer()
- func (t *Tasker) Run(ctx context.Context) (reterr error)
- func (t *Tasker) Stop()
- type TaskerOption
- func WithChannelBufferSize(sz int) TaskerOption
- func WithExecuteTimeout(d time.Duration) TaskerOption
- func WithStartFns(f ...StartFn) TaskerOption
- func WithStopFns(f ...StopFn) TaskerOption
- func WithTimeout(d time.Duration) TaskerOption
- func WithUniqueId(id int32) TaskerOption
- func WithUpdateFn(f UpdateFn) TaskerOption
- func WithUpdateInterval(d time.Duration) TaskerOption
- type TaskerOptions
- type UpdateFn
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TaskDefaultChannelSize = 64 // task channel buffer size TaskDefaultExecuteTimeout = time.Second * 5 // execute timeout TaskDefaultTimeout = time.Hour * 24 * 356 // default timeout TaskDefaultUpdateInterval = time.Second // update interval ErrTimeout = errors.New("time out") ErrTaskPanic = errors.New("task panic") ErrTaskFailed = errors.New("task failed") ErrTaskFulled = errors.New("task fulled") )
Functions ¶
This section is empty.
Types ¶
type TaskHandler ¶
type Tasker ¶
type Tasker struct {
// contains filtered or unexported fields
}
func (*Tasker) AddWait ¶ added in v1.0.6
func (t *Tasker) AddWait(ctx context.Context, f TaskHandler, p ...interface{}) error
func (*Tasker) GetTaskNum ¶ added in v1.2.2
func (*Tasker) Init ¶
func (t *Tasker) Init(opts ...TaskerOption)
func (*Tasker) ResetTimer ¶
func (t *Tasker) ResetTimer()
type TaskerOption ¶
type TaskerOption func(*TaskerOptions)
func WithChannelBufferSize ¶ added in v1.1.4
func WithChannelBufferSize(sz int) TaskerOption
func WithExecuteTimeout ¶ added in v1.1.8
func WithExecuteTimeout(d time.Duration) TaskerOption
func WithStartFns ¶ added in v1.0.3
func WithStartFns(f ...StartFn) TaskerOption
func WithStopFns ¶ added in v1.1.1
func WithStopFns(f ...StopFn) TaskerOption
func WithTimeout ¶
func WithTimeout(d time.Duration) TaskerOption
func WithUniqueId ¶ added in v1.2.2
func WithUniqueId(id int32) TaskerOption
func WithUpdateFn ¶ added in v1.0.2
func WithUpdateFn(f UpdateFn) TaskerOption
func WithUpdateInterval ¶ added in v1.1.7
func WithUpdateInterval(d time.Duration) TaskerOption
type TaskerOptions ¶
type TaskerOptions struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.