scheduler

package
v0.14.11 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package scheduler keeps one Temporal Schedule per backup job with a cron expression. Temporal owns the firing (persistence, overlap policy, catch-up after downtime); each firing starts BackupJobWorkflow exactly like the manual "Run Now" trigger. The API handlers call Sync/Remove on job changes and ReconcileAll repairs drift at startup.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScheduleID

func ScheduleID(jobID uuid.UUID) string

ScheduleID is the Temporal Schedule id for a job

Types

type Scheduler

type Scheduler struct {
	Client client.Client
	DB     *db.DB
	// TimeZone is the IANA timezone cron expressions are evaluated in ("" = UTC)
	TimeZone string
}

Scheduler reconciles backup jobs with Temporal Schedules

func New

func New(c client.Client, database *db.DB, timeZone string) *Scheduler

New creates a Scheduler; database may be nil (ReconcileAll then only prunes orphans)

func (*Scheduler) ReconcileAll

func (s *Scheduler) ReconcileAll(ctx context.Context) error

ReconcileAll aligns every schedule with the jobs table: it syncs each job and deletes fallbck-owned schedules whose job no longer exists. Run at server startup.

func (*Scheduler) Remove

func (s *Scheduler) Remove(ctx context.Context, jobID uuid.UUID) error

Remove deletes a job's schedule (job deletion); a missing schedule is fine

func (*Scheduler) Sync

func (s *Scheduler) Sync(ctx context.Context, job *db.BackupJob) error

Sync makes the Temporal Schedule for a job match its configuration: a cron creates or updates it (paused while the job is disabled), no cron removes it. Cron expressions are evaluated in UTC.

Jump to

Keyboard shortcuts

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