Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / html / python / lib / node76.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="next" href="node77.html" />
13<link rel="prev" href="module-shelve.html" />
14<link rel="parent" href="module-shelve.html" />
15<link rel="next" href="node77.html" />
16<meta name='aesop' content='information' />
17<title>3.17.1 Restrictions</title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="3.17 shelve "
25 href="module-shelve.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="3.17 shelve "
28 href="module-shelve.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="3.17.2 Example"
31 href="node77.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Library Reference</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
38 border='0' height='32' alt='Module Index' width='32' /></a></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="module-shelve.html">3.17 shelve </A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="module-shelve.html">3.17 shelve </A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="node77.html">3.17.2 Example</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H2><A NAME="SECTION0051710000000000000000">
563.17.1 Restrictions</A>
57</H2>
58
59<P>
60
61<UL>
62<LI>The choice of which database package will be used
63(such as <tt class="module"><a href="module-dbm.html">dbm</a></tt>, <tt class="module"><a href="module-gdbm.html">gdbm</a></tt> or <tt class="module"><a href="module-bsddb.html">bsddb</a></tt>) depends on
64which interface is available. Therefore it is not safe to open the database
65directly using <tt class="module"><a href="module-dbm.html">dbm</a></tt>. The database is also (unfortunately) subject
66to the limitations of <tt class="module"><a href="module-dbm.html">dbm</a></tt>, if it is used -- this means
67that (the pickled representation of) the objects stored in the
68database should be fairly small, and in rare cases key collisions may
69cause the database to refuse updates.
70<a id='l2h-672' xml:id='l2h-672'></a>
71
72<P>
73</LI>
74<LI>Depending on the implementation, closing a persistent dictionary may
75or may not be necessary to flush changes to disk. The <tt class="method">__del__</tt>
76method of the <tt class="class">Shelf</tt> class calls the <tt class="method">close</tt> method, so the
77programmer generally need not do this explicitly.
78
79<P>
80</LI>
81<LI>The <tt class="module">shelve</tt> module does not support <em>concurrent</em> read/write
82access to shelved objects. (Multiple simultaneous read accesses are
83safe.) When a program has a shelf open for writing, no other program
84should have it open for reading or writing. <span class="Unix">Unix</span> file locking can
85be used to solve this, but this differs across <span class="Unix">Unix</span> versions and
86requires knowledge about the database implementation used.
87
88<P>
89</LI>
90</UL>
91
92<P>
93<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
94 <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-669' xml:id='l2h-669' class="class">Shelf</tt></b>(</nobr></td>
95 <td><var>dict</var><big>[</big><var>, protocol=None</var><big>[</big><var>, writeback=False</var><big>[</big><var>, binary=None</var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
96<dd>
97A subclass of <tt class="class">UserDict.DictMixin</tt> which stores pickled values in the
98<var>dict</var> object.
99
100<P>
101By default, version 0 pickles are used to serialize values. The
102version of the pickle protocol can be specified with the
103<var>protocol</var> parameter. See the <tt class="module">pickle</tt> documentation for a
104discussion of the pickle protocols.
105<span class="versionnote">Changed in version 2.3:
106The <var>protocol</var>
107parameter was added. The <var>binary</var> parameter is deprecated and
108provided for backwards compatibility only.</span>
109
110<P>
111If the <var>writeback</var> parameter is <code>True</code>, the object will hold a
112cache of all entries accessed and write them back to the <var>dict</var> at
113sync and close times. This allows natural operations on mutable entries,
114but can consume much more memory and make sync and close take a long time.
115</dl>
116
117<P>
118<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
119 <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-670' xml:id='l2h-670' class="class">BsdDbShelf</tt></b>(</nobr></td>
120 <td><var>dict</var><big>[</big><var>, protocol=None</var><big>[</big><var>, writeback=False</var><big>[</big><var>, binary=None</var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
121<dd>
122
123<P>
124A subclass of <tt class="class">Shelf</tt> which exposes <tt class="method">first</tt>,
125<tt class="method">next</tt>, <tt class="method">previous</tt>, <tt class="method">last</tt> and
126<tt class="method">set_location</tt> which are available in the <tt class="module">bsddb</tt> module
127but not in other database modules. The <var>dict</var> object passed to
128the constructor must support those methods. This is generally
129accomplished by calling one of <tt class="function">bsddb.hashopen</tt>,
130<tt class="function">bsddb.btopen</tt> or <tt class="function">bsddb.rnopen</tt>. The optional
131<var>protocol</var>, <var>writeback</var>, and <var>binary</var> parameters have the
132same interpretation as for the <tt class="class">Shelf</tt> class.
133
134<P>
135</dl>
136
137<P>
138<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
139 <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-671' xml:id='l2h-671' class="class">DbfilenameShelf</tt></b>(</nobr></td>
140 <td><var>filename</var><big>[</big><var>, flag='c'</var><big>[</big><var>, protocol=None</var><big>[</big><var>, writeback=False</var><big>[</big><var>, binary=None</var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
141<dd>
142
143<P>
144A subclass of <tt class="class">Shelf</tt> which accepts a <var>filename</var> instead of
145a dict-like object. The underlying file will be opened using
146<tt class="function">anydbm.open</tt>. By default, the file will be created and
147opened for both read and write. The optional <var>flag</var> parameter has
148the same interpretation as for the <tt class="function">open</tt> function. The
149optional <var>protocol</var>, <var>writeback</var>, and <var>binary</var> parameters
150have the same interpretation as for the <tt class="class">Shelf</tt> class.
151
152<P>
153</dl>
154
155<P>
156
157<DIV CLASS="navigation">
158<div class='online-navigation'>
159<p></p><hr />
160<table align="center" width="100%" cellpadding="0" cellspacing="2">
161<tr>
162<td class='online-navigation'><a rel="prev" title="3.17 shelve "
163 href="module-shelve.html"><img src='../icons/previous.png'
164 border='0' height='32' alt='Previous Page' width='32' /></A></td>
165<td class='online-navigation'><a rel="parent" title="3.17 shelve "
166 href="module-shelve.html"><img src='../icons/up.png'
167 border='0' height='32' alt='Up One Level' width='32' /></A></td>
168<td class='online-navigation'><a rel="next" title="3.17.2 Example"
169 href="node77.html"><img src='../icons/next.png'
170 border='0' height='32' alt='Next Page' width='32' /></A></td>
171<td align="center" width="100%">Python Library Reference</td>
172<td class='online-navigation'><a rel="contents" title="Table of Contents"
173 href="contents.html"><img src='../icons/contents.png'
174 border='0' height='32' alt='Contents' width='32' /></A></td>
175<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
176 border='0' height='32' alt='Module Index' width='32' /></a></td>
177<td class='online-navigation'><a rel="index" title="Index"
178 href="genindex.html"><img src='../icons/index.png'
179 border='0' height='32' alt='Index' width='32' /></A></td>
180</tr></table>
181<div class='online-navigation'>
182<b class="navlabel">Previous:</b>
183<a class="sectref" rel="prev" href="module-shelve.html">3.17 shelve </A>
184<b class="navlabel">Up:</b>
185<a class="sectref" rel="parent" href="module-shelve.html">3.17 shelve </A>
186<b class="navlabel">Next:</b>
187<a class="sectref" rel="next" href="node77.html">3.17.2 Example</A>
188</div>
189</div>
190<hr />
191<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
192</DIV>
193<!--End of Navigation Panel-->
194<ADDRESS>
195See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
196</ADDRESS>
197</BODY>
198</HTML>