Files
seaweedfs/seaweed-block/core/engine/promotion_ready.go
T
Ping Qiu 5c4f995c55 v0.2 alpha: Day-1 activation and first-volume loop (#48)
Package the Kubernetes alpha into a script-based Day-1 activation loop: activate the stack, create the first PVC-backed volume, verify writer/reader data, collect product-owned observation evidence, render a local read-only report, and clean up.

Includes multi-node-safe activation defaults, first-volume example automation, read-only ops report output, README/quickstart/release note updates, and review-driven hardening for fail-fast configuration, promotion evidence, inventory fail-closed behavior, and test guards.

Validated by Day-1 activation run 20260517-205252-04e9 and read-only report run 20260517-212358-bfba. Local targeted tests passed.
2026-05-18 16:43:35 -07:00

49 lines
1.6 KiB
Go

package engine
const (
PromotionReadyReasonReady = "promotion_ready"
PromotionReadyReasonNotMember = "not_member"
PromotionReadyReasonNotReachable = "not_reachable"
PromotionReadyReasonNotCaughtUp = "not_caught_up"
PromotionReadyReasonFencePending = "fence_pending"
PromotionReadyReasonPostCloseAckNeeded = "post_close_durable_ack_needed"
)
// PromotionReadyFact is a control-facing fact derived from the engine's truth
// domains. It intentionally does not reuse ReplicaProjection, which is
// operator-facing and must not be fed back into authority decisions.
type PromotionReadyFact struct {
Ready bool
Reason string
ReplicaID string
Epoch uint64
EndpointVersion uint64
}
func BuildPromotionReadyFact(st *ReplicaState) PromotionReadyFact {
if st == nil {
return PromotionReadyFact{Reason: PromotionReadyReasonNotMember}
}
fact := PromotionReadyFact{
Reason: PromotionReadyReasonReady,
ReplicaID: st.Identity.ReplicaID,
Epoch: st.Identity.Epoch,
EndpointVersion: st.Identity.EndpointVersion,
}
switch {
case !st.Identity.MemberPresent:
fact.Reason = PromotionReadyReasonNotMember
case st.Reachability.Status != ProbeReachable:
fact.Reason = PromotionReadyReasonNotReachable
case st.Recovery.Decision != DecisionNone:
fact.Reason = PromotionReadyReasonNotCaughtUp
case st.Identity.Epoch > st.Reachability.FencedEpoch:
fact.Reason = PromotionReadyReasonFencePending
case recoveredReplicaWaitingForPostCloseAck(st):
fact.Reason = PromotionReadyReasonPostCloseAckNeeded
default:
fact.Ready = true
}
return fact
}