Up

Module Heartbeater

A Heartbeater.t is an Rpc server only used for heartbeats. The only thing you can do with a Heartbeater.t is connect to it and get notified when the connection closed.

Signature

type t
val __bin_read_t__ : (int -> t) Core.Std.Bin_prot.Read.reader
val if_spawned : (t -> ([>
| `No_parent
] as 'a) Async.Std.Deferred.t) -> [
| `Spawned of t
| `Served
] -> 'a Async.Std.Deferred.t

A helper function to be used on the ~parent_heartbeater argument of the init_worker_state function. The suggested use is:

Heartbeater.(if_spawned connect_and_shutdown_on_disconnect_exn) parent_heartbeater

if_spawned f parent_heartbeater will run f on the heartbeater if this worker was created with spawn. If the worker was created with Connection.serve (in process), nothing occurs and `No_parent is returned.

val connect_and_shutdown_on_disconnect_exn : t -> [>
| `Connected
] Async.Std.Deferred.t

Connect to the given Heartbeater.t (host and port) and call Shutdown.shutdown upon Rpc.Connection.close_finished, raising an exception if unable to connect. The returned Deferred.t is determined once the initial connection has been established.

val connect_and_wait_for_disconnect_exn : t -> [>
| `Connected of [
| `Disconnected
] Async.Std.Deferred.t
] Async.Std.Deferred.t