basic

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parameter

type Parameter interface {
	// contains filtered or unexported methods
}

Parameter is the interface for service parameters.

func WithLogLevel

func WithLogLevel(logLevel zerolog.Level) Parameter

WithLogLevel sets the log level for the module.

func WithMonitor

func WithMonitor(monitor metrics.SchedulerMonitor) Parameter

WithMonitor sets the monitor for this module.

type Service

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

Service is a controller service.

func New

func New(ctx context.Context, params ...Parameter) (*Service, error)

New creates a new scheduling service.

func (*Service) CancelJob

func (s *Service) CancelJob(ctx context.Context, name string) error

CancelJob removes a named job. If the job does not exist it will return an appropriate error.

func (*Service) CancelJobs

func (s *Service) CancelJobs(ctx context.Context, prefix string) error

CancelJobs cancels all jobs with the given prefix. If the prefix matches a period job then all future instances are cancelled.

func (*Service) JobExists

func (s *Service) JobExists(ctx context.Context, name string) bool

JobExists returns true if a job exists.

func (*Service) RunJob

func (s *Service) RunJob(ctx context.Context, name string) error

RunJob runs a named job immediately. If the job does not exist it will return an appropriate error.

func (*Service) RunJobIfExists

func (s *Service) RunJobIfExists(ctx context.Context, name string) error

RunJobIfExists runs a job if it exists. This does not return an error if the job does not exist. If the job does not exist it will return an appropriate error.

func (*Service) ScheduleJob

func (s *Service) ScheduleJob(ctx context.Context, name string, runtime time.Time, jobFunc scheduler.JobFunc, data interface{}) error

ScheduleJob schedules a one-off job for a given time. This function returns two cancel funcs. If the first is triggered the job will not run. If the second is triggered the job runs immediately. Note that if the parent context is cancelled the job wil not run.

func (*Service) SchedulePeriodicJob

func (s *Service) SchedulePeriodicJob(ctx context.Context, name string, runtimeFunc scheduler.RuntimeFunc, runtimeData interface{}, jobFunc scheduler.JobFunc, jobData interface{}) error

SchedulePeriodicJob scheduls a periodic job for a given time.

Jump to

Keyboard shortcuts

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