Documentation ¶
Index ¶
- Variables
- type ContextDoneFn
- type StartFn
- 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) Init(opts ...TaskerOption)
- func (t *Tasker) IsRunning() bool
- func (t *Tasker) ResetTimer()
- func (t *Tasker) Run(ctx context.Context) error
- func (t *Tasker) Stop()
- type TaskerOption
- type TaskerOptions
- type UpdateFn
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TaskDefaultExecuteTimeout = time.Second * 5 // execute timeout TaskDefaultTimeout = time.Hour * 24 * 30 * 12 // default timeout TaskDefaultSleep = time.Millisecond * 500 // sleep time 500ms ErrTimeout = errors.New("time out") )
Functions ¶
This section is empty.
Types ¶
type ContextDoneFn ¶ added in v1.0.2
type ContextDoneFn func()
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) Init ¶
func (t *Tasker) Init(opts ...TaskerOption)
func (*Tasker) ResetTimer ¶
func (t *Tasker) ResetTimer()
type TaskerOption ¶
type TaskerOption func(*TaskerOptions)
func WithContextDoneFn ¶ added in v1.0.2
func WithContextDoneFn(f ContextDoneFn) TaskerOption
func WithSleep ¶
func WithSleep(d time.Duration) TaskerOption
func WithStartFns ¶ added in v1.0.3
func WithStartFns(f ...StartFn) TaskerOption
func WithTimeout ¶
func WithTimeout(d time.Duration) TaskerOption
func WithUpdateFn ¶ added in v1.0.2
func WithUpdateFn(f UpdateFn) TaskerOption
type TaskerOptions ¶
type TaskerOptions struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.