Runner.claim: def of bend-kit-runner@0.13.0.1 Import: import bend-kit-runner@0.13.0.1/runner.bend as Runner Lines 1274-1283 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=1274&end_line=1283 import Base import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes import bend-kit-retry@0.3.0.0/retry.bend as Retry # Starts an attempt for each due ticket while the pool has a free unit; each attempt sends its outcome on the inbox. # fuel bounds the tickets taken, and the fuel left comes back. def claim(~A: Data, ~penc: A -> Bytes.Bytes, ~target: A -> String, ~work: A -> IO(Retry.Outcome), fuel: Nat, +now: Nat, r: Runner) -> IO(Claimed(A)): match fuel: case 0n: IO.pure(Claimed(A), (r, 0n, Done{Unit{}})) case 1n+n: Runner{j, +s, p, c, ib, fs} = r +m = n claim.pick(~A, ~penc, ~target, ~work, m, now, pick(~A, p, s, now), j, s, c, ib, fs, (r2 => claim(~A, ~penc, ~target, ~work, m, now, r2))) Uses (13): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.pure https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Unit https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=Bytes https://jend.leeeet.dev/definition.txt?path=bend-kit-retry@0.3.0.0/retry.bend&name=Outcome https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=Claimed https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=Runner https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=claim.pick https://jend.leeeet.dev/definition.txt?path=bend-kit-runner@0.13.0.1/runner.bend&name=pick