1<?xml version="1.0" encoding="UTF-8" standalone="no"?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 6 <title>DbEnv::rep_set_nsites()</title> 7 <link rel="stylesheet" href="apiReference.css" type="text/css" /> 8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> 9 <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" /> 10 <link rel="up" href="rep.html" title="Chapter��11.�� Replication Methods" /> 11 <link rel="prev" href="repset_limit.html" title="DbEnv::rep_set_limit()" /> 12 <link rel="next" href="reppriority.html" title="DbEnv::rep_set_priority()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DbEnv::rep_set_nsites()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="repset_limit.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��11.�� 23 Replication Methods 24 </th> 25 <td width="20%" align="right">��<a accesskey="n" href="reppriority.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="sect1" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title" style="clear: both"><a id="repnsites"></a>DbEnv::rep_set_nsites()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbEnv::rep_set_nsites(u_int32_t nsites); </pre> 42 <p> 43 The <code class="methodname">DbEnv::rep_set_nsites()</code> method specifies the total number of 44 sites in a replication group. 45 </p> 46 <p> 47 The <code class="methodname">DbEnv::rep_set_nsites()</code> method is typically called by 48 Replication Manager applications. (However, see also the 49 <a class="xref" href="repelect.html" title="DbEnv::rep_elect()">DbEnv::rep_elect()</a> method 50 <span class="bold"><strong>nsites</strong></span> 51 parameter.) 52 </p> 53 <p> 54 The database environment's replication subsystem may also be 55 configured using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The 56 syntax of the entry in that file is a single line with the string 57 "rep_set_nsites", one or more whitespace characters, and the number of 58 sites specified. For example, "rep_set_nsites 5" sets the number of 59 sites to 5. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is 60 read when the database environment is opened, it will silently 61 overrule configuration done before that time. 62 </p> 63 <p> 64 The <code class="methodname">DbEnv::rep_set_nsites()</code> method configures a database 65 environment, not only operations performed using the specified 66 <a class="link" href="env.html" title="Chapter��5.�� The DbEnv Handle">DbEnv</a> handle. 67 </p> 68 <p> 69 If master leases are in use, the <code class="methodname">DbEnv::rep_set_nsites()</code> method 70 may not be called after the <a class="xref" href="repstart.html" title="DbEnv::rep_start()">DbEnv::rep_start()</a> or 71 <a class="xref" href="repmgrstart.html" title="DbEnv::repmgr_start()">DbEnv::repmgr_start()</a> methods 72 are called. If master leases are not in use, the 73 <code class="methodname">DbEnv::rep_set_nsites()</code> method may be 74 called at any time during the life of the application. 75 </p> 76 <p> 77 The <code class="methodname">DbEnv::rep_set_nsites()</code> <span> 78 79 <span> 80 method either returns a non-zero error value or throws an 81 exception that encapsulates a non-zero error value on 82 failure, and returns 0 on success. 83 </span> 84 </span> 85 </p> 86 <div class="sect2" lang="en" xml:lang="en"> 87 <div class="titlepage"> 88 <div> 89 <div> 90 <h3 class="title"><a id="id1703758"></a>Parameters</h3> 91 </div> 92 </div> 93 </div> 94 <div class="sect3" lang="en" xml:lang="en"> 95 <div class="titlepage"> 96 <div> 97 <div> 98 <h4 class="title"><a id="id1703635"></a>nsites</h4> 99 </div> 100 </div> 101 </div> 102 <p> 103 An integer specifying the total number of sites in the replication 104 group. 105 </p> 106 </div> 107 </div> 108 <div class="sect2" lang="en" xml:lang="en"> 109 <div class="titlepage"> 110 <div> 111 <div> 112 <h3 class="title"><a id="id1703634"></a>Errors</h3> 113 </div> 114 </div> 115 </div> 116 <p> 117 The <code class="methodname">DbEnv::rep_set_nsites()</code> <span> 118 119 <span> 120 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter��6.��The DbException Class">DbException</a> 121 exception, encapsulating one of the following non-zero errors, or return one 122 of the following non-zero errors: 123 </span> 124 </span> 125 </p> 126 <div class="sect3" lang="en" xml:lang="en"> 127 <div class="titlepage"> 128 <div> 129 <div> 130 <h4 class="title"><a id="id1703844"></a>EINVAL</h4> 131 </div> 132 </div> 133 </div> 134 <p> 135 If master leases are in use and replication has already been started; or if 136 an invalid flag value or parameter was specified. 137 </p> 138 </div> 139 </div> 140 <div class="sect2" lang="en" xml:lang="en"> 141 <div class="titlepage"> 142 <div> 143 <div> 144 <h3 class="title"><a id="id1703836"></a>Class</h3> 145 </div> 146 </div> 147 </div> 148 <p> 149 <a class="link" href="env.html" title="Chapter��5.�� The DbEnv Handle">DbEnv</a> 150 </p> 151 </div> 152 <div class="sect2" lang="en" xml:lang="en"> 153 <div class="titlepage"> 154 <div> 155 <div> 156 <h3 class="title"><a id="id1703627"></a>See Also</h3> 157 </div> 158 </div> 159 </div> 160 <p> 161 <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> 162 </p> 163 </div> 164 </div> 165 <div class="navfooter"> 166 <hr /> 167 <table width="100%" summary="Navigation footer"> 168 <tr> 169 <td width="40%" align="left"><a accesskey="p" href="repset_limit.html">Prev</a>��</td> 170 <td width="20%" align="center"> 171 <a accesskey="u" href="rep.html">Up</a> 172 </td> 173 <td width="40%" align="right">��<a accesskey="n" href="reppriority.html">Next</a></td> 174 </tr> 175 <tr> 176 <td width="40%" align="left" valign="top">DbEnv::rep_set_limit()��</td> 177 <td width="20%" align="center"> 178 <a accesskey="h" href="index.html">Home</a> 179 </td> 180 <td width="40%" align="right" valign="top">��DbEnv::rep_set_priority()</td> 181 </tr> 182 </table> 183 </div> 184 </body> 185</html> 186