Skip to content

pebble: move sync-run methods onto SyncRuns - #1204

Open
kans wants to merge 2 commits into
mainfrom
refactor/2-i-sync-runs
Open

kans wants to merge 2 commits into
mainfrom
refactor/2-i-sync-runs

Conversation

@kans

@kans kans commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Stacked on #1200. First of the pebble.Engine splits: the 29 sync-run and sync-stats methods from sync_runs.go, adapter_sync_meta.go, sync_stats_sidecar.go, adapter_stats.go move to SyncRuns, following Ledger (type SyncRuns struct{ e *Engine }, value field syncRuns on Engine, Engine.SyncRuns() accessor). The five fields only they used (computedStats*, syncStatsOverlay, deferredGrantStats*) move with them. Locks stay on Engine; bodies are unchanged apart from e. → r.e. and two locals renamed from r to rec to free the receiver name.

No forwarders on Engine: TestWriteMuHolders rejects a name declared on two checked types, which is the point of #1200. Callers go through SyncRuns() (71 files, almost all tests; production sites are pebble_store.go, source_cache.go, sqlite/convert.go, compactor_pebble.go). pebbleStore gains an explicit ListSyncRuns where the embed used to supply it. Export status is unchanged; unexporting waits for the exportcheck ratchet in #1138.

What to look at: engine.go (field and init next to ledger), the SyncRuns struct in sync_runs.go, and pebble_store.go. Everything else is receiver and call-site rewrites the compiler checked.

Checks: go build ./..., go vet ./..., golangci-lint run ./pkg/dotc1z/... clean; go test ./pkg/dotc1z/... -count=1 ok including TestWriteMuHolders and TestPebbleStoreDirtyCoverage; focused -run 'Stats|SyncRun|Cleanup' across pkg/sync ok.

kans and others added 2 commits October 29, 2026 12:58
The checker keyed receivers on the names e and l. Resolve a method's
receiver identifier to its declared type instead, and recognise
<sub-type>.e, <engine>.<field> and <engine>.<Type>() so methods moved
onto SyncRuns, Digests, Expansion and Records stay under the writeMu
rules. requireSubTypeShape pins the composition those rules assume:
a value field on Engine, an accessor named for the type, and an
e *Engine field on the sub-type.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sync-run and sync-stats methods now sit on SyncRuns, the same shape as Ledger: a syncRuns value on Engine, e *Engine on SyncRuns, and calls through r.e.withWrite. Callers outside the package use SyncRuns, and pebbleStore implements ListSyncRuns by calling that accessor.

Co-authored-by: Cursor <cursoragent@cursor.com>
Base automatically changed from refactor/2-0-write-mu-holders-subtypes to main October 30, 2026 19:08
@kans
kans requested a review from a team October 30, 2026 19:08
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.

2 participants