Skip to content

relay/registry: split track.go into track_registry.go and track_entry.go#23

Merged
floatdrop merged 1 commit into
draft-18from
relay-split-track-registry-entry
Jun 26, 2026
Merged

relay/registry: split track.go into track_registry.go and track_entry.go#23
floatdrop merged 1 commit into
draft-18from
relay-split-track-registry-entry

Conversation

@floatdrop

Copy link
Copy Markdown
Owner

Why

pkg/relay/internal/registry/track.go had grown to ~1030 lines mixing two distinct concerns:

  • the process-wide TrackRegistry — the track map, lifecycle, upstream/downstream wiring, discovery;
  • 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.

What

Split along that seam, matching the existing by-domain file naming in the package (namespace.go, fetch_router.go, …):

File Lines Contents
track_registry.go 576 TrackRegistry, its options, Get/GetOrCreate, Add/Remove*, RemoveSession, cache-TTL resolution, discovery publish/unpublish
track_entry.go 459 TrackEntry + SubgroupKey/SharedSubgroup and every (e *TrackEntry) method

Pure code movement — no behavior change. Git tracks track.go → track_registry.go as a rename.

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.

Test

go build ./..., go test ./pkg/relay/..., and golangci-lint run ./pkg/relay/internal/registry/... all pass.

🤖 Generated with Claude Code

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>
@floatdrop floatdrop merged commit 2680022 into draft-18 Jun 26, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant