Module Pbrt_services.Server

Service stubs, server side

type 'm mode = 'm Client.mode =
  1. | Unary : Value_mode.unary mode
  2. | Stream : Value_mode.stream mode
type ('req, 'req_mode, 'res, 'res_mode) rpc = {
  1. name : string;
  2. req_mode : 'req_mode mode;
  3. res_mode : 'res_mode mode;
  4. encode_json_res : 'res -> Yojson.Basic.t;
  5. encode_pb_res : 'res -> Pbrt.Encoder.t -> unit;
  6. decode_json_req : Yojson.Basic.t -> 'req;
  7. decode_pb_req : Pbrt.Decoder.t -> 'req;
}

A single RPC method, alongside encoders and decoders for input and output types. .

type any_rpc =
  1. | RPC : ('req, 'req_mode, 'res, 'res_mode) rpc -> any_rpc

A RPC endpoint.

val mk_rpc : name:string -> req_mode:'req_mode mode -> res_mode:'res_mode mode -> encode_json_res:('res -> Yojson.Basic.t) -> encode_pb_res:('res -> Pbrt.Encoder.t -> unit) -> decode_json_req:(Yojson.Basic.t -> 'req) -> decode_pb_req:(Pbrt.Decoder.t -> 'req) -> unit -> ('req, 'req_mode, 'res, 'res_mode) rpc

Helper to build a RPC

type 'h t = {
  1. service_name : string;
    (*

    Name of the service

    *)
  2. package : string list;
    (*

    The package this belongs in (e.g. "bigco.auth.secretpasswordstash"), split along "."

    *)
  3. handlers : 'h list;
    (*

    A list of handlers

    *)
}

A service with fixed set of methods, which depends on the concrete RPC implementation. Each method is a handler of some type 'h.