Module Jenga_lib.Reportable

This module allows the jenga server to incrementally send updates about build errors in a typed way to clients (see the errors rpc).

type t

A Reportable.t is an updatable bag of reportable errors, with clients. When a client attaches it receives a snapshot and a pipe of updates.

include sig ... end
val sexp_of_t : t ‑> Base.Sexp.t
module Error : sig ... end

Reportable.Error.t is a reportable error

val create : name:string ‑> t

create t returns a new Reportable.t to which errors can be added and removed name is shown by "jenga -trace" when clients register/unregister

val add : t ‑> Error.t ‑> unit

add t e adds e to t. If e is already in t then it raises an exception.

val remove : t ‑> Error.Id.t ‑> unit

remove t e removes e from t.

val length : t ‑> int

length t is the number of errors in t.

val iter : t ‑> f:(Error.t ‑> unit) ‑> unit

iter t ~f calls f on each error in t.

val to_list : t ‑> Error.t list

to_list t is the list of errors in t.

module Snap : sig ... end
module Update : sig ... end
module Stable : sig ... end
val drop_clients : t ‑> unit

Drop all clients attached to the Reportable.t. Useful for testing the reconnection logic of clients.

val snap_with_updates : trace:(string ‑> unit) ‑> t ‑> Snap.t * Update.t Async.Pipe.Reader.t

snap_with_updates ~trace t attaches a new client, returning the snapshot & update pipe. The client is detached when the caller closes the returned pipe-reader.

The intended use of snap_with_updates is the Error_pipe RPC; constructing a `mirror' Reportable.t on the client-side of the RPC using of_snap and update.

val of_snap : name:string ‑> Snap.t ‑> t

of_snap ~name snap returns a new Reportable.t initialized from a snapshot.

val update : t ‑> Update.t ‑> unit

update t update applies an update to Reportable.t.