Skip to content

Commit 953fe4b

Browse files
authored
feat(stovepipe): add Queue entity (#309)
## Why? Implementing `process` step. This change creates a Queue entity to keep track of queue-level state. This matches the spec outlined in: https://github.com/uber/submitqueue/blob/main/doc/rfc/stovepipe/steps/process.md#queue-new-persisted-entity ## What? Add the per-queue Queue entity that backs the process stage's concurrency gate and backlog coalescing. ## Test Plan -Subsequent PRs will build out functionality that we can test
1 parent efd7b47 commit 953fe4b

2 files changed

Lines changed: 48 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: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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 queue's last-known-good commit: the most recent head at which
31+
// whole-repo validation recorded green (health degree 0). Empty until the first such outcome.
32+
LastGreenURI string `json:"last_green_uri"`
33+
34+
// InFlightCount is the number of trunk validations admitted by process but not yet terminal.
35+
InFlightCount int32 `json:"in_flight_count"`
36+
37+
// LatestRequestSeq is the highest request sequence accepted for this queue. Used to coalesce
38+
// backlog so intermediate heads are skipped without superseding the newest head.
39+
LatestRequestSeq int64 `json:"latest_request_seq"`
40+
41+
// Version is the version of the object. It is used for optimistic locking.
42+
// Versioning starts at 1 and is incremented for each change to the object.
43+
Version int32 `json:"version"`
44+
}

0 commit comments

Comments
 (0)