scheduler

package
v0.0.0-...-8e17a21 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTask

func AddTask(t *Task) error

AddTask adds task to global scheduler

func Parse

func Parse(cronSpec string) (cron.Schedule, error)

Parse parses cron format

func UpdateTask

func UpdateTask(t *Task) error

UpdateTask updates task in global scheduler

Types

type Handler

type Handler interface {
	Run(*Task)
}

Handler represents interface of task handler

type Scheduler

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

Scheduler represents wrapper over the cron library

func NewScheduler

func NewScheduler() *Scheduler

NewScheduler creates a new scheduler

func (*Scheduler) AddTask

func (s *Scheduler) AddTask(t *Task) error

AddTask adds task to cron

func (*Scheduler) UpdateTask

func (s *Scheduler) UpdateTask(t *Task) error

UpdateTask updates task

type Task

type Task struct {
	ID       string
	CronSpec string

	Handler Handler
	// contains filtered or unexported fields
}

Task represents task

func (*Task) Next

func (t *Task) Next(tm time.Time) time.Time

Next returns time for next task

func (*Task) ParseCron

func (t *Task) ParseCron() error

ParseCron parsed cron format

func (*Task) Run

func (t *Task) Run()

Run executes task

func (*Task) String

func (t *Task) String() string

String returns description of task

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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