scheduler

package
v0.0.0-...-553821e Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CronScheduler

type CronScheduler struct {
	C *cron.Cron
}

CronScheduler implements LifeCycleTimer wrapping a cron.Cron instance.

func (*CronScheduler) Schedule

func (lct *CronScheduler) Schedule(spec interface{}, job func()) (id interface{}, err error)

func (*CronScheduler) Start

func (lct *CronScheduler) Start()

func (*CronScheduler) Stop

func (lct *CronScheduler) Stop()

func (*CronScheduler) Unschedule

func (lct *CronScheduler) Unschedule(id interface{}) error

type Provider

type Provider interface {

	// Schedule adds a job to the scheduler which is
	// executed according to the given spec.
	//
	// Returns an id of the scheduled job and n error
	// when the job could not be scheduled.
	Schedule(spec interface{}, job func()) (id interface{}, err error)

	// Unschedule removes the given job by its id
	// from the scheduler so it will not be executed
	// anymore.
	Unschedule(id interface{}) error

	// Start runs the scheduler cycle.
	Start()

	// Stop cancels the scheduler cycle.
	Stop()
}

Provider provides a job scheduler which executes given jobs at a specified time or in a given location.

Jump to

Keyboard shortcuts

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