Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PriorityItem ¶
type PriorityItem struct { Value TimerJob // The value of the item; arbitrary. Priority int64 // The priority of the item in the queue. }
An PriorityItem is something we manage in a priority queue.
type PriorityQueue ¶
type PriorityQueue []*PriorityItem
An PriorityQueue is a min-heap of ints.
func (PriorityQueue) Len ¶
func (h PriorityQueue) Len() int
func (PriorityQueue) Less ¶
func (h PriorityQueue) Less(i, j int) bool
func (PriorityQueue) Swap ¶
func (h PriorityQueue) Swap(i, j int)
type TimerJob ¶
type TimerJob interface { GetInterval() time.Duration Check() bool Fire() Do() error GetChan() <-chan struct{} DebugInfo() interface{} // error 时,用来打印日志 }
TimerJob TimerJob
type TimerJobDispather ¶
type TimerJobDispather struct {
// contains filtered or unexported fields
}
TimerJobDispather 定时任务分发器
func NewTimerJobDispather ¶
func NewTimerJobDispather(ctx context.Context) *TimerJobDispather
NewTimerJobDispather 构造函数
func (*TimerJobDispather) Add ¶
func (dispather *TimerJobDispather) Add(timerJob TimerJob)
Add 增加定时任务
Click to show internal directories.
Click to hide internal directories.