Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 77 lines (61 sloc) 2.431 kB
fccc685 Initial open-source release
MLstate authored
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 (*
19 @author Adam Koprowski
20 **)
21
22 (**
23 * This module builds on the Cluster module and provides communication
24 * primitives for all nodes in the cluster (using UDP)
25 *)
26
27 (**
28 * A type of a cluster (i.e. a collection of servers)
29 *)
30 type ('out', 'in') t
31
32 type addr = Unix.sockaddr
33
34 (**
35 * Initializes a cluster. Takes an addr of the machine running
36 * this function and of all the other machines in the cluster.
37 *
38 * WARNING: all the machines in a cluster must run this function
39 * consistently (i.e. with the same group of addresses), which then
40 * ensures that the process identifiers will be unique and correct.
41 *)
42 (* FIXME, This of course is no good, big time. In the future we want
43 a less painful way to set-up a cluster & in the long run,
44 we want a cluster with re-configuration capabilities. *)
45 val init : protocol:NetAddr.protocol -> Scheduler.t -> ?me:addr -> addr list -> ('out', 'in') t
46
47 val init_from : protocol:NetAddr.protocol -> Scheduler.t -> Cluster.t -> ('out', 'in') t
48
49 (* FIXME, allow easy recognition of node_ids for messages from within the cluster *)
50 val register_msg_handler : ('out', 'in') t -> (('out', 'in') t -> addr -> 'in' -> unit) -> unit
51
52 (**
53 * Cluster clean-up; closes all channels etc.
54 *)
55 val close : ('out', 'in') t -> unit
56
57 (**
58 * Returns the cluster structure.
59 *)
60 val get_cluster : ('out', 'in') t -> Cluster.t
61
62 (**
63 * Sends a value to a machine with given id.
64 *)
65 val send : ('out', 'in') t -> Cluster.node_id -> 'out' -> unit Cps.t
66
67 (**
68 * Sends a value to a given address (possibly of a machine
69 * outside of the cluster.
70 *)
71 val send_to : ('out', 'in') t -> addr -> 'out' -> unit Cps.t
72
73 (**
74 * Sends a value to all the machines in the cluster.
75 *)
76 val broadcast : ?including_myself:bool -> ('out', 'in') t -> 'out' -> unit Cps.t
Something went wrong with that request. Please try again.