varasto: github.com/function61/varasto/pkg/scheduler Index | Files

package scheduler

import "github.com/function61/varasto/pkg/scheduler"

Index

Package Files

scheduler.go

func ValidateSpec Uses

func ValidateSpec(spec JobSpec) (cron.Schedule, error)

type Controller Uses

type Controller struct {
    SnapshotReady chan []JobSpec
    // contains filtered or unexported fields
}

func New Uses

func New(
    jobs []*Job,
    jobLogger *log.Logger,
    start func(func(context.Context) error),
) *Controller

func (*Controller) Snapshot Uses

func (s *Controller) Snapshot() []JobSpec

gets an atomic snapshot of scheduler's internal state

func (*Controller) Trigger Uses

func (s *Controller) Trigger(jobId string)

type Job Uses

type Job struct {
    Spec     JobSpec
    Run      JobFn
    Schedule cron.Schedule
}

func NewJob Uses

func NewJob(spec JobSpec, run JobFn, now time.Time) (*Job, error)

type JobFn Uses

type JobFn func(ctx context.Context, logger *log.Logger) error

type JobLastRun Uses

type JobLastRun struct {
    Started  time.Time
    Finished time.Time
    Error    string
}

type JobSpec Uses

type JobSpec struct {
    Id          string
    Description string
    NextRun     time.Time
    Running     bool
    Schedule    string
    LastRun     *JobLastRun
}

Package scheduler imports 5 packages (graph) and is imported by 1 packages. Updated 2020-04-02. Refresh now. Tools for package owners.