workqueue

package
v0.91.7 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBranch = "work-queue"
View Source
const FileName = "work-queue.jsonl"
View Source
const MaxClaimsPerDispatch = 16
View Source
const MaxEnqueued = MaxTimestamp
View Source
const MaxTimestamp int64 = 9007199254740991
View Source
const Version = 3

Variables

This section is empty.

Functions

func AuthorizeEffect added in v0.91.6

func AuthorizeEffect(state Projection, actor Actor, target EffectResource) error

func BuildCandidate added in v0.91.6

func BuildCandidate(commits []QueueCommit, actor Actor, request Request, at int64) ([]QueueCommit, *QueueCommit, Decision, error)

func Canonical added in v0.91.6

func Canonical(data []byte) ([]byte, error)

Canonical uses the contract's integer-only JSON profile and UTF-8 key order.

func CanonicalValue added in v0.91.6

func CanonicalValue(value any) ([]byte, error)

CanonicalValue encodes typed JSON without repairing strings or losing numeric values.

func Fingerprint added in v0.91.6

func Fingerprint(actor Actor, kind string, parameters json.RawMessage) (string, error)

func IndependentGraphID added in v0.91.6

func IndependentGraphID(payload []byte) (string, error)

func NodeID added in v0.91.6

func NodeID(graphID, nodeKey string) string

func NormalizeClaimHandle added in v0.91.6

func NormalizeClaimHandle(assignment Assignment, selector *string) (string, error)

func ObservationRefreshBudget added in v0.91.6

func ObservationRefreshBudget(state Projection, requested int) (int, error)

ObservationRefreshBudget reserves a Claim slot and excludes optional recovery-capacity reads.

func ProposedCommitID added in v0.91.6

func ProposedCommitID(state Projection, request Request) string

func RecoveryHeadroom added in v0.91.6

func RecoveryHeadroom(state Projection) int64

RecoveryHeadroom reports the outstanding closure reservation for a replayed projection.

func Serialize

func Serialize(commits []QueueCommit) ([]byte, error)

func ValidateAssignment added in v0.91.6

func ValidateAssignment(state Projection, assignment Assignment) error

func ValidateCommit added in v0.91.6

func ValidateCommit(commit QueueCommit) error

func ValidatePolicy added in v0.91.6

func ValidatePolicy(policy Policy) error

ValidatePolicy checks the closed contract and semantic limits, not caller authentication or approval of the configured worker identities.

Types

type Actor added in v0.91.6

type Actor struct {
	Role        string `json:"role"`
	Principal   string `json:"principal"`
	Repository  string `json:"repository"`
	Workflow    string `json:"workflow,omitempty"`
	RunID       string `json:"run_id,omitempty"`
	RunAttempt  int    `json:"run_attempt,omitempty"`
	DispatchID  string `json:"dispatch_id,omitempty"`
	ClaimHandle string `json:"claim_handle,omitempty"`
}

type Assignment added in v0.91.6

type Assignment struct {
	Version       int               `json:"version"`
	DispatchID    string            `json:"dispatch_id"`
	RequestID     string            `json:"request_id"`
	CommitID      string            `json:"commit_id"`
	PolicyEpoch   string            `json:"policy_epoch"`
	Pool          string            `json:"pool"`
	WorkerProfile string            `json:"worker_profile"`
	Claims        []AssignmentClaim `json:"claims"`
}

func ParseAssignment added in v0.91.6

func ParseAssignment(data []byte) (Assignment, error)

type AssignmentClaim added in v0.91.6

type AssignmentClaim struct {
	Handle     string            `json:"handle"`
	ClaimID    string            `json:"claim_id"`
	WorkID     string            `json:"work_id"`
	Work       json.RawMessage   `json:"work"`
	ResultRefs []ResultReference `json:"result_refs"`
}

type Branch

type Branch struct {
	Remote              string
	Name                string
	DependencyClients   map[string]*api.RESTClient
	DeliveryVerifier    DeliveryVerifier
	RemediationVerifier RemediationVerifier
	// contains filtered or unexported fields
}

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

func (Branch) Authenticate added in v0.91.6

func (b Branch) Authenticate(ctx context.Context, role string) (Actor, error)

