Runner.step: def of bend-kit-runner@0.13.0.1
Import: import bend-kit-runner@0.13.0.1/runner.bend as Runner
Lines 270-294 of bend-kit-runner@0.13.0.1/runner.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-runner@0.13.0.1/runner.bend&start_line=270&end_line=294
import Base
import bend-kit-scheduler@0.4.1.0/queue.bend as Q
import bend-kit-collections@0.1.4.1/hmap.bend as M
# The state after op. Live and replay both run it, so they agree.
def step(~A: Data, s: State, op: Op) -> State:
match s op:
case State{q, ts, ds, bs} Enqueue{+d, x}:
step.enqueued(A, Q.enqueue(~A, d, x, q), ts, ds, bs, d)
case State{q, ts, ds, bs} Select{now}:
step.selected(A, Q.select(~A, now, q), ts, ds, bs)
case State{q, ts, ds, bs} Complete{+i}:
step.completed(A, Q.complete(A, i, q), tries.drop(ts, i), ds, bs)
case State{q, ts, ds, bs} Cancel{+i}:
State{Q.cancel(~A, i, q), tries.drop(ts, i), dead.drop(~A, ds, i), bs}
case State{q, ts, ds, bs} Requeue{+i, d}:
step.requeued(A, Q.requeue(~A, i, d, q), tries.bump(ts, i), ds, bs)
case State{q, ts, ds, bs} Defer{i, d}:
step.requeued(A, Q.requeue(~A, i, d, q), ts, ds, bs)
case State{q, ts, ds, bs} Abandon{+i, w, at}:
step.abandoned(~A, Q.complete(A, i, q), tries.drop(ts, i), ds, bs, w, at)
case State{Q.State{n, h, r}, ts, +ds, bs} Revive{+i, d}:
step.revived(~A, dead.get(~A, ds, i), i, n, h, r, ts, dead.drop(~A, ds, i), bs, d)
case State{q, ts, ds, bs} Purge{t}:
State{q, ts, dead.purge(~A, ds, t), bs}
case State{q, ts, ds, bs} PurgeAll{}:
State{q, ts, M.HMap.new(Nat, Dead), bs}
case State{q, ts, ds, bs} Break{k, b}:
State{q, ts, ds, step.broke(bs, k, b)}
Uses (23):
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat
https://jend.leeeet.dev/definition.txt?path=bend-kit-collections@0.1.4.1/hmap.bend&name=HMap.new
https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=Dead
https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=Op
https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=State
https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=dead.drop
https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=dead.get
https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=dead.purge
https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=step.abandoned
https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=step.broke
https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=step.completed
https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=step.enqueued
https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=step.requeued
https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=step.revived
https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=step.selected
https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=tries.bump
https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=tries.drop
https://jend.leeeet.dev/definition.txt?path=bend-kit-scheduler@0.4.1.0/queue.bend&name=State
https://jend.leeeet.dev/definition.txt?path=bend-kit-scheduler@0.4.1.0/queue.bend&name=cancel
https://jend.leeeet.dev/definition.txt?path=bend-kit-scheduler@0.4.1.0/queue.bend&name=complete
https://jend.leeeet.dev/definition.txt?path=bend-kit-scheduler@0.4.1.0/queue.bend&name=enqueue
https://jend.leeeet.dev/definition.txt?path=bend-kit-scheduler@0.4.1.0/queue.bend&name=requeue
https://jend.leeeet.dev/definition.txt?path=bend-kit-scheduler@0.4.1.0/queue.bend&name=select