job

package
v1.0.284 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: Apache-2.0 Imports: 15 Imported by: 13

Documentation

Index

Constants

View Source
const (
	ResourceTypeCheckStatuses = "check_statuses"
	ResourceTypeComponent     = "components"
	ResourceTypeUpstream      = "upstream"
)

Variables

View Source
var Retention3Day = Retention{
	Success:  3,
	Failed:   3,
	Age:      time.Hour * 24 * 3,
	Interval: time.Hour * 4,
}
View Source
var RetentionDay = Retention{
	Success:  3,
	Failed:   3,
	Age:      time.Hour,
	Interval: time.Hour * 24,
}
View Source
var RetentionHour = Retention{
	Success:  1,
	Failed:   3,
	Age:      time.Hour,
	Interval: 5 * time.Minute,
}

Functions

func AggregateCheckStatus1d added in v1.0.245

func AggregateCheckStatus1d(ctx context.Context) (error, int)

func AggregateCheckStatus1h added in v1.0.245

func AggregateCheckStatus1h(ctx context.Context) (error, int)

func CleanupSoftDeletedComponents added in v1.0.267

func CleanupSoftDeletedComponents(ctx context.Context, olderThan time.Duration) (int, error)

func DeleteOldCheckStatuses added in v1.0.245

func DeleteOldCheckStatuses(ctx context.Context, retention int) (error, int)

func DeleteOldCheckStatuses1d added in v1.0.245

func DeleteOldCheckStatuses1d(ctx context.Context, retention int) (error, int)

func DeleteOldCheckStatuses1h added in v1.0.245

func DeleteOldCheckStatuses1h(ctx context.Context, retention int) (error, int)

func RefreshCheckStatusSummary added in v1.0.245

func RefreshCheckStatusSummary(ctx context.Context) error

func RefreshCheckStatusSummaryAged added in v1.0.245

func RefreshCheckStatusSummaryAged(ctx context.Context) error

Types

type Job added in v1.0.202

type Job struct {
	context.Context
	Name         string
	Schedule     string
	Singleton    bool
	Debug, Trace bool
	Timeout      time.Duration
	Fn           func(ctx JobRuntime) error
	JobHistory   bool
	RunNow       bool
	ID           string

	Retention Retention
	// contains filtered or unexported fields
}

func NewJob

func NewJob(ctx context.Context, name string, schedule string, fn func(ctx JobRuntime) error) *Job

func (*Job) AddToScheduler added in v1.0.202

func (j *Job) AddToScheduler(cronRunner *cron.Cron) error

func (*Job) FindHistory added in v1.0.250

func (j *Job) FindHistory(statuses ...string) ([]models.JobHistory, error)

func (*Job) GetEntry added in v1.0.202

func (j *Job) GetEntry(cronRunner *cron.Cron) *cron.Entry

func (*Job) RemoveFromScheduler added in v1.0.202

func (j *Job) RemoveFromScheduler(cronRunner *cron.Cron)

func (*Job) Retain added in v1.0.265

func (j *Job) Retain(r Retention) *Job

func (*Job) Run added in v1.0.202

func (j *Job) Run()

func (*Job) RunOnStart added in v1.0.202

func (j *Job) RunOnStart() *Job

func (*Job) SetID added in v1.0.202

func (j *Job) SetID(id string) *Job

func (*Job) SetTimeout added in v1.0.202

func (j *Job) SetTimeout(t time.Duration) *Job

func (*Job) String added in v1.0.250

func (j *Job) String() string

func (*Job) Unschedule added in v1.0.245

func (j *Job) Unschedule()

type JobRuntime

type JobRuntime struct {
	context.Context
	Job       *Job
	Span      trace.Span
	History   *models.JobHistory
	Table, Id string
	// contains filtered or unexported fields
}

func (*JobRuntime) Failf added in v1.0.245

func (j *JobRuntime) Failf(message string, args ...interface{})

func (*JobRuntime) ID added in v1.0.250

func (j *JobRuntime) ID() string

type Retention added in v1.0.250

type Retention struct {
	Success, Failed int
	Age             time.Duration
	Interval        time.Duration
}

func (Retention) String added in v1.0.250

func (r Retention) String() string

Jump to

Keyboard shortcuts

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