package command_rpc

  1. Overview
  2. Docs

Command is used for setting up an RPC server in the child process communicating with the parent over stdin&stdout. By default this will use an Async RPC protocol, but passing the -sexp flag will make it use a sexp-based interface. Passing the -menu flag will cause the command to print out a sexp indicating which RPC names and versions are supported.

Since stdout is used for communication with the parent process, it's not available for use as a debug output channel. We remap the file descriptors in the child in such a way that any attempted write to stdout gets sent to stderr instead. Then stderr can be forwarded to stderr of the parent if propagate_stderr = true.

module Invocation : sig ... end
module Stateful : sig ... end
module type T = Stateful.T with type state := Invocation.t
module type T_conv = Stateful.T_conv with type state := Invocation.t
module type T_pipe = Stateful.T_pipe with type state := Invocation.t
type t = [
  1. | `Plain of (module T)
  2. | `Plain_conv of (module T_conv)
  3. | `Pipe of (module T_pipe)
  4. | `Pipe_conv of (module T_pipe_conv)
  5. | `Implementations of Invocation.t Async.Rpc.Implementation.t list
]
val stateful : Invocation.t Stateful.t list -> t list

You need to call this on your list of stateful RPCs before they can be passed to create or (more usually) the function you get in Expert.param.

val create : ?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 -> summary:string -> t list -> Async.Command.t
module Expert : sig ... end
OCaml

Innovation. Community. Security.