Skip to content

Commit 6650878

Browse files
sbalabanov-zzclaude
andcommitted
refactor: rename example/ to service/
The example/ tree holds the runnable server/client wiring for every domain — it is the composition root, not throwaway demo code. Rename it to service/ to reflect that role and update all references: Bazel labels, Go importpaths, Makefile compose vars and targets, docker-compose build contexts, integration/e2e suite paths, and documentation. Also refresh the docs for the current layout: - Rewrite service/README.md to include the runway service and the stovepipe Ingest/process pipeline (previously documented as Ping-only). - Add service/runway/README.md and service/stovepipe/README.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 3aef74e commit 6650878

47 files changed

Lines changed: 399 additions & 226 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CLAUDE.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ submitqueue/ # repo root (Go module github.com/uber/submi
5656
├── runway/ # Runway domain (single service — the domain *is* the service)
5757
│ └── controller/ # Runway service controllers (consumes the merge queues; no gateway/orchestrator split)
5858
├── tool/ # Development and CI tooling
59-
├── example/
59+
├── service/ # Runnable server/client wiring (entry points + Docker Compose)
6060
│ ├── submitqueue/ # Runnable SubmitQueue servers/clients + Docker Compose
61-
│ ├── stovepipe/ # Runnable Stovepipe servers/clients
61+
│ ├── stovepipe/ # Runnable Stovepipe server/client + Docker Compose
6262
│ └── runway/ # Runnable Runway server/client + Docker Compose
6363
├── test/
6464
│ ├── e2e/submitqueue/ # End-to-end tests (full stack)
@@ -132,7 +132,7 @@ Vendor-agnostic, pluggable interfaces with implementations in subdirectories:
132132
133133
A `{domain}/extension/{ext}` or `platform/extension/{ext}` package contains the behavioral interface, its `Config`, the `Factory` *interface*, and impl constructors `New(...)` that return the interface. It must **not** contain `Factory` *implementations* (`NewFactory()` constructors or factory structs) or any queue-selection logic.
134134
135-
Why: an impl package (e.g. `scorer/heuristic`) can't know the queue topology or the other impls, so a "which impl for which queue" decision doesn't belong there. Per-queue routing — and the small adapters that wrap a `New(...)` impl in the `Factory` interface — live in the wiring layer (e.g. `example/{domain}/{service}/server/main.go`), the one place that knows the full queue set. That's where you route on `Config.QueueName`.
135+
Why: an impl package (e.g. `scorer/heuristic`) can't know the queue topology or the other impls, so a "which impl for which queue" decision doesn't belong there. Per-queue routing — and the small adapters that wrap a `New(...)` impl in the `Factory` interface — live in the wiring layer (e.g. `service/{domain}/{service}/server/main.go`), the one place that knows the full queue set. That's where you route on `Config.QueueName`.
136136
137137
Rule of thumb: if you're about to add a `NewFactory()` or a `map[queue]impl` under `{domain}/extension/` or `platform/extension/`, it belongs in the wiring layer instead.
138138
@@ -239,11 +239,11 @@ make clean # Clean Bazel cache
239239
**Add new RPC method:**
240240
1. Edit `api/{domain}/{service}/proto/*.proto``make proto`
241241
2. Add controller in `{domain}/{service}/controller/`
242-
3. Wire up in `example/{domain}/{service}/server/main.go`
242+
3. Wire up in `service/{domain}/{service}/server/main.go`
243243

244244
**Add new queue message controller:**
245245
1. Create `{domain}/{service}/controller/{step}/` implementing `consumer.Controller`
246-
2. Wire up in `example/{domain}/{service}/server/main.go`
246+
2. Wire up in `service/{domain}/{service}/server/main.go`
247247

248248
**Add new extension:**
249249
1. Create the extension under `{domain}/extension/{ext}/{impl}/` (domain-specific, e.g. `submitqueue/extension/...`) or `platform/extension/{ext}/{impl}/` (shared across domains) with factory and interfaces

Makefile

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ BAZEL = ./tool/bazel
55
COMPOSE = docker-compose
66

