Files
seaweedfs/sw-block/engine/replication/doc.go
pingqiu fb0da91196 feat: start Phase 14 V2 core shell
Make the first V2 core owner explicit in sw-block by freezing Phase 14 docs, mode/readiness/publication semantics, and bounded command emission rules. This turns accepted Phase 13 constraints into executable core behavior without overclaiming live runtime cutover.

Made-with: Cursor
2026-04-03 16:11:38 -07:00

38 lines
1.6 KiB
Go

// Package replication implements V2 per-replica sender/session ownership.
//
// This is the real V2 engine core, promoted from the prototype at
// sw-block/prototype/enginev2/. It preserves all accepted invariants:
//
// - One stable Sender per replica, identified by ReplicaID
// - One active Session per replica per epoch
// - Session identity fencing: stale sessionID rejected at every execution API
// - Endpoint change invalidates active session
// - Epoch bump invalidates all stale-epoch sessions
// - Catch-up is bounded (frozen target, budget enforcement)
// - Rebuild is a separate, exclusive sender-owned execution path
// - Completion requires convergence (catch-up) or ReadyToComplete (rebuild)
//
// File layout:
//
// Slice 1 core (ownership/fencing):
//
// types.go — Endpoint, ReplicaState, SessionKind, SessionPhase
// sender.go — Sender: per-replica owner with execution APIs
// session.go — Session: recovery lifecycle with FSM phases
// registry.go — Registry: sender group with reconcile + assignment intent
//
// Phase 14 explicit core shell:
//
// state.go — VolumeState, readiness, boundary, normalized mode
// event.go — bounded event vocabulary
// command.go — side-effect-free command decisions
// projection.go — bounded outward publication projection
// engine.go — ApplyEvent() -> state update -> emit commands/projection
//
// Carried forward from prototype (accepted in Phase 4.5):
//
// budget.go — CatchUpBudget: bounded catch-up enforcement
// rebuild.go — RebuildState: rebuild execution FSM
// outcome.go — HandshakeResult, RecoveryOutcome classification
package replication