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 Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@ GO_GENERATE_PACKAGES := \
./submitqueue/extension/changeprovider/... \
./submitqueue/extension/conflict/... \
./submitqueue/extension/queueconfig/... \
./submitqueue/extension/queuepause/... \
./submitqueue/extension/speculation/... \
./submitqueue/extension/storage/... \
./submitqueue/extension/validator/... \
Expand Down
1 change: 1 addition & 0 deletions submitqueue/entity/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ go_library(
"path_build.go",
"queue_batch_state.go",
"queue_config.go",
"queue_pause.go",
"request.go",
"request_batch.go",
"request_history.go",
Expand Down
29 changes: 29 additions & 0 deletions submitqueue/entity/queue_pause.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) 2026 Uber Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package entity

// QueuePause is a point-in-time snapshot of the pause switches of a single
// queue. The two switches are independent, and the zero value means the queue
// is not paused.
type QueuePause struct {
// RejectLands is true while the queue refuses new land requests.
RejectLands bool

// FreezeProcessing is true while the queue's accepted requests are not advanced.
FreezeProcessing bool
Comment thread
manjari25 marked this conversation as resolved.

// Reason is the operator's free-text explanation for the pause. Empty when none was given.
Reason string
}
9 changes: 9 additions & 0 deletions submitqueue/extension/queuepause/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
srcs = ["queuepause.go"],
importpath = "github.com/uber/submitqueue/submitqueue/extension/queuepause",
visibility = ["//visibility:public"],
deps = ["//submitqueue/entity:go_default_library"],
)
15 changes: 15 additions & 0 deletions submitqueue/extension/queuepause/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Queue Pause Extension

Vendor-agnostic source of per-queue pause state. See [the pause and unpause RFC](../../../doc/rfc/submitqueue/queue-pause-and-unpause.md) for the design.

## Interfaces

### Store

Returns the pause state of a queue by name. The state is two independent switches: reject new land requests, and freeze processing of accepted requests. A queue with no entry is not paused, and an error means the backend could not be read.

The store only reports state. The gateway and orchestrator enforce it, so every deployment runs the same rejection and freezing logic and only the source of the state differs.

## Entities

`QueuePause` lives in `submitqueue/entity/queue_pause.go`.
12 changes: 12 additions & 0 deletions submitqueue/extension/queuepause/mock/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
load("@rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
srcs = ["queuepause_mock.go"],
importpath = "github.com/uber/submitqueue/submitqueue/extension/queuepause/mock",
visibility = ["//visibility:public"],
deps = [
"//submitqueue/entity:go_default_library",
"@org_uber_go_mock//gomock:go_default_library",
],
)
57 changes: 57 additions & 0 deletions submitqueue/extension/queuepause/mock/queuepause_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions submitqueue/extension/queuepause/queuepause.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) 2026 Uber Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package queuepause

//go:generate mockgen -source=queuepause.go -destination=mock/queuepause_mock.go -package=mock

import (
"context"

"github.com/uber/submitqueue/submitqueue/entity"
)

// Store is the source of per-queue pause state. It reports the switches and
// decides nothing; enforcement lives in the services that resolve it.
type Store interface {
// Get returns the current pause state of a queue. A queue with no entry
// returns the zero state (not paused) and no error. A non-nil error means
// the backend could not be read, not that the queue is unpaused; a caller
// that enforces a switch must not fail open on it. Implementations must be
// safe for concurrent use.
Get(ctx context.Context, queue string) (entity.QueuePause, error)
}
Loading