Infrastructure code for managing RPCs that evolve over time to use different types at different versions.
Three scenarios are supported:
In each scenario, it is desirable that the party responsible for managing versions be
coded largely in terms of a single "master" version of the types involved, with all
necessary type conversions relegated to a single module. Versioned_rpc
is intended
for implementing such a module.
Type coercions into and out of the model go in the directions indicated by the following diagram:
Caller converts Callee converts =============== =============== caller callee | callee | callee | | caller | | callee | | | | | | ,-->-- Q1 --> R1 -->-. Q1 -->-. | ,-->-- R1 / \ \ | / Q --->-- Q2 --> R2 -->-- R Q2 -->-- Q --> R --->-- R2 \ / / \ `-->-- Q3 --> R3 -->-' Q3 -->-' `-->-- R3
a directory of supported rpc names and versions.
add impls
extends a list of rpc implementations with an additional rpc
implementation for providing a Menu.t
when one is requested via Menu.request
.
request an rpc version menu from an rpc connection
multi-version dispatch
All versions supported by dispatch_multi
.
(useful for computing which old versions may be pruned)
Given a model of the types involved in a family of RPCs, this functor provides a
single 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 --> R1 -->-. / \ Q --->-- Q2 --> R2 -->-- R \ / `-->-- Q3 --> R3 -->-'
multi-version dispatch
The return type varies slightly from Rpc.Pipe_rpc.dispatch
to make it clear
that conversion of each individual element in the returned pipe may fail.
All versions supported by dispatch_multi
.
(useful for computing which old versions may be pruned)
Given a model of the types involved in a family of Pipe_RPCs, this functor
provides a single Pipe_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 --> R1 -->-. E1 -->-. / \ \ Q --->-- Q2 --> R2 -->-- R E2 -->-- E \ / / `-->-- Q3 --> R3 -->-' E3 -->-'
implement multiple versions at once
All versions implemented by implement_multi
.
(useful for computing which old versions may be pruned)
Given a model of the types involved in a family of 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 -->-. ,-->-- R1 \ / Q2 -->-- Q --> R --->-- R2 / \ Q3 -->-' `-->-- R3
implement multiple versions at once
All versions supported by dispatch_multi
.
(useful for computing which old versions may be pruned)
Given a model of the types involved in a family of Pipe_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 -->-. ,-->-- R1 \ / Q2 -->-- Q --> R --->-- R2 / \ Q3 -->-' `-->-- R3
Both_convert
rpcs combine features of both caller-converts and callee-converts
versioning schemes in such a way that one can smoothly add a new version of the rpc
to a shared library, and it doesn't matter whether the callee or caller upgrades to
the latest version of the shared library first, the new version will not be
exercised until both sides support it.
(conv) (conv) (conv) (conv) caller callee callee caller | | | | | | | | Q.caller ---->-- Q1 -->-. (impl) .->-- R1 -->---- R.caller \ \ callee / / \--->-- Q2 -->---\ | /--->-- R2 -->---/ \ \ | / / `->-- Q3 -->---- Q.callee --> R.callee ---->-- R3 -->-'
multi-version dispatch
implement multiple versions at once
All supported versions. Useful for detecting old versions that may be pruned.