package tezos-baking-alpha

  1. Overview
  2. Docs
type Tezos_base__TzPervasives.error +=
  1. | Node_connection_lost
val sleep_until : Tezos_base.Time.Protocol.t -> unit Lwt.t option
val wait_for_first_event : name:string -> ('event, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt_stream.t -> 'event Lwt.t
val main : name:string -> cctxt:Tezos_client_alpha.Protocol_client_context.full as 'a -> stream: ('event, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt_stream.t -> state_maker: ('event -> ('state, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t) -> pre_loop: ('a -> 'state -> 'event -> (unit, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t) -> compute_timeout:('state -> 'timesup Lwt.t) -> timeout_k: ('a -> 'state -> 'timesup -> (unit, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t) -> event_k: ('a -> 'state -> 'event -> (unit, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t) -> finalizer:('state -> unit Lwt.t) -> (unit, Tezos_error_monad.TzCore.error list) Stdlib.result Lwt.t

main ~name ~cctxt ~stream ~state_maker ~pre_loop ~timeout_maker ~timeout_k ~event_k is an infinitely running loop that monitors new events arriving on stream. The loop exits when the stream gives an error.

The function pre_loop is called before the loop starts.

The loop maintains a state (of type 'state) initialized by state_maker and passed to the callbacks timeout_maker (used to set up waking-up timeouts), timeout_k (when a computed timeout happens), and event_k (when a new event arrives on the stream).

OCaml

Innovation. Community. Security.