Documentation
¶
Index ¶
- Constants
- type Intent
- type Journal
- type Reader
- func (r Reader) ActiveForScaleSet(ctx context.Context, owner, scaleSet string) (bool, error)
- func (r Reader) HasActive(ctx context.Context) (bool, error)
- func (r Reader) ReadActive(ctx context.Context) (Snapshot, error)
- func (r Reader) RepositoryForScaleSet(ctx context.Context, owner, scaleSet string) (string, error)
- type RecoveryResult
- type RepositoryState
- type Snapshot
- type State
Constants ¶
const ( LegacySchemaVersion = 1 PreviousSchemaVersion = 3 SchemaVersion = 4 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Intent ¶
type Intent struct {
Key string `json:"key"`
ScaleSetID int64 `json:"scale_set_id"`
JobID string `json:"job_id"`
RunnerRequestID int64 `json:"runner_request_id"`
WorkflowRunID int64 `json:"workflow_run_id,omitempty"`
JobDisplayName string `json:"job_display_name,omitempty"`
GitHubRunnerID int64 `json:"github_runner_id,omitempty"`
ScaleSetName string `json:"scale_set_name"`
RunnerName string `json:"runner_name,omitempty"`
// Owner is the forge account the scale set hangs from, written by GARM.
// GitHub scopes a scale set name to one entity, so the name alone stopped
// being an identity when the fleet gained a second tenant. Empty reads as
// the fleet's own account, which is what every journal written before this
// field existed meant.
//
// This is the journal's own vocabulary, not the tenant registry's: GARM
// knows the account it serves and has no reason to know the registry ID
// the fleet files it under. Translating one into the other is the
// provider's job, at the one place that compares them.
Owner string `json:"owner,omitempty"`
Repository string `json:"repository"`
WorkflowRef string `json:"workflow_ref"`
EventName string `json:"event_name"`
QueueTime time.Time `json:"queue_time"`
State State `json:"state"`
Priority int `json:"priority"`
StateEnteredAt time.Time `json:"state_entered_at"`
UpdatedAt time.Time `json:"updated_at"`
ExpiresAt time.Time `json:"expires_at"`
}
Intent is the durable queue identity observed at JobAssigned before GARM changes desired capacity. RunnerRequestID is bound later at JobAvailable. GARM is the sole writer; provider and observer processes consume immutable fsync+rename generations without taking the writer lock.
func (Intent) OwnerAccount ¶
OwnerAccount resolves the intent's forge account, defaulting to the fleet's own so a journal written before the field existed keeps its original meaning.
type Journal ¶
type Reader ¶
func (Reader) ActiveForScaleSet ¶
ActiveForScaleSet reports whether the named scale set of the named tenant holds an intent that has passed central admission. Both halves are required: two tenants may serve the same scale set class name, and answering from the name alone would let one tenant's admitted job authorize the other's create.
func (Reader) RepositoryForScaleSet ¶
RepositoryForScaleSet returns the one concrete repository carried by an admitted intent. Organization entities give providers only the account URL, so the durable pre-AcquireJobs journal is the authoritative narrowing point.
type RecoveryResult ¶
type RecoveryResult struct {
Applied bool `json:"applied"`
Key string `json:"key"`
ExpectedUpdatedAt time.Time `json:"expected_updated_at"`
PreviousGeneration uint64 `json:"previous_generation"`
Generation uint64 `json:"generation"`
RecoveredAt time.Time `json:"recovered_at"`
}
func RecoverCanceledUnbound ¶
func RecoverCanceledUnbound(ctx context.Context, journalPath, lockPath, key string, expectedUpdatedAt time.Time, apply bool) (RecoveryResult, error)
RecoverCanceledUnbound removes one exact queued or assigned intent after the operator has proved its GitHub run/job is completed with conclusion cancelled. The intent must never have crossed the JobAvailable boundary.
func RecoverUnboundRunning ¶
func RecoverUnboundRunning(ctx context.Context, journalPath, lockPath, key string, expectedUpdatedAt time.Time, apply bool) (RecoveryResult, error)
RecoverUnboundRunning removes one exact stale organization intent while GARM is stopped. It uses GARM's sibling lock and an identity-checked atomic rename; callers must separately prove that no provider lease exists.