Sophie

Sophie

distrib > Fedora > 13 > i386 > media > updates > by-pkgid > e2eef204a8562d4f753a051d0e998dc4 > files > 41

openstack-swift-doc-1.0.2-5.fc13.noarch.rpm

<!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>Misc &mdash; Swift v1.0.2 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:     '1.0.2',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="Swift v1.0.2 documentation" href="index.html" />
    <link rel="prev" title="Developer’s Authorization" href="auth.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="modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="auth.html" title="Developer’s Authorization"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">Swift v1.0.2 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="misc">
<span id="id1"></span><h1>Misc<a class="headerlink" href="#misc" title="Permalink to this headline">¶</a></h1>
<div class="section" id="module-swift.common.exceptions">
<span id="exceptions"></span><h2>Exceptions<a class="headerlink" href="#module-swift.common.exceptions" title="Permalink to this headline">¶</a></h2>
<dl class="exception">
<dt id="swift.common.exceptions.AuditException">
<em class="property">exception </em><tt class="descclassname">swift.common.exceptions.</tt><tt class="descname">AuditException</tt><a class="headerlink" href="#swift.common.exceptions.AuditException" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <tt class="xref docutils literal"><span class="pre">exceptions.Exception</span></tt></dd></dl>

<dl class="exception">
<dt id="swift.common.exceptions.AuthException">
<em class="property">exception </em><tt class="descclassname">swift.common.exceptions.</tt><tt class="descname">AuthException</tt><a class="headerlink" href="#swift.common.exceptions.AuthException" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <tt class="xref docutils literal"><span class="pre">exceptions.Exception</span></tt></dd></dl>

<dl class="exception">
<dt id="swift.common.exceptions.ChunkReadTimeout">
<em class="property">exception </em><tt class="descclassname">swift.common.exceptions.</tt><tt class="descname">ChunkReadTimeout</tt><big>(</big><em>seconds=None</em>, <em>exception=None</em><big>)</big><a class="headerlink" href="#swift.common.exceptions.ChunkReadTimeout" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <tt class="xref docutils literal"><span class="pre">eventlet.timeout.Timeout</span></tt></dd></dl>

<dl class="exception">
<dt id="swift.common.exceptions.ChunkWriteTimeout">
<em class="property">exception </em><tt class="descclassname">swift.common.exceptions.</tt><tt class="descname">ChunkWriteTimeout</tt><big>(</big><em>seconds=None</em>, <em>exception=None</em><big>)</big><a class="headerlink" href="#swift.common.exceptions.ChunkWriteTimeout" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <tt class="xref docutils literal"><span class="pre">eventlet.timeout.Timeout</span></tt></dd></dl>

<dl class="exception">
<dt id="swift.common.exceptions.ConnectionTimeout">
<em class="property">exception </em><tt class="descclassname">swift.common.exceptions.</tt><tt class="descname">ConnectionTimeout</tt><big>(</big><em>seconds=None</em>, <em>exception=None</em><big>)</big><a class="headerlink" href="#swift.common.exceptions.ConnectionTimeout" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <tt class="xref docutils literal"><span class="pre">eventlet.timeout.Timeout</span></tt></dd></dl>

<dl class="exception">
<dt id="swift.common.exceptions.DriveNotMounted">
<em class="property">exception </em><tt class="descclassname">swift.common.exceptions.</tt><tt class="descname">DriveNotMounted</tt><a class="headerlink" href="#swift.common.exceptions.DriveNotMounted" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <tt class="xref docutils literal"><span class="pre">exceptions.Exception</span></tt></dd></dl>

<dl class="exception">
<dt id="swift.common.exceptions.LockTimeout">
<em class="property">exception </em><tt class="descclassname">swift.common.exceptions.</tt><tt class="descname">LockTimeout</tt><big>(</big><em>seconds=None</em>, <em>msg=None</em><big>)</big><a class="headerlink" href="#swift.common.exceptions.LockTimeout" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <a title="swift.common.exceptions.MessageTimeout" class="reference internal" href="#swift.common.exceptions.MessageTimeout"><tt class="xref docutils literal"><span class="pre">swift.common.exceptions.MessageTimeout</span></tt></a></dd></dl>

<dl class="exception">
<dt id="swift.common.exceptions.MessageTimeout">
<em class="property">exception </em><tt class="descclassname">swift.common.exceptions.</tt><tt class="descname">MessageTimeout</tt><big>(</big><em>seconds=None</em>, <em>msg=None</em><big>)</big><a class="headerlink" href="#swift.common.exceptions.MessageTimeout" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <tt class="xref docutils literal"><span class="pre">eventlet.timeout.Timeout</span></tt></dd></dl>

</div>
<div class="section" id="module-swift.common.constraints">
<span id="constraints"></span><h2>Constraints<a class="headerlink" href="#module-swift.common.constraints" title="Permalink to this headline">¶</a></h2>
<dl class="data">
<dt id="swift.common.constraints.MAX_FILE_SIZE">
<tt class="descclassname">swift.common.constraints.</tt><tt class="descname">MAX_FILE_SIZE</tt><a class="headerlink" href="#swift.common.constraints.MAX_FILE_SIZE" title="Permalink to this definition">¶</a></dt>
<dd>Max file size allowed for objects</dd></dl>

<dl class="data">
<dt id="swift.common.constraints.MAX_META_COUNT">
<tt class="descclassname">swift.common.constraints.</tt><tt class="descname">MAX_META_COUNT</tt><a class="headerlink" href="#swift.common.constraints.MAX_META_COUNT" title="Permalink to this definition">¶</a></dt>
<dd>Max number of metadata items</dd></dl>

<dl class="data">
<dt id="swift.common.constraints.MAX_META_NAME_LENGTH">
<tt class="descclassname">swift.common.constraints.</tt><tt class="descname">MAX_META_NAME_LENGTH</tt><a class="headerlink" href="#swift.common.constraints.MAX_META_NAME_LENGTH" title="Permalink to this definition">¶</a></dt>
<dd>Max length of the name of a key for metadata</dd></dl>

<dl class="data">
<dt id="swift.common.constraints.MAX_META_OVERALL_SIZE">
<tt class="descclassname">swift.common.constraints.</tt><tt class="descname">MAX_META_OVERALL_SIZE</tt><a class="headerlink" href="#swift.common.constraints.MAX_META_OVERALL_SIZE" title="Permalink to this definition">¶</a></dt>
<dd>Max overall size of metadata</dd></dl>

<dl class="data">
<dt id="swift.common.constraints.MAX_META_VALUE_LENGTH">
<tt class="descclassname">swift.common.constraints.</tt><tt class="descname">MAX_META_VALUE_LENGTH</tt><a class="headerlink" href="#swift.common.constraints.MAX_META_VALUE_LENGTH" title="Permalink to this definition">¶</a></dt>
<dd>Max length of the value of a key for metadata</dd></dl>

<dl class="data">
<dt id="swift.common.constraints.MAX_OBJECT_NAME_LENGTH">
<tt class="descclassname">swift.common.constraints.</tt><tt class="descname">MAX_OBJECT_NAME_LENGTH</tt><a class="headerlink" href="#swift.common.constraints.MAX_OBJECT_NAME_LENGTH" title="Permalink to this definition">¶</a></dt>
<dd>Max object name length</dd></dl>

