postgres

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package postgres provides a PostgreSQL-backed implementation of the build queue.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresQueue

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

PostgresQueue implements queue.Queue using PostgreSQL.

func NewPostgresQueue

func NewPostgresQueue(db *sql.DB, logger *slog.Logger) *PostgresQueue

NewPostgresQueue creates a new PostgreSQL-backed queue.

func (*PostgresQueue) Ack

func (q *PostgresQueue) Ack(ctx context.Context, jobID string) error

Ack acknowledges successful processing of a job, removing it from the queue.

func (*PostgresQueue) Dequeue

func (q *PostgresQueue) Dequeue(ctx context.Context) (*models.BuildJob, error)

Dequeue retrieves and locks the next available build job from the queue. Uses SELECT FOR UPDATE SKIP LOCKED for concurrent worker safety.

func (*PostgresQueue) Enqueue

func (q *PostgresQueue) Enqueue(ctx context.Context, job *models.BuildJob) error

Enqueue adds a new build job to the queue. The job is serialized to JSON and stored in the build_queue table.

func (*PostgresQueue) Nack

func (q *PostgresQueue) Nack(ctx context.Context, jobID string) error

Nack indicates that job processing failed, making the job available for retry.

Jump to

Keyboard shortcuts

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