~/bend-docscommunity

collectrun.bend relies on unsafe/foreign

raw source on the hub · import cswap-bend-cli@0.1.0.0/collectrun.bend as Collectrun

13 imports
import Base
import ./store/base.bend as SBase
import ./urec.bend as Urec
import ./pollrow.bend as Pollrow
import ./usage/cred.bend as UCred
import ./json.bend as Json
import ./clock.bend as Clock
import ./act.bend as Act
import ./poll.bend as Poll
import ./ustore.bend as Ustore
import ./usage.bend as Usage
import ./view.bend as View
import ./collect.bend as Collect

Types

type Job source · line 85 · raw

Data

A state with the lease it won, if any.

Definitions

def claim.pick source · line 15 · raw

@hit:Bool -> @id:String -> @rest:Maybe<&2, String> -> Maybe<&2, String>

def claim_of source · line 22 · raw

@cs:List<&2, 0x0717344745a30ebad1f19045228e8f18/ustore.Claim> -> @+slot:String -> Maybe<&2, String>

def struck_json source · line 29 · raw

@m:Maybe<&2, String> -> IO(0x0717344745a30ebad1f19045228e8f18/json.Json)

def run_fetch source · line 36 · raw

@active:Bool -> @+creds:String -> @+slot:String -> @+email:String -> @+root:String -> IO(0x0717344745a30ebad1f19045228e8f18/usage.Fetched)

def rec.ok2 source · line 43 · raw

@+id:0x0717344745a30ebad1f19045228e8f18/ustore.Id -> @+claim:String -> @+usage:0x0717344745a30ebad1f19045228e8f18/json.Json -> @active:Bool -> @+plan:0x0717344745a30ebad1f19045228e8f18/poll.Sched -> 0x0717344745a30ebad1f19045228e8f18/urec.Rec

def rec.ok source · line 46 · raw

@+r:0x0717344745a30ebad1f19045228e8f18/pollrow.Row -> @+id:0x0717344745a30ebad1f19045228e8f18/ustore.Id -> @+claim:String -> @+usage:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+active:Bool -> @+models:List<&2, String> -> @+threshold:U32 -> @+now:U32 -> 0x0717344745a30ebad1f19045228e8f18/urec.Rec

def rec.err source · line 51 · raw

@error:Maybe<&2, String> -> @retry:Maybe<&2, U32> -> @struck:0x0717344745a30ebad1f19045228e8f18/json.Json -> @ok:0x0717344745a30ebad1f19045228e8f18/urec.Rec -> @+id:0x0717344745a30ebad1f19045228e8f18/ustore.Id -> @+claim:String -> 0x0717344745a30ebad1f19045228e8f18/urec.Rec

def rec.of source · line 58 · raw

@o:0x0717344745a30ebad1f19045228e8f18/usage.Outcome -> @+id:0x0717344745a30ebad1f19045228e8f18/ustore.Id -> @+claim:String -> @+row:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+active:Bool -> @+models:List<&2, String> -> @+threshold:U32 -> @+now:U32 -> @struck:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/urec.Rec

def outcome_struck source · line 63 · raw

@o:0x0717344745a30ebad1f19045228e8f18/usage.Outcome -> Maybe<&2, String>

def rec.fetched source · line 68 · raw

@f:0x0717344745a30ebad1f19045228e8f18/usage.Fetched -> @+id:0x0717344745a30ebad1f19045228e8f18/ustore.Id -> @+claim:String -> @+row:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+active:Bool -> @+models:List<&2, String> -> @+threshold:U32 -> @+now:U32 -> IO(0x0717344745a30ebad1f19045228e8f18/urec.Rec)

def fetch_info source · line 73 · raw

@+info:0x0717344745a30ebad1f19045228e8f18/collect.Info -> @+row:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+claim:String -> @+root:String -> @+models:List<&2, String> -> @+threshold:U32 -> @+now:U32 -> IO(0x0717344745a30ebad1f19045228e8f18/urec.Rec)

def fetch_st source · line 79 · raw

@+st:0x0717344745a30ebad1f19045228e8f18/collect.St -> @+claim:String -> @+root:String -> @+models:List<&2, String> -> @+threshold:U32 -> @+now:U32 -> IO(0x0717344745a30ebad1f19045228e8f18/urec.Rec)

def jobs source · line 88 · raw

@ss:List<&2, 0x0717344745a30ebad1f19045228e8f18/collect.St> -> @+cs:List<&2, 0x0717344745a30ebad1f19045228e8f18/ustore.Claim> -> List<&2, Job>

def fetch_all source · line 95 · raw

@js:List<&2, Job> -> @+root:String -> @+models:List<&2, String> -> @+threshold:U32 -> @+now:U32 -> IO(List<&2, 0x0717344745a30ebad1f19045228e8f18/urec.Rec>)

