queue

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnqueueOptions

type EnqueueOptions struct {
	AutoRequeue  bool
	RequeueLimit *int
	// Manual job fields (used when no template is specified).
	Name       string
	Owner      string
	Repo       string
	WorkflowID string
	Ref        string
	Labels     map[string]string
}

EnqueueOptions contains optional parameters for enqueueing a job.

type JobChangeCallback

type JobChangeCallback func(job *store.Job)

JobChangeCallback is called when a job state changes.

type Service

type Service interface {
	Start(ctx context.Context) error
	Stop() error

	// Queue operations.
	Enqueue(ctx context.Context, groupID, templateID, createdBy string, inputs map[string]string, opts *EnqueueOptions) (*store.Job, error)
	Dequeue(ctx context.Context, groupID string) (*store.Job, error)
	Peek(ctx context.Context, groupID string) (*store.Job, error)
	Remove(ctx context.Context, jobID string) error
	Reorder(ctx context.Context, groupID string, jobIDs []string) error

	// Queries.
	GetJob(ctx context.Context, jobID string) (*store.Job, error)
	ListPending(ctx context.Context, groupID string) ([]*store.Job, error)
	ListByStatus(ctx context.Context, groupID string, statuses ...store.JobStatus) ([]*store.Job, error)
	ListHistory(ctx context.Context, groupID string, limit int) ([]*store.Job, error)
	ListHistoryPaginated(ctx context.Context, opts store.HistoryQueryOpts) (*store.HistoryResult, error)

	// State transitions.
	MarkTriggered(ctx context.Context, jobID string, runID int64, runURL string) error
	MarkRunning(ctx context.Context, jobID string, runnerID int64, runnerName string) error
	MarkCompleted(ctx context.Context, jobID string) error
	MarkFailed(ctx context.Context, jobID, errMsg string) error
	MarkCancelled(ctx context.Context, jobID string) error

	// Pause/Unpause.
	Pause(ctx context.Context, jobID string) (*store.Job, error)
	Unpause(ctx context.Context, jobID string) (*store.Job, error)

	// Update.
	UpdateInputs(ctx context.Context, jobID string, inputs map[string]string) error
	UpdateJob(ctx context.Context, jobID string, opts *UpdateJobOptions) error

	// Auto-requeue control.
	DisableAutoRequeue(ctx context.Context, jobID string) (*store.Job, error)
	UpdateAutoRequeue(ctx context.Context, jobID string, autoRequeue bool, requeueLimit *int) (*store.Job, error)

	// Callbacks.
	SetJobChangeCallback(cb JobChangeCallback)
}

Service defines the interface for queue operations.

func NewService

func NewService(log logrus.FieldLogger, cfg *config.Config, st store.Store) Service

NewService creates a new queue service.

type UpdateJobOptions

type UpdateJobOptions struct {
	Inputs     map[string]string
	Name       *string
	Owner      *string
	Repo       *string
	WorkflowID *string
	Ref        *string
	Labels     map[string]string
}

UpdateJobOptions contains parameters for updating a job.

Jump to

Keyboard shortcuts

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