Up

Module Make (S : Parallel.Worker_spec) : Worker with type 'a functions := 'a S.functions and type worker_state_init_arg := S.Worker_state.init_arg and type connection_state_init_arg := S.Connection_state.init_arg

Parameters

Signature

type t

NOTE: If you are passing around Worker.t's, keep in mind that a large connection state init arg means you are passing around a lot of data.

val sexp_of_t : t -> Sexplib.Sexp.t
val __bin_read_t__ : (int -> t) Core.Std.Bin_prot.Read.reader
type unmanaged_t
type 'a functions
val functions : unmanaged_t functions

Accessor for the functions implemented by this worker type

type worker_state_init_arg
type connection_state_init_arg
val id : t -> Id.t
val spawn : ?where:Executable_location.t -> ?env:(string * string) list -> ?rpc_max_message_size:int -> ?rpc_handshake_timeout:Core.Std.Time.Span.t -> ?rpc_heartbeat_config:Async.Std.Rpc.Connection.Heartbeat_config.t -> ?connection_timeout:Core.Std.Time.Span.t -> ?cd:string -> ?umask:int -> redirect_stdout:Fd_redirection.t -> redirect_stderr:Fd_redirection.t -> worker_state_init_arg -> connection_state_init_arg -> on_failure:(Core.Std.Error.t -> unit) -> t Core.Std.Or_error.t Async.Std.Deferred.t
val spawn_exn : ?where:Executable_location.t -> ?env:(string * string) list -> ?rpc_max_message_size:int -> ?rpc_handshake_timeout:Core.Std.Time.Span.t -> ?rpc_heartbeat_config:Async.Std.Rpc.Connection.Heartbeat_config.t -> ?connection_timeout:Core.Std.Time.Span.t -> ?cd:string -> ?umask:int -> redirect_stdout:Fd_redirection.t -> redirect_stderr:Fd_redirection.t -> worker_state_init_arg -> connection_state_init_arg -> on_failure:(Core.Std.Error.t -> unit) -> t Async.Std.Deferred.t
val run : t -> f:(unmanaged_t, 'query, 'response) Parallel.Function.t -> arg:'query -> 'response Core.Std.Or_error.t Async.Std.Deferred.t

run t and run_exn t will connect to t if there is not already a connection, but if there is currently a connection that has gone stale, they will fail with an error. Trying again will attempt a reconnection.

val run_exn : t -> f:(unmanaged_t, 'query, 'response) Parallel.Function.t -> arg:'query -> 'response Async.Std.Deferred.t

Using these functions will not result in on_failure reporting a closed connection, unlike running the shutdown function.

val kill_exn : t -> unit Async.Std.Deferred.t