def Context.continue_or_start_with

bend-trace-context@0.2.0.0 · trace_context.bend:3620

import bend-trace-context@0.2.0.0/trace_context.bend as TraceContext
import Base

3620# Give a service its own operation for a received message, from a caller's
3621# source (see the section's introduction). Laws: continue_usable,
3622# restart_usable, start_unusable and restart_keeps_nothing.
3623def Context.continue_or_start_with(~S: Type, ~read: S -> IO(S & Result<&1, &1, U32 & String, U32>), source: S,
3624  +extraction: Extraction, reception: Reception, sampling: Sampling, +policy: FailurePolicy) ->
3625  IO(S & FailurePolicy.result(policy, Service)):
3626  IO.bind(S & Service, S & FailurePolicy.result(policy, Service),
3627    Serve.operation(~S, ~read, source, extraction, reception, sampling),
3628    done => IO.pure(S & FailurePolicy.result(policy, Service), Policy.apply.done(S, policy, Service, Serve.strict,
3629      done)))

Uses (16)

Used by (2)