<dl class="function">
<dt id="swift.common.constraints.check_float">
<tt class="descclassname">swift.common.constraints.</tt><tt class="descname">check_float</tt><big>(</big><em>string</em><big>)</big><a class="headerlink" href="#swift.common.constraints.check_float" title="Permalink to this definition">¶</a></dt>
<dd><p>Helper function for checking if a string can be converted to a float.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>string</em> &#8211; string to be verified as a float</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">True if the string can be converted to a float, False otherwise</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.constraints.check_metadata">
<tt class="descclassname">swift.common.constraints.</tt><tt class="descname">check_metadata</tt><big>(</big><em>req</em><big>)</big><a class="headerlink" href="#swift.common.constraints.check_metadata" title="Permalink to this definition">¶</a></dt>
<dd><p>Check metadata sent for objects in the request headers.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>req</em> &#8211; request object</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises HTTPBadRequest:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">bad metadata</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.constraints.check_mount">
<tt class="descclassname">swift.common.constraints.</tt><tt class="descname">check_mount</tt><big>(</big><em>root</em>, <em>drive</em><big>)</big><a class="headerlink" href="#swift.common.constraints.check_mount" title="Permalink to this definition">¶</a></dt>
<dd><p>Verify that the path to the device is a mount point and mounted.  This
allows us to fast fail on drives that have been unmounted because of
issues, and also prevents us for accidently filling up the root partition.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>root</em> &#8211; base path where the devices are mounted</li>
<li><em>drive</em> &#8211; drive name to be checked</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">True if it is a valid mounted device, False otherwise</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.constraints.check_object_creation">
<tt class="descclassname">swift.common.constraints.</tt><tt class="descname">check_object_creation</tt><big>(</big><em>req</em>, <em>object_name</em><big>)</big><a class="headerlink" href="#swift.common.constraints.check_object_creation" title="Permalink to this definition">¶</a></dt>
<dd><p>Check to ensure that everything is alright about an object to be created.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>req</em> &#8211; HTTP request object</li>
<li><em>object_name</em> &#8211; name of object to be created</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises HTTPRequestEntityTooLarge:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">the object is too large</p>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises HTTPLengthRequered:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">missing content-length header and not
a chunked request</p>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises HTTPBadRequest:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first last">missing or bad content-type header, or
bad metadata</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.constraints.check_xml_encodable">
<tt class="descclassname">swift.common.constraints.</tt><tt class="descname">check_xml_encodable</tt><big>(</big><em>string</em><big>)</big><a class="headerlink" href="#swift.common.constraints.check_xml_encodable" title="Permalink to this definition">¶</a></dt>
<dd><p>Validate if a string can be encoded in xml.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>string</em> &#8211; string to be validated</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">True if the string can be encoded in xml, False otherwise</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
<div class="section" id="module-swift.common.utils">
<span id="utils"></span><h2>Utils<a class="headerlink" href="#module-swift.common.utils" title="Permalink to this headline">¶</a></h2>
<p>Miscellaneous utility functions for use with Swift.</p>
<dl class="class">
<dt id="swift.common.utils.NamedLogger">
<em class="property">class </em><tt class="descclassname">swift.common.utils.</tt><tt class="descname">NamedLogger</tt><big>(</big><em>logger</em>, <em>server</em><big>)</big><a class="headerlink" href="#swift.common.utils.NamedLogger" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">object</span></tt></p>
<p>Cheesy version of the LoggerAdapter available in Python 3</p>
</dd></dl>

<dl class="class">
<dt id="swift.common.utils.NullLogger">
<em class="property">class </em><tt class="descclassname">swift.common.utils.</tt><tt class="descname">NullLogger</tt><a class="headerlink" href="#swift.common.utils.NullLogger" title="Permalink to this definition">¶</a></dt>
<dd>A no-op logger for eventlet wsgi.</dd></dl>

