Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file pbrt_services.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111(** Runtime for Protobuf services. *)(** Whether there's a single value or a stream of them *)moduleValue_mode=structtypeunarytypestreamend(** Service stubs, client side *)moduleClient=structtype_mode=|Unary:Value_mode.unarymode|Stream:Value_mode.streammodetype('req,'req_mode,'res,'res_mode)rpc={service_name:string;package:stringlist;(** Package for the service *)rpc_name:string;req_mode:'req_modemode;res_mode:'res_modemode;encode_json_req:'req->Yojson.Basic.t;encode_pb_req:'req->Pbrt.Encoder.t->unit;decode_json_res:Yojson.Basic.t->'res;decode_pb_res:Pbrt.Decoder.t->'res;}(** A RPC description. You need a transport library
that knows where to send the bytes to actually use it. *)letmk_rpc:?package:stringlist->service_name:string->rpc_name:string->req_mode:'req_modemode->res_mode:'res_modemode->encode_json_req:('req->Yojson.Basic.t)->encode_pb_req:('req->Pbrt.Encoder.t->unit)->decode_json_res:(Yojson.Basic.t->'res)->decode_pb_res:(Pbrt.Decoder.t->'res)->unit->('req,'req_mode,'res,'res_mode)rpc=fun?(package=[])~service_name~rpc_name~req_mode~res_mode~encode_json_req~encode_pb_req~decode_json_res~decode_pb_res():_rpc->{service_name;package;rpc_name;req_mode;res_mode;encode_pb_req;encode_json_req;decode_pb_res;decode_json_res;}end(** Service stubs, server side *)moduleServer=structtype'mmode='mClient.mode=|Unary:Value_mode.unarymode|Stream:Value_mode.streammodetype('req,'req_mode,'res,'res_mode)rpc={name:string;req_mode:'req_modemode;res_mode:'res_modemode;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;}(** A single RPC method, alongside encoders and decoders for
input and output types. . *)(** A RPC endpoint. *)typeany_rpc=RPC:('req,'req_mode,'res,'res_mode)rpc->any_rpc[@@unboxed](** Helper to build a RPC *)letmk_rpc:name:string->req_mode:'req_modemode->res_mode:'res_modemode->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=fun~name~req_mode~res_mode~encode_json_res~encode_pb_res~decode_json_req~decode_pb_req()->{name;req_mode;res_mode;decode_pb_req;decode_json_req;encode_pb_res;encode_json_res;}type'ht={service_name:string;(** Name of the service *)package:stringlist;(** The package this belongs in (e.g. "bigco.auth.secretpasswordstash"),
split along "." *)handlers:'hlist;(** 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]. *)end