policy/exhaust.bend checks
raw source on the hub · import cswap-bend-cli@0.1.0.0/policy/exhaust.bend as Exhaust
5 imports
import Base import ./types.bend as T import ./usage.bend as U import ./rank.bend as R import ./pick.bend as K
Types
type Br source · line 12 · raw
Data
How an account is blocked: not at all, at 100 % with no known reset, or until the latest reset among its windows at 100 %.
NotBlockedBr
BlockedNoTsBr
BlockedAt@t:Nat -> Br
type Er source · line 17 · raw
Data
ErNoneEr
ErAt@t:Nat -> Er
ErPoisonEr
Definitions
def readable.at source · line 22 · raw
@+ok:Bool -> @+m:Maybe<&2, Nat> -> Maybe<&2, Nat>
def readable.acct source · line 30 · raw
@+a:0x0717344745a30ebad1f19045228e8f18/policy/types.Account -> @+active:Nat -> @+us:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage> -> @+now:Nat -> @+ms:List<&2, String> -> Maybe<&2, Nat>
The trusted headroom of a candidate, backoff or not.
def is_some source · line 33 · raw
@+m:Maybe<&2, Nat> -> Bool
def any_known source · line 41 · raw
@+as:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Account> -> @+active:Nat -> @+us:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage> -> @+now:Nat -> @+ms:List<&2, String> -> Bool
Some candidate has a trusted reading.
def exhausted.known source · line 48 · raw
@+m:Maybe<&2, Nat> -> Bool
def exhausted.at source · line 55 · raw
@+base:Bool -> @+m:Maybe<&2, Nat> -> Bool
def all_exhausted source · line 63 · raw
@+as:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Account> -> @+active:Nat -> @+us:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage> -> @+now:Nat -> @+ms:List<&2, String> -> Bool
Every OAuth candidate is readable and at its limit.
def any_cand source · line 70 · raw
@+as:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Account> -> @+active:Nat -> Bool
def any_api source · line 77 · raw
@+as:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Account> -> @+active:Nat -> Bool
def api.first source · line 85 · raw
@+as:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Account> -> @+active:Nat -> Maybe<&2, Nat>
The first last-resort API-key candidate, in sequence order.
def br.upd source · line 94 · raw
@+acc:Br -> @+r:Maybe<&2, Nat> -> Br
def br.if source · line 109 · raw
@+blocked:Bool -> @+acc:Br -> @+r:Maybe<&2, Nat> -> Br
def br.win source · line 116 · raw
@+ws:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Win> -> @+acc:Br -> Br
def br.fresh source · line 125 · raw
@+ok:Bool -> @+u:0x0717344745a30ebad1f19045228e8f18/policy/types.Usage -> @+ms:List<&2, String> -> Br
def br.row source · line 132 · raw
@+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage> -> @+now:Nat -> @+ms:List<&2, String> -> Br
def er.min source · line 139 · raw
@+e:Er -> @+t:Nat -> Er
def er.at source · line 148 · raw
@+past:Bool -> @+e:Er -> @+t:Nat -> Er
def er.step source · line 155 · raw
@+e:Er -> @+b:Br -> @+now:Nat -> Er
def er.out source · line 164 · raw
@+e:Er -> Maybe<&2, Nat>
def earliest source · line 173 · raw
@+as:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Account> -> @+us:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage> -> @+now:Nat -> @+ms:List<&2, String> -> @+e:Er -> Er
Earliest moment any blocked account (the live one included) is usable again; None when it cannot be proven.