registry

package
v0.2.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Every3Seconds = "@every 3s"
)

Variables

View Source
var (
	// ErrRegistered will be returned when watcher is already been registered.
	ErrRegistered = errors.New("watcher has already been registered")
	// ErrConfigUnavailable will be returned when the configuration input is not the expected type.
	ErrConfigUnavailable = errors.New("configuration is not available")
)

Functions

func ListWatchers

func ListWatchers() map[string]Watcher

ListWatchers returns registered watchers in map format.

func Register

func Register(name string, watcher Watcher)

Register registers a watcher and save in global variable `registry`.

Types

type ISpec

type ISpec interface {
	// Spec return the spec for a cron job.
	// There are two cron spec formats in common usage:
	// - standard cron format: https://en.wikipedia.org/wiki/Cron
	// - quartz scheduler format: http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/tutorial-lesson-06.html
	// This method is optional for a watcher.
	Spec() string
}

Spec interface provides methods to set spec for a cron job.

type Watcher

type Watcher interface {
	cron.Job
}

Watcher is the interface for watchers. It use cron job as a scheduling engine.

Jump to

Keyboard shortcuts

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