Skip to content

Commit bc8acfc

Browse files
committed
feat(stovepipe): add Queue entity
1 parent efd7b47 commit bc8acfc

2 files changed

Lines changed: 47 additions & 1 deletion

File tree

stovepipe/entity/BUILD.bazel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ load("@rules_go//go:def.bzl", "go_library", "go_test")
22

33
go_library(
44
name = "go_default_library",
5-
srcs = ["request.go"],
5+
srcs = [
6+
"queue.go",
7+
"request.go",
8+
],
69
importpath = "github.com/uber/submitqueue/stovepipe/entity",
710
visibility = ["//visibility:public"],
811
)

stovepipe/entity/queue.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright (c) 2025 Uber Technologies, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package entity
16+
17+
// Queue holds per-queue pipeline coordination state for a named repo+ref (e.g. "monorepo/main").
18+
type Queue struct {
19+
// ****************
20+
// Immutable fields, fixed at queue entity creation
21+
// ****************
22+
23+
// Name is the stable logical id for the queue. It should be unique within the system.
24+
Name string `json:"name"`
25+
26+
// ****************
27+
// Following fields could be changed throughout the lifecycle of the queue
28+
// ****************
29+
30+
// LastGreenURI is the most recent whole-repo-green commit. Empty until the first green.
31+
LastGreenURI string `json:"last_green_uri"`
32+
33+
// InFlightCount is the number of Phase 1 validations admitted but not yet in a terminal state.
34+
InFlightCount int32 `json:"in_flight_count"`
35+
36+
// LatestRequestSeq is the highest request sequence accepted for this queue. Used to coalesce
37+
// backlog so intermediate heads are skipped without superseding the newest head.
38+
LatestRequestSeq int64 `json:"latest_request_seq"`
39+
40+
// Version is the version of the object. It is used for optimistic locking.
41+
// Versioning starts at 1 and is incremented for each change to the object.
42+
Version int32 `json:"version"`
43+
}

0 commit comments

Comments
 (0)