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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
(***********************************************************************)
(* *)
(* Objective Caml *)
(* *)
(* Luc Maranget, projet Moscova, INRIA Rocquencourt *)
(* *)
(* Copyright 2004 Institut National de Recherche en Informatique et *)
(* en Automatique. All rights reserved. This file is distributed *)
(* under the terms of the Q Public License version 1.0. *)
(* *)
(***********************************************************************)
(* $Id: join_types.mli 7746 2006-11-20 16:47:41Z maranget $ *)
(******************)
(* Local automata *)
(******************)
(* Status managers *)
type 'a status =
{
set : int -> bool ; (* set bit, answers true when bit was unset *)
erase : int -> unit ; (* unset bit *)
includes : 'a -> bool ;
to_string : unit -> string ; (* for debug *)
}
(* Local automaton *)
type queue = Obj.t
type automaton = {
status : Obj.t status ;
mutex : Mutex.t ;
queues : queue array ;
mutable matches : reaction array ;
names : string array ; (* For debug, channel names *)
}
and reaction = Obj.t * int * (Obj.t -> Obj.t)
type kval = Start | Go of (unit -> Obj.t) | Ret of Obj.t | Exn of exn
type continuation =
{ kmutex : Mutex.t ;
kcondition : Condition.t ;
mutable kval : kval }
(*******************)
(* Remote pointers *)
(*******************)
type t_uniq = int * float
type space_id = { host : string ; uniq : t_uniq ; }
type service = space_id * string
type t_global= space_id * int (* value names in network *)
type chan_id = {auto_id:int ; chan_id:int}
and kont_id = int
and alone_id = int
and parameter = string * t_global array
type message =
| AsyncSend of chan_id * parameter
| AloneSend of alone_id * parameter
| SyncSend of chan_id * kont_id * parameter
| AloneSyncSend of alone_id * kont_id * parameter
| ReplySend of kont_id * parameter
| ReplyExn of kont_id * exn
(* Like AloneSyncSend, except that function is given by name *)
| Service of string * kont_id * parameter
(* Stubs for handling localized 'values' (eg join-definitions)
They are implemented trough JoCustom blocks *)
(* custom ops, cf join.c *)
type ops
type stub_tag = Local | Remote
(* Either local value/remote space description *)
type stub_val
type stub =
{
ops : ops ;
stub_tag : stub_tag ;
mutable stub_val : stub_val ;
mutable uid : int ; (* identity in space *)
}
(*
If stub_tag is Local
- The site name (local space) is not present in stub.
- stub_val is the localized value (well pointer to it).
- uid=0 means that the stub has not been exported yet.
If stub_tag is Remote
- the stub stands for value uid at (remote) space stub_val
*)
(* internal structure for channels *)
type 'a async =
Async of stub * int
| Alone of stub * string
type route = Unix.sockaddr
type link =
| NoConnection of Mutex.t
| Connecting of Mutex.t * Condition.t
| Connected of Join_link.t * Mutex.t
| DeadConnection
type remote_space =
{
rspace_id : space_id ;
next_kid : unit -> int ;
replies_pending : Join_misc.counter ;
konts : (int, continuation) Join_hash.t ;
originator : space_id ;
route : route Join_set.t ;
mutable link : link ;
write_mtx : Mutex.t ;
mutable hooks : unit async list
}
type listener =
| Deaf of Mutex.t
| Listen of Unix.sockaddr Join_set.t
type space =
{
space_id : space_id ;
uid_mutex : Mutex.t ;
next_uid : unit -> int ;
uid2local : (int, stub_val) Join_hash.t ;
remote_spaces : (space_id, remote_space) Join_hash.t ;
services : (string, int) Join_hash.t ;
mutable listener : listener ;
}
|