Files
seaweedfs/sw-block/engine/replication/command.go
pingqiu a6fc8545b9 feat: Phase 14A+14B — V2 core publication ownership + command semantics
14A: Publication as explicit core-owned state
- state.go: PublicationView on VolumeState, explicit gate reasons
- engine.go: mode→readiness→publication chain with named gates
  (awaiting_role_apply, awaiting_shipper_configured, awaiting_barrier_durability)
- projection.go: PublicationProjection carries publication truth
- RF=1/no-replicas → allocated_only (CP13-9 constraint in core)
- phase14_core_test.go: strengthened publication closure + RF=1 proof

14B: Command emission bounded by semantic gap
- engine.go: repeated same-assignment skips redundant commands,
  repeated same-reason BarrierRejected skips duplicate invalidation,
  command-state tracking on VolumeState
- command.go: new command types for bounded emission
- event.go: new boundary events
- phase14_command_test.go: exact command sequences frozen as proofs
  (primary/replica repeated assignment, assignment changed, repeated failure)
- phase14_boundary_test.go: boundary/recovery structural tests

All tests pass in sw-block/engine/replication.
Phase 14 docs updated (14A accepted, 14B active→14C planned).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 16:52:55 -07:00

57 lines
1.3 KiB
Go

package replication
// Command is one side-effect-free decision emitted by the Phase 14 core skeleton.
// Adapters execute commands later; the core only decides them.
type Command interface {
commandName() string
}
type ApplyRoleCommand struct {
VolumeID string
Epoch uint64
Role VolumeRole
}
func (ApplyRoleCommand) commandName() string { return "apply_role" }
type StartReceiverCommand struct {
VolumeID string
}
func (StartReceiverCommand) commandName() string { return "start_receiver" }
type ConfigureShipperCommand struct {
VolumeID string
Replicas []ReplicaAssignment
}
func (ConfigureShipperCommand) commandName() string { return "configure_shipper" }
type StartCatchUpCommand struct {
VolumeID string
TargetLSN uint64
}
func (StartCatchUpCommand) commandName() string { return "start_catchup" }
type StartRebuildCommand struct {
VolumeID string
TargetLSN uint64
}
func (StartRebuildCommand) commandName() string { return "start_rebuild" }
type InvalidateSessionCommand struct {
VolumeID string
Reason string
}
func (InvalidateSessionCommand) commandName() string { return "invalidate_session" }
type PublishProjectionCommand struct {
VolumeID string
Projection PublicationProjection
}
func (PublishProjectionCommand) commandName() string { return "publish_projection" }