Functor Tick.Make_poweroff_resistant

module Make_poweroff_resistant: 
functor (P : PCLOCK) ->
functor (M : MCLOCK) ->
functor (MT : MTICK) ->
functor (E : LIFECYCLE) ->
functor (Kv : KV) -> WATCHER with type trigger = T.t
Best-effort, program poweroff resistant, monotonic, clock tick watchers.

Given a watcher w:

In this interface triggers can be persisted. Note that trigger actuation occurs through the Tick.PERSISTENT_TRIGGER interface.
Kv : KV

Tick watchers

type span_ns = int64 
The type for positive nanoseconds time spans. This is an unsigned 64-bit integer it can represent time spans up to approximatevley 584 Julian years.
type trigger 
The type for tick watcher triggers. This is the value being acted upon when a watcher sees a tick.
type t 
The type for tick watchers. Encapsulate a delay to watch for and a trigger to actuate whenever the delay elapsed.
val watch : delay_ns:span_ns -> trigger -> t
watch d tr is a tick in that occurs after d nanoseconds and is watched by trigger tr.
val unwatch : t -> unit
unwatch w unwatches the tick in w. If w is no longer Tick.WATCHER.waiting this has no effect. Otherwise w's trigger is guaranteed not to be actuated and Tick.WATCHER.waiting w becomes false.
val waiting : t -> bool
waiting w is true iff w's trigger has not been actuated yet or w was not Tick.WATCHER.unwatched.
val linger_ns : t -> span_ns
linger_ns w is the number of nanoseconds during which Tick.WATCHER.waiting w was true. If w's trigger was actuated then:
val delay_ns : t -> span_ns
delay_ns w is w's waiting delay.
val trigger : t -> trigger
trigger w is w's trigger.
val fold : ('a -> t -> 'a) -> 'a -> 'a
fold f acc folds over all watchers that have Tick.WATCHER.waiting t = true.