a little nicer wrt pep8
[sfa.git] / docs / pythondoc-record.html
1 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
2 <html>
3 <head>
4 <meta http-equiv='Content-Type' content='text/html; charset=us-ascii' />
5 <title>The record Module</title>
6 </head>
7 <body>
8 <h1>The record Module</h1>
9 <p>Implements support for geni records
10
11 TODO: Use existing PLC database methods? or keep this separate?</p>
12 <dl>
13 <dt><b>GeniRecord(name=None, gid=None, type=None, pointer=None, dict=None)</b> (class) [<a href='#record.GeniRecord-class'>#</a>]</dt>
14 <dd>
15 <p>The GeniRecord class implements a Geni Record.</p>
16 <p>For more information about this class, see <a href='#record.GeniRecord-class'><i>The GeniRecord Class</i></a>.</p>
17 </dd>
18 </dl>
19 <h2><a id='record.GeniRecord-class' name='record.GeniRecord-class'>The GeniRecord Class</a></h2>
20 <dl>
21 <dt><b>GeniRecord(name=None, gid=None, type=None, pointer=None, dict=None)</b> (class) [<a href='#record.GeniRecord-class'>#</a>]</dt>
22 <dd>
23 <p>The GeniRecord class implements a Geni Record. A GeniRecord is a tuple
24 (Name, GID, Type, Info).
25
26 Name specifies the HRN of the object
27 GID is the GID of the object
28 Type is user | sa | ma | slice | component
29
30 Info is comprised of the following sub-fields
31        pointer = a pointer to the record in the PL database
32        pl_info = planetlab-specific info (when talking to client)
33        geni_info = geni-specific info (when talking to client)
34
35 The pointer is interpreted depending on the type of the record. For example,
36 if the type==&quot;user&quot;, then pointer is assumed to be a person_id that indexes
37 into the persons table.
38
39 A given HRN may have more than one record, provided that the records are
40 of different types. For example, planetlab.us.arizona may have both an SA
41 and a MA record, but cannot have two SA records.</p>
42 </dd>
43 <dt><a id='record.GeniRecord.as_dict-method' name='record.GeniRecord.as_dict-method'><b>as_dict()</b></a> [<a href='#record.GeniRecord.as_dict-method'>#</a>]</dt>
44 <dd>
45 <p>Return the record in the form of a dictionary</p>
46 </dd>
47 <dt><a id='record.GeniRecord.dump-method' name='record.GeniRecord.dump-method'><b>dump(dump_parents=False)</b></a> [<a href='#record.GeniRecord.dump-method'>#</a>]</dt>
48 <dd>
49 <p>Dump the record to stdout</p>
50 <dl>
51 <dt><i>dump_parents</i></dt>
52 <dd>
53 if true, then the parents of the GID will be dumped</dd>
54 </dl><br />
55 </dd>
56 <dt><a id='record.GeniRecord.get_field_names-method' name='record.GeniRecord.get_field_names-method'><b>get_field_names()</b></a> [<a href='#record.GeniRecord.get_field_names-method'>#</a>]</dt>
57 <dd>
58 <p>Returns a list of field names in this record. pl_info, geni_info are not
59 included because they are not part of the record that is stored in the
60 database, but are rather computed values from other entities</p>
61 </dd>
62 <dt><a id='record.GeniRecord.get_field_value_string-method' name='record.GeniRecord.get_field_value_string-method'><b>get_field_value_string(fieldname)</b></a> [<a href='#record.GeniRecord.get_field_value_string-method'>#</a>]</dt>
63 <dd>
64 <p>Given a field name (&quot;name&quot;, &quot;gid&quot;, ...) return the value of that field.</p>
65 <dl>
66 <dt><i>name</i></dt>
67 <dd>
68 is the name of field to be returned</dd>
69 </dl><br />
70 </dd>
71 <dt><a id='record.GeniRecord.get_field_value_strings-method' name='record.GeniRecord.get_field_value_strings-method'><b>get_field_value_strings(fieldnames)</b></a> [<a href='#record.GeniRecord.get_field_value_strings-method'>#</a>]</dt>
72 <dd>
73 <p>Given a list of field names, return a list of values for those fields.</p>
74 <dl>
75 <dt><i>fieldnames</i></dt>
76 <dd>
77 is a list of field names</dd>
78 </dl><br />
79 </dd>
80 <dt><a id='record.GeniRecord.get_geni_info-method' name='record.GeniRecord.get_geni_info-method'><b>get_geni_info()</b></a> [<a href='#record.GeniRecord.get_geni_info-method'>#</a>]</dt>
81 <dd>
82 <p>Return the geni_info of the record, or an empty dictionary if none exists</p>
83 </dd>
84 <dt><a id='record.GeniRecord.get_gid_object-method' name='record.GeniRecord.get_gid_object-method'><b>get_gid_object()</b></a> [<a href='#record.GeniRecord.get_gid_object-method'>#</a>]</dt>
85 <dd>
86 <p>Return the GID of the record, in the form of a GID object
87 TODO: not the best name for the function, because we have things called
88 gidObjects in the Cred</p>
89 </dd>
90 <dt><a id='record.GeniRecord.get_key-method' name='record.GeniRecord.get_key-method'><b>get_key()</b></a> [<a href='#record.GeniRecord.get_key-method'>#</a>]</dt>
91 <dd>
92 <p>Return a key that uniquely identifies this record among all records in
93 Geni. This key is used to uniquely identify the record in the Geni
94 database.</p>
95 </dd>
96 <dt><a id='record.GeniRecord.get_name-method' name='record.GeniRecord.get_name-method'><b>get_name()</b></a> [<a href='#record.GeniRecord.get_name-method'>#</a>]</dt>
97 <dd>
98 <p>Return the name (HRN) of the record</p>
99 </dd>
100 <dt><a id='record.GeniRecord.get_pl_info-method' name='record.GeniRecord.get_pl_info-method'><b>get_pl_info()</b></a> [<a href='#record.GeniRecord.get_pl_info-method'>#</a>]</dt>
101 <dd>
102 <p>Return the pl_info of the record, or an empty dictionary if none exists</p>
103 </dd>
104 <dt><a id='record.GeniRecord.get_pointer-method' name='record.GeniRecord.get_pointer-method'><b>get_pointer()</b></a> [<a href='#record.GeniRecord.get_pointer-method'>#</a>]</dt>
105 <dd>
106 <p>Return the pointer of the record. The pointer is an integer that may be
107 used to look up the record in the PLC database. The evaluation of pointer
108 depends on the type of the record</p>
109 </dd>
110 <dt><a id='record.GeniRecord.get_type-method' name='record.GeniRecord.get_type-method'><b>get_type()</b></a> [<a href='#record.GeniRecord.get_type-method'>#</a>]</dt>
111 <dd>
112 <p>Return the type of the record</p>
113 </dd>
114 <dt><a id='record.GeniRecord.set_geni_info-method' name='record.GeniRecord.set_geni_info-method'><b>set_geni_info(geni_info)</b></a> [<a href='#record.GeniRecord.set_geni_info-method'>#</a>]</dt>
115 <dd>
116 <p>Set the geni info the record</p>
117 <dl>
118 <dt><i>geni_info</i></dt>
119 <dd>
120 is a dictionary containing geni info</dd>
121 </dl><br />
122 </dd>
123 <dt><a id='record.GeniRecord.set_gid-method' name='record.GeniRecord.set_gid-method'><b>set_gid(gid)</b></a> [<a href='#record.GeniRecord.set_gid-method'>#</a>]</dt>
124 <dd>
125 <p>Set the GID of the record</p>
126 <dl>
127 <dt><i>gid</i></dt>
128 <dd>
129 is a GID object or the string representation of a GID object</dd>
130 </dl><br />
131 </dd>
132 <dt><a id='record.GeniRecord.set_name-method' name='record.GeniRecord.set_name-method'><b>set_name(name)</b></a> [<a href='#record.GeniRecord.set_name-method'>#</a>]</dt>
133 <dd>
134 <p>Set the name of the record</p>
135 <dl>
136 <dt><i>name</i></dt>
137 <dd>
138 is a string containing the HRN</dd>
139 </dl><br />
140 </dd>
141 <dt><a id='record.GeniRecord.set_pl_info-method' name='record.GeniRecord.set_pl_info-method'><b>set_pl_info(pl_info)</b></a> [<a href='#record.GeniRecord.set_pl_info-method'>#</a>]</dt>
142 <dd>
143 <p>Set the PLC info of the record</p>
144 <dl>
145 <dt><i>pl_info</i></dt>
146 <dd>
147 is a dictionary containing planetlab info</dd>
148 </dl><br />
149 </dd>
150 <dt><a id='record.GeniRecord.set_pointer-method' name='record.GeniRecord.set_pointer-method'><b>set_pointer(pointer)</b></a> [<a href='#record.GeniRecord.set_pointer-method'>#</a>]</dt>
151 <dd>
152 <p>Set the pointer of the record</p>
153 <dl>
154 <dt><i>pointer</i></dt>
155 <dd>
156 is an integer containing the ID of a PLC record</dd>
157 </dl><br />
158 </dd>
159 <dt><a id='record.GeniRecord.set_type-method' name='record.GeniRecord.set_type-method'><b>set_type(type)</b></a> [<a href='#record.GeniRecord.set_type-method'>#</a>]</dt>
160 <dd>
161 <p>Set the type of the record</p>
162 <dl>
163 <dt><i>type</i></dt>
164 <dd>
165 is a string: user | sa | ma | slice | component</dd>
166 </dl><br />
167 </dd>
168 </dl>
169 </body></html>