Random changes.
[virt-ctrl.git] / virt-ctrl / vc_connections.mli
1 (* virt-ctrl: A graphical management tool.
2    (C) Copyright 2007 Richard W.M. Jones, Red Hat Inc.
3    http://libvirt.org/
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2 of the License, or
8    (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19    Handle connections and the complicated GtkTreeView which
20    displays the connections / domains.
21 *)
22
23 (** Get the list of current connections. *)
24 val get_conns : unit -> (int * Libvirt.rw Libvirt.Connect.t) list
25
26 (** The current/previous state last time repopulate was called.  The
27     repopulate function uses this state to determine what has changed
28     (eg. domains added, removed) since last time.
29 *)
30 type state
31
32 type columns = string GTree.column * string GTree.column * string GTree.column * string GTree.column * string GTree.column * int GTree.column
33
34 (** This function should be called once per second in order to
35     redraw the GtkTreeView.
36
37     Takes the previous state as a parameter and returns the new state.
38 *)
39 val repopulate : GTree.view -> GTree.tree_store -> columns -> state -> state
40
41 (** Create the GtkTreeView.  Returns the widget itself, the model,
42     the list of columns, and the initial state.
43 *)
44 val make_treeview :
45   ?packing:(GObj.widget -> unit) -> unit ->
46     GTree.view * GTree.tree_store * columns * state
47
48 (** Open a new connection to the hypervisor URI given. *)
49 val open_connection : string -> unit
50
51 (** Get node info, hostname, URI and capabilities from a connection. *)
52 val get_node_info : int -> Libvirt.Connect.node_info
53 val get_hostname : int -> string option
54 val get_uri : int -> string
55 val get_capabilities : int -> Xml.xml option
56
57 (** Return the amount of historical data that we hold about a
58     domain (in seconds).
59
60     The parameters are connection ID (see {!get_conns}) and domain ID.
61
62     This can return from [0] to [86400] (or 1 day of data).
63 *)
64 val get_hist_size : int -> int -> int
65
66 (** Return a slice of historical %CPU data about a domain.
67
68     The required parameters are connection ID (see {!get_conns})
69     and domain ID.
70
71     The optional [latest] parameter is the latest data we should
72     return.  It defaults to [0] meaning to return everything up to now.
73
74     The optional [earliest] parameter is the earliest data we should
75     return.  This is a positive number representing number of seconds
76     back in time.  It defaults to returning all data.
77
78     The optional [granularity] parameter is the granularity of data
79     that we should return, in seconds.  This defaults to [1], meaning
80     to return all data (once per second), but you might for example
81     set this to [60] to return data for each minute.
82
83     This returns an array of data.  The first element of the array is
84     the oldest data.  The last element of the array is the most recent
85     data.  The array returned might be shorter than you expect (if
86     data is missing or for some other reason) so always check the
87     length.
88
89     Entries in the array are clamped to [0..100], except that if an
90     entry is [-1] it means "no data".
91
92     This returns a zero-length array if we don't know about the domain.
93 *)
94 val get_hist_cpu : ?latest:int -> ?earliest:int -> ?granularity:int ->
95   int -> int ->
96   int array
97
98 (** Return a slice of historical memory data about a domain.
99
100     Parameters as above.
101
102     Entries in the array are 64 bit integers corresponding to the
103     amount of memory in KB allocated to the domain (not necessarily
104     the amount being used, which we don't know about).
105 *)
106 val get_hist_mem : ?latest:int -> ?earliest:int -> ?granularity:int ->
107   int -> int ->
108   int64 array