schedule

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package schedule provides scheduling functionality for automated benchmark tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	Plugin  string
	Enabled *bool
	Limit   int
	Offset  int
}

Filter represents filters for querying schedules

type Runner

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

Runner manages scheduled test executions

func NewRunner

func NewRunner(database *db.DB, logger *log.Logger) *Runner

NewRunner creates a new schedule runner

func (*Runner) CheckDue

func (r *Runner) CheckDue() error

CheckDue runs any overdue schedules immediately

func (*Runner) ListJobs

func (r *Runner) ListJobs() []cron.Entry

ListJobs returns information about all scheduled jobs

func (*Runner) RefreshSchedule

func (r *Runner) RefreshSchedule(scheduleID int64) error

RefreshSchedule updates a schedule in the runner

func (*Runner) RegisterSchedule

func (r *Runner) RegisterSchedule(scheduleID int64) error

RegisterSchedule adds a schedule to the runner

func (*Runner) Start

func (r *Runner) Start() error

Start starts the scheduler

func (*Runner) Stop

func (r *Runner) Stop()

Stop stops the scheduler

func (*Runner) UnregisterSchedule

func (r *Runner) UnregisterSchedule(scheduleID int64) error

UnregisterSchedule removes a schedule from the runner

type Schedule

type Schedule struct {
	ID          int64       `json:"id"`
	Name        string      `json:"name"`
	Description string      `json:"description"`
	CronExpr    string      `json:"cron_expr"`
	Plugin      string      `json:"plugin"`
	Params      db.JSONData `json:"params"`
	Enabled     bool        `json:"enabled"`
	LastRunID   *int64      `json:"last_run_id"`
	LastRunTime *time.Time  `json:"last_run_time"`
	NextRunTime *time.Time  `json:"next_run_time"`
	CreatedAt   time.Time   `json:"created_at"`
	UpdatedAt   time.Time   `json:"updated_at"`
}

Schedule represents a scheduled test configuration

func (*Schedule) IsOverdue

func (s *Schedule) IsOverdue() bool

IsOverdue returns true if the schedule is overdue for execution

func (*Schedule) ShouldRun

func (s *Schedule) ShouldRun() bool

ShouldRun returns true if the schedule should run now

type Store

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

Store handles schedule persistence

func NewStore

func NewStore(database *db.DB) *Store

NewStore creates a new schedule store

func (*Store) Create

func (s *Store) Create(schedule *Schedule) error

Create creates a new schedule

func (*Store) Delete

func (s *Store) Delete(id int64) error

Delete deletes a schedule

func (*Store) Disable

func (s *Store) Disable(id int64) error

Disable disables a schedule

func (*Store) Enable

func (s *Store) Enable(id int64) error

Enable enables a schedule

func (*Store) Get

func (s *Store) Get(id int64) (*Schedule, error)

Get retrieves a schedule by ID

func (*Store) GetByName

func (s *Store) GetByName(name string) (*Schedule, error)

GetByName retrieves a schedule by name

func (*Store) GetDue

func (s *Store) GetDue() ([]*Schedule, error)

GetDue returns all schedules that are due to run

func (*Store) List

func (s *Store) List(filter Filter) ([]*Schedule, error)

List retrieves schedules based on filters

func (*Store) Update

func (s *Store) Update(schedule *Schedule) error

Update updates a schedule

func (*Store) UpdateLastRun

func (s *Store) UpdateLastRun(scheduleID, runID int64) error

UpdateLastRun updates the last run information for a schedule

Jump to

Keyboard shortcuts

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