Documentation ¶
Index ¶
- type AddCbArgs
- type BanCbArgs
- type CancelCbArgs
- type EveryDaySchedule
- type ExecuteCbArgs
- type ISchedule
- type PlanSchedule
- 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 TaskObj
- type TaskResult
- type TimerObj
- type UnBanCbArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EveryDaySchedule ¶
type EveryDaySchedule struct {
// contains filtered or unexported fields
}
每日指定时刻调度器
func NewEveryDaySchedule ¶
func NewEveryDaySchedule(hour, minute, second, mSecond int) *EveryDaySchedule
func (*EveryDaySchedule) Expression ¶
func (e *EveryDaySchedule) Expression(t *TaskInfo) (nt time.Time, isValid bool)
func (*EveryDaySchedule) ToString ¶
func (e *EveryDaySchedule) ToString() string
type ExecuteCbArgs ¶
type ExecuteCbArgs struct { *TaskInfo Res map[string]interface{} Error error Gid pool.GoroutineUID }
type ISchedule ¶
type ISchedule interface { Expression(t *TaskInfo) (nt time.Time, isValid bool) // 表达式 // Record(t *TaskInfo, cs ...int) (et []time.Time) // 索引执行记录 返回执行时刻 time为zero时说明还没被执行 ToString() string }
任务调度接口
type PlanSchedule ¶
type PlanSchedule struct {
// contains filtered or unexported fields
}
指定时间点调度器
func NewPlanSchedule ¶
func NewPlanSchedule(tList []time.Time) *PlanSchedule
func (*PlanSchedule) Expression ¶
func (p *PlanSchedule) Expression(t *TaskInfo) (nt time.Time, isValid bool)
func (*PlanSchedule) ToString ¶
func (p *PlanSchedule) ToString() string
type SpecSchedule ¶
type SpecSchedule struct {
// contains filtered or unexported fields
}
指定时长循环调度
func NewSpecSchedule ¶
func NewSpecSchedule(spec time.Duration) *SpecSchedule
func (*SpecSchedule) Expression ¶
func (p *SpecSchedule) Expression(t *TaskInfo) (nt time.Time, isValid bool)
func (*SpecSchedule) Record ¶
func (p *SpecSchedule) Record(t *TaskInfo, cs ...int) (et []time.Time)
func (*SpecSchedule) ToString ¶
func (p *SpecSchedule) ToString() string
type SpecTimeSchedule ¶
type SpecTimeSchedule struct {
// contains filtered or unexported fields
}
指定时长指定次数调度器
func NewSpecTimeSchedule ¶
func NewSpecTimeSchedule(spec time.Duration, time int) *SpecTimeSchedule
func (*SpecTimeSchedule) Expression ¶
func (p *SpecTimeSchedule) Expression(t *TaskInfo) (nt time.Time, isValid bool)
func (*SpecTimeSchedule) ToString ¶
func (p *SpecTimeSchedule) ToString() string
type TaskInfo ¶
type TaskInfo struct { Key string // 任务标志key Task TaskObj // 任务方法 LastTime time.Time // 最后一次执行任务的时间(未执行过时为time.Time{}) AddTime time.Time // 任务添加的时间 NextTime time.Time // 下次执行时间 Count int // 任务执行次数 Sche ISchedule // 任务计划 HasNext bool // 是否还有下一次执行 LastResult *TaskResult // 任务最后一次执行的结果 // contains filtered or unexported fields }
func (*TaskInfo) GetLastExecuteTime ¶
最后一次执行时间
type TaskMap ¶
type TaskMap struct {
// contains filtered or unexported fields
}
任务字典 线程安全
func (*TaskMap) SelectNextExec ¶
选择下一个最早执行的任务
type TaskResult ¶
func (*TaskResult) Clone ¶
func (tr *TaskResult) Clone() *TaskResult
type TimerObj ¶
Click to show internal directories.
Click to hide internal directories.