def key1
import cswap-bend-cli@0.1.0.0/policy/safe.bend as Safeimport Base
76# round-robin: the next slot after the live one, wrapping to the lowest.
77# soonest-reset: the weekly window that resets first (unknown last), then more
78# headroom. drain-first: the least headroom (the most used). best, sticky: the
79# most headroom. Ties go to the first account in sequence order.
80def key1(+algo: Algo, +active: Nat, +slot: Nat, +reset: Maybe<&2, Nat>) -> Maybe<&2, Nat>:
81 match algo:
82 case ARoundRobin{}:
83 Some{rr.group(slot, active)}
84 case ASoonestReset{}:
85 reset
86 case o:
87 Some{0n}