common

package
v0.0.0-...-c7b92ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 3 Imported by: 0

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) Pop

func (h *PriorityQueue) Pop() interface{}

Pop Pop

func (*PriorityQueue) Push

func (h *PriorityQueue) Push(x interface{})

Push Push

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 增加定时任务

func (*TimerJobDispather) Run

func (dispather *TimerJobDispather) Run()

Run Run

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL