ticker

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Crontab

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

func (*Crontab) AddTask

func (c *Crontab) AddTask(name string, duration time.Duration, limit int, handle Task) error

func (*Crontab) GetTask

func (c *Crontab) GetTask(name string) (Task, int, error)

func (*Crontab) Init

func (c *Crontab) Init()

func (*Crontab) RemoveTask

func (c *Crontab) RemoveTask(name string) error

func (*Crontab) Run

func (c *Crontab) Run()

func (*Crontab) Stop

func (c *Crontab) Stop()

type Node

type Node interface {
	Name() string
	Run(time.Time)
	ExecuteAt() time.Time
	SetExecuteAt(time.Time)
	Idx() int
	SetIdx(int)
	Duration() time.Duration
	Valid() bool
	SetRemove()
	ResetValid(time.Time)
	OnRemove()
	OnClose()
}

***** Node

type Task

type Task interface {
	Run(tm time.Time, remain int)
	Close()
}

type Ticker

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

***** Ticker

func (*Ticker) Get

func (c *Ticker) Get(name string) (Node, error)

func (*Ticker) Init

func (c *Ticker) Init()

func (*Ticker) Register

func (c *Ticker) Register(node Node) error

func (*Ticker) Remove

func (c *Ticker) Remove(name string) error

func (*Ticker) Run

func (c *Ticker) Run()

func (*Ticker) Stop

func (c *Ticker) Stop()

Jump to

Keyboard shortcuts

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