durablequeue

package
v0.140.3 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package durablequeue provides a scoped client for the durable work queue. A 204 claim response means no task is claimable now, not that the run ended.

Index

Constants

This section is empty.

Variables

View Source
var ErrConflict = errors.New("durablequeue: conflict or stale lease")
View Source
var ErrInvalid = errors.New("durablequeue: invalid request")
View Source
var ErrUnauthorized = errors.New("durablequeue: unauthorized")
View Source
var ErrUnavailable = errors.New("durablequeue: service unavailable")

Functions

This section is empty.

Types

type Client

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

func New

func New(cfg Config) (*Client, error)

func (*Client) Claim

func (c *Client) Claim(ctx context.Context, run, worker string, lease time.Duration) (Lease, bool, error)

func (*Client) Complete

func (c *Client) Complete(ctx context.Context, run string, l Lease, result json.RawMessage) error

func (*Client) CreateRun

func (c *Client) CreateRun(ctx context.Context, run string) error

func (*Client) Enqueue

func (c *Client) Enqueue(ctx context.Context, run string, tasks []Task) error

func (*Client) Fail

func (c *Client) Fail(ctx context.Context, run string, l Lease, code string, retry bool, backoff time.Duration) error

func (*Client) Renew

func (c *Client) Renew(ctx context.Context, run string, l Lease, lease time.Duration) error

func (*Client) RunCompletion added in v0.140.3

func (c *Client) RunCompletion(ctx context.Context, run string) (Completion, error)

func (*Client) Seal

func (c *Client) Seal(ctx context.Context, run string, expected int64) error

func (*Client) SetPaused

func (c *Client) SetPaused(ctx context.Context, run string, paused bool) error

func (*Client) Stats

func (c *Client) Stats(ctx context.Context, run string) (Stats, error)

func (*Client) TerminalResults added in v0.140.2

func (c *Client) TerminalResults(ctx context.Context, run, after string, limit int) (TerminalPage, error)

TerminalResults returns one byte-bounded keyset page. For an exhaustive export, wait until Stats reports Complete: tasks can become terminal behind a cursor while a run is still active.

type Completion added in v0.140.3

type Completion struct {
	Sealed   bool
	Complete bool
}

Completion is a lightweight indexed completion check, without exact counts.

type Config

type Config struct {
	URL, Token, TokenFile string
	Timeout               time.Duration
	Transport             http.RoundTripper
}

type Lease

type Lease struct {
	Key      string          `json:"key"`
	Worker   string          `json:"worker"`
	Version  int64           `json:"lease_version"`
	Attempts int             `json:"attempts"`
	Until    time.Time       `json:"lease_until"`
	Payload  json.RawMessage `json:"payload"`
}

type Stats

type Stats struct {
	State    string `json:"state"`
	Sealed   bool   `json:"sealed"`
	Total    int64  `json:"total"`
	Pending  int64  `json:"pending"`
	Leased   int64  `json:"leased"`
	Done     int64  `json:"done"`
	Failed   int64  `json:"failed"`
	Complete bool   `json:"complete"`
}

type Task

type Task struct {
	Key         string          `json:"key"`
	Payload     json.RawMessage `json:"payload"`
	MaxAttempts int             `json:"max_attempts"`
}

type TerminalPage added in v0.140.2

type TerminalPage struct {
	Tasks []TerminalTask `json:"tasks"`
	Next  string         `json:"next,omitempty"`
}

type TerminalTask added in v0.140.2

type TerminalTask struct {
	Key       string          `json:"key"`
	State     string          `json:"state"`
	Attempts  int             `json:"attempts"`
	Result    json.RawMessage `json:"result,omitempty"`
	ErrorCode string          `json:"error_code,omitempty"`
}

TerminalTask is an owner-scoped completed or permanently failed task receipt. Large results should live in the owning storage service, referenced here.

Jump to

Keyboard shortcuts

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