77
# SubmitQueue compose files
8-
COMPOSE_FILE = example/submitqueue/docker-compose.yml
9-
GATEWAY_COMPOSE_FILE = example/submitqueue/gateway/server/docker-compose.yml
10-
ORCHESTRATOR_COMPOSE_FILE = example/submitqueue/orchestrator/server/docker-compose.yml
8+
COMPOSE_FILE = service/submitqueue/docker-compose.yml
9+
GATEWAY_COMPOSE_FILE = service/submitqueue/gateway/server/docker-compose.yml
10+
ORCHESTRATOR_COMPOSE_FILE = service/submitqueue/orchestrator/server/docker-compose.yml
1111

1212
# Fixed project name for local manual testing (tests use unique random names)
1313
SUBMITQUEUE_LOCAL_PROJECT = submitqueue
1414

1515
# Stovepipe compose file (single Ping-only service)
16-
STOVEPIPE_COMPOSE_FILE = example/stovepipe/docker-compose.yml
16+
STOVEPIPE_COMPOSE_FILE = service/stovepipe/docker-compose.yml
1717

1818
# Fixed project name for local manual testing (tests use unique random names)
1919
STOVEPIPE_LOCAL_PROJECT = stovepipe
2020

2121
# Runway compose files
22-
RUNWAY_COMPOSE_FILE = example/runway/server/docker-compose.yml
22+
RUNWAY_COMPOSE_FILE = service/runway/server/docker-compose.yml
2323

2424
# Fixed project name for local manual testing (tests use unique random names)
2525
RUNWAY_LOCAL_PROJECT = runway
@@ -65,34 +65,34 @@ build-all-linux: build-submitqueue-gateway-linux build-submitqueue-orchestrator-
6565

6666
build-runway-linux: ## Build Runway Linux binary for Docker
6767
@echo "Building Runway Linux binary for Docker..."
68-
@$(BAZEL) build --platforms=@rules_go//go/toolchain:linux_amd64 //example/runway/server:runway
68+
@$(BAZEL) build --platforms=@rules_go//go/toolchain:linux_amd64 //service/runway/server:runway
6969
@mkdir -p .docker-bin
70-
@cp -f bazel-bin/example/runway/server/runway_/runway .docker-bin/runway 2>/dev/null || \
71-
cp -f bazel-bin/example/runway/server/runway .docker-bin/runway
70+
@cp -f bazel-bin/service/runway/server/runway_/runway .docker-bin/runway 2>/dev/null || \
71+
cp -f bazel-bin/service/runway/server/runway .docker-bin/runway
7272
@echo "Runway Linux binary ready at .docker-bin/runway"
7373

7474
build-submitqueue-gateway-linux: ## Build Gateway Linux binary for Docker
7575
@echo "Building Gateway Linux binary for Docker..."
76-
@$(BAZEL) build --platforms=@rules_go//go/toolchain:linux_amd64 //example/submitqueue/gateway/server:gateway
76+
@$(BAZEL) build --platforms=@rules_go//go/toolchain:linux_amd64 //service/submitqueue/gateway/server:gateway
7777
@mkdir -p .docker-bin
78-
@cp -f bazel-bin/example/submitqueue/gateway/server/gateway_/gateway .docker-bin/gateway 2>/dev/null || \
79-
cp -f bazel-bin/example/submitqueue/gateway/server/gateway .docker-bin/gateway
78+
@cp -f bazel-bin/service/submitqueue/gateway/server/gateway_/gateway .docker-bin/gateway 2>/dev/null || \
79+
cp -f bazel-bin/service/submitqueue/gateway/server/gateway .docker-bin/gateway
8080
@echo "Gateway Linux binary ready at .docker-bin/gateway"
8181

