Module Expert.Node
val sexp_of_t : ('a -> Ppx_sexp_conv_lib.Sexp.t) -> ('w -> Ppx_sexp_conv_lib.Sexp.t) -> ('a, 'w) t -> Ppx_sexp_conv_lib.Sexp.t
val create : 'w State.t -> ?on_observability_change:(is_now_observable:bool -> unit) -> (unit -> 'a) -> ('a, 'w) tlet t = create ?on_observability_change callbackcreates a new expert node.on_observability_change, if given, is called whenever the node becomes observable or unobservable (with alternating value foris_now_observable, starting attruethe first time the node becomes observable). This callback could run multiple times per stabilization. It should not change the incremental graph.callbackis called if any dependency ofthas changed since it was last called, or if the set of dependencies has changed. The callback will only run when all the dependencies are up-to-date, and inside the callback, you can safely callDependency.valueon your dependencies, as well as call all the functions below on the parent nodes. Any behavior that works on all incremental nodes (cutoff, invalidation, debug info etc) also work ont.
val watch : ('a, 'w) t -> ('a, 'w) incrementalwatch tallows you to plugtin the rest of the incremental graph, but it's also useful to set a cutoff function, debug info etc.
val make_stale : (_, _) t -> unitCalling
make_stale tensures that incremental will recomputetbefore anyone reads its value.tmay not fire though, if it never becomes necessary. This is intended to be called only from a child oft. Along with a well chosen cutoff function, it allows to choose which parents should fire.
val invalidate : (_, _) t -> unitinvalidate tmakestinvalid, as if its surrounding bind had changed. This is intended to be called only from a child oft.
val add_dependency : (_, 'w) t -> (_, 'w) Dependency.t -> unitadd_dependency t depmakestdepend on the child incremental in thedep. Ifdepis already used to link the child incremental to another parent, an exception is raised.This is intended to be called either outside of stabilization, or right after creating
t, or from a child oft(and in that case, as a consequencetmust be necessary).The
on_changecallback ofdepwill be fired whentbecomes observable, or immediately, or whenever the child changes as long astis observable. When this function is called due to observability changes, the callback may fire several times in the same stabilization, so it should be idempotent. The callback must not change the incremental graph, particularly not the dependencies oft.All the
on_changecallbacks are guaranteed to be run before the callback ofcreateis run.
val remove_dependency : (_, 'w) t -> (_, 'w) Dependency.t -> unitremove_dependency t depcan only be called from a child oft.