Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions entity/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go_library(
srcs = [
"batch.go",
"batch_dependent.go",
"build.go",
"change_provider.go",
"request.go",
],
Expand Down
34 changes: 34 additions & 0 deletions entity/build.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package entity

// BuildStatus defines the possible states of a build.
type BuildStatus string

const (
// BuildStateUnknown is the unreachable state. It is set by default when the structure is initialized. It should never be seen in the system.
BuildStateUnknown BuildStatus = ""
// TODO: Add comprehensive list of known build states.
)

// SpeculationPathInfo represents the base and head commits of a speculation path used in a build.
type SpeculationPathInfo struct {
// Base is a list of batchIDs(in order) that form the base of this speculation path.
Base []string
}

// Build represents a build scheduled for a batch along a specific speculation path.
// All fields except the Status are immutable after creation.
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
}
8 changes: 8 additions & 0 deletions extension/storage/mysql/schema/build.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE IF NOT EXISTS build (
id VARCHAR(255) NOT NULL,
batch_id VARCHAR(255) NOT NULL,
speculation_path JSON NOT NULL,
score FLOAT NOT NULL,
status VARCHAR(64) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;