def server.work

bend-kit-camber@0.15.0.1 · camber.bend:1020

import bend-kit-camber@0.15.0.1/camber.bend as Camber
import Base
import bend-kit-http@0.38.1.1/http.bend as Http

1020def server.work(~A: Data, ~S: Type, ~K: Data, ~E: Data, ~H: Data,
1021  ~before_hook: H -> S -> K -> Metadata -> IO(Step<S, E>),
1022  ~after_hook: H -> S -> K -> Http.Res -> IO(S & Result<&2, &1, Error<E>, Http.Res>),
1023  ~run: A -> S -> K -> Match<Policy<H>> -> Http.Req -> IO(S & Result<&2, &1, Error<E>, Http.Res>),
1024  ~mapper: S -> K -> Error<E> -> IO(S & Result<&2, &1, Error<E>, Http.Res>),
1025  state: S, app: Application<A, K, Policy<H>>, input: BufferedRequest
1026) -> IO(S & Result<&2, &2, Unit, ApplicationReport<H>>):
1027  BufferedRequest{Metadata{method, target, headers}, body_channel, response_channel} = input
1028  do IO<S & Result<&2, &2, Unit, ApplicationReport<H>>>:
1029    body : Http.Body <- receive(Http.Body, body_channel)
1030    completion : Completion<S, H> <- dispatch.application(~A, ~S, ~K, ~E, ~H, ~before_hook, ~after_hook, ~run, ~mapper,
1031      app, state, Http.Req{method, target, headers, body})
1032    server.work.completed(~S, ~H, response_channel, completion)

Uses (20)

Used by (1)