mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-21 13:34:26 +02:00
Batch 7: Command dispatch binding extraction - New weed/server/blockcmd package: CommandHandler interface + DispatchCommands - volume_server_block.go applyCoreCommandsWithAssignment delegates to dispatcher - weed/server still owns RecordCommand, EmitCoreEvent, PublishProjection - v2bridge NOT given command-switch or event-emission semantics Phase 16C: Rebuilding assignment enters core command path Phase 16D: Rebuild recovery-task startup is command-driven Phase 16E: Catch-up recovery-task startup is command-driven Engine refinements: - RecoveryTarget on AssignmentDelivered event - shouldStartRecoveryTask / shouldStartReceiver guards - bootstrapReason: awaiting_rebuild_start Bridge/contract updates: - control_adapter.go: refined translation helpers - contract.go: executor port alignment Migration design docs (Batch 1-3 delivered, design artifacts): - v2-first/second/third-migration-batch.md + task-pack.md - v2-assignment-translation-unification.md - v2-execution-muscles-inventory.md - v2-separation-port-layer-audit.md - v2-legacy-runtime-exit-criteria.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3.4 KiB
3.4 KiB
V2 Execution Muscles Inventory
Date: 2026-04-04 Status: active
Purpose
This note inventories the current V1/weed code that should be treated as execution muscles for separation, rather than semantic authority.
Movable Execution-Muscle Clusters
1. Recovery executor mechanics
Files:
weed/storage/blockvol/v2bridge/executor.go- related tests under
weed/storage/blockvol/v2bridge/*transfer* - related tests under
weed/storage/blockvol/v2bridge/*snapshot* - related tests under
weed/storage/blockvol/v2bridge/*truncate*
Why this is a muscle:
- it performs TCP rebuild/catch-up I/O
- it applies WAL entries, snapshots, and full-base transfer
- it does not decide recovery policy; the engine already decides the plan
2. Storage state read mechanics
File:
weed/storage/blockvol/v2bridge/reader.go
Why this is a muscle:
- it only reads real
BlockVolstate - it populates the engine-facing retained-history view
- it carries no semantic authority
3. Pin / retention hold mechanics
File:
weed/storage/blockvol/v2bridge/pinner.go
Why this is a muscle:
- it only implements hold/release against real flusher retention
- pin meaning belongs to the engine; this file only executes the hold
4. Recovery-side blockvol shims
Current location:
weed/server/block_recovery.go
Candidate functions:
readerShimForRecoverypinnerShimForRecovery
Why they are muscles:
- they are thin glue from runtime host code into bridge contracts
- they should not remain mixed into recovery lifecycle ownership
Code That Should Stay In weed/
1. Product adapter shell
Files:
weed/server/volume_server_block.goweed/server/block_recovery.go
Why they stay:
- process lifecycle and goroutine hosting
- command dispatch into real servers/backends
- heartbeat, iSCSI, NVMe, and server integration
2. Raw blockvol backend
Files:
weed/storage/blockvol/*
Why they stay:
- they are the actual backend implementation
- the separation goal is not to move
BlockVolitself intosw-block
3. Real master/heartbeat wire adaptation
File:
weed/storage/blockvol/v2bridge/control.go
Why it stays for now:
- it consumes
weed/storage/blockvol.BlockVolumeAssignment - it is still closest to master / heartbeat wire shape
- canonical mapping logic can move into
sw-block, but source-format adaptation still belongs inweed/
Main Migration Risks
1. Hidden weed dependency
Risk:
executor.go,reader.go, andpinner.godirectly depend onweed/storage/blockvol.BlockVol
Implication:
- they cannot be moved into
sw-blockunchanged - ports/interfaces must be stabilized first
2. Assignment translation drift
Risk files:
weed/storage/blockvol/v2bridge/control.goweed/server/volume_server_block.go
Implication:
- if migration happens before canonical helper extraction, identity and recovery-target rules can drift
3. Runtime host coupling
Risk file:
weed/server/block_recovery.go
Implication:
- goroutine lifecycle, logging, sender invalidation, and core event emission are still mixed together
- only the execution muscles should move first, not the whole runtime host
Recommended Move Order
- stabilize contracts in
sw-block/bridge/blockvol - extract canonical mapping helpers into
sw-block - migrate reader/pinner/executor logic behind those ports
- shrink
weed/serverto adapter shell afterward