timewheel

package
v0.0.0-...-cdfbdfc Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicateTaskKey = errors.New("duplicate task key")
	ErrTaskKeyNotFount  = errors.New("task key doesn't existed in task list, please check your input")
)

Functions

This section is empty.

Types

type Job

type Job func(interface{})

type Task

type Task struct {
	// contains filtered or unexported fields
}

type TimeWheel

type TimeWheel struct {
	// contains filtered or unexported fields
}

func GetTimeWheel

func GetTimeWheel() *TimeWheel

func NewTimeWheel

func NewTimeWheel(interval time.Duration, slotNums int, job Job) *TimeWheel

func (*TimeWheel) AddTask

func (tw *TimeWheel) AddTask(interval time.Duration, key interface{}, createdTime time.Time, times int, job Job) error

func (*TimeWheel) IsRunning

func (tw *TimeWheel) IsRunning() bool

func (*TimeWheel) RemoveTask

func (tw *TimeWheel) RemoveTask(key interface{}) error

func (*TimeWheel) Start

func (tw *TimeWheel) Start()

func (*TimeWheel) Stop

func (tw *TimeWheel) Stop()

Jump to

Keyboard shortcuts

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