timer

package
v0.0.0-...-ff803ae Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReleaseCron

func ReleaseCron(cron *Cron)

func ReleaseTicker

func ReleaseTicker(ticker *Ticker)

func ReleaseTimer

func ReleaseTimer(timer *Timer)

Types

type Cron

type Cron struct {
	Timer
}

Cron

func NewCron

func NewCron(t *timewheel.Timer, cb func(), name string, onClose func(timer *timewheel.Timer)) *Cron

func (*Cron) Close

func (c *Cron) Close()

func (*Cron) Do

func (c *Cron) Do()

type CronExpr

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

Field name | Mandatory? | Allowed values | Allowed special characters ---------- | ---------- | -------------- | -------------------------- Seconds | No | 0-59 | * / , - Minutes | Yes | 0-59 | * / , - Hours | Yes | 0-23 | * / , - Day of month | Yes | 1-31 | * / , - Month | Yes | 1-12 | * / , - Day of week | Yes | 0-6 | * / , -

func NewCronExpr

func NewCronExpr(expr string) (cronExpr *CronExpr, err error)

goroutine safe

func (*CronExpr) Next

func (e *CronExpr) Next(t time.Time) time.Time

goroutine safe

type Dispatcher

type Dispatcher struct {
	ChanTimer chan *timewheel.Timer
}

one dispatcher per goroutine (goroutine not safe)

func NewDispatcher

func NewDispatcher(l int) *Dispatcher

func (*Dispatcher) AfterFunc

func (disp *Dispatcher) AfterFunc(d time.Duration, cb func(), onCloseTimer func(timer *timewheel.Timer), onAddTimer func(timer *timewheel.Timer)) *Timer

func (*Dispatcher) CronFunc

func (disp *Dispatcher) CronFunc(cronExpr *CronExpr, cb func(), onCloseTimer func(timer *timewheel.Timer), onAddTimer func(timer *timewheel.Timer)) *Cron

func (*Dispatcher) TickerFunc

func (disp *Dispatcher) TickerFunc(d time.Duration, cb func(), onCloseTimer func(timer *timewheel.Timer), onAddTimer func(timer *timewheel.Timer)) *Ticker

type ITime

type ITime interface {
	Close()
	Do()
	GetName() string
}

type Ticker

type Ticker struct {
	Timer
}

Ticker

func NewTicker

func NewTicker(t *timewheel.Timer, cb func(), name string, onClose func(timer *timewheel.Timer)) *Ticker

func (*Ticker) Close

func (tk *Ticker) Close()

func (*Ticker) Do

func (tk *Ticker) Do()

type Timer

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

Timer

func NewTimer

func NewTimer(t *timewheel.Timer, cb func(), name string, onClose func(timer *timewheel.Timer)) *Timer

func (*Timer) Close

func (t *Timer) Close()

func (*Timer) Do

func (t *Timer) Do()

func (*Timer) GetName

func (t *Timer) GetName() string

Jump to

Keyboard shortcuts

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