workqueue

package
v0.91.5 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 22 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

Index

Constants

View Source
const DefaultBranch = "gh-aw-work-queue"
View Source
const FileName = "work-queue.jsonl"
View Source
const MaxEnqueued int64 = 9007199254740991

MaxEnqueued is the largest integer represented exactly by JavaScript.

Variables

This section is empty.

Functions

func OldestAvailable added in v0.90.4

func OldestAvailable(transactions []Transaction) (string, error)

OldestAvailable selects by enqueue time, then UTF-8 Work identity. Legacy Work has age zero; an empty identity means no Work is available.

func Serialize

func Serialize(transactions []Transaction) ([]byte, error)

func WorkID

func WorkID(payload []byte) (string, json.RawMessage, error)

Types

type Branch

type Branch struct {
	Remote string
	Name   string
	// contains filtered or unexported fields
}

Branch operates through GitHub Git APIs without a local checkout or Git executable.

func (Branch) Read

func (b Branch) Read(ctx context.Context) ([]Transaction, error)

func (Branch) Update

func (b Branch) Update(ctx context.Context, change func([]Transaction) ([]Transaction, bool, error)) ([]Transaction, bool, error)

Update retries rejected non-force reference updates from a fresh branch snapshot.

type ClaimState

type ClaimState struct {
	ClaimID string `json:"claim_id"`
	RunID   string `json:"run_id"`
	State   string `json:"state"`
}

type Projection

type Projection struct {
	Works     []WorkState `json:"works"`
	Available []string    `json:"available"`
	Stats     Stats       `json:"stats"`
}

func Replay

func Replay(transactions []Transaction) (Projection, error)

type Stats

type Stats struct {
	Work         int `json:"work"`
	Available    int `json:"available"`
	Claimed      int `json:"claimed"`
	Completed    int `json:"completed"`
	Cancelled    int `json:"cancelled"`
	Claims       int `json:"claims"`
	Transactions int `json:"transactions"`
}

type Transaction

type Transaction struct {
	Kind      string          `json:"kind"`
	WorkID    string          `json:"work_id"`
	Work      json.RawMessage `json:"work,omitempty"`
	ClaimID   string          `json:"claim_id,omitempty"`
	RunID     string          `json:"run_id,omitempty"`
	AttemptID string          `json:"attempt_id,omitempty"`
	Outcome   string          `json:"outcome,omitempty"`
	Enqueued  int64           `json:"enqueued,omitempty"`
}

func Apply

func Apply(transactions []Transaction, tx Transaction) ([]Transaction, bool, error)

func Compact

func Compact(transactions []Transaction) ([]Transaction, error)

func NewWork added in v0.90.4

func NewWork(payload []byte) (Transaction, error)

NewWork captures immutable enqueue time before publication retries.

func Parse

func Parse(data []byte) ([]Transaction, error)

type WorkState

type WorkState struct {
	WorkID   string          `json:"work_id"`
	Work     json.RawMessage `json:"work"`
	State    string          `json:"state"`
	Winner   string          `json:"winner,omitempty"`
	Claims   []ClaimState    `json:"claims"`
	Outcome  string          `json:"outcome,omitempty"`
	Enqueued int64           `json:"enqueued"`
}

Jump to

Keyboard shortcuts

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