package async_rpc_kernel

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

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.

Sourcetype t = Menu.t

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.

Sourceval sexp_of_t : t -> Sexplib0.Sexp.t
Sourceval version_menu_rpc_name : string

The name of the rpc to request the menu

Sourcemodule With_digests_in_sexp : sig ... end

Alternative sexp printer

Sourceval supported_rpcs : t -> Async_rpc_kernel__.Description.t list

Finds what rpcs are supported. Constructs a new list on every call

Sourceval supported_versions : t -> rpc_name:string -> Core.Int.Set.t

Finds which versions of a particular rpc are supported. Constructs a new set on every call

Sourceval mem : t -> Async_rpc_kernel__.Description.t -> bool

Checks if a given rpc appears in the menu

Sourceval shape_digests : t -> Async_rpc_kernel__.Description.t -> Rpc_shapes.Just_digests.t option

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.

Sourceval 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.t

Similar 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.

Sourceval highest_shared_version : rpc_name:string -> callee_menu:t -> caller_versions:Core.Int.Set.t -> int Core.Or_error.t

Helper function for both-convert rpcs. Gives nice error messages.

Sourceval has_some_versions : t -> rpc_name:string -> bool

Test if there is an rpc with this name with some version in the menu

Sourceval of_supported_rpcs : Async_rpc_kernel__.Description.t list -> rpc_shapes:[ `Unknown ] -> t

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.

Sourcemodule Stable : sig ... end
Sourceval of_v1_response : Stable.V1.response -> t

Used for the Versioned_rpc.Menu rpc.

Sourceval of_v2_response : Stable.V2.response -> t

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.

Specifies directly how to handle the version menu rpc.

  • deprecated [since 2023-06] If you use [implement], strange inconsistencies may happen as the v3 protocol sends a menu automatically and [Menu.request] gives that one

Requests an rpc version menu from an rpc connection.

Like request but returns an Rpc_result.t rather than an Or_error.t

Sourcemodule With_shapes : sig ... end
Sourceval create : Rpc.Description.t list -> t

Creates a menu directly -- generally you should use request instead.