daemon/walk.bend relies on unsafe/foreign
raw source on the hub · import cswap-bend-cli@0.1.0.0/daemon/walk.bend as Walk
13 imports
import Base import ../json.bend as Json import ../act.bend as Act import ../clock.bend as Clock import ../store/base.bend as SBase import ./events.bend as Ev import ./cadence.bend as Cad import ./dec.bend as Dc import ./apply.bend as Ap import ./tick.bend as Tk import ./gather.bend as G import ./freshen.bend as Fr import ./quarantine.bend as Q
Types
type Trail source · line 23 · raw
Data
Trail@skip:List<&2, String> -> @events:List<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> @transient:Bool -> @first:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out> -> @sys:String -> Trail
type Move source · line 27 · raw
Data
What one attempt came to: finished, or retry with this trail.
MDone@out:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> Move
MRetry@trail:Trail -> Move
type W source · line 32 · raw
Data
Fixed inputs of the walk.
W@env:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Env -> @t0:U32 -> @ts:String -> @m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Snap> -> W
type Verdict source · line 36 · raw
Data
What freshening a candidate came to.
VOkVerdict
VDeadVerdict
VConflictVerdict
VSkipVerdict
VSysVerdict
VTransVerdict
Definitions
def ActM source · line 44 · raw
@-A:Type -> Type
def ActM.pure source · line 47 · raw
@-A:Type -> @x:A -> 0x0717344745a30ebad1f19045228e8f18/act.of(A)
def ActM.bind source · line 50 · raw
@-A:Type -> @-B:Type -> @m:0x0717344745a30ebad1f19045228e8f18/act.of(A) -> @f:(@_:A -> 0x0717344745a30ebad1f19045228e8f18/act.of(B)) -> 0x0717344745a30ebad1f19045228e8f18/act.of(B)
def no_trail source · line 53 · raw
Trail
def trail_skip source · line 56 · raw
@t:Trail -> List<&2, String>
def trail_transient source · line 61 · raw
@t:Trail -> Bool
def lead_of source · line 67 · raw
@t:Trail -> @+o:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> 0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out
The first decision's Out (its poll events), else the one at hand.
def with_events source · line 74 · raw
@+o:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> @+extra:List<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> 0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out
def trail_events source · line 79 · raw
@t:Trail -> List<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json>
def with_info source · line 84 · raw
@+o:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> @i:0x0717344745a30ebad1f19045228e8f18/daemon/cadence.Info -> 0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out
def merged source · line 90 · raw
@+o:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> @res:0x0717344745a30ebad1f19045228e8f18/daemon/dec.TickRes -> 0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out
The poll events first, then what acting on the decision produced.
def applied source · line 95 · raw
@+o:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> @c:0x0717344745a30ebad1f19045228e8f18/daemon/dec.Ctx -> @d:0x0717344745a30ebad1f19045228e8f18/daemon/dec.Dec -> 0x0717344745a30ebad1f19045228e8f18/act.of(0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out)
def info_of source · line 100 · raw
@o:0x0717344745a30ebad1f19045228e8f18/daemon/cadence.Outcome -> @+np:Maybe<&2, U32> -> 0x0717344745a30ebad1f19045228e8f18/daemon/cadence.Info
def msg2 source · line 103 · raw
@+a:Bool -> @+b:Bool -> @+c:Bool -> String
def sys_message source · line 114 · raw
@+s:String -> String
def failed_with source · line 117 · raw
@+o:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> @+ts:String -> @+msg:String -> 0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out
def gave_up3 source · line 120 · raw
@+nothing_systemic:Bool -> @+transient:Bool -> @+sy:String -> @+o:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> @+ts:String -> 0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out
def trail_sys source · line 129 · raw
@+t:Trail -> String
def gave_up source · line 136 · raw
@+t:Trail -> @+o:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> @+ts:String -> 0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out
Every candidate failed to freshen: a systemic refusal, or the network, is an error; otherwise there was simply nothing viable.
def extend source · line 139 · raw
@+t:Trail -> @+slot:String -> @+more:List<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> @+transient:Bool -> @+o:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> Trail
def worse2 source · line 142 · raw
@+take_new:Bool -> @+old:String -> @+new:String -> String
def worse source · line 151 · raw
@+old:String -> @+new:String -> String
The most actionable systemic cause wins (a lower rank), so one needing a human never hides behind one that clears itself.
def extend_sys source · line 154 · raw
@+t:Trail -> @+slot:String -> @+status:String -> @+o:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> Trail
def w_env source · line 159 · raw
@w:W -> 0x0717344745a30ebad1f19045228e8f18/daemon/tick.Env
def w_t0 source · line 164 · raw
@w:W -> U32
def w_ts source · line 169 · raw
@w:W -> String
def w_m source · line 174 · raw
@w:W -> Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Snap>
def done_with source · line 179 · raw
@w:W -> @+tr:Trail -> @+o:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> @c:0x0717344745a30ebad1f19045228e8f18/daemon/dec.Ctx -> @d:0x0717344745a30ebad1f19045228e8f18/daemon/dec.Dec -> 0x0717344745a30ebad1f19045228e8f18/act.of(Move)
def quarantined source · line 184 · raw
@+w:W -> @tr:Trail -> @+o:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> @+slot:String -> @+email:String -> @+reason:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(Move)
def verdict2 source · line 189 · raw
@+is_sys:Bool -> @+st:String -> Verdict
def verdict1 source · line 196 · raw
@+ok:Bool -> @+dead:Bool -> @+conflict:Bool -> @+skip:Bool -> @+st:String -> Verdict
def verdict source · line 209 · raw
@+st:String -> Verdict
def route source · line 212 · raw
@+v:Verdict -> @+st:String -> @w:W -> @tr:Trail -> @+o:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> @c:0x0717344745a30ebad1f19045228e8f18/daemon/dec.Ctx -> @d:0x0717344745a30ebad1f19045228e8f18/daemon/dec.Dec -> @+slot:String -> @+email:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(Move)
def try_target source · line 227 · raw
@+w:W -> @tr:Trail -> @+o:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> @c:0x0717344745a30ebad1f19045228e8f18/daemon/dec.Ctx -> @d:0x0717344745a30ebad1f19045228e8f18/daemon/dec.Dec -> @+slot:String -> @+email:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(Move)
def on_go source · line 232 · raw
@+w:W -> @+tr:Trail -> @+o:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> @+c:0x0717344745a30ebad1f19045228e8f18/daemon/dec.Ctx -> @+d:0x0717344745a30ebad1f19045228e8f18/daemon/dec.Dec -> @+slot:String -> @+email:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(Move)
def on_other source · line 235 · raw
@+w:W -> @+tr:Trail -> @+o:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> @c:0x0717344745a30ebad1f19045228e8f18/daemon/dec.Ctx -> @d:0x0717344745a30ebad1f19045228e8f18/daemon/dec.Dec -> 0x0717344745a30ebad1f19045228e8f18/act.of(Move)
def on_act source · line 238 · raw
@w:W -> @tr:Trail -> @+o:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out -> @c:0x0717344745a30ebad1f19045228e8f18/daemon/dec.Ctx -> @d:0x0717344745a30ebad1f19045228e8f18/daemon/dec.Dec -> 0x0717344745a30ebad1f19045228e8f18/act.of(Move)
def next source · line 245 · raw
@w:W -> @tr:Trail -> @+nx:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Next -> 0x0717344745a30ebad1f19045228e8f18/act.of(Move)
def attempt source · line 253 · raw
@+w:W -> @+tr:Trail -> 0x0717344745a30ebad1f19045228e8f18/act.of(Move)
Decide again (without the slots already ruled out) and act.
def retry source · line 256 · raw
@w:W -> @mv:Move -> 0x0717344745a30ebad1f19045228e8f18/act.of(Move)
def settle source · line 263 · raw
@+w:W -> @mv:Move -> 0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out
def again source · line 270 · raw
@w:W -> @a:0x0717344745a30ebad1f19045228e8f18/act.of(Move) -> 0x0717344745a30ebad1f19045228e8f18/act.of(Move)
def again4 source · line 273 · raw
@+w:W -> @a:0x0717344745a30ebad1f19045228e8f18/act.of(Move) -> 0x0717344745a30ebad1f19045228e8f18/act.of(Move)
def walk source · line 276 · raw
@+w:W -> 0x0717344745a30ebad1f19045228e8f18/act.of(0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out)
def run source · line 282 · raw
@+env:0x0717344745a30ebad1f19045228e8f18/daemon/tick.Env -> @+t0:U32 -> @+ts:String -> @+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Snap> -> 0x0717344745a30ebad1f19045228e8f18/act.of(0x0717344745a30ebad1f19045228e8f18/daemon/tick.Out)
Up to 16 candidates are tried per tick (autoswitch.py walks the whole ranking; Bend has no mutual recursion for an unbounded loop here). A longer ranking is finished on the next tick: the ones found dead are quarantined by then.