~/bend-docscommunity

policy/bar.bend checks

raw source on the hub · import cswap-bend-cli@0.1.0.0/policy/bar.bend as Bar

4 imports
import Base
import ./types.bend as T
import ./usage.bend as U
import ./rank.bend as R

Definitions

def is_none source · line 11 · raw

@+m:Maybe<&2, Nat> -> Bool

def trig.is_failover source · line 18 · raw

@+t:0x0717344745a30ebad1f19045228e8f18/policy/types.Trigger -> Bool

def snap.fail source · line 26 · raw

@+lt:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Trigger> -> @+lh:Maybe<&2, Nat> -> @+lr:Maybe<&2, Nat> -> Bool

A failover departure: by the recorded trigger, else by the two nulls.

def gt_land source · line 34 · raw

@+h:Maybe<&2, Nat> -> @+thr:Nat -> Bool

h > 100 - threshold: would the ranking accept it as a landing spot?

def rec.finite source · line 41 · raw

@+a:Maybe<&2, Nat> -> Bool

def recov.fail source · line 50 · raw

@+h:Maybe<&2, Nat> -> @+peer:Maybe<&2, Nat> -> @+act:Maybe<&2, Nat> -> @+thr:Nat -> @+now:Nat -> Bool

Failover departure: no baseline, so read only the present. Landing spot, or its binding reset is meaningfully sooner than the active one's.

def recov.dom source · line 54 · raw

@+h:Maybe<&2, Nat> -> @+ah:Maybe<&2, Nat> -> @+thr:Nat -> Bool

Dominance over the active account.

def recov.self source · line 64 · raw

@+h:Maybe<&2, Nat> -> @+lh:Maybe<&2, Nat> -> Bool

Headroom risen three points past the departure baseline.

def recov.ord source · line 72 · raw

@+h:Maybe<&2, Nat> -> @+ah:Maybe<&2, Nat> -> @+lh:Maybe<&2, Nat> -> @+lr:Maybe<&2, Nat> -> @+peer:Maybe<&2, Nat> -> @+thr:Nat -> Bool

Ordinary departure: dominance, headroom rise, or a sooner binding reset.

def recov.pick source · line 75 · raw

@+isf:Bool -> @+h:Maybe<&2, Nat> -> @+ah:Maybe<&2, Nat> -> @+lh:Maybe<&2, Nat> -> @+lr:Maybe<&2, Nat> -> @+peer:Maybe<&2, Nat> -> @+act:Maybe<&2, Nat> -> @+thr:Nat -> @+now:Nat -> Bool

def recov.snap source · line 82 · raw

@+sn:0x0717344745a30ebad1f19045228e8f18/policy/types.Snap -> @+f:Nat -> @+current:Nat -> @+us:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage> -> @+ah:Maybe<&2, Nat> -> @+thr:Nat -> @+now:Nat -> @+ms:List<&2, String> -> Bool

def recovered source · line 91 · raw

@+st:0x0717344745a30ebad1f19045228e8f18/policy/types.State -> @+current:Nat -> @+us:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage> -> @+ah:Maybe<&2, Nat> -> @+thr:Nat -> @+now:Nat -> @+ms:List<&2, String> -> Bool

Is the account the engine left a better proposition than when it left it? No record of the departure means release.

def nr.release source · line 101 · raw

@+hb:Maybe<&2, Nat> -> @+ah:Maybe<&2, Nat> -> @+thr:Nat -> Bool

The bar lifts when the account we left beats us outright.

def nr.rel source · line 110 · raw

@+rel:Bool -> @+f:Nat -> Maybe<&2, Nat>

def nr.rec source · line 117 · raw

@+rec:Bool -> @+f:Nat -> @+hb:Maybe<&2, Nat> -> @+ah:Maybe<&2, Nat> -> @+thr:Nat -> Maybe<&2, Nat>

def landed_away source · line 125 · raw

@+lt:Maybe<&2, Nat> -> @+current:Nat -> Bool

Only while the engine still stands where its switch put it.

def nr.landed source · line 132 · raw

@+away:Bool -> @+f:Nat -> @+rec:Bool -> @+hb:Maybe<&2, Nat> -> @+ah:Maybe<&2, Nat> -> @+thr:Nat -> Maybe<&2, Nat>

def nr.state source · line 139 · raw

@+st:0x0717344745a30ebad1f19045228e8f18/policy/types.State -> @+current:Nat -> @+rec:Bool -> @+us:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage> -> @+ah:Maybe<&2, Nat> -> @+thr:Nat -> @+now:Nat -> @+ms:List<&2, String> -> Maybe<&2, Nat>

def no_return source · line 150 · raw

@+t:0x0717344745a30ebad1f19045228e8f18/policy/types.Trigger -> @+st:0x0717344745a30ebad1f19045228e8f18/policy/types.State -> @+current:Nat -> @+rec:Bool -> @+us:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage> -> @+ah:Maybe<&2, Nat> -> @+thr:Nat -> @+now:Nat -> @+ms:List<&2, String> -> Maybe<&2, Nat>

The account this engine most recently left, while it is still barred. Proactive and consume-first triggers only: at-limit and failover escape.