package dune-rpc-lwt

  1. Overview
  2. Docs

Individual RPC procedures are versioned beyond the larger API version. At session startup, the server and client exchange version information for each method ("negotiation"), setting on a common version for each (if possible) to produce a "version menu".

To initiate a method, then, that method must be looked up in the version menu to determine the correct protocol for this session. This module stages this pattern to share the lookup for all calls to the same procedure.

For lower-level design details, see doc/dev/rpc-versioning.md in the main dune repository.

type 'a notification
type ('a, 'b) request
val prepare_request : t -> ('a, 'b) Dune_rpc.V1.Request.t -> (('a, 'b) request, Dune_rpc.V1.Version_error.t) Stdlib.result Lwt.t

prepare_request client r checks the request r against the negotiated version menu, giving a versioned request as a result.

This function does not initiate any communication with the server. However, as this function must check the version menu, it cannot complete until after version negotiation, and so returns a fiber.

val prepare_notification : t -> 'a Dune_rpc.V1.Notification.t -> ('a notification, Dune_rpc.V1.Version_error.t) Stdlib.result Lwt.t

See prepare_request.

OCaml

Innovation. Community. Security.