Documentation
¶
Overview ¶
Package postgres provides an inspectable PostgreSQL job store.
Index ¶
- Constants
- type Option
- type Store
- func (store *Store) Ack(ctx context.Context, lease job.Lease) (bool, error)
- func (store *Store) Claim(ctx context.Context, request job.ClaimRequest) ([]job.Delivery, error)
- func (store *Store) Enqueue(ctx context.Context, executor job.Executor, request job.EnqueueRequest) (job.DispatchResult, error)
- func (store *Store) Fail(ctx context.Context, request job.FailureRequest) (bool, error)
- func (store *Store) FailExhausted(ctx context.Context, queues, names []string, limit int) ([]job.FailedJob, error)
- func (store *Store) FindFailed(ctx context.Context, id job.ID) (job.FailedJobDetail, bool, error)
- func (store *Store) ForgetFailed(ctx context.Context, id job.ID) (bool, error)
- func (store *Store) Heartbeat(ctx context.Context, lease job.Lease, duration time.Duration) (bool, error)
- func (store *Store) ListFailed(ctx context.Context, limit int) ([]job.FailedJob, error)
- func (store *Store) Release(ctx context.Context, lease job.Lease) (bool, error)
- func (store *Store) Retry(ctx context.Context, request job.RetryRequest) (bool, error)
- func (store *Store) RetryFailed(ctx context.Context, id job.ID) (bool, error)
Constants ¶
const DropSchema = `DROP TABLE IF EXISTS goforge_failed_jobs; DROP TABLE IF EXISTS goforge_jobs;`
DropSchema is intended for isolated integration-test cleanup.
const Schema = `` /* 2982-byte string literal not displayed */
Schema is the default plain SQL queue schema for application migrations.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*config) error
Option configures validated PostgreSQL identifiers.
func WithLimits ¶
WithLimits changes defensive encoded payload and diagnostic bounds.
func WithTables ¶
WithTables selects application-owned table names.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store owns queue operations but not the supplied database handle.
func (*Store) Claim ¶
Claim atomically leases only known, due jobs and returns after the statement commits.
func (*Store) Enqueue ¶
func (store *Store) Enqueue(ctx context.Context, executor job.Executor, request job.EnqueueRequest) (job.DispatchResult, error)
Enqueue inserts through the explicitly supplied DB or transaction.
func (*Store) FailExhausted ¶
func (store *Store) FailExhausted(ctx context.Context, queues, names []string, limit int) ([]job.FailedJob, error)
FailExhausted atomically moves expired final-attempt leases to failures.
func (*Store) FindFailed ¶
FindFailed explicitly retrieves one terminal job including its payload.
func (*Store) ForgetFailed ¶
ForgetFailed permanently deletes one terminal failure.
func (*Store) Heartbeat ¶
func (store *Store) Heartbeat(ctx context.Context, lease job.Lease, duration time.Duration) (bool, error)
Heartbeat extends a live fenced lease using the database clock.
func (*Store) ListFailed ¶
ListFailed returns newest payload-free failure summaries first.
func (*Store) Release ¶
Release immediately releases a fenced job without changing its attempt count.