Module Lwt_process_watchdog.Daemon

Parameters

module Event : EVENTS

Signature

val stop : 'a t -> unit Lwt.t

stop t stops the process handled by the watchdog daemon as soon as it is called.

val run_process : 'a t -> binary_path:string -> arguments:string array -> unit -> 'a t Tezos_base.TzPervasives.tzresult Lwt.t

run_process t ~binary_path ~arguments () starts a Lwt_process.process_none thanks to the given binary_path and its arguments. Note that the arguments are taken directly from the argument, thus, the binary_path is not added to the argument list. Refer to the Lwt_process documentation for more details.

val run_process_with_sockets : 'a t -> process_name:string -> ?socket_prefix:string -> ?executable_name:string -> handshake:bytes -> unit -> 'a t Tezos_base.TzPervasives.tzresult Lwt.t

run_process_with_sockets t ~process_name ?socket_prefix ?executable_name ~handshake () starts a Lwt_process.process_none depending on the given process_name and executable_name parameters. If executable_name is passed, then the process will be run thanks to the path to this binary. Otherwise, the current binary name will be used as a forked process. process_name aims to be the entry point of the binary, that may differ from the executable_name in case of fork. The stdout and stderr are redirected to the default Unix streams.

socket_prefix and handshake are used to setup the communication, through a socket, with the created process. The values ares expected to be defined accordingly to both parts.

val watch_dog : start_new_server:(unit -> 'a t Tezos_base.TzPervasives.tzresult Lwt.t) -> 'a t -> (unit, Tezos_base.TzPervasives.tztrace) Stdlib.result Lwt.t

watch_dog ~start_new_server t takes a running process t and make sure it runs well. If it crashed, it will restart the process using the given start_new_server callback.