Authenticate derives operator identity from the credential, not command flags, Git authors, submitted actor fields, or an untrusted Actions environment.

func (Branch) CancelReserved added in v0.91.6

func (b Branch) CancelReserved(ctx context.Context, dispatchID, requestID string) (Reconciliation, error)

CancelReserved is a checked prelaunch cancellation, never a force release. A competing start marker wins through CAS and makes this request invalid.

func (Branch) Compact added in v0.91.6

func (b Branch) Compact(ctx context.Context) (Compaction, error)

Compact canonicalizes representation only. Every unique commit, operation, logical request and charged turn remains in the original causal chain.

func (Branch) InspectEvidence added in v0.91.6

func (b Branch) InspectEvidence(ctx context.Context, dispatchID string) (Reconciliation, error)

func (Branch) Publish added in v0.91.6

func (b Branch) Publish(ctx context.Context, actor Actor, request Request) (Publication, error)

Publish retains only authenticated logical intent across CAS retries. It discards selections, handles, charges and clocks and recovers uncertain ref acknowledgments by stable request identity before constructing another grant.

func (Branch) Read

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

func (Branch) Reconcile added in v0.91.6

func (b Branch) Reconcile(ctx context.Context, dispatchID, requestID string) (Reconciliation, error)

Reconcile inspects the exact bound native attempt. Missing/unbound runs retain reservations; terminal recovery cancels open members only, preserving every Completion and independently pending delivery barrier.

func (Branch) RecoverDelivery added in v0.91.6

func (b Branch) RecoverDelivery(ctx context.Context, workID, requestID string) (DeliveryRecovery, error)

RecoverDelivery settles a barrier independently of native capacity. Missing proof remains unknown; neither an overall run success nor a missing artifact is interpreted as verified delivery or as proof that effects never began.

type Capacity added in v0.91.6

type Capacity struct {
	Logical int `json:"logical"`
	Native  int `json:"native"`
	Account int `json:"account"`
}

type ClaimExplanation added in v0.91.6

type ClaimExplanation struct {
	Tip            string    `json:"tip"`
	At             int64     `json:"at"`
	Status         string    `json:"status"`
	BeforeTip      string    `json:"before_tip"`
	Position       Position  `json:"position"`
	RequestID      string    `json:"request_id"`
	CommitID       string    `json:"commit_id"`
	PolicyEpoch    string    `json:"policy_epoch"`
	ClaimID        string    `json:"claim_id"`
	DispatchID     string    `json:"dispatch_id"`
	Handle         string    `json:"claim_handle"`
	WorkID         string    `json:"work_id"`
	Pool           string    `json:"pool"`
	Priority       int       `json:"priority"`
	FairnessKey    string    `json:"fairness_key"`
	WorkPosition   Position  `json:"work_position"`
	Selection      Selection `json:"selection"`
	ClassPassPrior string    `json:"class_pass_prior"`
	KeyPassPrior   string    `json:"key_pass_prior"`
	CapacityBefore Capacity  `json:"capacity_before"`
	CapacityAfter  Capacity  `json:"capacity_after"`
}

func ExplainBeforeClaim added in v0.91.6

func ExplainBeforeClaim(commits []QueueCommit, claimID string) (ClaimExplanation, error)

ExplainBeforeClaim validates the whole authority, then reduces the exact predecessor and earlier in-commit observations/Claims with native reducers.

type ClaimOperation added in v0.91.6

type ClaimOperation struct {
	Kind         string   `json:"kind"`
	WorkID       string   `json:"work_id"`
	ClaimID      string   `json:"claim_id"`
	DispatchID   string   `json:"dispatch_id"`
	Handle       string   `json:"handle"`
	Observations []string `json:"observations"`
}

type ClaimState

type ClaimState struct {
	ClaimOperation
	State              string `json:"state"`
	CommitID           string `json:"commit_id"`
	RequestID          string `json:"request_id"`
	TerminalCommitID   string `json:"terminal_commit_id,omitempty"`
	CancellationReason string `json:"cancellation_reason,omitempty"`
	RetryNotBefore     int64  `json:"retry_not_before,omitempty"`
	IssueComment       string `json:"issue_comment,omitempty"`
}

type Clock added in v0.91.6

