1 (* Goalfile dependency DAG
2 * Copyright (C) 2020 Richard W.M. Jones
3 * Copyright (C) 2020 Red Hat Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 (** The type of the directed acyclic graph of dependencies. *)
23 val create : Ast.env -> Ast.expr list -> t
24 (** [create env roots] constructs the DAG of dependencies starting
25 with the roots, returning the final structure or raising
26 [Failure _] if there is a problem. *)
29 (** State held when running jobs. *)
32 Ast.env -> Ast.loc -> string -> Ast.expr list -> Ast.goal ->
33 Ast.expr list -> string -> unit
34 (** Run a single goal. *)
36 type exists_runner = Ast.env -> Ast.loc -> Ast.pattern -> string -> unit
37 (** Run an existence predicate. *)
39 val new_state : t -> goal_runner -> exists_runner -> state
40 (** Create a new state object from the DAG.
42 [goal_runner] is a function for running single goals.
43 [exists_runner] is a function for running existence predicates.
44 See the {!Run} module. *)
48 val retire_job : state -> node -> unit
49 val fail_job : state -> node -> unit
50 (** See {!Jobs.run}. *)
52 val next_job : state -> node Jobs.next
53 (** Returns the next job that is able to run. (See {!Jobs.run}).
55 It is always guaranteed that the next job which is returned
56 has already had all its dependencies retired already. *)
58 val string_of_job : node -> string