def healed.cons source · line 105 · raw

@h:Bool -> @+id:0x0717344745a30ebad1f19045228e8f18/ustore.Id -> @rest:List<&2, 0x0717344745a30ebad1f19045228e8f18/ustore.Id> -> List<&2, 0x0717344745a30ebad1f19045228e8f18/ustore.Id>

def fetchable.cons source · line 112 · raw

@ok:Bool -> @+id:0x0717344745a30ebad1f19045228e8f18/ustore.Id -> @rest:List<&2, 0x0717344745a30ebad1f19045228e8f18/ustore.Id> -> List<&2, 0x0717344745a30ebad1f19045228e8f18/ustore.Id>

def fetchable source · line 120 · raw

@ss:List<&2, 0x0717344745a30ebad1f19045228e8f18/collect.St> -> List<&2, 0x0717344745a30ebad1f19045228e8f18/ustore.Id>

Slots with nothing that rules out a fetch.

def clear_if source · line 127 · raw

@+root:String -> @ids:List<&2, 0x0717344745a30ebad1f19045228e8f18/ustore.Id> -> 0x0717344745a30ebad1f19045228e8f18/act.of(Unit)

def login_secs source · line 134 · raw

@+d:String -> Maybe<&2, String>

def login.pick source · line 137 · raw

@ok:Bool -> @+i:String -> Maybe<&2, String>

def login.int source · line 144 · raw

@ps:List<&2, String> -> Maybe<&2, String>

def login.num source · line 151 · raw

@j:0x0717344745a30ebad1f19045228e8f18/json.Json -> Maybe<&2, String>

def login_expires source · line 160 · raw

@+creds:String -> Maybe<&2, String>

oauth.login_expires_at_iso: refreshTokenExpiresAt (epoch ms) as ISO, when the stored login records one.

def acct.info source · line 163 · raw

@+info:0x0717344745a30ebad1f19045228e8f18/collect.Info -> @+row:0x0717344745a30ebad1f19045228e8f18/json.Json -> @sentinel:Maybe<&2, String> -> 0x0717344745a30ebad1f19045228e8f18/view.Acct

def acct.of source · line 168 · raw

@+s:0x0717344745a30ebad1f19045228e8f18/collect.St -> 0x0717344745a30ebad1f19045228e8f18/view.Acct

def accts source · line 173 · raw

@ss:List<&2, 0x0717344745a30ebad1f19045228e8f18/collect.St> -> List<&2, 0x0717344745a30ebad1f19045228e8f18/view.Acct>

def pass.final source · line 180 · raw

@+root:String -> @xs:List<&2, 0x0717344745a30ebad1f19045228e8f18/collect.Info> -> @+now:U32 -> 0x0717344745a30ebad1f19045228e8f18/act.of(List<&2, 0x0717344745a30ebad1f19045228e8f18/view.Acct>)

def pass.fetch source · line 184 · raw

@+root:String -> @+ss:List<&2, 0x0717344745a30ebad1f19045228e8f18/collect.St> -> @+models:List<&2, String> -> @+threshold:U32 -> @+now:U32 -> @+tick:Nat -> @xs:List<&2, 0x0717344745a30ebad1f19045228e8f18/collect.Info> -> 0x0717344745a30ebad1f19045228e8f18/act.of(List<&2, 0x0717344745a30ebad1f19045228e8f18/view.Acct>)

def healed_ids source · line 190 · raw

@ss:List<&2, 0x0717344745a30ebad1f19045228e8f18/collect.St> -> List<&2, 0x0717344745a30ebad1f19045228e8f18/ustore.Id>

def pass.heal source · line 197 · raw

@+root:String -> @ss:List<&2, 0x0717344745a30ebad1f19045228e8f18/collect.St> -> @+models:List<&2, String> -> @+threshold:U32 -> @+now:U32 -> @+tick:Nat -> @+xs:List<&2, 0x0717344745a30ebad1f19045228e8f18/collect.Info> -> 0x0717344745a30ebad1f19045228e8f18/act.of(List<&2, 0x0717344745a30ebad1f19045228e8f18/view.Acct>)

def collect source · line 205 · raw

@+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+xs:List<&2, 0x0717344745a30ebad1f19045228e8f18/collect.Info> -> @+now:U32 -> @+models:List<&2, String> -> @+threshold:U32 -> @+tick:Nat -> 0x0717344745a30ebad1f19045228e8f18/act.of(List<&2, 0x0717344745a30ebad1f19045228e8f18/view.Acct>)

One usage pass over xs: lease what is eligible, fetch it, merge the outcomes, and answer an Acct per account with the state read after the merge.