<dl class="function">
<dt id="swift.common.utils.compute_eta">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">compute_eta</tt><big>(</big><em>start_time</em>, <em>current_value</em>, <em>final_value</em><big>)</big><a class="headerlink" href="#swift.common.utils.compute_eta" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute an ETA.  Now only if we could also have a progress bar...</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>start_time</em> &#8211; Unix timestamp when the operation began</li>
<li><em>current_value</em> &#8211; Current value</li>
<li><em>final_value</em> &#8211; Final value</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">ETA as a tuple of (length of time, unit of time) where unit of
time is one of (&#8216;h&#8217;, &#8216;m&#8217;, &#8216;s&#8217;)</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.utils.drop_buffer_cache">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">drop_buffer_cache</tt><big>(</big><em>fd</em>, <em>offset</em>, <em>length</em><big>)</big><a class="headerlink" href="#swift.common.utils.drop_buffer_cache" title="Permalink to this definition">¶</a></dt>
<dd><p>Drop &#8216;buffer&#8217; cache for the given range of the given file.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>fd</em> &#8211; file descriptor</li>
<li><em>offset</em> &#8211; start offset</li>
<li><em>length</em> &#8211; length</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.utils.drop_privileges">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">drop_privileges</tt><big>(</big><em>user</em><big>)</big><a class="headerlink" href="#swift.common.utils.drop_privileges" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the userid of the current process</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>user</em> &#8211; User id to change privileges to</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.utils.fallocate">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">fallocate</tt><big>(</big><em>fd</em>, <em>size</em><big>)</big><a class="headerlink" href="#swift.common.utils.fallocate" title="Permalink to this definition">¶</a></dt>
<dd><p>Pre-allocate disk space for a file file.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>fd</em> &#8211; file descriptor</li>
<li><em>size</em> &#8211; size to allocate (in bytes)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.utils.get_logger">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">get_logger</tt><big>(</big><em>conf</em>, <em>name</em><big>)</big><a class="headerlink" href="#swift.common.utils.get_logger" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the current system logger using config settings.</p>
<p><strong>Log config and defaults</strong>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">log_facility</span> <span class="o">=</span> <span class="n">LOG_LOCAL0</span>
<span class="n">log_level</span> <span class="o">=</span> <span class="n">INFO</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>conf</em> &#8211; Configuration dict to read settings from</li>
<li><em>name</em> &#8211; Name of the logger</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.utils.get_param">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">get_param</tt><big>(</big><em>req</em>, <em>name</em>, <em>default=None</em><big>)</big><a class="headerlink" href="#swift.common.utils.get_param" title="Permalink to this definition">¶</a></dt>
<dd><p>Get parameters from an HTTP request ensuring proper handling UTF-8
encoding.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>req</em> &#8211; Webob request object</li>
<li><em>name</em> &#8211; parameter name</li>
<li><em>default</em> &#8211; result to return if the parameter is not found</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">HTTP request parameter value</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.utils.get_time_units">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">get_time_units</tt><big>(</big><em>time_amount</em><big>)</big><a class="headerlink" href="#swift.common.utils.get_time_units" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a nomralized length of time in the largest unit of time (hours,
minutes, or seconds.)</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>time_amount</em> &#8211; length of time in seconds</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">A touple of (length of time, unit of time) where unit of time is
one of (&#8216;h&#8217;, &#8216;m&#8217;, &#8216;s&#8217;)</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.utils.hash_path">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">hash_path</tt><big>(</big><em>account</em>, <em>container=None</em>, <em>object=None</em>, <em>raw_digest=False</em><big>)</big><a class="headerlink" href="#swift.common.utils.hash_path" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the connonical hash for an account/container/object</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>account</em> &#8211; Account</li>
<li><em>container</em> &#8211; Container</li>
<li><em>object</em> &#8211; Object</li>
<li><em>raw_digest</em> &#8211; If True, return the raw version rather than a hex digest</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">hash string</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.utils.iter_devices_partitions">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">iter_devices_partitions</tt><big>(</big><em>devices_dir</em>, <em>item_type</em><big>)</big><a class="headerlink" href="#swift.common.utils.iter_devices_partitions" title="Permalink to this definition">¶</a></dt>
<dd><p>Iterate over partitions accross all devices.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>devices_dir</em> &#8211; Path to devices</li>
<li><em>item_type</em> &#8211; One of &#8216;accounts&#8217;, &#8216;containers&#8217;, or &#8216;objects&#8217;</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">Each iteration returns a tuple of (device, partition)</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.utils.lock_parent_directory">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">lock_parent_directory</tt><big>(</big><em>filename</em>, <em>timeout=10</em><big>)</big><a class="headerlink" href="#swift.common.utils.lock_parent_directory" title="Permalink to this definition">¶</a></dt>
<dd><p>Context manager that acquires a lock on the parent directory of the given
file path.  This will block until the lock can be acquired, or the timeout
time has expired (whichever occurs first).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>filename</em> &#8211; file path of the parent directory to be locked</li>
<li><em>timeout</em> &#8211; timeout (in seconds)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.utils.lock_path">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">lock_path</tt><big>(</big><em>*args</em>, <em>**kwds</em><big>)</big><a class="headerlink" href="#swift.common.utils.lock_path" title="Permalink to this definition">¶</a></dt>
<dd><p>Context manager that acquires a lock on a directory.  This will block until
the lock can be acquired, or the timeout time has expired (whichever occurs
first).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>directory</em> &#8211; directory to be locked</li>
<li><em>timeout</em> &#8211; timeout (in seconds)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.utils.mkdirs">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">mkdirs</tt><big>(</big><em>path</em><big>)</big><a class="headerlink" href="#swift.common.utils.mkdirs" title="Permalink to this definition">¶</a></dt>
<dd><p>Ensures the path is a directory or makes it if not. Errors if the path
exists but is a file or on permissions failure.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>path</em> &#8211; path to create</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.utils.normalize_timestamp">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">normalize_timestamp</tt><big>(</big><em>timestamp</em><big>)</big><a class="headerlink" href="#swift.common.utils.normalize_timestamp" title="Permalink to this definition">¶</a></dt>
<dd><p>Format a timestamp (string or numeric) into a standardized
xxxxxxxxxx.xxxxx format.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>timestamp</em> &#8211; unix timestamp</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">normalized timestamp as a string</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.utils.renamer">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">renamer</tt><big>(</big><em>old</em>, <em>new</em><big>)</big><a class="headerlink" href="#swift.common.utils.renamer" title="Permalink to this definition">¶</a></dt>
<dd><p>Attempt to fix^H^H^Hhide race conditions like empty object directories
being removed by backend processes during uploads, by retrying.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>old</em> &#8211; old path to be renamed</li>
<li><em>new</em> &#8211; new path to be renamed to</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.utils.split_path">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">split_path</tt><big>(</big><em>path</em>, <em>minsegs=1</em>, <em>maxsegs=None</em>, <em>rest_with_last=False</em><big>)</big><a class="headerlink" href="#swift.common.utils.split_path" title="Permalink to this definition">¶</a></dt>
<dd><p>Validate and split the given HTTP request path.</p>
<p><strong>Examples</strong>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">[</span><span class="s">&#39;a&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">split_path</span><span class="p">(</span><span class="s">&#39;/a&#39;</span><span class="p">)</span>
<span class="p">[</span><span class="s">&#39;a&#39;</span><span class="p">,</span> <span class="bp">None</span><span class="p">]</span> <span class="o">=</span> <span class="n">split_path</span><span class="p">(</span><span class="s">&#39;/a&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="p">[</span><span class="s">&#39;a&#39;</span><span class="p">,</span> <span class="s">&#39;c&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">split_path</span><span class="p">(</span><span class="s">&#39;/a/c&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="p">[</span><span class="s">&#39;a&#39;</span><span class="p">,</span> <span class="s">&#39;c&#39;</span><span class="p">,</span> <span class="s">&#39;o/r&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">split_path</span><span class="p">(</span><span class="s">&#39;/a/c/o/r&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="bp">True</span><span class="p">)</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>path</em> &#8211; HTTP Request path to be split</li>
<li><em>minsegs</em> &#8211; Minimum number of segments to be extracted</li>
<li><em>maxsegs</em> &#8211; Maximum number of segments to be extracted</li>
<li><em>rest_with_last</em> &#8211; If True, trailing data will be returned as part
of last segment.  If False, and there is
trailing data, raises ValueError.</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">list of segments with a length of maxsegs (non-existant
segments will return as None)</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.utils.storage_directory">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">storage_directory</tt><big>(</big><em>datadir</em>, <em>partition</em>, <em>hash</em><big>)</big><a class="headerlink" href="#swift.common.utils.storage_directory" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the storage directory</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>datadir</em> &#8211; Base data directory</li>
<li><em>partition</em> &#8211; Partition</li>
<li><em>hash</em> &#8211; Account, container or object hash</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">Storage directory</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.utils.unlink_older_than">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">unlink_older_than</tt><big>(</big><em>path</em>, <em>mtime</em><big>)</big><a class="headerlink" href="#swift.common.utils.unlink_older_than" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove any file in a given path that that was last modified before mtime.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>path</em> &#8211; Path to remove file from</td>
</tr>
<tr class="field"><th class="field-name">Mtime:</th><td class="field-body">Timestamp of oldest file to keep</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.utils.whataremyips">
<tt class="descclassname">swift.common.utils.</tt><tt class="descname">whataremyips</tt><big>(</big><big>)</big><a class="headerlink" href="#swift.common.utils.whataremyips" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the machine&#8217;s ip addresses using ifconfig</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">list of Strings of IPv4 ip addresses</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
<div class="section" id="module-swift.common.auth">
<span id="common-auth"></span><h2>Auth<a class="headerlink" href="#module-swift.common.auth" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="swift.common.auth.DevAuthMiddleware">
<em class="property">class </em><tt class="descclassname">swift.common.auth.</tt><tt class="descname">DevAuthMiddleware</tt><big>(</big><em>app</em>, <em>conf</em>, <em>memcache_client</em>, <em>logger</em><big>)</big><a class="headerlink" href="#swift.common.auth.DevAuthMiddleware" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">object</span></tt></p>
<p>Auth Middleware that uses the dev auth server</p>
<dl class="method">
<dt id="swift.common.auth.DevAuthMiddleware.auth">
<tt class="descname">auth</tt><big>(</big><em>account</em>, <em>token</em><big>)</big><a class="headerlink" href="#swift.common.auth.DevAuthMiddleware.auth" title="Permalink to this definition">¶</a></dt>
<dd><p>Dev authorization implmentation</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>account</em> &#8211; account name</li>
<li><em>token</em> &#8211; auth token</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">True if authorization is successful, False otherwise</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-swift.common.wsgi">
<span id="wsgi"></span><h2>WSGI<a class="headerlink" href="#module-swift.common.wsgi" title="Permalink to this headline">¶</a></h2>
<p>WSGI tools for use with swift.</p>
<dl class="function">
<dt id="swift.common.wsgi.monkey_patch_mimetools">
<tt class="descclassname">swift.common.wsgi.</tt><tt class="descname">monkey_patch_mimetools</tt><big>(</big><big>)</big><a class="headerlink" href="#swift.common.wsgi.monkey_patch_mimetools" title="Permalink to this definition">¶</a></dt>
<dd>mimetools.Message defaults content-type to &#8220;text/plain&#8221;
This changes it to default to None, so we can detect missing headers.</dd></dl>

<dl class="function">
<dt id="swift.common.wsgi.run_wsgi">
<tt class="descclassname">swift.common.wsgi.</tt><tt class="descname">run_wsgi</tt><big>(</big><em>app</em>, <em>conf</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#swift.common.wsgi.run_wsgi" title="Permalink to this definition">¶</a></dt>
<dd><p>Loads common settings from conf, then instantiates app and runs
the server using the specified number of workers.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>app</em> &#8211; WSGI callable</li>
<li><em>conf</em> &#8211; Configuration dictionary</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
<div class="section" id="module-swift.common.client">
<span id="client"></span><h2>Client<a class="headerlink" href="#module-swift.common.client" title="Permalink to this headline">¶</a></h2>
<p>Cloud Files client library used internally</p>
<dl class="exception">
<dt id="swift.common.client.ClientException">
<em class="property">exception </em><tt class="descclassname">swift.common.client.</tt><tt class="descname">ClientException</tt><big>(</big><em>msg</em>, <em>http_scheme=''</em>, <em>http_host=''</em>, <em>http_port=''</em>, <em>http_path=''</em>, <em>http_query=''</em>, <em>http_status=0</em>, <em>http_reason=''</em>, <em>http_device=''</em><big>)</big><a class="headerlink" href="#swift.common.client.ClientException" title="Permalink to this definition">¶</a></dt>
<dd>Bases: <tt class="xref docutils literal"><span class="pre">exceptions.Exception</span></tt></dd></dl>

<dl class="class">
<dt id="swift.common.client.Connection">
<em class="property">class </em><tt class="descclassname">swift.common.client.</tt><tt class="descname">Connection</tt><big>(</big><em>authurl</em>, <em>user</em>, <em>key</em>, <em>retries=5</em>, <em>preauthurl=None</em>, <em>preauthtoken=None</em>, <em>snet=False</em><big>)</big><a class="headerlink" href="#swift.common.client.Connection" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">object</span></tt></p>
<p>Convenience class to make requests that will also retry the request</p>
<dl class="method">
<dt id="swift.common.client.Connection.delete_container">
<tt class="descname">delete_container</tt><big>(</big><em>container</em><big>)</big><a class="headerlink" href="#swift.common.client.Connection.delete_container" title="Permalink to this definition">¶</a></dt>
<dd>Wrapper for delete_container</dd></dl>

<dl class="method">
<dt id="swift.common.client.Connection.delete_object">
<tt class="descname">delete_object</tt><big>(</big><em>container</em>, <em>obj</em><big>)</big><a class="headerlink" href="#swift.common.client.Connection.delete_object" title="Permalink to this definition">¶</a></dt>
<dd>Wrapper for delete_object</dd></dl>

<dl class="method">
<dt id="swift.common.client.Connection.get_account">
<tt class="descname">get_account</tt><big>(</big><em>marker=None</em>, <em>limit=None</em>, <em>prefix=None</em>, <em>full_listing=False</em><big>)</big><a class="headerlink" href="#swift.common.client.Connection.get_account" title="Permalink to this definition">¶</a></dt>
<dd>Wrapper for get_account</dd></dl>

<dl class="method">
<dt id="swift.common.client.Connection.get_container">
<tt class="descname">get_container</tt><big>(</big><em>container</em>, <em>marker=None</em>, <em>limit=None</em>, <em>prefix=None</em>, <em>delimiter=None</em>, <em>full_listing=False</em><big>)</big><a class="headerlink" href="#swift.common.client.Connection.get_container" title="Permalink to this definition">¶</a></dt>
<dd>Wrapper for get_container</dd></dl>

<dl class="method">
<dt id="swift.common.client.Connection.get_object">
<tt class="descname">get_object</tt><big>(</big><em>container</em>, <em>obj</em>, <em>resp_chunk_size=None</em><big>)</big><a class="headerlink" href="#swift.common.client.Connection.get_object" title="Permalink to this definition">¶</a></dt>
<dd>Wrapper for get_object</dd></dl>

<dl class="method">
<dt id="swift.common.client.Connection.head_account">
<tt class="descname">head_account</tt><big>(</big><big>)</big><a class="headerlink" href="#swift.common.client.Connection.head_account" title="Permalink to this definition">¶</a></dt>
<dd>Wrapper for head_account</dd></dl>

<dl class="method">
<dt id="swift.common.client.Connection.head_container">
<tt class="descname">head_container</tt><big>(</big><em>container</em><big>)</big><a class="headerlink" href="#swift.common.client.Connection.head_container" title="Permalink to this definition">¶</a></dt>
<dd>Wrapper for head_container</dd></dl>

<dl class="method">
<dt id="swift.common.client.Connection.head_object">
<tt class="descname">head_object</tt><big>(</big><em>container</em>, <em>obj</em><big>)</big><a class="headerlink" href="#swift.common.client.Connection.head_object" title="Permalink to this definition">¶</a></dt>
<dd>Wrapper for head_object</dd></dl>

<dl class="method">
<dt id="swift.common.client.Connection.post_object">
<tt class="descname">post_object</tt><big>(</big><em>container</em>, <em>obj</em>, <em>metadata</em><big>)</big><a class="headerlink" href="#swift.common.client.Connection.post_object" title="Permalink to this definition">¶</a></dt>
<dd>Wrapper for post_object</dd></dl>

<dl class="method">
<dt id="swift.common.client.Connection.put_container">
<tt class="descname">put_container</tt><big>(</big><em>container</em><big>)</big><a class="headerlink" href="#swift.common.client.Connection.put_container" title="Permalink to this definition">¶</a></dt>
<dd>Wrapper for put_container</dd></dl>

<dl class="method">
<dt id="swift.common.client.Connection.put_object">
<tt class="descname">put_object</tt><big>(</big><em>container</em>, <em>obj</em>, <em>contents</em>, <em>metadata={}</em>, <em>content_length=None</em>, <em>etag=None</em>, <em>chunk_size=65536</em>, <em>content_type=None</em><big>)</big><a class="headerlink" href="#swift.common.client.Connection.put_object" title="Permalink to this definition">¶</a></dt>
<dd>Wrapper for put_object</dd></dl>

</dd></dl>

<dl class="function">
<dt id="swift.common.client.delete_container">
<tt class="descclassname">swift.common.client.</tt><tt class="descname">delete_container</tt><big>(</big><em>url</em>, <em>token</em>, <em>container</em>, <em>http_conn=None</em><big>)</big><a class="headerlink" href="#swift.common.client.delete_container" title="Permalink to this definition">¶</a></dt>
<dd><p>Delete a container</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>url</em> &#8211; storage URL</li>
<li><em>token</em> &#8211; auth token</li>
<li><em>container</em> &#8211; container name to delete</li>
<li><em>http_conn</em> &#8211; HTTP connection object (If None, it will create the
conn object)</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises <a title="swift.common.client.ClientException" class="reference internal" href="#swift.common.client.ClientException">ClientException</a>:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first last">HTTP DELETE request failed</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.client.delete_object">
<tt class="descclassname">swift.common.client.</tt><tt class="descname">delete_object</tt><big>(</big><em>url</em>, <em>token</em>, <em>container</em>, <em>name</em>, <em>http_conn=None</em><big>)</big><a class="headerlink" href="#swift.common.client.delete_object" title="Permalink to this definition">¶</a></dt>
<dd><p>Delete object</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>url</em> &#8211; storage URL</li>
<li><em>token</em> &#8211; auth token</li>
<li><em>container</em> &#8211; container name that the object is in</li>
<li><em>name</em> &#8211; object name to delete</li>
<li><em>http_conn</em> &#8211; HTTP connection object (If None, it will create the
conn object)</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises <a title="swift.common.client.ClientException" class="reference internal" href="#swift.common.client.ClientException">ClientException</a>:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first last">HTTP DELETE request failed</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.client.get_account">
<tt class="descclassname">swift.common.client.</tt><tt class="descname">get_account</tt><big>(</big><em>url</em>, <em>token</em>, <em>marker=None</em>, <em>limit=None</em>, <em>prefix=None</em>, <em>http_conn=None</em>, <em>full_listing=False</em><big>)</big><a class="headerlink" href="#swift.common.client.get_account" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a listing of containers for the account.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>url</em> &#8211; storage URL</li>
<li><em>token</em> &#8211; auth token</li>
<li><em>marker</em> &#8211; marker query</li>
<li><em>limit</em> &#8211; limit query</li>
<li><em>prefix</em> &#8211; prefix query</li>
<li><em>http_conn</em> &#8211; HTTP connection object (If None, it will create the
conn object)</li>
<li><em>full_listing</em> &#8211; if True, return a full listing, else returns a max
of 10000 listings</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a list of accounts</p>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises <a title="swift.common.client.ClientException" class="reference internal" href="#swift.common.client.ClientException">ClientException</a>:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first last">HTTP GET request failed</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.client.get_auth">
<tt class="descclassname">swift.common.client.</tt><tt class="descname">get_auth</tt><big>(</big><em>url</em>, <em>user</em>, <em>key</em>, <em>snet=False</em><big>)</big><a class="headerlink" href="#swift.common.client.get_auth" title="Permalink to this definition">¶</a></dt>
<dd><p>Get authentication credentials</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>url</em> &#8211; authentication URL</li>
<li><em>user</em> &#8211; user to auth as</li>
<li><em>key</em> &#8211; key or passowrd for auth</li>
<li><em>snet</em> &#8211; use SERVICENET internal network default is False</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">tuple of (storage URL, storage token, auth token)</p>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises <a title="swift.common.client.ClientException" class="reference internal" href="#swift.common.client.ClientException">ClientException</a>:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first last">HTTP GET request to auth URL failed</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.client.get_container">
<tt class="descclassname">swift.common.client.</tt><tt class="descname">get_container</tt><big>(</big><em>url</em>, <em>token</em>, <em>container</em>, <em>marker=None</em>, <em>limit=None</em>, <em>prefix=None</em>, <em>delimiter=None</em>, <em>http_conn=None</em>, <em>full_listing=False</em><big>)</big><a class="headerlink" href="#swift.common.client.get_container" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a listing of objects for the container.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>url</em> &#8211; storage URL</li>
<li><em>token</em> &#8211; auth token</li>
<li><em>container</em> &#8211; container name to get a listing for</li>
<li><em>marker</em> &#8211; marker query</li>
<li><em>limit</em> &#8211; limit query</li>
<li><em>prefix</em> &#8211; prefix query</li>
<li><em>delimeter</em> &#8211; string to delimit the queries on</li>
<li><em>http_conn</em> &#8211; HTTP connection object (If None, it will create the
conn object)</li>
<li><em>full_listing</em> &#8211; if True, return a full listing, else returns a max
of 10000 listings</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a list of objects</p>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises <a title="swift.common.client.ClientException" class="reference internal" href="#swift.common.client.ClientException">ClientException</a>:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first last">HTTP GET request failed</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.client.get_object">
<tt class="descclassname">swift.common.client.</tt><tt class="descname">get_object</tt><big>(</big><em>url</em>, <em>token</em>, <em>container</em>, <em>name</em>, <em>http_conn=None</em>, <em>resp_chunk_size=None</em><big>)</big><a class="headerlink" href="#swift.common.client.get_object" title="Permalink to this definition">¶</a></dt>
<dd><p>Get an object</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>url</em> &#8211; storage URL</li>
<li><em>token</em> &#8211; auth token</li>
<li><em>container</em> &#8211; container name that the object is in</li>
<li><em>name</em> &#8211; object name to get</li>
<li><em>http_conn</em> &#8211; HTTP connection object (If None, it will create the
conn object)</li>
<li><em>resp_chunk_size</em> &#8211; if defined, chunk size of data to read</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a list of objects</p>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises <a title="swift.common.client.ClientException" class="reference internal" href="#swift.common.client.ClientException">ClientException</a>:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first last">HTTP GET request failed</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.client.head_account">
<tt class="descclassname">swift.common.client.</tt><tt class="descname">head_account</tt><big>(</big><em>url</em>, <em>token</em>, <em>http_conn=None</em><big>)</big><a class="headerlink" href="#swift.common.client.head_account" title="Permalink to this definition">¶</a></dt>
<dd><p>Get account stats.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>url</em> &#8211; storage URL</li>
<li><em>token</em> &#8211; auth token</li>
<li><em>http_conn</em> &#8211; HTTP connection object (If None, it will create the
conn object)</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a tuple of (container count, object count, bytes used)</p>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises <a title="swift.common.client.ClientException" class="reference internal" href="#swift.common.client.ClientException">ClientException</a>:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first last">HTTP HEAD request failed</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.client.head_container">
<tt class="descclassname">swift.common.client.</tt><tt class="descname">head_container</tt><big>(</big><em>url</em>, <em>token</em>, <em>container</em>, <em>http_conn=None</em><big>)</big><a class="headerlink" href="#swift.common.client.head_container" title="Permalink to this definition">¶</a></dt>
<dd><p>Get container stats.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>url</em> &#8211; storage URL</li>
<li><em>token</em> &#8211; auth token</li>
<li><em>container</em> &#8211; container name to get stats for</li>
<li><em>http_conn</em> &#8211; HTTP connection object (If None, it will create the
conn object)</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a tuple of (object count, bytes used)</p>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises <a title="swift.common.client.ClientException" class="reference internal" href="#swift.common.client.ClientException">ClientException</a>:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first last">HTTP HEAD request failed</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.client.head_object">
<tt class="descclassname">swift.common.client.</tt><tt class="descname">head_object</tt><big>(</big><em>url</em>, <em>token</em>, <em>container</em>, <em>name</em>, <em>http_conn=None</em><big>)</big><a class="headerlink" href="#swift.common.client.head_object" title="Permalink to this definition">¶</a></dt>
<dd><p>Get object info</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>url</em> &#8211; storage URL</li>
<li><em>token</em> &#8211; auth token</li>
<li><em>container</em> &#8211; container name that the object is in</li>
<li><em>name</em> &#8211; object name to get info for</li>
<li><em>http_conn</em> &#8211; HTTP connection object (If None, it will create the
conn object)</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a tuple of (content type, content length, last modfied, etag,
dictionary of metadata)</p>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises <a title="swift.common.client.ClientException" class="reference internal" href="#swift.common.client.ClientException">ClientException</a>:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first last">HTTP HEAD request failed</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.client.http_connection">
<tt class="descclassname">swift.common.client.</tt><tt class="descname">http_connection</tt><big>(</big><em>url</em><big>)</big><a class="headerlink" href="#swift.common.client.http_connection" title="Permalink to this definition">¶</a></dt>
<dd><p>Make an HTTPConnection or HTTPSConnection</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>url</em> &#8211; url to connect to</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">tuple of (parsed url, connection object)</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises <a title="swift.common.client.ClientException" class="reference internal" href="#swift.common.client.ClientException">ClientException</a>:</th></tr>
<tr><td>&nbsp;</td><td class="field-body">Unable to handle protocol scheme</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.client.post_object">
<tt class="descclassname">swift.common.client.</tt><tt class="descname">post_object</tt><big>(</big><em>url</em>, <em>token</em>, <em>container</em>, <em>name</em>, <em>metadata</em>, <em>http_conn=None</em><big>)</big><a class="headerlink" href="#swift.common.client.post_object" title="Permalink to this definition">¶</a></dt>
<dd><p>Change object metadata</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>url</em> &#8211; storage URL</li>
<li><em>token</em> &#8211; auth token</li>
<li><em>container</em> &#8211; container name that the object is in</li>
<li><em>name</em> &#8211; object name to change</li>
<li><em>metadata</em> &#8211; dictionary of object metadata</li>
<li><em>http_conn</em> &#8211; HTTP connection object (If None, it will create the
conn object)</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises <a title="swift.common.client.ClientException" class="reference internal" href="#swift.common.client.ClientException">ClientException</a>:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first last">HTTP POST request failed</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.client.put_container">
<tt class="descclassname">swift.common.client.</tt><tt class="descname">put_container</tt><big>(</big><em>url</em>, <em>token</em>, <em>container</em>, <em>http_conn=None</em><big>)</big><a class="headerlink" href="#swift.common.client.put_container" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a container</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>url</em> &#8211; storage URL</li>
<li><em>token</em> &#8211; auth token</li>
<li><em>container</em> &#8211; container name to create</li>
<li><em>http_conn</em> &#8211; HTTP connection object (If None, it will create the
conn object)</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises <a title="swift.common.client.ClientException" class="reference internal" href="#swift.common.client.ClientException">ClientException</a>:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first last">HTTP PUT request failed</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.client.put_object">
<tt class="descclassname">swift.common.client.</tt><tt class="descname">put_object</tt><big>(</big><em>url</em>, <em>token</em>, <em>container</em>, <em>name</em>, <em>contents</em>, <em>metadata={}</em>, <em>content_length=None</em>, <em>etag=None</em>, <em>chunk_size=65536</em>, <em>content_type=None</em>, <em>http_conn=None</em><big>)</big><a class="headerlink" href="#swift.common.client.put_object" title="Permalink to this definition">¶</a></dt>
<dd><p>Put an object</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>url</em> &#8211; storage URL</li>
<li><em>token</em> &#8211; auth token</li>
<li><em>container</em> &#8211; container name that the object is in</li>
<li><em>name</em> &#8211; object name to put</li>
<li><em>contents</em> &#8211; file like object to read object data from</li>
<li><em>metadata</em> &#8211; dictionary of object metadata</li>
<li><em>content_length</em> &#8211; value to send as content-length header</li>
<li><em>etag</em> &#8211; etag of contents</li>
<li><em>chunk_size</em> &#8211; chunk size of data to write</li>
<li><em>content_type</em> &#8211; value to send as content-type header</li>
<li><em>http_conn</em> &#8211; HTTP connection object (If None, it will create the
conn object)</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">etag from server response</p>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Raises <a title="swift.common.client.ClientException" class="reference internal" href="#swift.common.client.ClientException">ClientException</a>:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first last">HTTP PUT request failed</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.client.quote">
<tt class="descclassname">swift.common.client.</tt><tt class="descname">quote</tt><big>(</big><em>value</em>, <em>safe='/'</em><big>)</big><a class="headerlink" href="#swift.common.client.quote" title="Permalink to this definition">¶</a></dt>
<dd>Patched version of urllib.quote that encodes utf8 strings before quoting</dd></dl>

