/usr/share/doc/python-pymongo-doc/html/api/pymongo/master_slave_connection.html is in python-pymongo-doc 2.6.3-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>master_slave_connection – Master-slave connection to MongoDB — PyMongo 2.6.3 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2.6.3',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/sidebar.js"></script>
<link rel="top" title="PyMongo 2.6.3 documentation" href="../../index.html" />
<link rel="up" title="pymongo – Python driver for MongoDB" href="index.html" />
<link rel="next" title="message – Tools for creating messages to be sent to MongoDB" href="message.html" />
<link rel="prev" title="errors – Exceptions raised by the pymongo package" href="errors.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="message.html" title="message – Tools for creating messages to be sent to MongoDB"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="errors.html" title="errors – Exceptions raised by the pymongo package"
accesskey="P">previous</a> |</li>
<li><a href="../../index.html">PyMongo 2.6.3 documentation</a> »</li>
<li><a href="../index.html" >API Documentation</a> »</li>
<li><a href="index.html" accesskey="U"><tt class="docutils literal"><span class="pre">pymongo</span></tt> – Python driver for MongoDB</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="module-pymongo.master_slave_connection">
<span id="master-slave-connection-master-slave-connection-to-mongodb"></span><h1><tt class="xref py py-mod docutils literal"><span class="pre">master_slave_connection</span></tt> – Master-slave connection to MongoDB<a class="headerlink" href="#module-pymongo.master_slave_connection" title="Permalink to this headline">¶</a></h1>
<p>Master-Slave connection to Mongo.</p>
<p>Performs all writes to Master instance and distributes reads among all
slaves. Reads are tried on each slave in turn until the read succeeds
or all slaves failed.</p>
<dl class="class">
<dt id="pymongo.master_slave_connection.MasterSlaveConnection">
<em class="property">class </em><tt class="descclassname">pymongo.master_slave_connection.</tt><tt class="descname">MasterSlaveConnection</tt><big>(</big><em>master</em>, <em>slaves=</em><span class="optional">[</span><span class="optional">]</span>, <em>document_class=<type 'dict'></em>, <em>tz_aware=False</em><big>)</big><a class="headerlink" href="#pymongo.master_slave_connection.MasterSlaveConnection" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a new Master-Slave connection.</p>
<p>The resultant connection should be interacted with using the same
mechanisms as a regular <cite>MongoClient</cite>. The <cite>MongoClient</cite> instances used
to create this <cite>MasterSlaveConnection</cite> can themselves make use of
connection pooling, etc. <cite>MongoClient</cite> instances used as slaves should
be created with the read_preference option set to
<tt class="xref py py-attr docutils literal"><span class="pre">SECONDARY</span></tt>. Write
concerns are inherited from <cite>master</cite> and can be changed in this
instance.</p>
<p>Raises TypeError if <cite>master</cite> is not an instance of <cite>MongoClient</cite> or
slaves is not a list of at least one <cite>MongoClient</cite> instances.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><cite>master</cite>: <cite>MongoClient</cite> instance for the writable Master</li>
<li><cite>slaves</cite>: list of <cite>MongoClient</cite> instances for the
read-only slaves</li>
<li><cite>document_class</cite> (optional): default class to use for
documents returned from queries on this connection</li>
<li><cite>tz_aware</cite> (optional): if <tt class="docutils literal"><span class="pre">True</span></tt>,
<tt class="xref py py-class docutils literal"><span class="pre">datetime</span></tt> instances returned as values
in a document by this <a class="reference internal" href="#pymongo.master_slave_connection.MasterSlaveConnection" title="pymongo.master_slave_connection.MasterSlaveConnection"><tt class="xref py py-class docutils literal"><span class="pre">MasterSlaveConnection</span></tt></a> will be timezone
aware (otherwise they will be naive)</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="pymongo.master_slave_connection.MasterSlaveConnection.safe">
<tt class="descname">safe</tt><a class="headerlink" href="#pymongo.master_slave_connection.MasterSlaveConnection.safe" title="Permalink to this definition">¶</a></dt>
<dd><p><strong>DEPRECATED:</strong> Use the ‘w’ <tt class="xref py py-attr docutils literal"><span class="pre">write_concern</span></tt> option instead.</p>
<p>Use getlasterror with every write operation?</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.0.</span></p>
</div>
</dd></dl>
<dl class="method">
<dt id="pymongo.master_slave_connection.MasterSlaveConnection.get_lasterror_options">
<tt class="descname">get_lasterror_options</tt><big>(</big><big>)</big><a class="headerlink" href="#pymongo.master_slave_connection.MasterSlaveConnection.get_lasterror_options" title="Permalink to this definition">¶</a></dt>
<dd><p>DEPRECATED: Use <tt class="xref py py-attr docutils literal"><span class="pre">write_concern</span></tt> instead.</p>
<p>Returns a dict of the getlasterror options set on this instance.</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 2.4: </span>Deprecated get_lasterror_options.</p>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.0.</span></p>
</div>
</dd></dl>
<dl class="method">
<dt id="pymongo.master_slave_connection.MasterSlaveConnection.set_lasterror_options">
<tt class="descname">set_lasterror_options</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#pymongo.master_slave_connection.MasterSlaveConnection.set_lasterror_options" title="Permalink to this definition">¶</a></dt>
<dd><p>DEPRECATED: Use <tt class="xref py py-attr docutils literal"><span class="pre">write_concern</span></tt> instead.</p>
<p>Set getlasterror options for this instance.</p>
<p>Valid options include j=<bool>, w=<int/string>, wtimeout=<int>,
and fsync=<bool>. Implies safe=True.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last">
<li><dl class="first docutils">
<dt><cite>**kwargs</cite>: Options should be passed as keyword</dt>
<dd><p class="first last">arguments (e.g. w=2, fsync=True)</p>
</dd>
</dl>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 2.4: </span>Deprecated set_lasterror_options.</p>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.0.</span></p>
</div>
</dd></dl>
<dl class="method">
<dt id="pymongo.master_slave_connection.MasterSlaveConnection.unset_lasterror_options">
<tt class="descname">unset_lasterror_options</tt><big>(</big><em>*options</em><big>)</big><a class="headerlink" href="#pymongo.master_slave_connection.MasterSlaveConnection.unset_lasterror_options" title="Permalink to this definition">¶</a></dt>
<dd><p>DEPRECATED: Use <tt class="xref py py-attr docutils literal"><span class="pre">write_concern</span></tt> instead.</p>
<p>Unset getlasterror options for this instance.</p>
<p>If no options are passed unsets all getlasterror options.
This does not set <cite>safe</cite> to False.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><cite>*options</cite>: The list of options to unset.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 2.4: </span>Deprecated unset_lasterror_options.</p>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.0.</span></p>
</div>
</dd></dl>
<dl class="method">
<dt id="pymongo.master_slave_connection.MasterSlaveConnection.close_cursor">
<tt class="descname">close_cursor</tt><big>(</big><em>cursor_id</em>, <em>connection_id</em><big>)</big><a class="headerlink" href="#pymongo.master_slave_connection.MasterSlaveConnection.close_cursor" title="Permalink to this definition">¶</a></dt>
<dd><p>Close a single database cursor.</p>
<p>Raises TypeError if cursor_id is not an instance of (int, long). What
closing the cursor actually means depends on this connection’s cursor
manager.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><cite>cursor_id</cite>: cursor id to close</li>
<li><cite>connection_id</cite>: id of the <cite>MongoClient</cite> instance where the cursor
was opened</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pymongo.master_slave_connection.MasterSlaveConnection.database_names">
<tt class="descname">database_names</tt><big>(</big><big>)</big><a class="headerlink" href="#pymongo.master_slave_connection.MasterSlaveConnection.database_names" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a list of all database names.</p>
</dd></dl>
<dl class="method">
<dt id="pymongo.master_slave_connection.MasterSlaveConnection.disconnect">
<tt class="descname">disconnect</tt><big>(</big><big>)</big><a class="headerlink" href="#pymongo.master_slave_connection.MasterSlaveConnection.disconnect" title="Permalink to this definition">¶</a></dt>
<dd><p>Disconnect from MongoDB.</p>
<p>Disconnecting will call disconnect on all master and slave
connections.</p>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last">Module <a class="reference internal" href="mongo_client.html#module-pymongo.mongo_client" title="pymongo.mongo_client: Tools for connecting to MongoDB"><tt class="xref py py-mod docutils literal"><span class="pre">mongo_client</span></tt></a></p>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 1.10.1.</span></p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="pymongo.master_slave_connection.MasterSlaveConnection.document_class">
<tt class="descname">document_class</tt><a class="headerlink" href="#pymongo.master_slave_connection.MasterSlaveConnection.document_class" title="Permalink to this definition">¶</a></dt>
<dd><p>Default class to use for documents
returned on this connection.</p>
</dd></dl>
<dl class="method">
<dt id="pymongo.master_slave_connection.MasterSlaveConnection.drop_database">
<tt class="descname">drop_database</tt><big>(</big><em>name_or_database</em><big>)</big><a class="headerlink" href="#pymongo.master_slave_connection.MasterSlaveConnection.drop_database" title="Permalink to this definition">¶</a></dt>
<dd><p>Drop a database.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><cite>name_or_database</cite>: the name of a database to drop or the object
itself</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pymongo.master_slave_connection.MasterSlaveConnection.end_request">
<tt class="descname">end_request</tt><big>(</big><big>)</big><a class="headerlink" href="#pymongo.master_slave_connection.MasterSlaveConnection.end_request" title="Permalink to this definition">¶</a></dt>
<dd><p>End the current “request”.</p>
<p>See documentation for <cite>MongoClient.end_request</cite>.</p>
</dd></dl>
<dl class="attribute">
<dt id="pymongo.master_slave_connection.MasterSlaveConnection.is_mongos">
<tt class="descname">is_mongos</tt><a class="headerlink" href="#pymongo.master_slave_connection.MasterSlaveConnection.is_mongos" title="Permalink to this definition">¶</a></dt>
<dd><p>If this MasterSlaveConnection is connected to mongos (always False)</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.3.</span></p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="pymongo.master_slave_connection.MasterSlaveConnection.max_bson_size">
<tt class="descname">max_bson_size</tt><a class="headerlink" href="#pymongo.master_slave_connection.MasterSlaveConnection.max_bson_size" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the maximum size BSON object the connected master
accepts in bytes. Defaults to 4MB in server < 1.7.4.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.6.</span></p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="pymongo.master_slave_connection.MasterSlaveConnection.max_message_size">
<tt class="descname">max_message_size</tt><a class="headerlink" href="#pymongo.master_slave_connection.MasterSlaveConnection.max_message_size" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the maximum message size the connected master
accepts in bytes.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.6.</span></p>
</div>
</dd></dl>
<dl class="method">
<dt id="pymongo.master_slave_connection.MasterSlaveConnection.set_cursor_manager">
<tt class="descname">set_cursor_manager</tt><big>(</big><em>manager_class</em><big>)</big><a class="headerlink" href="#pymongo.master_slave_connection.MasterSlaveConnection.set_cursor_manager" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the cursor manager for this connection.</p>
<p>Helper to set cursor manager for each individual <cite>MongoClient</cite> instance
that make up this <cite>MasterSlaveConnection</cite>.</p>
</dd></dl>
<dl class="method">
<dt id="pymongo.master_slave_connection.MasterSlaveConnection.start_request">
<tt class="descname">start_request</tt><big>(</big><big>)</big><a class="headerlink" href="#pymongo.master_slave_connection.MasterSlaveConnection.start_request" title="Permalink to this definition">¶</a></dt>
<dd><p>Start a “request”.</p>
<p>Start a sequence of operations in which order matters. Note
that all operations performed within a request will be sent
using the Master connection.</p>
</dd></dl>
<dl class="attribute">
<dt id="pymongo.master_slave_connection.MasterSlaveConnection.use_greenlets">
<tt class="descname">use_greenlets</tt><a class="headerlink" href="#pymongo.master_slave_connection.MasterSlaveConnection.use_greenlets" title="Permalink to this definition">¶</a></dt>
<dd><p>Whether calling <a class="reference internal" href="#pymongo.master_slave_connection.MasterSlaveConnection.start_request" title="pymongo.master_slave_connection.MasterSlaveConnection.start_request"><tt class="xref py py-meth docutils literal"><span class="pre">start_request()</span></tt></a> assigns greenlet-local,
rather than thread-local, sockets.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.4.2.</span></p>
</div>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="errors.html"
title="previous chapter"><tt class="docutils literal"><span class="pre">errors</span></tt> – Exceptions raised by the <tt class="docutils literal"><span class="pre">pymongo</span></tt> package</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="message.html"
title="next chapter"><tt class="docutils literal"><span class="pre">message</span></tt> – Tools for creating messages to be sent to MongoDB</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../_sources/api/pymongo/master_slave_connection.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="message.html" title="message – Tools for creating messages to be sent to MongoDB"
>next</a> |</li>
<li class="right" >
<a href="errors.html" title="errors – Exceptions raised by the pymongo package"
>previous</a> |</li>
<li><a href="../../index.html">PyMongo 2.6.3 documentation</a> »</li>
<li><a href="../index.html" >API Documentation</a> »</li>
<li><a href="index.html" ><tt class="docutils literal"><span class="pre">pymongo</span></tt> – Python driver for MongoDB</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2008 - 2012, 10gen, Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.
</div>
</body>
</html>
|