registry

package
v0.2.0-alpha.13 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2025 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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