Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
val param :
unit ->
(?connection_description:Core.Info.t ->
?handshake_timeout:Core.Time.Span.t ->
?heartbeat_config:Async.Rpc.Connection.Heartbeat_config.t ->
?max_message_size:int ->
?log_not_previously_seen_version:(name:string -> int -> unit) ->
?buffer_age_limit:Async.Writer.buffer_age_limit ->
t list ->
unit Async.Deferred.t)
Async.Command.Param.t
param ()
returns a command line parameter which produces a function. You can do any initialization (e.g. of mutable state) and then call the function with your RPC implementations to start the RPC server. The deferred it returns will become determined when the client closes their connection, after which you may do any cleanup you need and then exit (possibly with an appropriate exit status).
This interface is marked Expert
because consuming from stdin or writing to stdout during your initialization may prevent you from receiving RPCs or responding to them properly, but we cannot check that you don't do this or prevent you from doing it, so you just have to be careful.
You are responsible for ensuring that the async scheduler is started, e.g., by calling Command.async_or_error'
.