type Clock struct {
	V      string            `json:"v"`
	Pass   map[string]string `json:"pass"`
	Active map[string]bool   `json:"active"`
}

type Compaction added in v0.91.6

type Compaction struct {
	Tip                     string `json:"tip"`
	At                      int64  `json:"at"`
	Changed                 bool   `json:"changed"`
	AcknowledgmentRecovered bool   `json:"acknowledgment_recovered"`
	Commits                 int    `json:"commits"`
	DuplicatesRemoved       int    `json:"duplicates_removed"`
	BytesBefore             int    `json:"bytes_before"`
	BytesAfter              int    `json:"bytes_after"`
}

type Decision added in v0.91.6

type Decision struct {
	Tip         string       `json:"tip"`
	Operations  []Operation  `json:"operations"`
	Assignments []Assignment `json:"assignments"`
	Reason      string       `json:"reason"`
	Next        Selection    `json:"next"`
}

func PlanDispatch added in v0.91.6

func PlanDispatch(state Projection, params DispatchParameters, requestID, commitID string, at int64) (Decision, error)

type DeliveryRecovery added in v0.91.6

type DeliveryRecovery struct {
	WorkID      string       `json:"work_id"`
	Reason      string       `json:"reason"`
	Attempts    int          `json:"attempts"`
	Publication *Publication `json:"publication,omitempty"`
}

type DeliveryVerification added in v0.91.6

type DeliveryVerification struct {
	Verified          bool
	Descriptor        json.RawMessage
	Receipt           string
	Disposition       string
	PositiveNoEffects bool
}

type DeliveryVerifier added in v0.91.6

type DeliveryVerifier func(context.Context, Projection, ClaimState) (DeliveryVerification, error)

DeliveryVerifier is a trusted, read-only receipt/effect-contract adapter. It verifies existing scoped effects; it must never execute or retry effects. Configuring it is a host capability, not an actor/source string or CLI flag.

type Dependency added in v0.91.6

type Dependency struct {
	Kind      string    `json:"kind"`
	WorkID    string    `json:"work_id,omitempty"`
	Resource  *Resource `json:"resource,omitempty"`
	Condition string    `json:"condition,omitempty"`
}

type DispatchParameters added in v0.91.6

type DispatchParameters struct {
	Pool          string `json:"pool"`
	MaxClaims     int    `json:"max_claims"`
	MaxDispatches int    `json:"max_dispatches"`
	MaxBytes      int64  `json:"max_bytes"`
}

type DispatchState added in v0.91.6

type DispatchState struct {
	Assignment
	Profile         WorkerProfile `json:"profile"`
	State           string        `json:"state"`
	Sender          *Actor        `json:"sender,omitempty"`
	Run             *RunBinding   `json:"run,omitempty"`
	Released        bool          `json:"released"`
	Reason          string        `json:"reason,omitempty"`
	LifecycleWrites int           `json:"lifecycle_writes"`
}

type EffectResource added in v0.91.6

type EffectResource map[string]string

EffectResource is a broker-resolved target, not an assertion of authenticated evidence.

type Evidence added in v0.91.6

type Evidence struct {
	Kind       string `json:"kind"`
	Source     string `json:"source"`
	Repository string `json:"repository"`
	Workflow   string `json:"workflow"`
	Ref        string `json:"ref"`
	Principal  string `json:"principal"`
	CheckedAt  int64  `json:"checked_at"`
	RunID      string `json:"run_id,omitempty"`
	RunAttempt int    `json:"run_attempt,omitempty"`
	Status     string `json:"status,omitempty"`
	Conclusion string `json:"conclusion,omitempty"`
	Receipt    string `json:"receipt,omitempty"`
	Attempts   int    `json:"attempts,omitempty"`
	Effects    string `json:"effects,omitempty"`
}

type FinishParameters added in v0.91.6

type FinishParameters struct {
	DispatchID  string `json:"dispatch_id"`
	ClaimHandle string `json:"claim_handle"`
	Outcome     string `json:"outcome"`
}

func NormalizeFinishIntent added in v0.91.6

func NormalizeFinishIntent(assignment Assignment, data []byte) (FinishParameters, error)

NormalizeFinishIntent preserves absent versus null through schema validation. The result still needs durable assignment/run/ownership verification.