</div>
<div class="section" id="module-swift.common.direct_client">
<span id="direct-client"></span><h2>Direct Client<a class="headerlink" href="#module-swift.common.direct_client" title="Permalink to this headline">¶</a></h2>
<p>Internal client library for making calls directly to the servers rather than
through the proxy.</p>
<dl class="function">
<dt id="swift.common.direct_client.direct_delete_container">
<tt class="descclassname">swift.common.direct_client.</tt><tt class="descname">direct_delete_container</tt><big>(</big><em>node</em>, <em>part</em>, <em>account</em>, <em>container</em>, <em>conn_timeout=5</em>, <em>response_timeout=15</em>, <em>headers={}</em><big>)</big><a class="headerlink" href="#swift.common.direct_client.direct_delete_container" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="swift.common.direct_client.direct_delete_object">
<tt class="descclassname">swift.common.direct_client.</tt><tt class="descname">direct_delete_object</tt><big>(</big><em>node</em>, <em>part</em>, <em>account</em>, <em>container</em>, <em>obj</em>, <em>conn_timeout=5</em>, <em>response_timeout=15</em>, <em>headers={}</em><big>)</big><a class="headerlink" href="#swift.common.direct_client.direct_delete_object" title="Permalink to this definition">¶</a></dt>
<dd><p>Delete object directly from the object server.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>node</em> &#8211; node dictionary from the ring</li>
<li><em>part</em> &#8211; partition the container is on</li>
<li><em>account</em> &#8211; account name</li>
<li><em>container</em> &#8211; container name</li>
<li><em>obj</em> &#8211; object name</li>
<li><em>conn_timeout</em> &#8211; timeout in seconds for establishing the connection</li>
<li><em>response_timeout</em> &#8211; timeout in seconds for getting the response</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">response from server</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.direct_client.direct_get_container">
<tt class="descclassname">swift.common.direct_client.</tt><tt class="descname">direct_get_container</tt><big>(</big><em>node</em>, <em>part</em>, <em>account</em>, <em>container</em>, <em>marker=None</em>, <em>limit=None</em>, <em>prefix=None</em>, <em>delimiter=None</em>, <em>conn_timeout=5</em>, <em>response_timeout=15</em><big>)</big><a class="headerlink" href="#swift.common.direct_client.direct_get_container" title="Permalink to this definition">¶</a></dt>
<dd><p>Get container listings directly from the container server.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>node</em> &#8211; node dictionary from the ring</li>
<li><em>part</em> &#8211; partition the container is on</li>
<li><em>account</em> &#8211; account name</li>
<li><em>container</em> &#8211; container name</li>
<li><em>marker</em> &#8211; marker query</li>
<li><em>limit</em> &#8211; query limit</li>
<li><em>prefix</em> &#8211; prefix query</li>
<li><em>delimeter</em> &#8211; delimeter for the query</li>
<li><em>conn_timeout</em> &#8211; timeout in seconds for establishing the connection</li>
<li><em>response_timeout</em> &#8211; timeout in seconds for getting the response</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">list of objects</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.direct_client.direct_get_object">
<tt class="descclassname">swift.common.direct_client.</tt><tt class="descname">direct_get_object</tt><big>(</big><em>node</em>, <em>part</em>, <em>account</em>, <em>container</em>, <em>obj</em>, <em>conn_timeout=5</em>, <em>response_timeout=15</em><big>)</big><a class="headerlink" href="#swift.common.direct_client.direct_get_object" title="Permalink to this definition">¶</a></dt>
<dd><p>Get object directly from the object server.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>node</em> &#8211; node dictionary from the ring</li>
<li><em>part</em> &#8211; partition the container is on</li>
<li><em>account</em> &#8211; account name</li>
<li><em>container</em> &#8211; container name</li>
<li><em>obj</em> &#8211; object name</li>
<li><em>conn_timeout</em> &#8211; timeout in seconds for establishing the connection</li>
<li><em>response_timeout</em> &#8211; timeout in seconds for getting the response</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">object</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.direct_client.direct_head_container">
<tt class="descclassname">swift.common.direct_client.</tt><tt class="descname">direct_head_container</tt><big>(</big><em>node</em>, <em>part</em>, <em>account</em>, <em>container</em>, <em>conn_timeout=5</em>, <em>response_timeout=15</em><big>)</big><a class="headerlink" href="#swift.common.direct_client.direct_head_container" title="Permalink to this definition">¶</a></dt>
<dd><p>Request container information directly from the container server.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>node</em> &#8211; node dictionary from the ring</li>
<li><em>part</em> &#8211; partition the container is on</li>
<li><em>account</em> &#8211; account name</li>
<li><em>container</em> &#8211; container name</li>
<li><em>conn_timeout</em> &#8211; timeout in seconds for establishing the connection</li>
<li><em>response_timeout</em> &#8211; timeout in seconds for getting the response</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">tuple of (object count, bytes used)</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.direct_client.direct_head_object">
<tt class="descclassname">swift.common.direct_client.</tt><tt class="descname">direct_head_object</tt><big>(</big><em>node</em>, <em>part</em>, <em>account</em>, <em>container</em>, <em>obj</em>, <em>conn_timeout=5</em>, <em>response_timeout=15</em><big>)</big><a class="headerlink" href="#swift.common.direct_client.direct_head_object" title="Permalink to this definition">¶</a></dt>
<dd><p>Request object information directly from the object server.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>node</em> &#8211; node dictionary from the ring</li>
<li><em>part</em> &#8211; partition the container is on</li>
<li><em>account</em> &#8211; account name</li>
<li><em>container</em> &#8211; container name</li>
<li><em>obj</em> &#8211; object name</li>
<li><em>conn_timeout</em> &#8211; timeout in seconds for establishing the connection</li>
<li><em>response_timeout</em> &#8211; timeout in seconds for getting the response</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">tuple of (content-type, object size, last modified timestamp,
etag, metadata dictionary)</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.direct_client.quote">
<tt class="descclassname">swift.common.direct_client.</tt><tt class="descname">quote</tt><big>(</big><em>value</em>, <em>safe='/'</em><big>)</big><a class="headerlink" href="#swift.common.direct_client.quote" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="swift.common.direct_client.retry">
<tt class="descclassname">swift.common.direct_client.</tt><tt class="descname">retry</tt><big>(</big><em>func</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#swift.common.direct_client.retry" title="Permalink to this definition">¶</a></dt>
<dd><p>Helper function to retry a given function a number of times.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>func</em> &#8211; callable to be called</li>
<li><em>retries</em> &#8211; number of retries</li>
<li><em>error_log</em> &#8211; logger for errors</li>
<li><em>args</em> &#8211; arguments to send to func</li>
<li><em>kwargs</em> &#8211; keyward arguments to send to func (if retries or
error_log are sent, they will be deleted from kwargs
before sending on to func)</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">restult of func</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
<div class="section" id="module-swift.common.bufferedhttp">
<span id="buffered-http"></span><h2>Buffered HTTP<a class="headerlink" href="#module-swift.common.bufferedhttp" title="Permalink to this headline">¶</a></h2>
<p>Monkey Patch httplib.HTTPResponse to buffer reads of headers. This can improve
performance when making large numbers of small HTTP requests.  This module
also provides helper functions to make HTTP connections using
BufferedHTTPResponse.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">If you use this, be sure that the libraries you are using do not access
the socket directly (xmlrpclib, I&#8217;m looking at you :/), and instead
make all calls through httplib.</p>
</div>
<dl class="class">
<dt id="swift.common.bufferedhttp.BufferedHTTPConnection">
<em class="property">class </em><tt class="descclassname">swift.common.bufferedhttp.</tt><tt class="descname">BufferedHTTPConnection</tt><big>(</big><em>host</em>, <em>port=None</em>, <em>strict=None</em>, <em>timeout=&lt;object object at 0x7f361fbff350&gt;</em><big>)</big><a class="headerlink" href="#swift.common.bufferedhttp.BufferedHTTPConnection" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">httplib.HTTPConnection</span></tt></p>
<p>HTTPConnection class that uses BufferedHTTPResponse</p>
<dl class="attribute">
<dt id="swift.common.bufferedhttp.BufferedHTTPConnection.response_class">
<tt class="descname">response_class</tt><a class="headerlink" href="#swift.common.bufferedhttp.BufferedHTTPConnection.response_class" title="Permalink to this definition">¶</a></dt>
<dd>alias of <a title="swift.common.bufferedhttp.BufferedHTTPResponse" class="reference internal" href="#swift.common.bufferedhttp.BufferedHTTPResponse"><tt class="xref docutils literal"><span class="pre">BufferedHTTPResponse</span></tt></a></dd></dl>

</dd></dl>

<dl class="class">
<dt id="swift.common.bufferedhttp.BufferedHTTPResponse">
<em class="property">class </em><tt class="descclassname">swift.common.bufferedhttp.</tt><tt class="descname">BufferedHTTPResponse</tt><big>(</big><em>sock</em>, <em>debuglevel=0</em>, <em>strict=0</em>, <em>method=None</em><big>)</big><a class="headerlink" href="#swift.common.bufferedhttp.BufferedHTTPResponse" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">httplib.HTTPResponse</span></tt></p>
<p>HTTPResponse class that buffers reading of headers</p>
</dd></dl>

<dl class="function">
<dt id="swift.common.bufferedhttp.http_connect">
<tt class="descclassname">swift.common.bufferedhttp.</tt><tt class="descname">http_connect</tt><big>(</big><em>ipaddr</em>, <em>port</em>, <em>device</em>, <em>partition</em>, <em>method</em>, <em>path</em>, <em>headers=None</em>, <em>query_string=None</em><big>)</big><a class="headerlink" href="#swift.common.bufferedhttp.http_connect" title="Permalink to this definition">¶</a></dt>
<dd><p>Helper function to create a HTTPConnection object that is buffered
for backend Swift services.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>ipaddr</em> &#8211; IPv4 address to connect to</li>
<li><em>port</em> &#8211; port to connect to</li>
<li><em>device</em> &#8211; device of the node to query</li>
<li><em>partition</em> &#8211; partition on the device</li>
<li><em>method</em> &#8211; HTTP method to request (&#8216;GET&#8217;, &#8216;PUT&#8217;, &#8216;POST&#8217;, etc.)</li>
<li><em>path</em> &#8211; request path</li>
<li><em>headers</em> &#8211; dictionary of headers</li>
<li><em>query_string</em> &#8211; request query string</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">HTTPConnection object</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="swift.common.bufferedhttp.http_connect_raw">
<tt class="descclassname">swift.common.bufferedhttp.</tt><tt class="descname">http_connect_raw</tt><big>(</big><em>ipaddr</em>, <em>port</em>, <em>method</em>, <em>path</em>, <em>headers=None</em>, <em>query_string=None</em><big>)</big><a class="headerlink" href="#swift.common.bufferedhttp.http_connect_raw" title="Permalink to this definition">¶</a></dt>
<dd><p>Helper function to create a HTTPConnection object that is buffered.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>ipaddr</em> &#8211; IPv4 address to connect to</li>
<li><em>port</em> &#8211; port to connect to</li>
<li><em>method</em> &#8211; HTTP method to request (&#8216;GET&#8217;, &#8216;PUT&#8217;, &#8216;POST&#8217;, etc.)</li>
<li><em>path</em> &#8211; request path</li>
<li><em>headers</em> &#8211; dictionary of headers</li>
<li><em>query_string</em> &#8211; request query string</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">HTTPConnection object</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
<div class="section" id="module-swift.common.healthcheck">
<span id="healthcheck"></span><h2>Healthcheck<a class="headerlink" href="#module-swift.common.healthcheck" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="swift.common.healthcheck.HealthCheckController">
<em class="property">class </em><tt class="descclassname">swift.common.healthcheck.</tt><tt class="descname">HealthCheckController</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#swift.common.healthcheck.HealthCheckController" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">object</span></tt></p>
<p>Basic controller used for monitoring.</p>
</dd></dl>

</div>
<div class="section" id="module-swift.common.memcached">
<span id="memecached"></span><h2>MemCacheD<a class="headerlink" href="#module-swift.common.memcached" title="Permalink to this headline">¶</a></h2>
<p>Lucid comes with memcached: v1.4.2.  Protocol documentation for that
version is at:</p>
<p><a class="reference external" href="http://github.com/memcached/memcached/blob/1.4.2/doc/protocol.txt">http://github.com/memcached/memcached/blob/1.4.2/doc/protocol.txt</a></p>
<dl class="class">
<dt id="swift.common.memcached.MemcacheRing">
<em class="property">class </em><tt class="descclassname">swift.common.memcached.</tt><tt class="descname">MemcacheRing</tt><big>(</big><em>servers</em>, <em>connect_timeout=0.29999999999999999</em>, <em>io_timeout=2.0</em>, <em>tries=3</em><big>)</big><a class="headerlink" href="#swift.common.memcached.MemcacheRing" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref docutils literal"><span class="pre">object</span></tt></p>
<p>Simple, consistent-hashed memcache client.</p>
<dl class="method">
<dt id="swift.common.memcached.MemcacheRing.delete">
<tt class="descname">delete</tt><big>(</big><em>key</em><big>)</big><a class="headerlink" href="#swift.common.memcached.MemcacheRing.delete" title="Permalink to this definition">¶</a></dt>
<dd><p>Deletes a key/value pair from memcache.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>key</em> &#8211; key to be deleted</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="swift.common.memcached.MemcacheRing.get">
<tt class="descname">get</tt><big>(</big><em>key</em><big>)</big><a class="headerlink" href="#swift.common.memcached.MemcacheRing.get" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the object specified by key.  It will also unpickle the object
before returning if it is pickled in memcache.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>key</em> &#8211; key</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">value of the key in memcache</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="swift.common.memcached.MemcacheRing.get_multi">
<tt class="descname">get_multi</tt><big>(</big><em>keys</em>, <em>server_key</em><big>)</big><a class="headerlink" href="#swift.common.memcached.MemcacheRing.get_multi" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets multiple values from memcache for the given keys.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><em>keys</em> &#8211; keys for values to be retrieved from memcache</li>
<li><em>servery_key</em> &#8211; key to use in determining which server in the ring
is used</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">list of values</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="swift.common.memcached.MemcacheRing.incr">
<tt class="descname">incr</tt><big>(</big><em>key</em>, <em>delta=1</em>, <em>timeout=0</em><big>)</big><a class="headerlink" href="#swift.common.memcached.MemcacheRing.incr" title="Permalink to this definition">¶</a></dt>
<dd><p>Increments a key which has a numeric value by delta.
If the key can&#8217;t be found, it&#8217;s added as delta.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>key</em> &#8211; key</li>
<li><em>delta</em> &#8211; amount to add to the value of key (or set as the value
if the key is not found)</li>
<li><em>timeout</em> &#8211; ttl in memcache</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="swift.common.memcached.MemcacheRing.set">
<tt class="descname">set</tt><big>(</big><em>key</em>, <em>value</em>, <em>serialize=True</em>, <em>timeout=0</em><big>)</big><a class="headerlink" href="#swift.common.memcached.MemcacheRing.set" title="Permalink to this definition">¶</a></dt>
<dd><p>Set a key/value pair in memcache</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>key</em> &#8211; key</li>
<li><em>value</em> &#8211; value</li>
<li><em>serialize</em> &#8211; if True, value is pickled before sending to memcache</li>
<li><em>timeout</em> &#8211; ttl in memcache</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="swift.common.memcached.MemcacheRing.set_multi">
<tt class="descname">set_multi</tt><big>(</big><em>mapping</em>, <em>server_key</em>, <em>serialize=True</em>, <em>timeout=0</em><big>)</big><a class="headerlink" href="#swift.common.memcached.MemcacheRing.set_multi" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets multiple key/value pairs in memcache.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><em>mapping</em> &#8211; dictonary of keys and values to be set in memcache</li>
<li><em>servery_key</em> &#8211; key to use in determining which server in the ring
is used</li>
<li><em>serialize</em> &#8211; if True, value is pickled before sending to memcache</li>
<li><em>timeout</em> &#8211; ttl for memcache</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="index.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="#">Misc</a><ul>
<li><a class="reference external" href="#module-swift.common.exceptions">Exceptions</a></li>
<li><a class="reference external" href="#module-swift.common.constraints">Constraints</a></li>
<li><a class="reference external" href="#module-swift.common.utils">Utils</a></li>
<li><a class="reference external" href="#module-swift.common.auth">Auth</a></li>
<li><a class="reference external" href="#module-swift.common.wsgi">WSGI</a></li>
<li><a class="reference external" href="#module-swift.common.client">Client</a></li>
<li><a class="reference external" href="#module-swift.common.direct_client">Direct Client</a></li>
<li><a class="reference external" href="#module-swift.common.bufferedhttp">Buffered HTTP</a></li>
<li><a class="reference external" href="#module-swift.common.healthcheck">Healthcheck</a></li>
<li><a class="reference external" href="#module-swift.common.memcached">MemCacheD</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="auth.html"
                                  title="previous chapter">Developer&#8217;s Authorization</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="_sources/misc.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" size="18" />
                <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="modindex.html" title="Global Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="auth.html" title="Developer’s Authorization"
             >previous</a> |</li>
        <li><a href="index.html">Swift v1.0.2 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; Copyright 2010, OpenStack, LLC..
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.6.
    </div>
  </body>
</html>