Babel.CallerSourceAn a t selects a dispatch function of type a, which will typically be a function type, given a version menu supplied by the server.
In order to use this interface, the callee must provide a version menu. Use Async.Versioned_rpc.Menu.add for this.
NOTE Babel does not catch exceptions raised by caller conversion functions.
The protocols supported by the caller in order from most preferred to least preferred.
Print the required set of protocols for each supported dispatching strategy in order from most preferred to least preferred. This is useful for demonstrating the final set of protocols in an expect test.
of_list_decreasing_preference ts results in a caller that picks the first t in ts compatible with whatever version menu is supplied to dispatch_multi.
High level functions for working with callers in the style of Async.Rpc.Rpc.dispatch.
High level functions for working with callers in the style of Async.Rpc.Rpc.dispatch_exn.
High level functions for working with callers in the style of Async.Rpc.Rpc.dispatch'. There is no Babel.Caller.Rpc'.dispatch_multi. Use the more general Babel.Caller.to_dispatch_fun.
High level functions for working with callers in the style of Async.Rpc.Pipe_rpc.dispatch.
High level functions for working with callers in the style of Async.Rpc.Pipe_rpc.dispatch_exn.
High level functions for working with callers in the style of Async.Rpc.Pipe_rpc.dispatch_iter.
High level functions for working with callers in the style of Async.Rpc.State_rpc.dispatch.
High level functions for working with callers in the style of Async.Rpc.One_way.dispatch.
High level functions for working with callers in the style of Async.Rpc.One_way.dispatch_exn.
High level functions for working with callers in the style of Async.Rpc.One_way.dispatch'. There is no Babel.Caller.One_way'.dispatch_multi. Use the more general Babel.Caller.to_dispatch_fun.
High level functions for working with callers in the style of Streamable.Plain_rpc.dispatch.
High level functions for working with callers in the style of Streamable.Pipe_rpc.dispatch.
High level functions for working with callers in the style of Streamable.State_rpc.dispatch.
val to_dispatch_fun :
'a t ->
Async_rpc_kernel.Versioned_rpc.Menu.t ->
(?metadata:Async_rpc_kernel.Rpc_metadata.t ->
Async_rpc_kernel.Rpc.Connection.t ->
'a)
Core.Or_error.tProduce a dispatch function that is compatible with the given version menu. You should prefer to dispatch using the more specialized functions above. You would use this function if you want to precompute the version menu checks or if you have changed the type to something incompatible with the more specialized functions for particular types of Rpc protocols.
val description :
_ t ->
Async_rpc_kernel.Versioned_rpc.Menu.t ->
Async_rpc_kernel.Rpc.Description.t Core.Or_error.tGiven a version menu, returns the description of the RPC that will be called by the dispatch function.
Transform the dispatch function generated by a caller. Since in practice we are usually working with functions, it may be enlightening to think of the type as:
val map
: ('a1 -> 'b1) t
-> f:(('a1 -> 'b1) -> 'a2 -> 'b2)
-> ('a2 -> 'b2) tMost of the time you should use the higher-level map_query and map_response functions instead of map. map is intended to be used for more radical changes to an implementation, such as to change the type of rpc protocol.
to_dispatch_fun (map t ~f) menu = Or_error.map (to_dispatch_fun t menu) ~fA specialization of map for the query type of a protocol.
In practice, most implementations will return deferreds or other complex types, so you should prefer to use more specialized functions, such as Rpc.map_query.
A specialization of map for the response type of a protocol.
In practice, most implementations will return deferreds or other complex types, so you should prefer to use more specialized functions, such as Rpc.map_response.
Return whether any of strategies in the rpc protocol menu are supported by the dispatch function.