package current

  1. Overview
  2. Docs

The main event loop.

type t
type results = {
  1. value : unit Current_term.Output.t;
  2. jobs : actions Job.Map.t;
    (*

    The jobs currently being used (whether running or finished).

    *)
}
val create : ?config:Config.t -> ?trace:(next:unit Lwt.t -> results -> unit Lwt.t) -> (unit -> unit term) -> t

create pipeline is a new engine running pipeline. The engine will evaluate t's pipeline immediately, and again whenever one of its inputs changes.

val update : unit -> unit

Primitives should call this after using Current_incr.change to run another step of the engine loop. This will (asynchronously) call Current_incr.propagate and perform any end-of-propagation activities.

val state : t -> results

The most recent results from evaluating the pipeline.

val jobs : results -> actions Job.Map.t
val thread : t -> 'a Lwt.t

thread t is the engine's thread. Use this to monitor the engine (in case it crashes).

val config : t -> Config.t
val pipeline : t -> unit term
val update_metrics : t -> unit

update_metrics t reports how many pipeline stages are in each state via Prometheus. Call this on each metrics collection if you have exactly one pipeline. The default web UI does this automatically.

val on_disable : (unit -> unit) -> unit

on_disable fn schedules fn () to be called after the next evaluation. You can increment a ref-count when calling this and then check it when the callback is called. If it is then zero, the operation is no longer required and you can e.g. cancel the job.

module Step : sig ... end
OCaml

Innovation. Community. Security.