type IssueCommentOperation added in v0.91.7

type IssueCommentOperation struct {
	Kind             string `json:"kind"`
	WorkID           string `json:"work_id"`
	CommentID        string `json:"comment_id"`
	ProjectorRef     string `json:"projector_ref"`
	ClaimID          string `json:"claim_id,omitempty"`
	AuthorityClaimID string `json:"authority_claim_id,omitempty"`
}

type IssueLinkOperation added in v0.91.7

type IssueLinkOperation struct {
	Kind         string   `json:"kind"`
	WorkID       string   `json:"work_id"`
	Resource     Resource `json:"resource"`
	ProjectorRef string   `json:"projector_ref"`
	ClaimID      string   `json:"claim_id,omitempty"`
}

type Limits added in v0.91.6

type Limits struct {
	LedgerBytes       int64 `json:"ledger_bytes"`
	RecoveryBytes     int64 `json:"recovery_bytes"`
	PayloadBytes      int64 `json:"payload_bytes"`
	GraphNodes        int   `json:"graph_nodes"`
	Predecessors      int   `json:"predecessors"`
	PendingNodes      int   `json:"pending_nodes"`
	Operations        int   `json:"operations"`
	AssignmentBytes   int64 `json:"assignment_bytes"`
	ResultBytes       int64 `json:"result_bytes"`
	EvidenceBytes     int64 `json:"evidence_bytes"`
	ObservationWrites int   `json:"observation_writes"`
}

type NativeDeliveryHost added in v0.91.6

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

NativeDeliveryHost owns in-process callback capabilities. JSON cannot create or configure a host. The copied registrations cannot be changed by Work data.

func NewNativeDeliveryHost added in v0.91.6

func NewNativeDeliveryHost(options NativeDeliveryHostOptions) *NativeDeliveryHost

func (*NativeDeliveryHost) Verifier added in v0.91.6

func (host *NativeDeliveryHost) Verifier(branch Branch) DeliveryVerifier

Verifier returns the native adapter used by both recovery and every fresh CAS prefix. It re-reads API provenance and approved callbacks on each invocation; a copied receipt/digest or successful job can never bypass those reads.

type NativeDeliveryHostOptions added in v0.91.6

type NativeDeliveryHostOptions struct {
	Inventory func(context.Context, NativeDeliveryScope) (NativeDeliveryInventory, error)
	// Credentials proves the host has approved read credentials for this exact
	// target and generation before any output verifier may call an external SDK.
	Credentials func(context.Context, NativeDeliveryScope, EffectResource) error
	Builtin     map[string]NativeOutputVerifier
	Declared    map[string]NativeOutputVerifier
}

type NativeDeliveryInventory added in v0.91.6

type NativeDeliveryInventory struct {
	Closed  bool
	Outputs []NativeDeliveryOutput
}

NativeDeliveryInventory must come from an approved process callback, not a receipt file, subprocess stdout, artifact, or caller-supplied source string. Closed means the process has stopped accepting effects for this member.

type NativeDeliveryOutput added in v0.91.6

type NativeDeliveryOutput struct {
	Type      string
	Target    EffectResource
	Intent    json.RawMessage
	RequestID string
}

NativeDeliveryOutput is an item from the protected worker's closed effect channel. Intent and Target are data; neither grants verifier authority.

type NativeDeliveryScope added in v0.91.6

type NativeDeliveryScope struct {
	Member               AssignmentClaim
	Run                  RunBinding
	CompletionID         string
	CredentialGeneration string
}

NativeDeliveryScope binds approved process callbacks to the immutable member and the authenticated original Actions attempt. It is not a wire credential.

type NativeOutputVerifier added in v0.91.6

NativeOutputVerifier performs independent readback only. Hosts register these callbacks before admitting untrusted worker input; no verifier is executable merely because a Work names its ID.

type NativeRun added in v0.91.6

