Exec.Exec.head: def of bend-kube-runtime@0.2.0.0 Import: import bend-kube-runtime@0.2.0.0/src/exec.bend as Exec Lines 136-157 of bend-kube-runtime@0.2.0.0/src/exec.bend: https://jend.leeeet.dev/read.txt?path=bend-kube-runtime@0.2.0.0/src/exec.bend&start_line=136&end_line=157 import Base import bend-kube-runtime@0.2.0.0/src/net.bend as N import bend-kube-runtime@0.2.0.0/src/client.bend as Cl # Reads until the head is whole. def Exec.head(fuel: Nat, ev: HEv, +sc: Scan, +ms: U32) -> IO(Socket & Result<&2, &2, Cl.KErr, Scan>): match fuel ev: case 0n HGot{s, r}: IO.pure(Socket & Result<&2, &2, Cl.KErr, Scan>, (s, Fail{Cl.KNet{0, "exec: head too long"}})) case 0n HChk{s, f, e}: IO.pure(Socket & Result<&2, &2, Cl.KErr, Scan>, (s, Fail{Cl.KNet{0, "exec: head too long"}})) case 1n+f HGot{s, Done{+bs}}: +next = Scan.feed(sc, bs) Exec.head(f, HChk{s, Scan.found(next), List.is_empty(&2, U32, bs)}, next, ms) case 1n+f HGot{s, Fail{(c, m)}}: IO.pure(Socket & Result<&2, &2, Cl.KErr, Scan>, (s, Fail{Cl.KNet{c, "exec: recv: " ++ m}})) case 1n+f HChk{s, True{}, e}: IO.pure(Socket & Result<&2, &2, Cl.KErr, Scan>, (s, Done{sc})) case 1n+f HChk{s, False{}, True{}}: IO.pure(Socket & Result<&2, &2, Cl.KErr, Scan>, (s, Fail{Cl.KNet{0, "exec: connection closed before the upgrade"}})) case 1n+f HChk{s, False{}, False{}}: IO.bind(Socket & Result<&1, &1, U32 & String, List<&2, U32>>, Socket & Result<&2, &2, Cl.KErr, Scan>, N.Tls.recv(s, 65536, ms), p => Exec.head(f, HEv.got(p), sc, ms)) Uses (21): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.pure https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.is_empty https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair 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=Socket https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.append https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/client.bend&name=KErr https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/exec.bend&name=HEv https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/exec.bend&name=HEv.got https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/exec.bend&name=Scan https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/exec.bend&name=Scan.feed https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/exec.bend&name=Scan.found https://jend.leeeet.dev/definition.txt?path=bend-kube-runtime@0.2.0.0/src/net.bend&name=Tls.recv