8282
build-submitqueue-orchestrator-linux: ## Build Orchestrator Linux binary for Docker
8383
@echo "Building Orchestrator Linux binary for Docker..."
84-
@$(BAZEL) build --platforms=@rules_go//go/toolchain:linux_amd64 //example/submitqueue/orchestrator/server:orchestrator
84+
@$(BAZEL) build --platforms=@rules_go//go/toolchain:linux_amd64 //service/submitqueue/orchestrator/server:orchestrator
8585
@mkdir -p .docker-bin
86-
@cp -f bazel-bin/example/submitqueue/orchestrator/server/orchestrator_/orchestrator .docker-bin/orchestrator 2>/dev/null || \
87-
cp -f bazel-bin/example/submitqueue/orchestrator/server/orchestrator .docker-bin/orchestrator
86+
@cp -f bazel-bin/service/submitqueue/orchestrator/server/orchestrator_/orchestrator .docker-bin/orchestrator 2>/dev/null || \
87+
cp -f bazel-bin/service/submitqueue/orchestrator/server/orchestrator .docker-bin/orchestrator
8888
@echo "Orchestrator Linux binary ready at .docker-bin/orchestrator"
8989

9090
build-stovepipe-linux: ## Build Stovepipe Linux binary for Docker
9191
@echo "Building Stovepipe Linux binary for Docker..."
92-
@$(BAZEL) build --platforms=@rules_go//go/toolchain:linux_amd64 //example/stovepipe/server:stovepipe
92+
@$(BAZEL) build --platforms=@rules_go//go/toolchain:linux_amd64 //service/stovepipe/server:stovepipe
9393
@mkdir -p .docker-bin
94-
@cp -f bazel-bin/example/stovepipe/server/stovepipe_/stovepipe .docker-bin/stovepipe 2>/dev/null || \
95-
cp -f bazel-bin/example/stovepipe/server/stovepipe .docker-bin/stovepipe
94+
@cp -f bazel-bin/service/stovepipe/server/stovepipe_/stovepipe .docker-bin/stovepipe 2>/dev/null || \
95+
cp -f bazel-bin/service/stovepipe/server/stovepipe .docker-bin/stovepipe
9696
@echo "Stovepipe Linux binary ready at .docker-bin/stovepipe"
9797

9898
check-gazelle: ## Check BUILD.bazel files are up to date
@@ -361,26 +361,26 @@ proto: ## Generate protobuf files from .proto definitions
361361

362362
# Bazel query helpers
363363
query-deps:
364-
@$(BAZEL) query 'deps(//example/submitqueue/gateway/server:gateway)'
364+
@$(BAZEL) query 'deps(//service/submitqueue/gateway/server:gateway)'
365365

366366
query-targets:
367367
@$(BAZEL) query //...
368368

369369
# Run gateway client (connects to any running gateway service)
370370
run-client-submitqueue-gateway:
371-
@$(BAZEL) run //example/submitqueue/gateway/client:gateway -- -addr $(or $(SERVER_ADDR),localhost:8081) -message "$(or $(MESSAGE),ping)"
371+
@$(BAZEL) run //service/submitqueue/gateway/client:gateway -- -addr $(or $(SERVER_ADDR),localhost:8081) -message "$(or $(MESSAGE),ping)"
372372

373373
# Run orchestrator client (connects to any running orchestrator service)
374374
run-client-submitqueue-orchestrator:
375-
@$(BAZEL) run //example/submitqueue/orchestrator/client:orchestrator -- -addr $(or $(SERVER_ADDR),localhost:8082) -message "$(or $(MESSAGE),ping)"
375+
@$(BAZEL) run //service/submitqueue/orchestrator/client:orchestrator -- -addr $(or $(SERVER_ADDR),localhost:8082) -message "$(or $(MESSAGE),ping)"
376376

377377
# Run stovepipe client (connects to any running stovepipe service)
378378
run-client-stovepipe:
379-
@$(BAZEL) run //example/stovepipe/client:stovepipe -- -addr $(or $(SERVER_ADDR),localhost:8083) -message "$(or $(MESSAGE),ping)"
379+
@$(BAZEL) run //service/stovepipe/client:stovepipe -- -addr $(or $(SERVER_ADDR),localhost:8083) -message "$(or $(MESSAGE),ping)"
380380

