cron

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package cron provides mechanisms for using the upstream cron package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() cronenberg.Cron

New creates a new instance of Cron.

func NewRunner

func NewRunner(job *cronenberg.Job, logger cronenberg.Logger) cronenberg.Runner

NewRunner takes a Job and a Logger, using them to configure the returned Runner.

Types

type Cron

type Cron struct {
	*cron.Cron
}

Cron is an object that uses the upstream cron package to manage a collection of Runners.

func (*Cron) Count

func (c *Cron) Count() int

Count is the number of Runners scheduled in the Cron at any given time.

func (*Cron) Manage

func (c *Cron) Manage(runner cronenberg.Runner) error

Manage takes a Runner and schedules it as a Cron entry. If there are issues adding the Runner to the schedule, an error is returned. Otherwise, nil is returned.

type Runner

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

Runner is an object that knows how to run a Job.

func (*Runner) Env

func (runner *Runner) Env() map[string]string

Env returns the environment map for the Job that the Runner wraps.

func (*Runner) Name

func (runner *Runner) Name() string

Name returns the name of the Job that the Runner wraps.

func (*Runner) Run

func (runner *Runner) Run()

Run runs the wrapped Job's command. If the job is configured as a locking process, only one instance of that process will ever be run by a given Runner.

func (*Runner) Spec

func (runner *Runner) Spec() string

Spec returns the cron schedule spec for the Job that the Runner wraps.

Jump to

Keyboard shortcuts

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