Skip to content

Commit f2d12c4

Browse files
behinddwallsgithub-actions[bot]
authored andcommitted
feat(stovepipe): add storage extension with RequestStore + RequestURIStore (MySQL)
Add the stovepipe `storage` extension and its first backend, so the pipeline can persist validation requests and look them up. Mirrors the SubmitQueue storage conventions (factory `Storage` interface, `ErrNotFound`/`ErrAlreadyExists`/`ErrVersionMismatch` sentinels, metrics-wrapped MySQL ops, optimistic-locking CAS where version arithmetic stays in the caller). Two stores, one per table: - `RequestStore` (`request` table) — `Create` (ErrAlreadyExists on duplicate ID), `Get` by ID (ErrNotFound), and `Update`, a pure conditional write that takes the full `Request` plus `oldVersion`/`newVersion` and persists the mutable fields (uri, state) only if the stored version matches (ErrVersionMismatch otherwise). - `RequestURIStore` (`request_uri` table) — the reverse index from a validated commit to its request, keyed by `(queue, uri)`: `Create` (ErrAlreadyExists on a duplicate `(queue, uri)` — the dedup signal backing the RFC's `(Queue, head URI)` key) and `GetIDByURI` (ErrNotFound). Kept a separate store because it is a separate table; the two are written independently so the contract stays satisfiable by key/value backends. Includes the MySQL implementation, schema (`request.sql`, `request_uri.sql`), generated mocks, and a docker-compose integration test covering create/get/update-CAS/not-found/duplicate and the URI mapping (including dedup and per-queue isolation).
1 parent bb65857 commit f2d12c4

18 files changed

Lines changed: 946 additions & 0 deletions
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
load("@rules_go//go:def.bzl", "go_library")
2+
3+
go_library(
4+
name = "storage",
5+
srcs = [
6+
"request_store.go",
7+
"request_uri_store.go",
8+
"storage.go",
9+
],
10+
importpath = "github.com/uber/submitqueue/stovepipe/extension/storage",
11+
visibility = ["//visibility:public"],
12+
deps = ["//stovepipe/entity"],
13+
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
load("@rules_go//go:def.bzl", "go_library")
2+
3+
go_library(
4+
name = "mock",
5+
srcs = [
6+
"request_store_mock.go",
7+
"request_uri_store_mock.go",
8+
"storage_mock.go",
9+
],
10+
importpath = "github.com/uber/submitqueue/stovepipe/extension/storage/mock",
11+
visibility = ["//visibility:public"],
12+
deps = [
13+
"//stovepipe/entity",
14+
"//stovepipe/extension/storage",
15+
"@org_uber_go_mock//gomock",
16+
],
17+
)

stovepipe/extension/storage/mock/request_store_mock.go

Lines changed: 85 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

stovepipe/extension/storage/mock/request_uri_store_mock.go

Lines changed: 70 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

stovepipe/extension/storage/mock/storage_mock.go

Lines changed: 83 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
load("@rules_go//go:def.bzl", "go_library")
2+
3+
go_library(
4+
name = "mysql",
5+
srcs = [
6+
"request_store.go",
7+
"request_uri_store.go",
8+
"storage.go",
9+
],
10+
importpath = "github.com/uber/submitqueue/stovepipe/extension/storage/mysql",
11+
visibility = ["//visibility:public"],
12+
deps = [
13+
"//platform/metrics",
14+
"//stovepipe/entity",
15+
"//stovepipe/extension/storage",
16+
"@com_github_go_sql_driver_mysql//:mysql",
17+
"@com_github_uber_go_tally//:tally",
18+
],
19+
)

0 commit comments

Comments
 (0)