Lines Matching refs:cons
34 let add_anonymous cons fd _can_write =
37 Hashtbl.add cons.anonymous (Xenbus.Xb.get_fd xbcon) con
39 let add_domain cons dom =
42 Hashtbl.add cons.domains (Domain.get_id dom) con;
44 | Some p -> Hashtbl.add cons.ports p con;
47 let select ?(only_if = (fun _ -> true)) cons =
54 cons.anonymous ([], [])
56 let find cons =
57 Hashtbl.find cons.anonymous
59 let find_domain cons =
60 Hashtbl.find cons.domains
62 let find_domain_by_port cons port =
63 Hashtbl.find cons.ports port
70 let del_anonymous cons con =
72 Hashtbl.remove cons.anonymous (Connection.get_fd con);
73 cons.watches <- Trie.map (del_watches_of_con con) cons.watches;
78 let del_domain cons id =
80 let con = find_domain cons id in
81 Hashtbl.remove cons.domains id;
85 | Some p -> Hashtbl.remove cons.ports p
88 cons.watches <- Trie.map (del_watches_of_con con) cons.watches;
93 let iter_domains cons fct =
94 Hashtbl.iter (fun _ c -> fct c) cons.domains
96 let iter_anonymous cons fct =
97 Hashtbl.iter (fun _ c -> fct c) cons.anonymous
99 let iter cons fct =
100 iter_domains cons fct; iter_anonymous cons fct
102 let has_more_work cons =
106 cons.domains []
116 let add_watch cons con path token =
120 if Trie.mem cons.watches key
121 then Trie.find cons.watches key
124 cons.watches <- Trie.set cons.watches key (watch :: watches);
127 let del_watch cons con path token =
130 let watches = Utils.list_remove watch (Trie.find cons.watches key) in
132 cons.watches <- Trie.unset cons.watches key
134 cons.watches <- Trie.set cons.watches key watches;
137 let del_watches cons con =
139 cons.watches <- Trie.map (del_watches_of_con con) cons.watches
142 let fire_watches ?oldroot root cons path recurse =
155 Trie.iter_path fire_watch cons.watches key;
157 Trie.iter fire_rec (Trie.sub cons.watches key)
159 let fire_spec_watches root cons specpath =
160 iter cons (fun con ->
163 let set_target cons domain target_domain =
164 let con = find_domain cons domain in
167 let number_of_transactions cons =
172 iter cons aux;
175 let stats cons =
180 iter_anonymous cons (fun con ->
185 iter_domains cons (fun con ->
190 (Hashtbl.length cons.anonymous, !nb_ops_anon, !nb_watchs_anon,
191 Hashtbl.length cons.domains, !nb_ops_dom, !nb_watchs_dom)
193 let debug cons =
194 let anonymous = Hashtbl.fold (fun _ con accu -> Connection.debug con :: accu) cons.anonymous [] in
195 let domains = Hashtbl.fold (fun _ con accu -> Connection.debug con :: accu) cons.domains [] in