def open.got
bend-kit-runner@0.13.0.1 · runner.bend:1780
import bend-kit-runner@0.13.0.1/runner.bend as Runner
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
import bend-kit-journal@0.3.0.1/journal.bend as J
import bend-kit-scheduler@0.4.1.0/queue.bend as Q
import bend-kit-resources@0.1.0.0/resources.bend as Res
1780def open.got(~A: Data, ~penc: A -> Bytes.Bytes, x: Out(J.Journal & Maybe<&2, State<A>>), +max: U32, path: String, +limit: U32, c: Config, +capacity: Nat) ->
1781 IO(Out(Runner<A>)):
1782 match x:
1783 case Fail{e}:
1784 IO.pure(Out(Runner<A>), Fail{e})
1785 case Done{(j, None{})}:
1786 do IO<Out(Runner<A>)>:
1787 J.close(j)
1788 return Fail{(22, "runner: a journal record is not a runner record")}
1789 case Done{(j, Some{+s})}:
1790 do IO<Out(Runner<A>)>:
1791 now : Nat <- clock()
1792 ib : Chan(Msg<A>) <- Chan.new(Msg<A>, (U32.from_nat(capacity) + 1 : U32))
1793 y : Ran(A) <- orphans(~A, ~penc, Q.running(A, queue(A, s)), now, Runner{log.of(j, max, path, limit), calm(A, s), Res.new(0n, capacity), c, ib, Nil{}}, Done{Unit{}})
1794 open.done(A, y)