Given a model of the types involved in a family of State_RPCs, this functor
provides a single multi-version implementation function implement_multi
in terms
of that model and a mechanism for registering the individual versions that
implement_multi
knows about. Registration requires knowing how to get into and
out of the model.
Q1 -->-. ,---->-- (S1, U1s) \ / Q2 -->-- Q --> (S, Us) -->-- (S2, U2s) / \ Q3 -->-´ `---->-- (S3, U3s)
Model : sig ... end
module Register_raw : functor (Version_i : sig ... end) -> sig ... end
Register_raw
is like Register
except you get the whole update pipe to deal
with. This is useful if, e.g., your update_of_model
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 implement_multi : ?log_not_previously_seen_version:(name:string ‑> int ‑> unit) ‑> ('connection_state ‑> version:int ‑> query ‑> (state * update Async_kernel.Pipe.Reader.t, error) Core_kernel.Result.t Async_kernel.Deferred.t) ‑> 'connection_state Async_rpc_kernel.Rpc.Implementation.t list
implement multiple versions at once
val versions : unit ‑> Core_kernel.Int.Set.t
All versions supported by implement_multi
.
(useful for computing which old versions may be pruned)