Documentation
¶
Index ¶
- Variables
- type AddCbArgs
- type BanCbArgs
- type CancelCbArgs
- type CbFuncMap
- type ExecuteCbArgs
- type Func
- type ISchedule
- type MultiTask
- type SingleTask
- type SpecSchedule
- type SpecTimeSchedule
- type TaskInfo
- type TaskMap
- func (tm *TaskMap) Add(key string, task *TaskInfo)
- func (tm *TaskMap) AddOrSet(key string, task *TaskInfo)
- func (tm *TaskMap) Delete(key string)
- func (tm *TaskMap) Get(key string) *TaskInfo
- func (tm *TaskMap) GetAll() map[string]*TaskInfo
- func (tm *TaskMap) IsExist(key string) bool
- func (tm *TaskMap) SelectNextExec() (*TaskInfo, time.Duration, bool)
- func (tm *TaskMap) Set(key string, task *TaskInfo)
- type TaskResult
- type TimedTask
- func (tt *TimedTask) Add(key string, obj Func, sche ISchedule)
- func (tt *TimedTask) AddAddCallback(cb func(*AddCbArgs))
- func (tt *TimedTask) AddBanCallback(cb func(*BanCbArgs))
- func (tt *TimedTask) AddCancelCallback(cb func(*CancelCbArgs))
- func (tt *TimedTask) AddExecuteCallback(cb func(*ExecuteCbArgs))
- func (tt *TimedTask) AddUnBanCallback(cb func(*UnBanCbArgs))
- func (tt *TimedTask) Ban(key string)
- func (tt *TimedTask) Cancel(key string)
- func (tt *TimedTask) DelAddCallback(cb func(*AddCbArgs))
- func (tt *TimedTask) DelBanCallback(cb func(*BanCbArgs))
- func (tt *TimedTask) DelCancelCallback(cb func(*CancelCbArgs))
- func (tt *TimedTask) DelExecuteCallback(cb func(*ExecuteCbArgs))
- func (tt *TimedTask) DelUnBanCallback(cb func(*UnBanCbArgs))
- func (tt *TimedTask) Execute(key string)
- func (tt *TimedTask) GetTimedTaskInfo() map[string]*TaskInfo
- func (tt *TimedTask) IsBan(key string) bool
- func (tt *TimedTask) Set(key string, obj Func, sche ISchedule)
- func (tt *TimedTask) Stop()
- func (tt *TimedTask) UnBan(key string)
- type TimerObj
- type UnBanCbArgs
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type CancelCbArgs ¶ added in v1.0.13
type CbFuncMap ¶
type CbFuncMap struct {
// contains filtered or unexported fields
}
func NewCbFuncMap ¶
func NewCbFuncMap() *CbFuncMap
type ExecuteCbArgs ¶ added in v1.0.13
type ExecuteCbArgs struct { *TaskInfo Res map[string]interface{} Error error Gid pool.GoroutineUID }
type ISchedule ¶ added in v1.0.13
type ISchedule interface { GetAddTime() time.Time // 获取添加时间 AddExecuteCount() // 添加执行次数 任务执行完毕后调用 GetExecuteCount() int // 获取执行次数 Expression() (nt time.Time, isValid bool) // 表达式 ToString() string }
任务调度接口
type SingleTask ¶
type SingleTask struct {
*MultiTask
}
指定只执行一次定时任务
func NewSingleTask ¶
func NewSingleTask(routineCount int) *SingleTask
type SpecSchedule ¶ added in v1.0.13
type SpecSchedule struct {
// contains filtered or unexported fields
}
指定时长循环调度
func NewSpecSchedule ¶ added in v1.0.13
func (*SpecSchedule) AddExecuteCount ¶ added in v1.0.15
func (p *SpecSchedule) AddExecuteCount()
func (*SpecSchedule) Expression ¶ added in v1.0.13
func (p *SpecSchedule) Expression() (nt time.Time, isValid bool)
func (*SpecSchedule) GetAddTime ¶ added in v1.0.15
func (p *SpecSchedule) GetAddTime() time.Time
func (*SpecSchedule) GetExecuteCount ¶ added in v1.0.15
func (p *SpecSchedule) GetExecuteCount() int
func (*SpecSchedule) ToString ¶ added in v1.0.13
func (p *SpecSchedule) ToString() string
type SpecTimeSchedule ¶ added in v1.0.13
type SpecTimeSchedule struct {
// contains filtered or unexported fields
}
指定时长指定次数调度器
func NewSpecTimeSchedule ¶ added in v1.0.13
func NewSpecTimeSchedule(spec time.Duration, limit int) *SpecTimeSchedule
func (*SpecTimeSchedule) AddExecuteCount ¶ added in v1.0.15
func (p *SpecTimeSchedule) AddExecuteCount()
func (*SpecTimeSchedule) Expression ¶ added in v1.0.13
func (p *SpecTimeSchedule) Expression() (nt time.Time, isValid bool)
func (*SpecTimeSchedule) GetAddTime ¶ added in v1.0.15
func (p *SpecTimeSchedule) GetAddTime() time.Time
func (*SpecTimeSchedule) GetExecuteCount ¶ added in v1.0.15
func (p *SpecTimeSchedule) GetExecuteCount() int
func (*SpecTimeSchedule) ToString ¶ added in v1.0.13
func (p *SpecTimeSchedule) ToString() string
type TaskInfo ¶ added in v1.0.13
type TaskInfo struct { Key string // 任务标志key Task Func // 任务方法 LastTime time.Time // 最后一次执行任务的时间(未执行过时为time.Time{}) Sche ISchedule // 任务计划 LastResult *TaskResult // 任务最后一次执行的结果 }
func NewTaskInfo ¶ added in v1.0.13
创建一个任务信息对象
func (*TaskInfo) GetAddTaskTime ¶ added in v1.0.13
任务添加时间
func (*TaskInfo) GetExecuteCount ¶ added in v1.0.15
func (*TaskInfo) GetLastExecuteTime ¶ added in v1.0.13
最后一次执行时间
func (*TaskInfo) HasNextExecute ¶ added in v1.0.13
是否还有下一次执行
func (*TaskInfo) NextScheduleTime ¶ added in v1.0.13
下次执行时间
type TaskMap ¶ added in v1.0.15
type TaskMap struct {
// contains filtered or unexported fields
}
任务字典 线程安全
func NewTaskMap ¶ added in v1.0.13
func NewTaskMap() *TaskMap
func (*TaskMap) SelectNextExec ¶ added in v1.0.15
选择下一个最早执行的任务
type TaskResult ¶ added in v1.0.15
func (*TaskResult) Clone ¶ added in v1.0.15
func (tr *TaskResult) Clone() *TaskResult
type TimedTask ¶
type TimedTask struct {
// contains filtered or unexported fields
}
func NewTimedTask ¶
func (*TimedTask) AddAddCallback ¶
func (*TimedTask) AddBanCallback ¶
func (*TimedTask) AddCancelCallback ¶
func (tt *TimedTask) AddCancelCallback(cb func(*CancelCbArgs))
func (*TimedTask) AddExecuteCallback ¶
func (tt *TimedTask) AddExecuteCallback(cb func(*ExecuteCbArgs))
func (*TimedTask) AddUnBanCallback ¶
func (tt *TimedTask) AddUnBanCallback(cb func(*UnBanCbArgs))
func (*TimedTask) DelAddCallback ¶
func (*TimedTask) DelBanCallback ¶
func (*TimedTask) DelCancelCallback ¶
func (tt *TimedTask) DelCancelCallback(cb func(*CancelCbArgs))
func (*TimedTask) DelExecuteCallback ¶
func (tt *TimedTask) DelExecuteCallback(cb func(*ExecuteCbArgs))
func (*TimedTask) DelUnBanCallback ¶
func (tt *TimedTask) DelUnBanCallback(cb func(*UnBanCbArgs))
func (*TimedTask) GetTimedTaskInfo ¶
获取定时任务列表信息
type UnBanCbArgs ¶ added in v1.0.13
type UnBanCbArgs BanCbArgs
Source Files
¶
Click to show internal directories.
Click to hide internal directories.