package async_rpc_kernel

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
module Responder : sig ... end
val schedule_dispatch : Connection.t -> rpc_tag:string -> version:int -> Core.Bigstring.t -> pos:int -> len:int -> handle_response: (Core.Bigstring.t -> pos:int -> len:int -> unit Async_kernel.Deferred.t) -> handle_error:(Core.Error.t -> unit) -> [ `Flushed of unit Async_kernel.Deferred.t | `Connection_closed ]

This just schedules a write, so the Bigstring.t should not be overwritten until the flushed Deferred.t is determined. The return value of handle_response has the same meaning as in the function argument of Implementations.Expert.create.

schedule_dispatch will raise if the length of the RPC message (i.e. len plus the message header) is longer than the underlying transport's max message size.

val schedule_dispatch_with_metadata : Connection.t -> rpc_tag:string -> version:int -> metadata:string option -> Core.Bigstring.t -> pos:int -> len:int -> handle_response: (Core.Bigstring.t -> pos:int -> len:int -> unit Async_kernel.Deferred.t) -> handle_error:(Core.Error.t -> unit) -> [ `Flushed of unit Async_kernel.Deferred.t | `Connection_closed ]

schedule_dispatch_with_metadata is like schedule_dispatch except that instead of the rpc metadata coming from metadata hooks added to the connection, it is passed directly. This is mostly useful if you are calling this function from an `Expert on_unknown_rpc handler (see Implementations.Expert.create).

val dispatch : Connection.t -> rpc_tag:string -> version:int -> Core.Bigstring.t -> pos:int -> len:int -> handle_response: (Core.Bigstring.t -> pos:int -> len:int -> unit Async_kernel.Deferred.t) -> handle_error:(Core.Error.t -> unit) -> [ `Ok | `Connection_closed ]

dispatch will raise if the length of the RPC message (i.e. len plus the message header) is longer than the underlying transport's max message size.

type implementation_result =
  1. | Replied
  2. | Delayed_response of unit Async_kernel.Deferred.t

Result of callbacks passed to implement and implement' and implement_for_tag_and_version and implement_for_tag_and_version':

  • Replied means that the response has already been sent using one of the functions of Responder
  • Delayed_response d means that the implementation is done using the input bigstring, but hasn't send the response yet. When d becomes determined it is expected that the response has been sent.

Note: it is NOT OK for an implementation to return:

Delayed_response (Responder.schedule responder buf ~pos:... ~len:...)

where buf is the same bigstring as the one containing the query. This is because it would indicate that buf can be overwritten even though it is still being used by Responder.schedule.

val implement : ?on_exception:On_exception.t -> (_, _) t -> ('connection_state -> Responder.t -> Core.Bigstring.t -> pos:int -> len:int -> implementation_result Async_kernel.Deferred.t) -> 'connection_state Implementation.t
val implement' : ?on_exception:On_exception.t -> (_, _) t -> ('connection_state -> Responder.t -> Core.Bigstring.t -> pos:int -> len:int -> implementation_result) -> 'connection_state Implementation.t
val implement_for_tag_and_version : ?on_exception:On_exception.t -> rpc_tag:string -> version:int -> ('connection_state -> Responder.t -> Core.Bigstring.t -> pos:int -> len:int -> implementation_result Async_kernel.Deferred.t) -> 'connection_state Implementation.t
val implement_for_tag_and_version' : ?on_exception:On_exception.t -> rpc_tag:string -> version:int -> ('connection_state -> Responder.t -> Core.Bigstring.t -> pos:int -> len:int -> implementation_result) -> 'connection_state Implementation.t
OCaml

Innovation. Community. Security.