Module Head_daemon.Daemon

type t = {
  1. daemon : unit Tezos_base.TzPervasives.tzresult Lwt.t;
  2. head_stream_stopper : Tezos_rpc.Context.stopper;
  3. applied_block_stream_stopper : Tezos_rpc.Context.stopper;
}
val fair_lwt_stream_get : ('a option -> unit) -> 'a Lwt_stream.t -> 'a Lwt_stream.t -> unit

fair_lwt_stream_get push s1 s2 aims to get the value available from s1 and s2 and push them to a stream, so that, all the values pushed to that stream are interleaved to preserve some fairness.

make_stream_daemon ~on_head ~on_applied_block ~head_stream ~applied_block_stream calls on_head or on_applied_block depending on the value received from the stream composed of head_stream and applied_block_stream. The composed stream is interleaved for fairness. It returns a couple (p, stopper) where p is a promise resolving when the stream closes and stopper is a function closing the stream.

val shutdown : t -> unit Lwt.t