• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src/router/db-4.8.30/docs/api_reference/CXX/
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_start()</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="reptransport.html" title="DbEnv::rep_set_transport()" />
12    <link rel="next" href="repstat.html" title="DbEnv::rep_stat()" />
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_start()</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="reptransport.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="repstat.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="repstart"></a>DbEnv::rep_start()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db_cxx.h&gt;
39 
40int
41DbEnv::rep_start(Dbt *cdata, u_int32_t flags);</pre>
42      <p>
43         The <code class="methodname">DbEnv::rep_start()</code> method configures the database environment as
44         a client or master in a group of replicated database environments.
45    </p>
46      <p>
47         The <code class="methodname">DbEnv::rep_start()</code> method is not called by most replication
48         applications.  It should only be called by Base API applications implementing
49         their own network transport layer, explicitly holding replication
50         group elections and handling replication messages outside of the
51         Replication Manager framework.
52    </p>
53      <p>
54         Replication master environments are the only database environments
55         where replicated databases may be modified.  Replication client
56         environments are read-only as long as they are clients.  Replication
57         client environments may be upgraded to be replication master
58         environments in the case that the current master fails or there is no
59         master present. If master leases are in use, this method cannot be
60         used to appoint a master, and should only be used to configure a database
61         environment as a master as the result of an election.
62    </p>
63      <p>
64         The enclosing database environment must already have been opened by
65         calling the <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a>  method and must
66         already have been configured to send replication messages by calling
67         the <a class="xref" href="reptransport.html" title="DbEnv::rep_set_transport()">DbEnv::rep_set_transport()</a> 
68         method.
69    </p>
70      <p>
71         The <code class="methodname">DbEnv::rep_start()</code> <span>
72            
73            <span>
74                method either returns a non-zero error value or throws an
75                exception that encapsulates a non-zero error value on
76                failure, and returns 0 on success.
77            </span>
78        </span>
79    </p>
80      <div class="sect2" lang="en" xml:lang="en">
81        <div class="titlepage">
82          <div>
83            <div>
84              <h3 class="title"><a id="id1705064"></a>Parameters</h3>
85            </div>
86          </div>
87        </div>
88        <div class="sect3" lang="en" xml:lang="en">
89          <div class="titlepage">
90            <div>
91              <div>
92                <h4 class="title"><a id="id1705045"></a>cdata</h4>
93              </div>
94            </div>
95          </div>
96          <p>
97                          The <span class="bold"><strong>cdata</strong></span> parameter is an opaque data
98                          item that is sent over the communication infrastructure when the client
99                          comes online (see <a href="../../programmer_reference/rep_newsite.html" class="olink">Connecting to a new site</a> for more information).  If no such information is useful,
100                          <span class="bold"><strong>cdata</strong></span> should be NULL.
101                     </p>
102        </div>
103        <div class="sect3" lang="en" xml:lang="en">
104          <div class="titlepage">
105            <div>
106              <div>
107                <h4 class="title"><a id="id1704984"></a>flags</h4>
108              </div>
109            </div>
110          </div>
111          <p>
112                          The <span class="bold"><strong>flags</strong></span> parameter must be set to
113                          one of the following values:
114                     </p>
115          <div class="itemizedlist">
116            <ul type="disc">
117              <li>
118                <p>
119                  <code class="literal">DB_REP_CLIENT</code>
120            </p>
121                <p>
122                Configure the environment as a replication client.
123            </p>
124              </li>
125              <li>
126                <p>
127                  <code class="literal">DB_REP_MASTER</code>
128            </p>
129                <p>
130                Configure the environment as a replication master.
131            </p>
132              </li>
133            </ul>
134          </div>
135        </div>
136      </div>
137      <div class="sect2" lang="en" xml:lang="en">
138        <div class="titlepage">
139          <div>
140            <div>
141              <h3 class="title"><a id="id1705573"></a>Errors</h3>
142            </div>
143          </div>
144        </div>
145        <p>
146                         The <code class="methodname">DbEnv::rep_start()</code> <span>
147            
148            <span>
149                method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 
150                exception, encapsulating one of the following non-zero errors, or return one
151                of the following non-zero errors:
152            </span>
153        </span>
154                    </p>
155        <div class="sect3" lang="en" xml:lang="en">
156          <div class="titlepage">
157            <div>
158              <div>
159                <h4 class="title"><a id="id1704483"></a>DB_REP_UNAVAIL</h4>
160              </div>
161              <div>
162                <h4 class="title"><a id="id1704483"></a>DB_REP_UNAVAIL</h4>
163              </div>
164            </div>
165          </div>
166          <p>
167			      If the flags parameter was passed as DB_REP_MASTER but the database
168			      environment cannot currently become the replication master because it is temporarily initializing and is incomplete.
169                         </p>
170          <p>
171                              If the database environment was not already configured to communicate
172                              with a replication group by a call to 
173                              <a class="xref" href="reptransport.html" title="DbEnv::rep_set_transport()">DbEnv::rep_set_transport()</a>;
174                              the database environment was not already opened; 
175                              this method is called from a Replication Manager application; outstanding
176                              master leases are granted; this method is used to appoint a new master when
177                              master leases are in use; or if an invalid flag value or parameter was specified.
178                         </p>
179        </div>
180      </div>
181      <div class="sect2" lang="en" xml:lang="en">
182        <div class="titlepage">
183          <div>
184            <div>
185              <h3 class="title"><a id="id1705075"></a>Class</h3>
186            </div>
187          </div>
188        </div>
189        <p>
190                <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>  
191            </p>
192      </div>
193      <div class="sect2" lang="en" xml:lang="en">
194        <div class="titlepage">
195          <div>
196            <div>
197              <h3 class="title"><a id="id1705360"></a>See Also</h3>
198            </div>
199          </div>
200        </div>
201        <p>
202                     <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> 
203                </p>
204      </div>
205    </div>
206    <div class="navfooter">
207      <hr />
208      <table width="100%" summary="Navigation footer">
209        <tr>
210          <td width="40%" align="left"><a accesskey="p" href="reptransport.html">Prev</a> </td>
211          <td width="20%" align="center">
212            <a accesskey="u" href="rep.html">Up</a>
213          </td>
214          <td width="40%" align="right"> <a accesskey="n" href="repstat.html">Next</a></td>
215        </tr>
216        <tr>
217          <td width="40%" align="left" valign="top">DbEnv::rep_set_transport() </td>
218          <td width="20%" align="center">
219            <a accesskey="h" href="index.html">Home</a>
220          </td>
221          <td width="40%" align="right" valign="top"> DbEnv::rep_stat()</td>
222        </tr>
223      </table>
224    </div>
225  </body>
226</html>
227