summaryrefslogtreecommitdiff
path: root/stm/coqworkmgrApi.mli
blob: 2983b619dbfec0238ca9dbceef9e7455053c85e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
(************************************************************************)
(*         *   The Coq Proof Assistant / The Coq Development Team       *)
(*  v      *   INRIA, CNRS and contributors - Copyright 1999-2018       *)
(* <O___,, *       (see CREDITS file for the list of authors)           *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)

(* High level api for clients of the service (like coqtop) *)

type priority = Low | High
val string_of_priority : priority -> string
val priority_of_string : string -> priority

(* Connects to a work manager if any. If no worker manager, then
   -async-proofs-j and -async-proofs-tac-j are used *)
val init : priority -> unit

(* blocking *)
val get : int -> int

(* not blocking *)
val tryget : int -> int option
val giveback : int -> unit

(* Low level *)
type request =
  | Hello of priority
  | Get of int
  | TryGet of int
  | GiveBack of int
  | Ping

type response =
  | Tokens of int
  | Noluck
  | Pong of int * int * int (* cur, max, pid *)

val connect : string -> Unix.file_descr option

exception ParseError

(* Intended to be used with input_line and output_string *)
val parse_request  : string -> request
val parse_response : string -> response

val print_request  : request -> string
val print_response : response -> string