package moves // The probe's attempt policy (moves spec §7.7, R12-2, INV-19). // // The window itself is not restated here. The activator's probeWindow and // start loop (internal/activator/claimwindow.go, claimwake.go) already // enforce the 30 second window counted from the attempt's first start, the // absolute cut deadline before every start and before readiness is // accepted, at most five starts and the doubling backoff between them. This // file holds the one piece of policy that lives with the moves: how many // attempts a probe is given. The per-attempt cost that prices them is // budget.go's, and ProbeAttemptsMax is its ceiling. // RecoveryAttempts is the number of probe attempts a recovery install is // given (§7.7): three rounds of the landing's three, because a recovery has // nowhere further to fall back to. const RecoveryAttempts = 9 // Probe kinds, as the operation kinds the claim records. const ( ProbeLanding = "landing" ProbeRecovery = "recovery" ) // AttemptsFor is how many probe attempts a probe of the given kind may // make. A landing gets the attempts T11 admitted (budget.go // AttemptsAdmitted), at most ProbeAttemptsMax, and none when none were // admitted. A recovery gets RecoveryAttempts whatever was admitted. A kind // that is neither gets none. func AttemptsFor(kind string, admitted int) int { switch kind { case ProbeLanding: return max(0, min(ProbeAttemptsMax, admitted)) case ProbeRecovery: return RecoveryAttempts } return 0 }