def server_stream

bendonnect-rpc@0.1.0.0 · src/transport/rpc.bend:140

import bendonnect-rpc@0.1.0.0/src/transport/rpc.bend as Rpc
import Base
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
import bendonnect-rpc@0.1.0.0/src/error.bend as E
import bendonnect-rpc@0.1.0.0/src/protocol.bend as P
import bendonnect-rpc@0.1.0.0/src/transport/server.bend as Srv

140# Serves a server-streaming method: impl gets the request and an Out to Rpc.send on, and returns
141# the final Out with Done (stream ends cleanly) or Fail (error in the EndStream message).
142def server_stream(~Req: Data, ~dec: @+codec: P.Codec -> Bytes.Bytes -> Result<&1, &1, E.Error, Req>, ~impl: Ctx -> Req -> Out -> IO(Out & Result<&1, &1, E.Error, Unit>), call: Srv.Call) -> IO(Srv.Reply):
143  Srv.Call{procedure, kind, +codec, headers, timeout_ms, messages} = call
144  match codec:
145    case P.Custom{name}:
146      reply_io(no_custom(name))
147    case P.Json{}:
148      ss.one(~Req, ~dec, ~impl, procedure, P.Json{}, headers, messages)
149    case P.Proto{}:
150      ss.one(~Req, ~dec, ~impl, procedure, P.Proto{}, headers, messages)

Uses (14)

Used by (0)

No other definition uses this definition.