job

package
v0.0.0-...-e65d92b Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("job not found")
	ErrConflict = errors.New("job was modified or is not in a valid state for this transition")
)

Functions

This section is empty.

Types

type JobClaim

type JobClaim struct {
	ID      pgtype.UUID
	Version int32
}

type LogLine

type LogLine struct {
	AttemptID pgtype.UUID
	Seq       int32
	Level     db.LogLevel
	Line      string
	CreatedAt pgtype.Timestamptz
}

type Repository

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

func New

func New(q db.Querier) *Repository

func (*Repository) Cancel

func (r *Repository) Cancel(ctx context.Context, id pgtype.UUID, version int32) (db.Job, error)

func (*Repository) ClaimForExecution

func (r *Repository) ClaimForExecution(ctx context.Context, id pgtype.UUID, workerID string, staleDelta pgtype.Interval) (db.ClaimJobForExecutionRow, error)

func (*Repository) CompleteAttempt

func (r *Repository) CompleteAttempt(ctx context.Context, attemptID pgtype.UUID, outcome db.AttemptOutcome, result pgtype.Text) (bool, error)

func (*Repository) CompleteJob

func (r *Repository) CompleteJob(ctx context.Context, id pgtype.UUID, version int32, nextRunAt pgtype.Timestamptz) (bool, error)

func (*Repository) Create

func (r *Repository) Create(ctx context.Context, arg db.CreateJobParams) (job db.Job, created bool, err error)

func (*Repository) Delete

func (r *Repository) Delete(ctx context.Context, id pgtype.UUID) error

func (*Repository) FinalizeExpiredJobs

func (r *Repository) FinalizeExpiredJobs(ctx context.Context) ([]pgtype.UUID, error)

func (*Repository) GetAttempt

func (r *Repository) GetAttempt(ctx context.Context, attemptID, jobID pgtype.UUID) (db.JobAttempt, error)

func (*Repository) GetByID

func (r *Repository) GetByID(ctx context.Context, id pgtype.UUID) (db.Job, error)

func (*Repository) GetJobAttemptLogs

func (r *Repository) GetJobAttemptLogs(ctx context.Context, attemptID pgtype.UUID, fromTS, toTS pgtype.Timestamptz, afterSeq, limit int32) ([]db.GetAttemptLogsRow, error)

func (*Repository) GetJobsReadyToRun

func (r *Repository) GetJobsReadyToRun(ctx context.Context, maxFetchPerQueue int, agingRate float64) ([]db.GetDueJobsRow, error)

func (*Repository) InsertJobLogs

func (r *Repository) InsertJobLogs(ctx context.Context, lines []LogLine) (int64, error)

func (*Repository) List

func (r *Repository) List(ctx context.Context, arg db.ListJobsParams) ([]db.Job, error)

func (*Repository) ListAttempts

func (r *Repository) ListAttempts(ctx context.Context, jobID pgtype.UUID, limit, offset int32) ([]db.JobAttempt, error)

func (*Repository) MarksJobAsQueued

func (r *Repository) MarksJobAsQueued(ctx context.Context, ids []pgtype.UUID, claimDeadline pgtype.Interval) ([]pgtype.UUID, error)

func (*Repository) Pause

func (r *Repository) Pause(ctx context.Context, id pgtype.UUID, version int32) (db.Job, error)

func (*Repository) ReclaimStale

func (r *Repository) ReclaimStale(ctx context.Context, maxDeliveryCount int32) ([]db.Job, error)

func (*Repository) RecordExecutionFailure

func (r *Repository) RecordExecutionFailure(ctx context.Context, id pgtype.UUID, version int32, nextCheckAt pgtype.Timestamptz) (bool, error)

func (*Repository) RefreshHeartbeats

func (r *Repository) RefreshHeartbeats(ctx context.Context, claims []JobClaim, staleDelta pgtype.Interval) ([]pgtype.UUID, error)

func (*Repository) Rerun

func (r *Repository) Rerun(ctx context.Context, id pgtype.UUID, version int32) (db.Job, error)

func (*Repository) Reschedule

func (r *Repository) Reschedule(ctx context.Context, arg db.RescheduleJobParams) (db.Job, error)

func (*Repository) Resume

func (r *Repository) Resume(ctx context.Context, id pgtype.UUID, version int32) (db.Job, error)

func (*Repository) SupersedeOpenAttempts

func (r *Repository) SupersedeOpenAttempts(ctx context.Context, jobIDs []pgtype.UUID) error

func (*Repository) UpdateLostJob

func (r *Repository) UpdateLostJob(ctx context.Context, result string) ([]pgtype.UUID, error)

Jump to

Keyboard shortcuts

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