Files
seaweedfs/sw-block/bridge/blockvol/doc.go
T
pingqiuandClaude Opus 4.6 05daede7f9 feat: add V2 bridge adapters for blockvol (Phase 07 P0)
Creates sw-block/bridge/blockvol/ — concrete adapters connecting
the V2 engine to real blockvol storage and control-plane state.

control_adapter.go:
- MakeReplicaID: volume-name/server-id (NOT address-derived)
- ToAssignmentIntent: maps master assignment → engine intent
- Role → SessionKind translation (pure mapping, no policy)

storage_adapter.go:
- BlockVolState: maps to real blockvol fields (WAL head/tail,
  committed, checkpoint) — NOT reconstructed from metadata
- GetRetainedHistory from real state
- PinSnapshot rejects untrusted checkpoint
- PinWALRetention rejects recycled range
- PinFullBase / ReleaseFullBase

8 bridge tests:
- StableIdentity: ReplicaID = vol/server (not address)
- AddressChangePreservesIdentity: same ID, different address
- RebuildRoleMapping: "rebuilding" → SessionRebuild
- PrimaryNoRecovery: no recovery targets for primary
- RetainedHistoryFromRealState: all fields from BlockVolState
- WALPinRejectsRecycled: tail validation
- SnapshotPinRejectsInvalid: trust validation
- E2E_AssignmentToRecovery: master assignment → adapter →
  engine intent → plan → execute → InSync

Adapter replacement order:
P0: control_adapter + storage_adapter (this delivery)
P1: executor_bridge + observe_adapter (deferred)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 17:39:39 -07:00

20 lines
834 B
Go

// Package blockvol bridges the V2 engine to real blockvol storage and
// control-plane state.
//
// This package implements the adapter interfaces defined in
// sw-block/engine/replication/ using real blockvol internals as the
// source of truth.
//
// Hard rules (Phase 07):
// - ReplicaID = <volume-name>/<replica-server-id> (not address-derived)
// - blockvol executes recovery I/O but does NOT own recovery policy
// - Engine decides zero-gap vs catch-up vs rebuild
// - Bridge translates engine decisions into blockvol actions
//
// Adapter replacement order:
// P0: control_adapter (assignment → engine intent)
// P0: storage_adapter (blockvol state → RetainedHistory)
// P1: executor_bridge (engine executor → blockvol I/O)
// P1: observe_adapter (engine status → service diagnostics)
package blockvol