relay/registry: split track.go into track_registry.go and track_entry.go#23
Merged
Merged
Conversation
track.go had grown to ~1030 lines mixing two distinct concerns: the
process-wide TrackRegistry (the track map, lifecycle, upstream/downstream
wiring, discovery) and the per-track TrackEntry control block (subgroup
fan-out state, the §2.1 dedup ledger, the largest-object watermark, Track
Properties, and the Copy* snapshots).
Split along that line:
- track_registry.go: TrackRegistry, its options, Get/GetOrCreate,
Add/Remove*, RemoveSession, cache-TTL resolution, and the discovery
publish/unpublish helpers.
- track_entry.go: TrackEntry plus SubgroupKey/SharedSubgroup and every
(e *TrackEntry) method.
Pure code movement — no behavior change. The one incidental fix: the
TrackRegistry doc comment had been separated from its struct by the
CacheTTLPolicy declaration sitting between them; CacheTTLPolicy now
precedes the doc, reattaching it to the type.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
pkg/relay/internal/registry/track.gohad grown to ~1030 lines mixing two distinct concerns:TrackRegistry— the track map, lifecycle, upstream/downstream wiring, discovery;TrackEntrycontrol block — subgroup fan-out state, the §2.1 dedup ledger, the largest-object watermark, Track Properties, and theCopy*snapshots.What
Split along that seam, matching the existing by-domain file naming in the package (
namespace.go,fetch_router.go, …):track_registry.goTrackRegistry, its options,Get/GetOrCreate,Add/Remove*,RemoveSession, cache-TTL resolution, discovery publish/unpublishtrack_entry.goTrackEntry+SubgroupKey/SharedSubgroupand every(e *TrackEntry)methodPure code movement — no behavior change. Git tracks
track.go → track_registry.goas a rename.One incidental fix: the
TrackRegistrydoc comment had been separated from its struct by theCacheTTLPolicydeclaration sitting between them.CacheTTLPolicynow precedes the doc, reattaching it to the type.Test
go build ./...,go test ./pkg/relay/..., andgolangci-lint run ./pkg/relay/internal/registry/...all pass.🤖 Generated with Claude Code