ticker

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package ticker implements a cron task schedule tool wrappered from the go timer sdk

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GlobalTicker

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

GlobalTicker is the schedule tool structure

func NewGlobalTicker

func NewGlobalTicker(id string) *GlobalTicker

func (*GlobalTicker) ClearRoutines

func (gt *GlobalTicker) ClearRoutines()

func (*GlobalTicker) RegisterOneTimeRoutine

func (gt *GlobalTicker) RegisterOneTimeRoutine(name string, routine RoutineFunc, delay uint32)

RegisterOneTimeRoutine registers a specified once-task to the scheduler instance. It will be executed after the given heartbeats (in seconds) denoted by delay

func (*GlobalTicker) RegisterPeriodicRoutine

func (gt *GlobalTicker) RegisterPeriodicRoutine(name string, routine RoutineFunc, interval uint32)

RegisterPeriodicRoutine registers a specified periodic task to the scheduler instance. The task denoted by the routine param will be executed every interval heartbeats (in seconds)

func (*GlobalTicker) RemoveRoutine

func (gt *GlobalTicker) RemoveRoutine(name string)

func (*GlobalTicker) StartAndTriggerRoutine

func (gt *GlobalTicker) StartAndTriggerRoutine(name string)

StartAndTriggerRoutine starts the specified routine. Note that, the task won't work if this function wasn't called after registered

func (*GlobalTicker) StartTickerRoutine

func (gt *GlobalTicker) StartTickerRoutine(name string, triggerNextTicker bool)

StartTickerRoutine starts the specified routine. Note that, the task won't work if this function wasn't called after registered

func (*GlobalTicker) StopTickerRoutine

func (gt *GlobalTicker) StopTickerRoutine(name string)

StopTickerRoutine stops the specified task

type RoutineFunc

type RoutineFunc func() bool

RoutineFunc is the routine function which will be called at specified moment

type TickerRoutine

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

TickerRoutine define the infos of the scheduled task

Jump to

Keyboard shortcuts

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