cronjobs

package
v0.354.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Timeout time.Duration
}

type DAL

type DAL interface {
	GetCronJobs(ctx context.Context) ([]model.CronJob, error)
	StartCronJobs(ctx context.Context, jobs []model.CronJob) (attemptedJobs []dal.AttemptedCronJob, err error)
	EndCronJob(ctx context.Context, job model.CronJob, next time.Time) (model.CronJob, error)
	GetStaleCronJobs(ctx context.Context, duration time.Duration) ([]model.CronJob, error)
}

type Scheduler

type Scheduler interface {
	Singleton(retry backoff.Backoff, job scheduledtask.Job)
	Parallel(retry backoff.Backoff, job scheduledtask.Job)
}

type Service

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

func New

func New(ctx context.Context, key model.ControllerKey, requestSource string, config Config, conn *sql.DB, scheduler Scheduler, call ExecuteCallFunc) *Service

func NewForTesting

func NewForTesting(ctx context.Context, key model.ControllerKey, requestSource string, config Config, dal DAL, scheduler Scheduler, call ExecuteCallFunc, clock clock.Clock) *Service

func (*Service) CreatedOrReplacedDeloyment

func (s *Service) CreatedOrReplacedDeloyment(ctx context.Context, newDeploymentKey model.DeploymentKey)

CreatedOrReplacedDeloyment is only called by the responsible controller to its cron service, and will not be received by the other cron services. When a controller creates/replaces a deployment, its cron job service is responsible for the newly created cron jobs until other controllers have a chance to resync their list of jobs and start sharing responsibility of the new cron jobs.

func (*Service) NewCronJobsForModule

func (s *Service) NewCronJobsForModule(ctx context.Context, module *schemapb.Module) ([]model.CronJob, error)

func (*Service) UpdatedControllerList

func (s *Service) UpdatedControllerList(ctx context.Context, controllers []parentdal.Controller)

UpdatedControllerList synchronises the hash ring with the active controllers.

Directories

Path Synopsis
Package dal provides a data abstraction layer for cron jobs
Package dal provides a data abstraction layer for cron jobs

Jump to

Keyboard shortcuts

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