scheduler

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "scheduler"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.2.11

type Config struct {
	Timeout     string       `yaml:"timeout"`
	JobSettings []JobSetting `yaml:"jobs"`
}

type CronRouter added in v0.2.11

type CronRouter interface {
	Crontab(s *Scheduler)
}

type JobFunc added in v0.2.11

type JobFunc func(ctx context.Context, name string) error

type JobSetting added in v0.2.11

type JobSetting struct {
	Disabled bool   `yaml:"disabled"`
	Schedule string `yaml:"schedule"`
	Name     string `yaml:"name"`
	Timeout  string `yaml:"timeout"`
}

type Scheduler

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

func New added in v0.2.11

func New(m lifecycle.Lifecycle, log log.Logger, opts []*Config, routers []CronRouter, metric metrics.Metric) *Scheduler

func (*Scheduler) Cron

func (s *Scheduler) Cron(name, expr string, fn JobFunc)

func (*Scheduler) Every

func (s *Scheduler) Every(name string, dur time.Duration, fn JobFunc)

func (*Scheduler) Once

func (s *Scheduler) Once(name string, delay time.Duration, fn JobFunc)

Jump to

Keyboard shortcuts

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