Up

Module Rpc

A library for building asynchronous RPC-style protocols.

The approach here is to have a separate representation of the server-side implementation of an RPC (An Implementation.t) and the interface that it exports (either an Rpc.t, a State_rpc.t or a Pipe_rpc.t, but we'll refer to them generically as RPC interfaces). A server builds the Implementation.t out of an RPC interface and a function for implementing the RPC, while the client dispatches a request using the same RPC interface.

The Implementation.t hides the type of the query and the response, whereas the Rpc.t is polymorphic in the query and response type. This allows you to build a Implementations.t out of a list of Implementation.ts.

Each RPC also comes with a version number. This is meant to allow support of multiple different versions of what is essentially the same RPC. You can think of it as an extension to the name of the RPC, and in fact, each RPC is uniquely identified by its (name, version) pair. RPCs with the same name but different versions should implement similar functionality.

Signature

module Description : sig .. end
module Implementation : sig .. end
A 'connection_state Implementation.t is something that knows how to respond to one query, given a 'connection_state.
module Implementations : sig .. end
A 'connection_state Implementations.t is something that knows how to respond to many different queries.
module Rpc : sig .. end
module Pipe_close_reason : sig .. end
module Pipe_rpc : sig .. end
module State_rpc : sig .. end
A state rpc is an easy way for two processes to synchronize a data structure by sending updates over the wire.
module One_way : sig .. end
An RPC that has no response.
module Any : sig .. end