Up

Parameter C : Creator with type worker_state = Worker_state.t and type worker_state_init_arg = Worker_state.init_arg and type connection_state = Connection_state.t and type connection_state_init_arg = Connection_state.init_arg

Signature

type worker
type worker_state = Worker_state.t
type worker_state_init_arg = Worker_state.init_arg
type connection_state = Connection_state.t
type connection_state_init_arg = Connection_state.init_arg
val create_rpc : ?name:string -> f:(worker_state:worker_state -> conn_state:connection_state -> 'query -> 'response Async.Std.Deferred.t) -> bin_input:'query Core.Std.Bin_prot.Type_class.t -> bin_output:'response Core.Std.Bin_prot.Type_class.t -> unit -> (worker, 'query, 'response) Function.t

create_rpc ?name ~f ~bin_input ~bin_output () will create an Rpc.Rpc.t with name if specified and use f as an implementation for this Rpc. It returns back a Function.t, a type-safe Rpc protocol.

val create_pipe : ?name:string -> f:(worker_state:worker_state -> conn_state:connection_state -> 'query -> 'response Async.Std.Pipe.Reader.t Async.Std.Deferred.t) -> bin_input:'query Core.Std.Bin_prot.Type_class.t -> bin_output:'response Core.Std.Bin_prot.Type_class.t -> unit -> (worker, 'query, 'response Async.Std.Pipe.Reader.t) Function.t

create_pipe ?name ~f ~bin_input ~bin_output () will create an Rpc.Pipe_rpc.t with name if specified. The implementation for this Rpc is a function that creates a Pipe.Reader.t and a Pipe.Writer.t, then calls f arg ~writer and returns the reader.

Notice that aborted is not exposed. The pipe is closed upon aborted.

val create_one_way : ?name:string -> f:(worker_state:worker_state -> conn_state:connection_state -> 'query -> unit) -> bin_input:'query Core.Std.Bin_prot.Type_class.t -> unit -> (worker, 'query, unit) Function.t

create_one_way ?name ~f ~bin_msg () will create an Rpc.One_way.t with name if specified and use f as an implementation.

val of_async_rpc : f:(worker_state:worker_state -> conn_state:connection_state -> 'query -> 'response Async.Std.Deferred.t) -> ('query, 'response) Async.Std.Rpc.Rpc.t -> (worker, 'query, 'response) Function.t

of_async_rpc ~f rpc is the analog to create_rpc but instead of creating an Rpc protocol, it uses the supplied one

val of_async_pipe_rpc : f:(worker_state:worker_state -> conn_state:connection_state -> 'query -> 'response Async.Std.Pipe.Reader.t Async.Std.Deferred.t) -> ('query, 'response, Core.Std.Error.t) Async.Std.Rpc.Pipe_rpc.t -> (worker, 'query, 'response Async.Std.Pipe.Reader.t) Function.t

of_async_pipe_rpc ~f rpc is the analog to create_pipe but instead of creating a Pipe rpc protocol, it uses the supplied one.

Notice that aborted is not exposed. The pipe is closed upon aborted.

val of_async_one_way_rpc : f:(worker_state:worker_state -> conn_state:connection_state -> 'query -> unit) -> 'query Async.Std.Rpc.One_way.t -> (worker, 'query, unit) Function.t

of_async_one_way_rpc ~f rpc is the analog to create_one_way but instead of creating a One_way rpc protocol, it uses the supplied one