mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-01 04:46:33 +00:00
Carry replica-scoped addressing through bounded recovery planning and completion events so the core no longer depends on a volume-only observation seam. This preserves the current single-replica catch-up and rebuilding behavior while aligning the observation side with the replica-scoped command path. Made-with: Cursor
147 lines
3.8 KiB
Go
147 lines
3.8 KiB
Go
package replication
|
|
|
|
// Event is one bounded input into the Phase 14 core skeleton.
|
|
// Events describe observation or intent; they do not perform side effects.
|
|
type Event interface {
|
|
VolumeID() string
|
|
}
|
|
|
|
// AssignmentDelivered carries the desired local role and replica set.
|
|
type AssignmentDelivered struct {
|
|
ID string
|
|
Epoch uint64
|
|
Role VolumeRole
|
|
Replicas []ReplicaAssignment
|
|
RecoveryTarget SessionKind
|
|
}
|
|
|
|
func (e AssignmentDelivered) VolumeID() string { return e.ID }
|
|
|
|
// RoleApplied confirms the local runtime applied the desired role.
|
|
type RoleApplied struct {
|
|
ID string
|
|
}
|
|
|
|
func (e RoleApplied) VolumeID() string { return e.ID }
|
|
|
|
// ReceiverReadyObserved confirms replica receiver readiness.
|
|
type ReceiverReadyObserved struct {
|
|
ID string
|
|
}
|
|
|
|
func (e ReceiverReadyObserved) VolumeID() string { return e.ID }
|
|
|
|
// ShipperConfiguredObserved confirms shipper wiring exists.
|
|
type ShipperConfiguredObserved struct {
|
|
ID string
|
|
}
|
|
|
|
func (e ShipperConfiguredObserved) VolumeID() string { return e.ID }
|
|
|
|
// ShipperConnectedObserved confirms the shipper is connected.
|
|
type ShipperConnectedObserved struct {
|
|
ID string
|
|
}
|
|
|
|
func (e ShipperConnectedObserved) VolumeID() string { return e.ID }
|
|
|
|
// DiagnosticShippedAdvanced updates sender-side diagnostic progress only.
|
|
type DiagnosticShippedAdvanced struct {
|
|
ID string
|
|
ShippedLSN uint64
|
|
}
|
|
|
|
func (e DiagnosticShippedAdvanced) VolumeID() string { return e.ID }
|
|
|
|
// CommittedLSNAdvanced updates the committed boundary truth without implying
|
|
// replica durability or checkpoint advancement.
|
|
type CommittedLSNAdvanced struct {
|
|
ID string
|
|
CommittedLSN uint64
|
|
}
|
|
|
|
func (e CommittedLSNAdvanced) VolumeID() string { return e.ID }
|
|
|
|
// BarrierAccepted advances authoritative durable progress.
|
|
type BarrierAccepted struct {
|
|
ID string
|
|
FlushedLSN uint64
|
|
}
|
|
|
|
func (e BarrierAccepted) VolumeID() string { return e.ID }
|
|
|
|
// BarrierRejected marks the bounded path degraded until a later success clears it.
|
|
type BarrierRejected struct {
|
|
ID string
|
|
Reason string
|
|
}
|
|
|
|
func (e BarrierRejected) VolumeID() string { return e.ID }
|
|
|
|
// CheckpointAdvanced updates the durable base-image boundary.
|
|
type CheckpointAdvanced struct {
|
|
ID string
|
|
CheckpointLSN uint64
|
|
}
|
|
|
|
func (e CheckpointAdvanced) VolumeID() string { return e.ID }
|
|
|
|
// CatchUpPlanned freezes the current replay target as bounded recovery truth.
|
|
type CatchUpPlanned struct {
|
|
ReplicaID string
|
|
ID string
|
|
TargetLSN uint64
|
|
}
|
|
|
|
func (e CatchUpPlanned) VolumeID() string { return e.ID }
|
|
|
|
// RecoveryProgressObserved updates achieved replay/rebuild progress without
|
|
// implying publication or durability closure by itself.
|
|
type RecoveryProgressObserved struct {
|
|
ReplicaID string
|
|
ID string
|
|
AchievedLSN uint64
|
|
}
|
|
|
|
func (e RecoveryProgressObserved) VolumeID() string { return e.ID }
|
|
|
|
// CatchUpCompleted closes a previously planned catch-up path at an explicit
|
|
// achieved boundary.
|
|
type CatchUpCompleted struct {
|
|
ReplicaID string
|
|
ID string
|
|
AchievedLSN uint64
|
|
}
|
|
|
|
func (e CatchUpCompleted) VolumeID() string { return e.ID }
|
|
|
|
// NeedsRebuildObserved is a fail-closed rebuild escalation.
|
|
type NeedsRebuildObserved struct {
|
|
ReplicaID string
|
|
ID string
|
|
Reason string
|
|
}
|
|
|
|
func (e NeedsRebuildObserved) VolumeID() string { return e.ID }
|
|
|
|
// RebuildStarted moves the recovery truth from blocked-needs-rebuild into an
|
|
// explicit rebuilding path with a frozen target.
|
|
type RebuildStarted struct {
|
|
ReplicaID string
|
|
ID string
|
|
TargetLSN uint64
|
|
}
|
|
|
|
func (e RebuildStarted) VolumeID() string { return e.ID }
|
|
|
|
// RebuildCommitted clears the rebuild condition with bounded durable truth.
|
|
type RebuildCommitted struct {
|
|
ReplicaID string
|
|
ID string
|
|
AchievedLSN uint64
|
|
FlushedLSN uint64
|
|
CheckpointLSN uint64
|
|
}
|
|
|
|
func (e RebuildCommitted) VolumeID() string { return e.ID }
|