type NativeRun struct {
	ID           json.Number `json:"id"`
	RunAttempt   int         `json:"run_attempt"`
	Event        string      `json:"event"`
	Status       string      `json:"status"`
	Conclusion   string      `json:"conclusion"`
	HeadSHA      string      `json:"head_sha"`
	Path         string      `json:"path"`
	DisplayTitle string      `json:"display_title"`
	Actor        struct {
		ID    json.Number `json:"id"`
		Login string      `json:"login"`
	} `json:"actor"`
	TriggeringActor struct {
		ID json.Number `json:"id,omitempty"`
	} `json:"triggering_actor"`
	Repository struct {
		FullName string `json:"full_name"`
	} `json:"repository"`
}

NativeRun is a bounded projection of the authenticated Actions run API. Native/resource IDs are decoded as json.Number and never through float64.

type Observation added in v0.91.6

type Observation struct {
	Kind                 string   `json:"kind"`
	ObservationID        string   `json:"observation_id"`
	Resource             Resource `json:"resource"`
	Condition            string   `json:"condition"`
	State                string   `json:"state"`
	ObservedAt           int64    `json:"observed_at"`
	CredentialGeneration string   `json:"credential_generation"`
	SourceUpdatedAt      *int64   `json:"source_updated_at,omitempty"`
	ReadStatus           string   `json:"read_status"`
	StateReason          string   `json:"state_reason,omitempty"`
	ResourceState        string   `json:"resource_state,omitempty"`
	Merged               *bool    `json:"merged,omitempty"`
	MergeCommit          string   `json:"merge_commit,omitempty"`
}

type Operation added in v0.91.6

type Operation = json.RawMessage

Operation stores a closed variant as raw JSON. Typed accessors keep absent, null, and explicit zero distinct, unlike a struct with omitempty authority.

func Op added in v0.91.6

func Op(value any) (Operation, error)

type OperationsParameters added in v0.91.6

type OperationsParameters struct {
	Operations []Operation `json:"operations"`
}

type Policy added in v0.91.6

type Policy struct {
	Mode              string                  `json:"mode"`
	ClassWeights      []int                   `json:"class_weights"`
	AccountingWeights map[string]int          `json:"accounting_weights"`
	Producers         map[string]ProducerRule `json:"producers"`
	Projectors        []ProjectorRule         `json:"projectors,omitempty"`
	Pools             map[string]PoolPolicy   `json:"pools"`
	Limits            Limits                  `json:"limits"`
}

func DefaultPolicy added in v0.91.6

func DefaultPolicy(principal, repository string) Policy

type PoolClocks added in v0.91.6

type PoolClocks struct {
	Classes Clock         `json:"classes"`
	Keys    map[int]Clock `json:"keys"`
}

type PoolPolicy added in v0.91.6

type PoolPolicy struct {
	DefaultProfile      string                   `json:"default_profile"`
	Profiles            map[string]WorkerProfile `json:"profiles"`
	LogicalLimit        int                      `json:"logical_limit"`
	NativeLimit         int                      `json:"native_limit"`
	PerAccountLimit     int                      `json:"per_account_limit,omitempty"`
	AllowedRepositories []string                 `json:"allowed_repositories"`
	MaxObservationAgeMS int64                    `json:"max_observation_age_ms"`
	Retry               RetryPolicy              `json:"retry"`
	Reconciliation      ReconciliationPolicy     `json:"reconciliation"`
}

type Position added in v0.91.6

type Position struct {
	Commit    int `json:"commit"`
	Operation int `json:"operation"`
}

type ProducerRule added in v0.91.6

type ProducerRule struct {
	Pools        []string `json:"pools"`
	Priorities   []int    `json:"priorities"`
	FairnessKeys []string `json:"fairness_keys"`
}

type Projection

type Projection struct {
	Repository           string                    `json:"repository"`
	Tip                  string                    `json:"tip"`
	PolicyEpoch          string                    `json:"policy_epoch"`
	Policy               *Policy                   `json:"policy"`
	Works                map[string]*WorkState     `json:"works"`
	Claims               map[string]*ClaimState    `json:"claims"`
	Dispatches           map[string]*DispatchState `json:"dispatches"`
	Observations         map[string]*Observation   `json:"observations"`
	Requests             map[string]QueueCommit    `json:"requests"`
	Clocks               map[string]PoolClocks     `json:"clocks"`
	AdmissionPaused      bool                      `json:"admission_paused"`
	GrantsPaused         bool                      `json:"grants_paused"`
	CredentialGeneration string                    `json:"credential_generation"`
	Stats                Stats                     `json:"stats"`
	LedgerBytes          int64                     `json:"ledger_bytes"`
	ObservationWrites    map[string]int            `json:"observation_writes"`
}

