refactor: Task F+G — remove pinner shim, executor already clean

Task F (Pinner):
- block_recovery.go: removed pinnerShimForRecovery (11 lines of pure
  pass-through). v2bridge.Pinner structurally satisfies bridge.BlockVolPinner
  (same method signatures), so it's passed directly.

Task G (Executor):
- Already clean. v2bridge.Executor is used directly without any shim —
  structurally satisfies engine.CatchUpIO and engine.RebuildIO.
  No code changes needed.

After Task E+F+G: zero shim types remain in block_recovery.go.
v2bridge Reader/Pinner/Executor all satisfy sw-block contracts directly.

Validation:
- go test ./weed/storage/blockvol/v2bridge/ -run "TestPinner_|TestExecutor_|TestBridge_" → PASS
- go test ./weed/server/ -run "TestP4_|TestP16B_" → PASS (8 tests)
- go test ./sw-block/bridge/blockvol/... → PASS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
pingqiu
2026-04-04 00:45:43 -07:00
co-authored by Claude Opus 4.6
parent 680b530314
commit 519c849946
+2 -13
View File
@@ -252,7 +252,7 @@ func (rm *RecoveryManager) runCatchUp(ctx context.Context, replicaID, rebuildAdd
pinner := v2bridge.NewPinner(vol)
sa = bridge.NewStorageAdapter(
reader,
&pinnerShimForRecovery{pinner},
pinner,
)
if s := bs.v2Orchestrator.Registry.Sender(replicaID); s != nil {
if snap := s.SessionSnapshot(); snap != nil {
@@ -332,7 +332,7 @@ func (rm *RecoveryManager) runRebuild(ctx context.Context, replicaID, rebuildAdd
pinner := v2bridge.NewPinner(vol)
sa = bridge.NewStorageAdapter(
reader,
&pinnerShimForRecovery{pinner},
pinner,
)
executor = v2bridge.NewExecutor(vol, rebuildAddr)
return nil
@@ -521,14 +521,3 @@ func (rm *RecoveryManager) volumePathForReplica(replicaID string) string {
// --- Bridge shims ---
type pinnerShimForRecovery struct{ p *v2bridge.Pinner }
func (s *pinnerShimForRecovery) HoldWALRetention(startLSN uint64) (func(), error) {
return s.p.HoldWALRetention(startLSN)
}
func (s *pinnerShimForRecovery) HoldSnapshot(checkpointLSN uint64) (func(), error) {
return s.p.HoldSnapshot(checkpointLSN)
}
func (s *pinnerShimForRecovery) HoldFullBase(committedLSN uint64) (func(), error) {
return s.p.HoldFullBase(committedLSN)
}