src/stream.bend relies on unsafe/foreign
raw source on the hub · import bend-kube-runtime@0.12.0.0/src/stream.bend as Stream
8 imports
import Base import ./json.bend as J import ./utf8.bend as U import ./http.bend as H import ./net.bend as N import ./core.bend as C import ./config.bend as K import ./client.bend as Cl
Types
type SEv source · line 25 · raw
Type
What the loop just saw: bytes (or a failure) from a recv, or the decoder after them with the body bytes it decoded, whether the server failed or the stream is over, whether the answer is 200, and whether its head came.
SGot@sock:Socket -> @resp:0x9e77ca668bf7a778a1520b32b67729c2/src/http.Resp -> @r:Result<&1, &1, Pair(U32, String), List<&2, U32>> -> SEv
SChk@sock:Socket -> @resp:0x9e77ca668bf7a778a1520b32b67729c2/src/http.Resp -> @body:List<&2, U32> -> @err:Maybe<&2, String> -> @ok:Bool -> @headed:Bool -> @empty:Bool -> @fin:Bool -> @code:U32 -> SEv
Definitions
def Res source · line 19 · raw
@-S:Type -> Type
def SEv.got source · line 30 · raw
@p:Pair(Socket, Result<&1, &1, Pair(U32, String), List<&2, U32>>) -> @resp:0x9e77ca668bf7a778a1520b32b67729c2/src/http.Resp -> SEv
def Stream.code source · line 35 · raw
@r:0x9e77ca668bf7a778a1520b32b67729c2/src/http.Resp -> U32
def Stream.check source · line 42 · raw
@s:Socket -> @+r:0x9e77ca668bf7a778a1520b32b67729c2/src/http.Resp -> @+body:List<&2, U32> -> @eof:Bool -> SEv
def Stream.taken source · line 47 · raw
@s:Socket -> @eof:Bool -> @rb:Pair(0x9e77ca668bf7a778a1520b32b67729c2/src/http.Resp, List<&2, U32>) -> SEv
def Stream.ended source · line 52 · raw
@eof:Bool -> @r:0x9e77ca668bf7a778a1520b32b67729c2/src/http.Resp -> 0x9e77ca668bf7a778a1520b32b67729c2/src/http.Resp
def Stream.fed source · line 61 · raw
@s:Socket -> @+bs:List<&2, U32> -> @r:0x9e77ca668bf7a778a1520b32b67729c2/src/http.Resp -> SEv
Feeds a cut (empty at the end of the stream) and takes the body bytes it decoded.
def Stream.message source · line 65 · raw
@+text:String -> @j:Result<&2, &2, String, 0x9e77ca668bf7a778a1520b32b67729c2/src/json.Json> -> String
def Stream.refused source · line 72 · raw
@+code:U32 -> @+bad:List<&2, U32> -> 0x9e77ca668bf7a778a1520b32b67729c2/src/client.KErr
def Stream.follow source · line 76 · raw
@on:Bool -> String
def Stream.recv source · line 83 · raw
@s:Socket -> @+ms:U32 -> IO(Pair(Socket, Result<&1, &1, Pair(U32, String), List<&2, U32>>))
def Stream.log_path source · line 149 · raw
@ns:String -> @pod:String -> @container:String -> @follow:Bool -> String
The log of a pod's container, followed while it runs (follow=true): the stream ends when the container does.
Templates
template Stream.loop source · line 89 · raw
@-S:Type -> @-on:(@_:S -> @_:List<&2, U32> -> IO(S)) -> @fuel:Nat -> @ev:SEv -> @st:S -> @+bad:List<&2, U32> -> @+ms:U32 -> IO(Pair(Socket, Res(S)))
Reads until the body ends, folding the body into st; bad holds the body of a refusal. Answers the socket and the outcome.
template Stream.close source · line 123 · raw
@-S:Type -> @p:Pair(Socket, Res(S)) -> IO(Res(S))
template Stream.opened source · line 128 · raw
@-S:Type -> @-on:(@_:S -> @_:List<&2, U32> -> IO(S)) -> @st:S -> @t:Result<&1, &1, Pair(U32, String), 0x9e77ca668bf7a778a1520b32b67729c2/src/net.Tls> -> @+ms:U32 -> IO(Res(S))
template Stream.fold source · line 142 · raw
@-S:Type -> @-on:(@_:S -> @_:List<&2, U32> -> IO(S)) -> @st:S -> @+cfg:0x9e77ca668bf7a778a1520b32b67729c2/src/config.Config -> @path:String -> @+ms:U32 -> IO(Res(S))
GETs path (with its query) and folds each cut of the body into st with on, in order, until the body ends: Done with the last state. ms bounds each wait for bytes (0: none; a followed log may stay quiet for long).