func Replay

func Replay(commits []QueueCommit) (Projection, error)

type ProjectorRule added in v0.91.7

type ProjectorRule struct {
	Principal        string     `json:"principal"`
	Workflow         string     `json:"workflow"`
	Ref              string     `json:"ref"`
	Pools            []string   `json:"pools"`
	Repositories     []string   `json:"repositories"`
	BackingIssues    []Resource `json:"backing_issues,omitempty"`
	CompletionPolicy string     `json:"completion_policy,omitempty"`
}

type ProtocolError added in v0.91.6

type ProtocolError struct {
	Code    string
	Message string
}

ProtocolError preserves a stable rejection code without requiring message matching.

func (*ProtocolError) Error added in v0.91.6

func (e *ProtocolError) Error() string

type Publication added in v0.91.6

type Publication struct {
	Commit   *QueueCommit `json:"commit,omitempty"`
	Decision Decision     `json:"decision"`
	Changed  bool         `json:"changed"`
}

type QueueCommit added in v0.91.6

type QueueCommit struct {
	Version     int         `json:"version"`
	ID          string      `json:"id"`
	Previous    *string     `json:"previous"`
	Request     Request     `json:"request"`
	Actor       Actor       `json:"actor"`
	PolicyEpoch string      `json:"policy_epoch"`
	At          int64       `json:"at"`
	Operations  []Operation `json:"operations"`
	Trace       *Trace      `json:"trace,omitempty"`
}

func Compact

func Compact(commits []QueueCommit) ([]QueueCommit, error)

func Genesis added in v0.91.6

func Genesis(actor Actor, policy Policy, requestID, epoch string, at int64) (QueueCommit, error)

func Parse

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

type Reconciliation added in v0.91.6

type Reconciliation struct {
	DispatchID  string       `json:"dispatch_id"`
	State       string       `json:"state"`
	Reason      string       `json:"reason"`
	Evidence    *Evidence    `json:"evidence,omitempty"`
	Publication *Publication `json:"publication,omitempty"`
}

type ReconciliationPolicy added in v0.91.6

type ReconciliationPolicy struct {
	MaxAttempts int   `json:"max_attempts"`
	DeadlineMS  int64 `json:"deadline_ms"`
}

type RemediationVerifier added in v0.91.6

type RemediationVerifier func(context.Context, Projection, WorkDefinition) error

RemediationVerifier validates domain-specific idempotence, compensation, or inspection-only scope before replacing a node with partial/unknown effects.

type Replacement added in v0.91.6

type Replacement struct {
	WorkID      string `json:"work_id"`
	Disposition string `json:"disposition"`
	Evidence    string `json:"evidence"`
}

type Request added in v0.91.6

type Request struct {
	ID          string          `json:"id"`
	Kind        string          `json:"kind"`
	Parameters  json.RawMessage `json:"parameters"`
	Fingerprint string          `json:"fingerprint"`
}

func NewRequest added in v0.91.6

func NewRequest(id, kind string, actor Actor, parameters any) (Request, error)

type RequestExplanation added in v0.91.6

type RequestExplanation struct {
	Tip         string             `json:"tip"`
	At          int64              `json:"at"`
	Status      string             `json:"status"`
	RequestID   string             `json:"request_id"`
	CommitID    string             `json:"commit_id"`
	Kind        string             `json:"kind"`
	PolicyEpoch string             `json:"policy_epoch"`
	Claims      []ClaimExplanation `json:"claims"`
}

func ExplainRequest added in v0.91.6

func ExplainRequest(commits []QueueCommit, requestID string) (RequestExplanation, error)

type Resource added in v0.91.6

type Resource struct {
	Kind         string `json:"kind"`
	Host         string `json:"host"`
	Repository   string `json:"repository"`
	RepositoryID string `json:"repository_id"`
	ResourceID   string `json:"resource_id"`
	Number       string `json:"number"`
}

type ResultReference added in v0.91.6

