package async_rpc_kernel
Module Versioned_rpc.MenuSource
Over-the-network discovery of rpc names and versions supported by a callee.
This is used by the dispatch_multi functions in Caller_converts and Both_convert to dynamically determine the most appropriate version to use.
A Menu.t represents the RPCs implemented by a peer. In v3 of the protocol, menus are sent between peers as part of the handshake, and these menus also include Rpc_shapes.Just_digests.t of the rpcs. In earlier protocol versions, the menus are requested by a special rpc (with name version_menu_rpc_name) that is added to a set of implementations with Versioned_rpc.Menu.add. These legacy menus do not include RPC shape information.
The name of the rpc to request the menu
Alternative sexp printer
Finds what rpcs are supported. Constructs a new list on every call
Finds which versions of a particular rpc are supported. Constructs a new set on every call
Checks if a given rpc appears in the menu
Find the shape of the entry in the menu for the given rpc description. Returns None if and only if there is no entry. If the shape is unknown (due to the peer not supporting the latest rpc protocol version), Some Unknown is returned.
val highest_available_version :
t ->
rpc_name:string ->
from_set:Core.Int.Set.t ->
(int, [ `Some_versions_but_none_match | `No_rpcs_with_this_name ])
Core.Result.tSimilar to supported_versions but specific for the usecase of finding an RPC to execute. Unlike the roughly equivalent code, Set.inter from_set (supported_versions menu ~rpc_name) |> Set.max_elt, this does not construct a new Set.t on every call.
Helper function for both-convert rpcs. Gives nice error messages.
Test if there is an rpc with this name with some version in the menu
Construct a menu from a list of rpcs. But note this menu won’t know about anything about the digests/types of the rpcs. This function exists for the legacy Versioned_rpc mechanism and shouldn’t be needed for new code.
Used for the Versioned_rpc.Menu rpc.
Used for the v3 protocol handshake.
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.
val implement :
('s -> unit -> Stable.V1.response Async_kernel.Deferred.t) ->
's Rpc.Implementation.tSpecifies directly how to handle the version menu rpc.
Requests an rpc version menu from an rpc connection.
Like request but returns an Rpc_result.t rather than an Or_error.t
Creates a menu directly -- generally you should use request instead.