Module State_rpc.Make
Given a model of the types involved in a family of State_RPCs, this functor provides a single State_RPC versioned dispatch function dispatch_multi
in terms of that model and a mechanism for registering the individual versions that dispatch_multi
knows about. Registration requires knowing how to get into and out of the model.
,-->-- Q1 --> (S1, U1s) -->----. E1 -->-. / \ \ Q --->-- Q2 --> (S2, U2s) -->-- (S, Us) E2 -->-- E \ / / `-->-- Q3 --> (S3, U3s) -->----´ E3 -->-´
Parameters
Model : sig ... end
Signature
module Register : functor (Version_i : sig ... end) -> sig ... end
Adds a new version to the set of versions available via
dispatch_multi
.
module Register_raw : functor (Version_i : sig ... end) -> sig ... end
Register_raw
is likeRegister
except you get to deal with the whole pipe. This is useful if, e.g., yourmodel_of_update
function can fail, so that you'd like to filter items out from the result pipe.
include S with type query := Model.query with type state := Model.state with type update := Model.update with type error := Model.error
val dispatch_multi : Connection_with_menu.t -> query -> (state * update Core_kernel.Or_error.t Async_kernel.Pipe.Reader.t * Async_rpc_kernel.Rpc.State_rpc.Metadata.t, error) Core_kernel.Result.t Core_kernel.Or_error.t Async_kernel.Deferred.t
Multi-version dispatch
The return type varies slightly from
Rpc.State_rpc.dispatch
to make it clear that conversion of each individual element in the returned pipe may fail.
val rpcs : unit -> Async_rpc_kernel.Rpc.Any.t list
All rpcs supported by
dispatch_multi
val versions : unit -> Core_kernel.Int.Set.t
All versions supported by
dispatch_multi
(useful for computing which old versions may be pruned).