381381
# Run runway client (connects to any running runway service)
382382
run-client-runway:
383-
@$(BAZEL) run //example/runway/client:runway -- -addr $(or $(SERVER_ADDR),localhost:8086) -message "$(or $(MESSAGE),ping)"
383+
@$(BAZEL) run //service/runway/client:runway -- -addr $(or $(SERVER_ADDR),localhost:8086) -message "$(or $(MESSAGE),ping)"
384384

385385
run-queue-admin: ## Run queue-admin CLI (use ARGS to pass arguments, e.g. make run-queue-admin ARGS="list-topics")
386386
@$(BAZEL) run //platform/extension/messagequeue/mysql/ctl -- $(ARGS)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ grpcurl -plaintext -d '{"message": "hello"}' localhost:8081 uber.submitqueue.gat
3333
make local-stop
3434
```
3535

36-
See [example/README.md](example/README.md) for more examples including running individual services and clients.
36+
See [service/README.md](service/README.md) for more examples including running individual services and clients.
3737

3838
## Documentation
3939

@@ -43,7 +43,7 @@ See [example/README.md](example/README.md) for more examples including running i
4343
| [Contributing](CONTRIBUTING.md) | How to contribute, workflow, guidelines |
4444
| [Testing Guide](doc/howto/TESTING.md) | Unit, integration, and E2E testing patterns |
4545
| [Architecture Guide](CLAUDE.md) | Project layout, patterns, conventions |
46-
| [Examples](example/README.md) | Running services, clients, API reference |
46+
| [Examples](service/README.md) | Running services, clients, API reference |
4747
| [RFCs](doc/rfc/index.md) | Design documents and proposals |
4848

4949
## Project Status

doc/howto/TESTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,6 @@ assert.Equal(s.T(), "expected", resp.Value)
388388
## See Also
389389

390390
- [CLAUDE.md](../../CLAUDE.md) - Development guidelines and project structure
391-
- [example/submitqueue/docker-compose.yml](../../example/submitqueue/docker-compose.yml) - Full stack service definitions
392-
- [example/submitqueue/gateway/server/docker-compose.yml](../../example/submitqueue/gateway/server/docker-compose.yml) - Gateway isolation
393-
- [example/submitqueue/orchestrator/server/docker-compose.yml](../../example/submitqueue/orchestrator/server/docker-compose.yml) - Orchestrator isolation
391+
- [service/submitqueue/docker-compose.yml](../../service/submitqueue/docker-compose.yml) - Full stack service definitions
392+
- [service/submitqueue/gateway/server/docker-compose.yml](../../service/submitqueue/gateway/server/docker-compose.yml) - Gateway isolation
393+
- [service/submitqueue/orchestrator/server/docker-compose.yml](../../service/submitqueue/orchestrator/server/docker-compose.yml) - Orchestrator isolation

doc/rfc/submitqueue/extension-contract.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Non-obvious points:
5252

5353
## Mechanism
5454

55-
Dependencies are injected per-extension at the existing `Factory.For` (wiring: `example/submitqueue/orchestrator/server/main.go`) — only the handles a contract justifies, never the whole storage aggregator. The repeated batch→changes walk becomes one shared resolver (today's duplicated `collectChanges`, consolidated, and preserving the batch boundaries build's copy flattens). Controllers shrink to passing the identity entity they already load.
55+
Dependencies are injected per-extension at the existing `Factory.For` (wiring: `service/submitqueue/orchestrator/server/main.go`) — only the handles a contract justifies, never the whole storage aggregator. The repeated batch→changes walk becomes one shared resolver (today's duplicated `collectChanges`, consolidated, and preserving the batch boundaries build's copy flattens). Controllers shrink to passing the identity entity they already load.
5656

5757
`entity.BatchChanges` is kept, not removed — it becomes the shared resolver's *detailed output* (URIs + provider details for a batch, what the scorer consumes) rather than a value the score controller assembles and passes in. Its line/file helpers move with it; only its producer changes.
5858

example/README.md

Lines changed: 0 additions & 153 deletions
This file was deleted.

0 commit comments

Comments
 (0)