Up

Module Functions (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) : Functions with type worker := C.worker and type 'a functions := 'a functions and 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

The functions that can be run on this worker type

Parameters

Signature

type worker
type worker_state_init_arg
type worker_state
type connection_state_init_arg
type connection_state
type 'worker functions
val functions : worker functions
val init_worker_state : parent_heartbeater:[
| `Spawned of Heartbeater.t
| `Served
] -> worker_state_init_arg -> worker_state Async.Std.Deferred.t

init_worker_state is called with the init_arg passed to spawn or serve

If spawn was called, it is highly recommeded to call connect_and_shutdown_on_disconnect_exn on the supplied heartbeater of the spawner.

The Cleanup.connect_and_shutdown_on_disconnect_if_spawned_exn function does just this for you.

val init_connection_state : connection:Async.Std.Rpc.Connection.t -> worker_state:worker_state -> connection_state_init_arg -> connection_state Async.Std.Deferred.t

init_connection_state is called with the init_arg passed to Connection.client

connection should only be used to register close_finished callbacks, not to dispatch.