~/bend-docscommunity

Bucket.bend checks

raw source on the hub · import hhefesto-bucket@1.0.0.0/Bucket.bend as Bucket

1 import
import Base

Types

type bk.Rule source · line 20 · raw

Data

a rule: size tries at once, one more each period ms

type bk.Rules source · line 24 · raw

Data

a visitor's rule and the one for all visitors together

type bk.B source · line 28 · raw

Data

a bucket: what it held (ms of refill) when it was last set, and when (ms)

type bk.KB source · line 32 · raw

Data

a key's bucket

type bk.Bs source · line 36 · raw

Data

the shared bucket, and the keys'

type bk.Verdict source · line 39 · raw

Data

type bk.R source · line 43 · raw

Data

Definitions

def bk.cap source · line 46 · raw

@r:bk.Rule -> Nat

def bk.period source · line 51 · raw

@r:bk.Rule -> Nat

def bk.level source · line 57 · raw

@r:bk.Rule -> @+now:Nat -> @b:bk.B -> Nat

A bucket's tries at now (in ms of refill)

def bk.find.at source · line 62 · raw

@hit:Bool -> @+b:bk.B -> @more:(@_:Unit -> Maybe<&2, bk.B>) -> Maybe<&2, bk.B>

def bk.find source · line 70 · raw

@es:List<&2, bk.KB> -> @+k:String -> Maybe<&2, bk.B>

a key's bucket, if it has one

def bk.mine source · line 78 · raw

@r:bk.Rule -> @+now:Nat -> @m:Maybe<&2, bk.B> -> Nat

a key's tries at now: its bucket's level, or a full one's

def bk.keep source · line 85 · raw

@full:Bool -> @e:bk.KB -> @rest:List<&2, bk.KB> -> List<&2, bk.KB>

def bk.unfilled source · line 94 · raw

@+r:bk.Rule -> @+now:Nat -> @es:List<&2, bk.KB> -> List<&2, bk.KB>

the keys whose buckets have not filled up again (a full one is what a new key gets: forgotten)

def bk.need source · line 101 · raw

@r:bk.Rule -> @+l:Nat -> Nat

def bk.ok source · line 106 · raw

@rs:bk.Rules -> @+now:Nat -> @+k:String -> @bs:bk.Bs -> Bool

whether a try by k at now is let through: its bucket and the shared one each hold a try

def bk.drop source · line 111 · raw

@es:List<&2, bk.KB> -> @+k:String -> List<&2, bk.KB>

def bk.taken source · line 118 · raw

@+rs:bk.Rules -> @+now:Nat -> @+k:String -> @bs:bk.Bs -> bk.Bs

def bk.wait source · line 124 · raw

@+rs:bk.Rules -> @+now:Nat -> @+k:String -> @bs:bk.Bs -> Nat

def bk.admit.at source · line 129 · raw

@ok:Bool -> @+rs:bk.Rules -> @+now:Nat -> @+k:String -> @+bs:bk.Bs -> bk.R

def bk.admit source · line 138 · raw

@+rs:bk.Rules -> @+now:Nat -> @+k:String -> @+bs:bk.Bs -> bk.R

A try by k at now: let through (the buckets after it), or how long to wait (the buckets as they were)

def bk.full source · line 142 · raw

@rs:bk.Rules -> @+now:Nat -> bk.Bs

every bucket full, at now

def bk.bs.of source · line 147 · raw

@r:bk.R -> bk.Bs

def bk.v.of source · line 152 · raw

@r:bk.R -> bk.Verdict

def bk.all.of source · line 157 · raw

@bs:bk.Bs -> bk.B

def bk.each.of source · line 162 · raw

@bs:bk.Bs -> List<&2, bk.KB>

def bk.count.at source · line 167 · raw

@r:bk.R -> @+n:Nat -> @more:(@_:Nat -> @_:bk.Bs -> Nat) -> Nat

def bk.count source · line 175 · raw

@+rs:bk.Rules -> @ks:List<&2, String> -> @+t:Nat -> @+n:Nat -> @bs:bk.Bs -> Nat

Tries one after another, all at time t: how many were let through

def bk.rules source · line 184 · raw

bk.Rules

Limit.hs's rules: 5 tries at once per visitor, then one each 12 s; 20 at once for all together, then one each 3 s

def bk.rules.instant source · line 190 · raw

bk.Rules

the same sizes, a try a millisecond: what one instant sees of them (at one instant nothing refills, so the period plays no part; the kernel that rechecks proofs counts in unary, and 60000 is a long count)