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 ¶
- Variables
- type Client
- func (c *Client) Claim(ctx context.Context, run, worker string, lease time.Duration) (Lease, bool, error)
- func (c *Client) Complete(ctx context.Context, run string, l Lease, result json.RawMessage) error
- func (c *Client) CreateRun(ctx context.Context, run string) error
- func (c *Client) Enqueue(ctx context.Context, run string, tasks []Task) error
- func (c *Client) Fail(ctx context.Context, run string, l Lease, code string, retry bool, ...) error
- func (c *Client) Renew(ctx context.Context, run string, l Lease, lease time.Duration) error
- func (c *Client) Seal(ctx context.Context, run string, expected int64) error
- func (c *Client) SetPaused(ctx context.Context, run string, paused bool) error
- func (c *Client) Stats(ctx context.Context, run string) (Stats, error)
- func (c *Client) TerminalResults(ctx context.Context, run, after string, limit int) (TerminalPage, error)
- type Config
- type Lease
- type Stats
- type Task
- type TerminalPage
- type TerminalTask
Constants ¶
This section is empty.
Variables ¶
var ErrConflict = errors.New("durablequeue: conflict or stale lease")
var ErrInvalid = errors.New("durablequeue: invalid request")
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
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 Config ¶
type Config struct {
URL, Token, TokenFile string
Timeout time.Duration
Transport http.RoundTripper
}
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.