Module Make.Connection

type t
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
val worker_id : t -> Id.t

The id of the connected worker

val run : t -> f:(worker'query'response) _function -> arg:'query -> 'response Core.Or_error.t Async.Deferred.t

Run functions implemented by this worker

val run_exn : t -> f:(worker'query'response) _function -> arg:'query -> 'response Async.Deferred.t
val client : worker -> connection_state_init_arg -> t Core.Or_error.t Async.Deferred.t

Connect to a given worker, returning a type wrapped Rpc.Connection.t that can be used to run functions.

val client_exn : worker -> connection_state_init_arg -> t Async.Deferred.t
val with_client : worker -> connection_state_init_arg -> f:(t -> 'a Async.Deferred.t) -> 'a Core.Or_error.t Async.Deferred.t

with_client worker init_arg f connects to the worker's server, initializes the connection state with init_arg and runs f until an exception is thrown or until the returned Deferred is determined.

NOTE: You should be careful when using this with Pipe_rpc. See Rpc.Connection.with_close for more information.

val close : t -> unit Async.Deferred.t
val close_finished : t -> unit Async.Deferred.t
val close_reason : t -> on_close:[ `started | `finished ] -> Core.Info.t Async.Deferred.t
val is_closed : t -> bool