Documentation ¶
Overview ¶
Package dal provides a data abstraction layer for cron jobs
Index ¶
- func NewQTx(pool sql.ConnI, tx pgx.Tx) *sql.Queries
- type AttemptedCronJob
- type DAL
- func (d *DAL) EndCronJob(ctx context.Context, job model.CronJob, next time.Time) (model.CronJob, error)
- func (d *DAL) GetCronJobs(ctx context.Context) ([]model.CronJob, error)
- func (d *DAL) GetStaleCronJobs(ctx context.Context, duration time.Duration) ([]model.CronJob, error)
- func (d *DAL) StartCronJobs(ctx context.Context, jobs []model.CronJob) (attemptedJobs []AttemptedCronJob, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AttemptedCronJob ¶
type DAL ¶
type DAL struct {
// contains filtered or unexported fields
}
func (*DAL) EndCronJob ¶
func (d *DAL) EndCronJob(ctx context.Context, job model.CronJob, next time.Time) (model.CronJob, error)
EndCronJob sets the status from executing to idle and updates the next execution time Can be called on the successful completion of a job, or if the job failed to execute (error or timeout)
func (*DAL) GetCronJobs ¶
GetCronJobs returns all cron jobs for deployments with min replicas > 0
func (*DAL) GetStaleCronJobs ¶
func (d *DAL) GetStaleCronJobs(ctx context.Context, duration time.Duration) ([]model.CronJob, error)
GetStaleCronJobs returns a list of cron jobs that have been executing longer than the duration
func (*DAL) StartCronJobs ¶
func (d *DAL) StartCronJobs(ctx context.Context, jobs []model.CronJob) (attemptedJobs []AttemptedCronJob, err error)
StartCronJobs returns a full list of results so that the caller can update their list of jobs whether or not they successfully updated the row
Click to show internal directories.
Click to hide internal directories.