type ResultReference struct {
	WorkID         string          `json:"work_id"`
	ResultCommitID string          `json:"result_commit_id"`
	Descriptor     json.RawMessage `json:"descriptor"`
}

type RetryPolicy added in v0.91.6

type RetryPolicy struct {
	MaxAttempts int   `json:"max_attempts"`
	BackoffMS   int64 `json:"backoff_ms"`
}

type RunBinding added in v0.91.6

type RunBinding struct {
	RunID      string `json:"run_id"`
	RunAttempt int    `json:"run_attempt"`
	Repository string `json:"repository"`
	Workflow   string `json:"workflow"`
	Ref        string `json:"ref"`
	Principal  string `json:"principal"`
	Event      string `json:"event"`
}

type Selection added in v0.91.6

type Selection struct {
	WorkID       string   `json:"work_id,omitempty"`
	Reason       string   `json:"reason"`
	Observations []string `json:"observations"`
	ClassPass    string   `json:"class_pass,omitempty"`
	KeyPass      string   `json:"key_pass,omitempty"`
}

func PlanNext added in v0.91.6

func PlanNext(state Projection, pool string, at int64) (Selection, error)

PlanNext does not change clocks, active sets, reservations, or ownership.

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"`
	Dispatches   int `json:"dispatches"`
	Transactions int `json:"transactions"`
	Nodes        int `json:"nodes"`
}

type SubmitParameters added in v0.91.6

type SubmitParameters struct {
	Nodes []WorkDefinition `json:"nodes"`
}

type Trace added in v0.91.6

type Trace struct {
	TraceID          string `json:"trace_id,omitempty"`
	SpanID           string `json:"span_id,omitempty"`
	PublisherAttempt int    `json:"publisher_attempt,omitempty"`
}

type TraceEvent added in v0.91.6

type TraceEvent struct {
	Position      Position        `json:"position"`
	CommitID      string          `json:"commit_id"`
	Previous      *string         `json:"previous"`
	RequestID     string          `json:"request_id"`
	RequestKind   string          `json:"request_kind"`
	PolicyEpoch   string          `json:"policy_epoch"`
	At            int64           `json:"at"`
	Actor         Actor           `json:"actor"`
	Kind          string          `json:"kind"`
	WorkID        string          `json:"work_id,omitempty"`
	ClaimID       string          `json:"claim_id,omitempty"`
	DispatchID    string          `json:"dispatch_id,omitempty"`
	ClaimHandle   string          `json:"claim_handle,omitempty"`
	CompletionID  string          `json:"completion_id,omitempty"`
	State         string          `json:"state,omitempty"`
	Reason        string          `json:"reason,omitempty"`
	Disposition   string          `json:"disposition,omitempty"`
	Control       string          `json:"control,omitempty"`
	Value         json.RawMessage `json:"value,omitempty"`
	ObservationID string          `json:"observation_id,omitempty"`
	Observations  []string        `json:"observations,omitempty"`
	Run           *RunBinding     `json:"run,omitempty"`
	RunID         string          `json:"run_id,omitempty"`
	RunAttempt    int             `json:"run_attempt,omitempty"`
	Evidence      *TraceEvidence  `json:"evidence,omitempty"`
	Trace         *Trace          `json:"trace,omitempty"`
}

type TraceEvidence added in v0.91.6

type TraceEvidence struct {
	Kind       string `json:"kind"`
	Source     string `json:"source"`
	CheckedAt  int64  `json:"checked_at"`
	Repository string `json:"repository"`
	Workflow   string `json:"workflow"`
	Ref        string `json:"ref"`
	Principal  string `json:"principal"`
	RunID      string `json:"run_id,omitempty"`
	RunAttempt int    `json:"run_attempt,omitempty"`
	Status     string `json:"status,omitempty"`
	Conclusion string `json:"conclusion,omitempty"`
	Effects    string `json:"effects,omitempty"`
	Attempts   int    `json:"attempts,omitempty"`
}

type TraceOptions added in v0.91.6

type TraceOptions struct {
	RequestID string
	ClaimID   string
	Offset    int
	Limit     int
}

type TracePage added in v0.91.6

