Documentation
¶
Index ¶
- func IsBatchStateHalted(s BatchState) bool
- func IsRequestStateHalted(s RequestState) bool
- func IsRequestStateTerminal(s RequestState) bool
- type Batch
- type BatchDependent
- type BatchID
- type BatchState
- type Build
- type BuildID
- type BuildMetadata
- type BuildStatus
- type CancelRequest
- type Change
- type ChangeProvider
- type ChangeRecord
- type LandRequest
- type QueueConfig
- type Request
- type RequestID
- type RequestLandStrategy
- type RequestLog
- type RequestState
- type RequestStatus
- type SpeculationInfo
- type SpeculationPathAction
- type SpeculationPathInfo
- type SpeculationTree
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBatchStateHalted ¶
func IsBatchStateHalted(s BatchState) bool
IsBatchStateHalted returns true if the batch is either terminal or in the process of being cancelled. Forward-progress controllers (score, build, buildsignal, speculate, merge) use this to short-circuit work for batches that the user has asked to cancel — even though Cancelling is non-terminal, no further pipeline work should start (cancel will write the terminal state and fan out).
func IsRequestStateHalted ¶
func IsRequestStateHalted(s RequestState) bool
IsRequestStateHalted returns true if the request is either terminal or in the process of being cancelled. Forward-progress controllers (validate, batch, ...) use this to short-circuit work for requests that the user has asked to cancel — even though Cancelling is non-terminal, no further pipeline work should start.
func IsRequestStateTerminal ¶
func IsRequestStateTerminal(s RequestState) bool
IsRequestStateTerminal returns true if the state represents a final, irreversible state (landed, error, or cancelled). RequestStateCancelling is intentionally excluded: cancellation is best-effort and a Cancelling request may still transition to Landed or Error before it reaches Cancelled. Callers that want to gate forward progress (and treat Cancelling as halted) should use IsRequestStateHalted instead.
Types ¶
type Batch ¶
type Batch struct {
// ID is the globally unique identifier for the batch. Format: "<queue>/batch/<counter_value>".
ID string
// Queue is the name of the queue processing the land request. Queue name is defined in the configuration and should be unique within the system.
Queue string
// Contains is a list of land request IDs that are part of this batch.
// Request IDs will always be part of the same queue.
//
// For e.g. - [queueA/1, queueA/2, queueA/3].
//
Contains []string
// Dependencies is a list of other batch IDs that this batch depends on.
// Dependencies will always be part of the same queue. This way batches form a directed acyclic graph (DAG).
// If a batch A depends on batch B directly, it means that some request in batch A has overlapping changed targets with
// some another request in batch B. The Dependencies list contains all the transitive closure of all the dependencies, both direct and indirect.
// The order is not specified. Only active batches are considered for dependencies, i.e. if the batch is in a terminal state, it does not need to be included.
// Because batch states are eventually consistent, dependent batches identified at the time of batch creation may move to terminal states. The interpretation logic
// should reconcile batch states separately (i.e. ignore them for processing).
//
//This field is ok to be updated whether the state of the dependency graph changes. Update should use Version property for optimistic locking.
//
// Example: consider batches - queueA/batch/1, queueA/batch/2, queueA/batch/3
// such that - queueA/batch/2 and queueA/batch/3 have overlapping targets with requests in queueA/batch/1, but queueA/batch/2 and queueA/batch/3 do not have overlapping targets with each other.
//
// In this case, the Dependencies field for -
// - queueA/batch/1 will be empty
// - queueA/batch/2 will contain queueA/batch/1
// - queueA/batch/3 will contain queueA/batch/1
Dependencies []string
// Score is the predicted probability of build success for this batch, ranging from 0.0 to 1.0.
// Set during the scoring phase. Zero value means the batch has not been scored yet.
Score float64
// The state of the batch lifecycle this batch is in. Updateable field with Version for optimistic locking.
State BatchState
// Version is the version of the object. It is used for optimistic locking.
// Versioning starts at 1 and is incremented for each change to the object.
Version int32
}
Batch represents a group of requests to land (merge into target branch of the source control repository).
func BatchFromBytes ¶
BatchFromBytes deserializes a Batch from JSON bytes.
type BatchDependent ¶
type BatchDependent struct {
// BatchID is the globally unique identifier of the upstream batch. Format: "<queue>/batch/<counter_value>".
BatchID string
// Dependents is a list of batch IDs that depend on this batch (i.e. batches whose Dependencies list contains BatchID).
// Updated as new batches are created that conflict with this batch. Uses Version for optimistic locking on updates.
Dependents []string
// Version is the version of the object. It is used for optimistic locking.
// Versioning starts at 1 and is incremented for each change to the object.
Version int32
}
BatchDependent is the reverse index of Batch.Dependencies. While Batch.Dependencies lists the batches a batch depends on (upstream), BatchDependent maps a batch to the batches that depend on it (downstream). This enables efficient fan-out notifications when a batch completes or fails — rather than scanning all batches to find which ones reference a given dependency, the system can look up dependents directly.
Example: consider batches queueA/batch/1, queueA/batch/2, queueA/batch/3 where batch/2 and batch/3 both depend on batch/1 (i.e. batch/1 is in their Dependencies list).
The BatchDependent records would be:
- BatchID=queueA/batch/1 → Dependents=[queueA/batch/2, queueA/batch/3]
- BatchID=queueA/batch/2 → Dependents=[] (nothing depends on it)
- BatchID=queueA/batch/3 → Dependents=[] (nothing depends on it)
type BatchID ¶
type BatchID struct {
// ID is the globally unique identifier for the batch.
ID string `json:"id"`
}
BatchID is a lightweight entity for publishing and consuming just the batch identifier via the queue.
func BatchIDFromBytes ¶
BatchIDFromBytes deserializes a BatchID from JSON bytes.
type BatchState ¶
type BatchState string
BatchState defines the possible states of a batch.
const ( // BatchStateUnknown is the unreachable state. It is set by default when the structure is initialized. It should never be seen in the system. BatchStateUnknown BatchState = "" // BatchStateCreated is the state of a batch that has been created for processing. BatchStateCreated BatchState = "created" // BatchStateSpeculating is the state of a batch that is undergoing speculative execution. BatchStateSpeculating BatchState = "speculating" // BatchStateMerging is the state of a batch that is being merged after speculative execution. BatchStateMerging BatchState = "merging" // BatchStateSucceeded is the terminal state of a batch that has been successfully landed. BatchStateSucceeded BatchState = "succeeded" // BatchStateFailed is the terminal state of a batch that has failed. BatchStateFailed BatchState = "failed" // BatchStateScored is the state of a batch that has been scored for build success probability. BatchStateScored BatchState = "scored" // BatchStateCancelling is the non-terminal intent state set when a cancel has been requested but the // batch has not yet been transitioned to BatchStateCancelled. A batch in this state may still reach // BatchStateSucceeded or BatchStateFailed if a concurrent merge wins the race (e.g. the push had // already completed before the cancel CAS observed the batch); those terminal states prevail. // Forward-progress controllers must treat this state as halted (no new work). The speculate // controller owns the transition to the terminal BatchStateCancelled and the downstream fan-out // (cancelling in-flight builds, respeculating dependents, publishing to conclude). BatchStateCancelling BatchState = "cancelling" // BatchStateCancelled is the terminal state of a batch that was cancelled before completion. BatchStateCancelled BatchState = "cancelled" )
func (BatchState) IsTerminal ¶
func (s BatchState) IsTerminal() bool
IsTerminal returns true if the batch state is a terminal state. Terminal states are states from which no further transitions are possible. BatchStateCancelling is intentionally excluded: cancellation is best-effort and a Cancelling batch may still transition to BatchStateSucceeded or BatchStateFailed before it reaches BatchStateCancelled. Callers that want to gate forward progress (and treat Cancelling as halted) should use IsBatchStateHalted instead.
type Build ¶
type Build struct {
// ID represents the build ID. It is the responsibility of a build management system to ensure
// that this is unique.
ID string
// BatchID is the batch for which this build is scheduled.
BatchID string
// SpeculationPath is the speculation path that represents this build. For
// a given batch this path is crafted from the graph that is generated from the
// dependencies of this batch.
SpeculationPath SpeculationPathInfo
// Score represents the build prediction score for this speculation path.
Score float32
// Status represents the state of the build lifecycle this build is in.
Status BuildStatus
}
Build represents a build scheduled for a batch along a specific speculation path. All fields except the Status are immutable after creation.
func BuildFromBytes ¶
BuildFromBytes deserializes a Build from JSON bytes.
type BuildID ¶
type BuildID struct {
// ID is the globally unique identifier for the build.
ID string `json:"id"`
}
BuildID is a lightweight entity for publishing and consuming just the build identifier via the queue.
func BuildIDFromBytes ¶
BuildIDFromBytes deserializes a BuildID from JSON bytes.
type BuildMetadata ¶
BuildMetadata carries provider-defined free-form metadata about a build (e.g. build URL, duration, commit SHA). Keys and values are implementation-defined; callers should not assume any particular schema.
type BuildStatus ¶
type BuildStatus string
BuildStatus defines the possible states of a build. The set is intentionally narrow: every supported build provider must be able to map its native lifecycle into one of these values without leaking provider-specific stages.
const ( // BuildStatusUnknown is the unreachable zero value, set by default when // the structure is initialized. It should never be seen in the system. BuildStatusUnknown BuildStatus = "" // BuildStatusAccepted indicates the build has been accepted for // execution. BuildStatusAccepted BuildStatus = "accepted" // BuildStatusRunning indicates the build is currently executing. BuildStatusRunning BuildStatus = "running" // BuildStatusSucceeded indicates the build completed successfully. // This is a terminal state. BuildStatusSucceeded BuildStatus = "succeeded" // BuildStatusFailed indicates the build did not complete successfully. // This is a terminal state. BuildStatusFailed BuildStatus = "failed" // BuildStatusCancelled indicates the build was cancelled. // This is a terminal state. BuildStatusCancelled BuildStatus = "cancelled" )
func (BuildStatus) IsTerminal ¶
func (s BuildStatus) IsTerminal() bool
IsTerminal returns true if the status represents a final state (Succeeded, Failed, or Cancelled).
type CancelRequest ¶
type CancelRequest struct {
// ID is the globally unique identifier of the request to cancel. Format: "<queue>/<counter_value>".
ID string `json:"id"`
// Reason is an optional free-form explanation of why the cancellation was requested.
Reason string `json:"reason"`
}
CancelRequest represents a cancellation request sent over the queue from the gateway to the orchestrator. It identifies the request to cancel by its ID and carries an optional human-readable reason for observability.
func CancelRequestFromBytes ¶
func CancelRequestFromBytes(data []byte) (CancelRequest, error)
CancelRequestFromBytes deserializes a CancelRequest from JSON bytes.
func (CancelRequest) ToBytes ¶
func (r CancelRequest) ToBytes() ([]byte, error)
ToBytes serializes the CancelRequest to JSON bytes for queue message payload.
type Change ¶
type Change struct {
// URIs identifies the change(s) to land (RFC 3986 compliant).
// The scheme identifies the change provider, and the path contains provider-specific resource identifiers.
//
// GitHub is supported by default (though other providers can be added):
// Template: "<scheme>://<org>/<repo>/pull/<pr>/<head_commit_sha>"
// Example: "github://uber/submitqueue/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab"
// Schemes: "github", "ghe", "ghes". Head commit SHA must be full 40-char lowercase hex.
//
URIs []string `json:"uris"`
}
Change represents a code change identified by URIs from a code change provider (e.g., GitHub Pull Request, Phabricator Diff). The provider is extracted from the URI scheme. The object is immutable after creation.
type ChangeProvider ¶
type ChangeProvider struct {
// RequestID is the globally unique identifier for the land request. Format: "<queue>/<counter_value>".
RequestID string
// ChangeProviderSrc defines the source of the change. For e.g. - Github, Gitlab etc.
ChangeProviderSrc string
// ChangeProviderID is the identifier specified by the change provider source. For e.g. - Github PR ID etc.
ChangeProviderID string
// Metadata is the interesting data from the change provider that we want to store.
// This is a freeform JSON object.
Metadata map[string]string
}
ChangeProvider represents a code change from an external provider (e.g., a GitHub pull request or Gerrit changelist) along with its associated metadata. The object is immutable after creation.
type ChangeRecord ¶
type ChangeRecord struct {
// URI identifies the change (RFC 3986). Same scheme/format as entity.Change.URIs.
// Example: "github://uber/submitqueue/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab".
URI string `json:"uri"`
// RequestID is the owning land request that claimed this URI.
// Format matches entity.Request.ID: "<queue>/<counter_value>".
//
// RequestID participates in the change-store primary key so that concurrent claims
// by different requests on the same URI coexist as distinct rows. Same-request
// retries collide on the PK and are absorbed idempotently; different-request
// collisions surface as additional rows that callers detect via FindOverlapping.
RequestID string `json:"request_id"`
// Queue is the queue the owning request belongs to. It is the leading column of
// the change-store primary key, so queue-scoped duplicate checks become PK-prefix
// scans and the table is shardable by queue.
Queue string `json:"queue"`
// Metadata is a JSON-encoded blob of provider-specific information about the change
// (e.g., PR title, author, mergeable state). Stored as `'{}'` when no metadata has
// been populated yet; updated by downstream enrichment.
Metadata string `json:"metadata,omitempty"`
// CreatedAt is the Unix milliseconds timestamp when this record was first created.
CreatedAt int64 `json:"created_at"`
// UpdatedAt is the Unix milliseconds timestamp when this record's Metadata was last updated.
// Equal to CreatedAt when the record has never been updated.
UpdatedAt int64 `json:"updated_at"`
// Version is the optimistic-locking counter for mutable fields (Metadata).
// Starts at 1 on Create and is incremented by callers on every update.
// Mirrors the request-store convention: callers compute newVersion = oldVersion + 1
// and pass both to the update method; the store performs a pure conditional write.
Version int32 `json:"version"`
}
ChangeRecord represents a single URI's claim by a request, persisted in the change store. The (Queue, URI, RequestID) triple is the identity and is immutable; Metadata may be updated over time as additional information about the change (e.g., PR title, author, mergeability) becomes available.
type LandRequest ¶
type LandRequest struct {
// ID is the globally unique identifier for the land request. Format: "<queue>/<counter_value>".
ID string `json:"id"`
// Queue is the name of the queue processing the land request.
Queue string `json:"queue"`
// Change is the set of code changes to land.
Change Change `json:"change"`
// LandStrategy is the source control integration strategy to use for this land operation.
LandStrategy RequestLandStrategy `json:"land_strategy"`
}
LandRequest represents the gateway-owned fields of a land request sent over the queue to the orchestrator. It contains only the validated inputs and generated ID — the orchestrator is responsible for constructing the full Request entity with state machine fields.
func LandRequestFromBytes ¶
func LandRequestFromBytes(data []byte) (LandRequest, error)
LandRequestFromBytes deserializes a LandRequest from JSON bytes.
func (LandRequest) ToBytes ¶
func (r LandRequest) ToBytes() ([]byte, error)
ToBytes serializes the LandRequest to JSON bytes for queue message payload.
type QueueConfig ¶
type QueueConfig struct {
// Name uniquely identifies this queue within the system.
// Referenced by Request.Queue.
Name string `json:"name" yaml:"name"`
// VCSType identifies the version control system (e.g., "git", "svn", "perforce").
// A queue operates on exactly one VCS.
VCSType string `json:"vcs_type" yaml:"vcs_type"`
// VCSAddress identifies the repository in the version control system.
// The format is VCS-specific:
// - Git: remote URL (e.g., "git@github.com:uber/submitqueue.git")
// - Perforce: depot path (e.g., "//depot/project")
// - SVN: repository URL (e.g., "https://svn.example.com/repos/project")
VCSAddress string `json:"vcs_address" yaml:"vcs_address"`
// Target is the landing target where changes are merged.
// The format is VCS-specific:
// - Git: branch ref (e.g., "main", "release/v2")
// - Perforce: stream or depot path (e.g., "//depot/main/...")
// - SVN: repository path (e.g., "trunk/")
Target string `json:"target" yaml:"target"`
// BuildRunner identifies the CI pipeline or job that runs builds for this queue.
// Opaque to the system; meaningful only to the build runner extension implementation.
// Examples:
// - Buildkite: "buildkite.com/uber/submitqueue-ci"
// - Jenkins: "jenkins.example.com/job/submitqueue-verify"
BuildRunner string `json:"build_runner" yaml:"build_runner"`
// ChangeProvider identifies the change provider implementation for this queue.
// Opaque to the system; meaningful only to the change provider extension implementation.
// Examples: "github", "gitlab", "phabricator"
ChangeProvider string `json:"change_provider" yaml:"change_provider"`
// MergeChecker identifies the merge checker implementation for this queue.
// Opaque to the system; meaningful only to the merge checker extension implementation.
// Examples: "github", "gitlab"
MergeChecker string `json:"merge_checker" yaml:"merge_checker"`
// LandProvider identifies the land provider implementation for this queue.
// Opaque to the system; meaningful only to the land provider extension implementation.
// Examples: "github", "gitlab"
LandProvider string `json:"land_provider" yaml:"land_provider"`
}
QueueConfig holds the configuration for a single submit queue. Each queue maps a VCS repository + target to a processing pipeline. A repository can have multiple queues, but each queue has exactly one target. Immutable after creation.
type Request ¶
type Request struct {
// ID is the globally unique identifier for the land request. Format: "<queue>/<counter_value>".
ID string `json:"id"`
// Queue is the name of the queue processing the land request. Queue name is defined in the configuration and should be unique within the system.
Queue string `json:"queue"`
// Change is a number of code changes (such as pull requests) to land into the target branch. Target branch is defined by the queue configuration.
Change Change `json:"change"`
// LandStrategy is the source control integration strategy to use for this land operation.
LandStrategy RequestLandStrategy `json:"land_strategy"`
// State is the current state of the land request.
State RequestState `json:"state"`
// Version is the version of the object. It is used for optimistic locking.
// Versioning starts at 1 and is incremented for each change to the object.
Version int32 `json:"version"`
}
Request defines a request to land (merge into target branch of the source control repository) a set of code changes. The object is immutable after creation.
func RequestFromBytes ¶
RequestFromBytes deserializes a Request from JSON bytes.
type RequestID ¶
type RequestID struct {
// ID is the globally unique identifier for the land request.
ID string `json:"id"`
}
RequestID is a lightweight entity for publishing and consuming just the request identifier via the queue.
func RequestIDFromBytes ¶
RequestIDFromBytes deserializes a RequestID from JSON bytes.
type RequestLandStrategy ¶
type RequestLandStrategy string
RequestLandStrategy defines the possible source control integration methods.
const ( // RequestLandStrategyUnknown is the unknown strategy. It is set by default when the structure is initialized. It should never be seen in the system and used for error control. RequestLandStrategyUnknown RequestLandStrategy = "" // RequestLandStrategyRebase rebases commits onto the target branch before landing. RequestLandStrategyRebase RequestLandStrategy = "rebase" // RequestLandStrategySquashRebase squashes commits into a single commit before rebasing on top of the target branch. RequestLandStrategySquashRebase RequestLandStrategy = "squash_rebase" // RequestLandStrategyMerge merges commits into the target branch by creating a separate merge commit, preserving the commit history along with hashes. RequestLandStrategyMerge RequestLandStrategy = "merge" )
type RequestLog ¶
type RequestLog struct {
// RequestID is the ID of the request this log entry belongs to. References entity.Request.ID.
RequestID string `json:"request_id"`
// TimestampMs is the time this log entry was created, in milliseconds since Unix epoch.
TimestampMs int64 `json:"timestamp_ms"`
// Status is the request status at the time this log entry was created. It may contain requests states from the state machine and also display-friendly intermediate statuses.
Status RequestStatus `json:"status"`
// RequestVersion is the version of the request at the time this log entry was created.
// Zero if the version is not available.
RequestVersion int32 `json:"request_version"`
// LastError is the last error message associated with the status at the time of this log entry.
// Empty string if no error.
LastError string `json:"last_error"`
// Metadata is a set of key-value pairs providing additional context for this log entry.
// Empty map if no metadata.
Metadata map[string]string `json:"metadata"`
}
RequestLog is an append-only record that captures a point-in-time snapshot of a request's status for reconciliation purposes. It is stored in a separate database from the request store to support eventual consistency reconciliation.
func NewRequestLog ¶
func NewRequestLog(requestID string, status RequestStatus, requestVersion int32, lastError string, metadata map[string]string) RequestLog
NewRequestLog creates a new RequestLog with the given fields. TimestampMs is set to the current time. If metadata is nil, it will be initialized as an empty map. requestVersion is the version of the request entity, should only be set if reporting a request state as a status, otherwise it should be 0. lastError is the last error message associated with the status at the time of this log entry, empty string if no error. metadata is a set of key-value pairs providing additional context for this log entry. Not constrained to any specific format or schema, used for display or debugging purposes.
func RequestLogFromBytes ¶
func RequestLogFromBytes(data []byte) (RequestLog, error)
RequestLogFromBytes deserializes a RequestLog from JSON bytes. If metadata is absent from the JSON, it will be initialized as an empty map.
func (RequestLog) ToBytes ¶
func (r RequestLog) ToBytes() ([]byte, error)
ToBytes serializes the RequestLog to JSON bytes for queue message payload.
type RequestState ¶
type RequestState string
RequestState defines the possible states of a land request. They are internal and used to implement a state machine. A separate RequestStatus type is used to track the customer-friendly status of a request.
const ( // RequestStateUnknown is the unreachable state. It is set by default when the structure is initialized. It should never be seen in the system. RequestStateUnknown RequestState = "" // RequestStateStarted is the initial state of a land request. It is confirmed by the system but the processing is not started yet. RequestStateStarted RequestState = "started" // RequestStateValidated indicates that the request has been validated (duplicate check, merge check etc.) successfully. RequestStateValidated RequestState = "validated" // RequestStateBatched indicates that the request has been claimed by the batch controller and enrolled in a // batch. The CAS-write of this state by the batch controller is the serialization point between batch and // cancel: the batch controller transitions Validated → Batched immediately before persisting the new batch, // so any concurrent cancel that has already transitioned the request to Cancelling will lose the CAS and // abandon the batch. From this state forward, the request's terminal outcome is owned by the batch it is // enrolled in (via conclude), not by the cancel controller's request-only fast path. RequestStateBatched RequestState = "batched" // RequestStateProcessing is the state of a land request that is being processed. RequestStateProcessing RequestState = "processing" // RequestStateLanded is the state of a land request that has been successfully processed and landed. This is the final state. RequestStateLanded RequestState = "landed" // RequestStateError is the state of a land request that has encountered an error. This is the final state. RequestStateError RequestState = "error" // RequestStateCancelling is the non-terminal intent state set when the user has requested cancellation but the // request has not yet been transitioned to RequestStateCancelled. A request in this state may still reach // RequestStateLanded or RequestStateError if a concurrent merge or failure wins the race; those terminal // states prevail. Forward-progress controllers must treat this state the same as terminal (i.e. do not start // any new work on the request). RequestStateCancelling RequestState = "cancelling" // RequestStateCancelled is the state of a land request that was cancelled by the user before it could land. This is the final state. RequestStateCancelled RequestState = "cancelled" )
type RequestStatus ¶
type RequestStatus string
RequestLogStatus defines the possible status of a request. Status is customer-friendly and can be displayed to the user. It is different from the request state, which is internal and used to implement a state machine. Request statuses can be generally added freely by the system without breaking the state machine. Some statuses correspond to the request state, in which case they should be supplemented with the request state version to be used for reconciliation. Other statuses are purely informational and can be added freely. Every status may be accompanied by a last error message and free-formmetadata in the Request Log. It will only be used for display or debugging purposes.
const ( // RequestStatusUnknown is the unknown sentinel status. It is set by default when the structure is initialized. It should never be seen in the system. RequestStatusUnknown RequestStatus = "" // RequestStatusAccepted indicates that the request has been accepted by the system. Typically a gateway service will set this status when the land request is received and persisted to the logging database. RequestStatusAccepted RequestStatus = "accepted" // RequestStatusStarted is the initial status of a request. It corresponds to the RequestStateStarted state and typically set by the orchestrator service when the request is received and persisted to the operating database. RequestStatusStarted RequestStatus = "started" // RequestStatusValidating indicates that the request is currently being validated (e.g., duplicate check, merge check, etc.). RequestStatusValidating RequestStatus = "validating" // RequestStatusValidated indicates that the request has been validated (duplicate check, merge check etc.) successfully. It corresponds to the RequestStateValidated state. RequestStatusValidated RequestStatus = "validated" // RequestStatusBatching indicates that the request is waiting to be included in a batch. RequestStatusBatching RequestStatus = "batching" // RequestStatusBatched indicates that the request has been included in a new batch and will be sent to speculation. RequestStatusBatched RequestStatus = "batched" // RequestStatusScored indicates that the batch containing the request has been scored for build success probability. RequestStatusScored RequestStatus = "scored" // RequestStatusSpeculating indicates that the request is currently being speculated (e.g., speculative merge/rebase, etc.). RequestStatusSpeculating RequestStatus = "speculating" // RequestStatusSpeculated indicates that the request has been successfully speculated and is ready to be validated via a build system. RequestStatusSpeculated RequestStatus = "speculated" // RequestStatusBuilding indicates that the request is currently being built (e.g., CI/CD system is building the change on top of the speculation path). RequestStatusBuilding RequestStatus = "building" // RequestStatusBuilt indicates that the request has finished the build step successfully and can move to the next phase, either wait for other requests to finish or move to the land phase. RequestStatusBuilt RequestStatus = "built" // RequestStatusWaitingPath indicates that the request is waiting for other preceiding request in the same speculation path to finish. RequestStatusWaitingPath RequestStatus = "waitingpath" // RequestStatusLanding indicates that the request is actively being landed (e.g., source control operation is in progress to push the change to the target branch). RequestStatusLanding RequestStatus = "landing" // RequestStatusProcessing is the status of a request that is being processed. It corresponds to the RequestStateProcessing state. RequestStatusProcessing RequestStatus = "processing" // RequestStatusLanded indicates that the request has been successfully processed and landed. It corresponds to the RequestStateLanded state. RequestStatusLanded RequestStatus = "landed" // RequestStatusError indicates that the request has encountered an error. It corresponds to the RequestStateError state. RequestStatusError RequestStatus = "error" // RequestStatusCancelling indicates that the user has requested cancellation but the request has not yet transitioned // to the RequestStateCancelled state. Cancellation is best-effort: a request that has already been merged or that // races to completion before the cancel propagates through the pipeline may still land. Observers should treat this // as intent only and rely on RequestStatusCancelled (or RequestStatusLanded) for the terminal outcome. Emitted by // the gateway when the Cancel RPC is received. RequestStatusCancelling RequestStatus = "cancelling" // RequestStatusCancelled indicates that the request was cancelled by the user before it could land. It corresponds to the RequestStateCancelled state. RequestStatusCancelled RequestStatus = "cancelled" )
type SpeculationInfo ¶
type SpeculationInfo struct {
// Path represents the speculation path; which is an ordered list of batches.
Path []string
// Action is a state that this path is in.
Action SpeculationPathAction
// Score is score for this speculation path.
Score float32
}
SpeculationInfo represents metadata about a single speculation path, including the path through the dependency graph, its current state, and the predicted build score.
type SpeculationPathAction ¶
type SpeculationPathAction string
SpeculationPathAction defines the possible actions for a speculation path.
const ( // SpeculationPathActionUnknown is the default zero value for SpeculationPathAction. SpeculationPathActionUnknown SpeculationPathAction = "" )
type SpeculationPathInfo ¶
type SpeculationPathInfo struct {
// Base is a list of batchIDs(in order) that form the base of this speculation path.
Base []string
}
SpeculationPathInfo represents the base and head commits of a speculation path used in a build.
type SpeculationTree ¶
type SpeculationTree struct {
// BatchID is the batch for which this speculation tree is constructed.
BatchID string
// Speculations is a list of speculation paths for this batch based on a graph of its
// dependents.
//
// For e.g - Consider batches - queueA/batch/1, queueA/batch/2, queueA/batch/3
// such that - queueA/batch/2 and queueA/batch/3 depend on queueA/batch/1
//
// Speculations for queueA/batch/1 - [{Path: []string{"queueA/batch/1"}, State: "scheduled", Score: 0.1}]
// Speculations for queueA/batch/2 - [{Path: []string{"queueA/batch/2"}, State: "scheduled", Score: 0.9}, {Path: []string{"queueA/batch/1", "queueA/batch/2"}, State: "scheduled", Score: 0.3}]
// Speculations for queueA/batch/3 - [{Path: []string{"queueA/batch/3"}, State: "scheduled", Score: 0.9}, {Path: []string{"queueA/batch/1", "queueA/batch/3"}, State: "scheduled", Score: 0.3}]
//
Speculations []SpeculationInfo
}
SpeculationTree represents the set of speculation paths constructed for a batch based on its dependency graph.