def plan
import bend-kit-retry@0.3.0.0/retry.bend as Retryimport Base
233# After an attempt ends at now: stop, or wait ms and then ask admit again. Settled, Failed, Rejected, and Unsafe always stop.
234# A transient outcome stops when the budget is spent or the wait would reach the deadline.
235def plan(o: Outcome, p: Policy, b: Budget, +n: Nat, +now: Nat, +r: Nat) -> Plan:
236 match o:
237 case Settled{}:
238 PlanStop{}
239 case Failed{}:
240 PlanStop{}
241 case Rejected{}:
242 PlanStop{}
243 case Unsafe{}:
244 PlanStop{}
245 case Transient{after}:
246 plan.at(wait(after, p, n, r), b, now)