type TracePage struct {
	Tip               string       `json:"tip"`
	At                int64        `json:"at"`
	Status            string       `json:"status"`
	TraceAvailability string       `json:"trace_availability"`
	RequestID         string       `json:"request_id,omitempty"`
	ClaimID           string       `json:"claim_id,omitempty"`
	Offset            int          `json:"offset"`
	Limit             int          `json:"limit"`
	TotalEvents       int          `json:"total_events"`
	NextOffset        *int         `json:"next_offset,omitempty"`
	Events            []TraceEvent `json:"events"`
}

func TraceQueue added in v0.91.6

func TraceQueue(commits []QueueCommit, options TraceOptions, at int64) (TracePage, error)

TraceQueue exposes bounded ledger provenance, never payloads, descriptors, receipt contents or request parameters. Missing telemetry does not lose facts.

type WorkDefinition added in v0.91.6

type WorkDefinition struct {
	Kind             string          `json:"kind"`
	WorkID           string          `json:"work_id"`
	GraphID          string          `json:"graph_id"`
	NodeKey          string          `json:"node_key"`
	Pool             string          `json:"pool"`
	Priority         int             `json:"priority"`
	FairnessKey      string          `json:"fairness_key"`
	WorkerProfile    string          `json:"worker_profile"`
	BatchTrustDomain string          `json:"batch_trust_domain"`
	Payload          json.RawMessage `json:"payload"`
	DependsOn        []Dependency    `json:"depends_on"`
	Enqueued         int64           `json:"enqueued"`
	Subject          *Resource       `json:"subject,omitempty"`
	BackingIssue     *Resource       `json:"backing_issue,omitempty"`
	ReplacementOf    *Replacement    `json:"replacement_of,omitempty"`
}

func NewChildWork added in v0.91.6

func NewChildWork(state Projection, actor Actor, payload []byte, nodeKey string, at int64) (WorkDefinition, error)

func NewWork added in v0.90.4

func NewWork(payload []byte, graphID, nodeKey, pool string, policy Policy, at int64) (WorkDefinition, error)

type WorkExplanation added in v0.91.6

type WorkExplanation struct {
	WorkID             string   `json:"work_id"`
	State              string   `json:"state"`
	Barrier            string   `json:"barrier"`
	Ready              bool     `json:"ready"`
	SchedulingEligible bool     `json:"scheduling_eligible"`
	Reason             string   `json:"reason"`
	Path               []string `json:"path"`
	Observations       []string `json:"observations"`
}

func ExplainWork added in v0.91.6

func ExplainWork(state Projection, id string, at int64) (WorkExplanation, error)

type WorkState

type WorkState struct {
	WorkDefinition
	EffectivePriority    int             `json:"effective_priority,omitempty"`
	State                string          `json:"state"`
	Position             Position        `json:"position"`
	ClaimID              string          `json:"claim_id,omitempty"`
	Attempts             int             `json:"attempts"`
	RetryNotBefore       int64           `json:"retry_not_before"`
	CompletionID         string          `json:"completion_id,omitempty"`
	Barrier              string          `json:"barrier"`
	Result               json.RawMessage `json:"result,omitempty"`
	ResultCommitID       string          `json:"result_commit_id,omitempty"`
	Disposition          string          `json:"disposition,omitempty"`
	CancellationReason   string          `json:"cancellation_reason,omitempty"`
	CancellationClaimID  string          `json:"cancellation_claim_id,omitempty"`
	CancellationCommitID string          `json:"cancellation_commit_id,omitempty"`
	IssueLink            *Resource       `json:"issue_link,omitempty"`
	IssueSummary         string          `json:"issue_summary,omitempty"`
	// contains filtered or unexported fields
}

func (*WorkState) SchedulingPriority added in v0.91.6

func (work *WorkState) SchedulingPriority() int

SchedulingPriority leaves the admitted definition and historical Claims immutable.

type WorkerProfile added in v0.91.6

type WorkerProfile struct {
	Workflow        string `json:"workflow"`
	Ref             string `json:"ref"`
	Principal       string `json:"principal"`
	TrustDomain     string `json:"trust_domain"`
	CredentialScope string `json:"credential_scope"`
	EffectScope     string `json:"effect_scope"`
	MaxClaims       int    `json:"max_claims"`
	ShareKeys       bool   `json:"share_keys"`
}

Jump to

Keyboard shortcuts

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