Repository navigation
refactor: move snapshot-offload wiring to internal/snapshotoffloadwiring (M4) - #1447
Conversation
Signed-off-by: bootjp <contact@bootjp.me>
First M4 area of the root package decomposition. Move the snapshot offload start-up wiring out of package main into a new internal/snapshotoffloadwiring package: the offload and retention flag structs (now Flags / RetentionFlags with Register), endpoint, prefix and spool validation, the TLS-enforcing HTTP client, store construction, stale-spool cleanup, and the scheduler and retention workers. Start takes []snapshotoffload.OffloadGroup and the build version instead of the node runtimes, so the package never sees raftGroupRuntime. main keeps snapshotOffloadGroups (runtimes -> offload groups with their leadership callbacks) and a thin startSnapshotOffload that calls Start. Tests moved with the code; the ones that exercise the runtime mapping stay in main. The import guard restricts the package to binaries. No behavior change: -help output and the set of test names are identical to the base. Signed-off-by: bootjp <contact@bootjp.me>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Design: docs/design/2026_11_12_partial_root_package_decomposition.md
The first M4 area of the root package decomposition: snapshot offload. The first commit updates the design doc. It records the new package, which is a sibling of the
snapshotoffloadlibrary rather than part of it, so flag and start-up code stays out of the library and away from its test fakes. The second commit moves the code.Changes
New package
internal/snapshotoffloadwiring:offload.go(frommain_snapshot_offload.go):FlagswithRegisterStartretention.go(wasmain_snapshot_offload_gc.go):RetentionFlags, the retention runner, and the worker loop.Starttakes[]snapshotoffload.OffloadGroupand the build version instead of the node runtimes, so the package never seesraftGroupRuntime.offload_test.go, plusretention_test.go(wasmain_snapshot_offload_gc_test.go). Three start/cleanup tests now pass offload groups directly instead of runtimes, since the mapping from runtimes is nowmain's job.mainkeeps:snapshotOffloadGroupsand the leadership callbacks: runtimes become offload groups, and each group reads the engine throughsnapshotEngine.startSnapshotOffloadthat callssnapshotoffloadwiring.Start.defaultServerFlags().snapshotOffload, with the same final values as before.serverFlags.snapshotOffloadis nowsnapshotoffloadwiring.Flags.The import guard lists the package as a wiring layer and restricts it to binaries. Only its test imports the concrete etcd backend.
Behavior change
None:
-helpoutput is identical to the base.internal/snapshotoffloadwiringis identical to the base.Risk
Low. Offload is opt-in and off by default. Validation order, the fail-closed start-up and the store hand-off are unchanged.
Test evidence
go test -race -count=1 . ./internal/snapshotoffloadwiring/ ./internal/testutil/cmd/importguard/: ok (root 224s).go build ./...: ok.golangci-lint: 0 issues.scripts/check-production-imports.sh: ok.-helpand test-name set: identical to the base../scripts/run-jepsen-local.sh, binary built fromaf0374f21, JDK 21): PASSED. The DynamoDB list-append workload and all ten type workloads report:valid? true. The filesystem workloads were skipped because FUSE is unavailable on the macOS runner.Self-review
snapshotEngine. The worker goroutine and shutdown path are unchanged.main→ package path.Summary by CodeRabbit