Sindbad~EG File Manager

Current Path : /usr/local/share/doc/db18/api_reference/CXX/
Upload File :
Current File : /usr/local/share/doc/db18/api_reference/CXX/dbset_partition.html

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!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>Db::set_partition()</title>
    <link rel="stylesheet" href="apiReference.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" />
    <link rel="up" href="db.html" title="Chapter 2.  The Db Handle" />
    <link rel="prev" href="dbset_pagesize.html" title="Db::set_pagesize()" />
    <link rel="next" href="dbset_partition_dirs.html" title="Db::set_partition_dirs()" />
  </head>
  <body>
    <div xmlns="" class="navheader">
      <div class="libver">
        <p>Library Version 18.1.40</p>
      </div>
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">
        
        <span xmlns="http://www.w3.org/1999/xhtml">Db::set_partition()</span>
    </th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="dbset_pagesize.html">Prev</a> </td>
          <th width="60%" align="center">Chapter 2. 
                The Db Handle
        </th>
          <td width="20%" align="right"> <a accesskey="n" href="dbset_partition_dirs.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both"><a id="dbset_partition"></a>
        
        <span>Db::set_partition()</span>
    </h2>
          </div>
        </div>
      </div>
      <pre class="programlisting">#include &lt;db_cxx.h&gt;
 
int
Db::set_partition(u_int32_t parts, DBT *kyes,
	u_int32_t (*db_partition_fcn) (Db *db, DBT *key));</pre>
      <p>
        Set up partitioning for a database.  Partitioning may be used on
        either BTREE or HASH databases.  Partitions may be specified by
        either a set of keys specifying a range of values in each
        partition, or with a callback function that returns the number of
        the partition to put a specific key.  Partition range keys may only
        be specified for BTREE databases.
	</p>
      <p>
        Partitions are implemented as separate database files and can help
        reduce contention within a logical database.  Contention can come
        from multiple threads of control accessing database pages
        simultaneously.  Typically these pages are the root of a btree and
        the metadata page which contains allocation information in both
        BTREE and HASH databases.  Each partition has its own metadata and
        root pages.
	</p>
      <p>
          The <code class="methodname">Db::set_partition()</code> method can not
          be used with a sliced database.
      </p>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="idm139755618088544"></a>Parameters</h3>
            </div>
          </div>
        </div>
        <p>
                Exactly one of the parameters 
                <span class="bold"><strong>keys</strong></span> and 
                <span class="bold"><strong>partition_fcn</strong></span> must be NULL.
            </p>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idm139755618001840"></a>parts</h4>
              </div>
            </div>
          </div>
          <p>
                The <span class="bold"><strong>parts</strong></span> parameter is the
	         number of partitions to create. The value must be greater than
	         or equal to 2, and smaller than 1000000.
	    </p>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idm139755618025392"></a>keys</h4>
              </div>
            </div>
          </div>
          <p>
                The <span class="bold"><strong>keys</strong></span> parameter is an
                array of DBT structures containing the keys that specify
                the range of key values to be stored in each partition.
                Each key specifies the minimum value that may be stored in
                the corresponding partition.  The number of keys must be
                one less than the number of partitions specified by the
                <span class="bold"><strong>parts</strong></span> parameter since the
                first partition will hold any key less than the first key
                in the array.
	    </p>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idm139755618032912"></a>db_partition_fcn</h4>
              </div>
            </div>
          </div>
          <p>
                The <span class="bold"><strong>db_partition_fcn</strong></span>
                parameter is the application-specified partitioning
                function.  The function returns an integer which will be
                used modulo the number of partitions specified by the 
                <span class="bold"><strong>parts</strong></span> parameter.  
                The function will be called with two parameters:
            </p>
          <div class="itemizedlist">
            <ul type="disc">
              <li>
                <p>
                        <code class="literal">db</code>
                    </p>
                <p>
                         The <span class="bold"><strong>db</strong></span> parameter
                         is the database handle.
                    </p>
              </li>
              <li>
                <p>
                        <code class="literal">key</code>
                    </p>
                <p>
                         The <span class="bold"><strong>key</strong></span> parameter
                         is the key for which a partition number should be
                         returned.
                    </p>
              </li>
            </ul>
          </div>
        </div>
      </div>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="idm139755617993408"></a>Class</h3>
            </div>
          </div>
        </div>
        <p>
            <a class="link" href="db.html" title="Chapter 2.  The Db Handle">Db</a>  
        </p>
      </div>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="idm139755618003872"></a>See Also</h3>
            </div>
          </div>
        </div>
        <p>
             <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a> 
        </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="dbset_pagesize.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="db.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="dbset_partition_dirs.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">
        
        <span>Db::set_pagesize()</span>
     </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> 
        
        <span>Db::set_partition_dirs()</span>
    </td>
        </tr>
      </table>
    </div>
  </body>
</html>

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists