-
Notifications
You must be signed in to change notification settings - Fork 1
/
protocol.mli
57 lines (40 loc) · 1.91 KB
/
protocol.mli
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
51
52
53
54
55
56
57
(**************************************************************************)
(* *)
(* Functory: a distributed computing library for Ocaml *)
(* Copyright (C) 2010 Jean-Christophe Filliatre and Kalyan Krishnamani *)
(* *)
(* This software is free software; you can redistribute it and/or *)
(* modify it under the terms of the GNU Library General Public *)
(* License version 2.1, with the special exception on linking *)
(* described in file LICENSE. *)
(* *)
(* This software is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *)
(* *)
(**************************************************************************)
(** The master/worker protocol. *)
val set_magic_number : int -> unit
(** if you need to change the default magic number *)
exception BadMagicNumber
exception BadProtocol
(** Note: All IDs are assigned by the master *)
module Master : sig
type t =
| Assign of int * string * string (* id, function, argument *)
| Kill of int (* id *)
| Stop of string
| Ping
val send : Unix.file_descr -> t -> unit
val receive : Unix.file_descr -> t
val print : Format.formatter -> t -> unit
end
module Worker : sig
type t =
| Pong
| Completed of int * string (* id, result *)
| Aborted of int (* id *)
val send : Unix.file_descr -> t -> unit
val receive : Unix.file_descr -> t
val print : Format.formatter -> t -> unit
end