package dune-rpc

  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/ in the main dune repository.

type 'a notification
type ('a, 'b) request
val prepare_request : t -> ('a, 'b) Request.t -> (('a, 'b) request, Version_error.t) Stdlib.result Fiber.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 Notification.t -> ('a notification, Version_error.t) Stdlib.result Fiber.t

See prepare_request.


Innovation. Community. Security.