1(*
2 * Copyright (C) 2006-2007 XenSource Ltd.
3 * Copyright (C) 2008      Citrix Ltd.
4 * Author Thomas Gazagnaire <thomas.gazagnaire@eu.citrix.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation; version 2.1 only. with the special
9 * exception on linking described in file LICENSE.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU Lesser General Public License for more details.
15 *)
16
17(** Node names *)
18
19(** Xenstore nodes names are often the same, ie. "local", "domain", "device", ... so it is worth to
20    manipulate them through the use of small identifiers that we call symbols. These symbols can be
21    compared in constant time (as opposite to strings) and should help the ocaml GC. *)
22
23type t
24(** The type of symbols. *)
25
26val of_string : string -> t
27(** Convert a string into a symbol. *)
28
29val to_string : t -> string
30(** Convert a symbol into a string. *)
31
32(** {6 Garbage Collection} *)
33
34(** Symbols need to be regulary garbage collected. The following steps should be followed:
35-     mark all the knowns symbols as unused (with [mark_all_as_unused]);
36-     mark all the symbols really usefull as used (with [mark_as_used]); and
37-     finally, call [garbage] *)
38
39val mark_all_as_unused : unit -> unit
40val mark_as_used : t -> unit
41val garbage : unit -> unit
42
43(** {6 Statistics } *)
44
45val stats : unit -> int
46(** Get the number of used symbols. *)
47
48val created : unit -> int
49(** Returns the number of symbols created since the last GC. *)
50
51val used : unit -> int
52(** Returns the number of existing symbols used since the last GC *)
53