• 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_set_transport()</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_timeout.html" title="DbEnv::rep_set_timeout()" />
12    <link rel="next" href="repstart.html" title="DbEnv::rep_start()" />
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_transport()</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="repset_timeout.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="repstart.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="reptransport"></a>DbEnv::rep_set_transport()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db_cxx.h&gt;
39 
40int
41DbEnv::rep_set_transport(int envid,
42    int (*send)(DB_ENV *dbenv,
43    const Dbt *control, const Dbt *rec, const DbLsn *lsnp,
44    int envid, u_int32_t flags));</pre>
45      <p>
46         The <code class="methodname">DbEnv::rep_set_transport()</code> method initializes the communication
47         infrastructure for a database environment participating in a replicated application.
48    </p>
49      <p>
50         The <code class="methodname">DbEnv::rep_set_transport()</code> method is not called by most
51         replication applications.  It should only be called by Base API applications
52         implementing their own network transport layer, explicitly holding
53         replication group elections and handling replication messages outside
54         of the Replication Manager framework.
55    </p>
56      <p>
57         The <code class="methodname">DbEnv::rep_set_transport()</code> method configures operations
58         performed using the specified <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>  handle, 
59         not all operations performed on the underlying database environment.
60    </p>
61      <p>
62         The <code class="methodname">DbEnv::rep_set_transport()</code> method may be called at any time
63         during the life of the application.
64    </p>
65      <p>
66         The <code class="methodname">DbEnv::rep_set_transport()</code> <span>
67            
68            <span>
69                method either returns a non-zero error value or throws an
70                exception that encapsulates a non-zero error value on
71                failure, and returns 0 on success.
72            </span>
73        </span>
74    </p>
75      <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
76        <h3 class="title">Note</h3>
77        <p>
78                    Berkeley DB is not re-entrant. The callback function
79for this method should not attempt to make
80                    library calls (for example, to release locks or close open handles). Re-entering
81                    Berkeley DB is not guaranteed to work correctly, and the results are undefined.
82            </p>
83      </div>
84      <div class="sect2" lang="en" xml:lang="en">
85        <div class="titlepage">
86          <div>
87            <div>
88              <h3 class="title"><a id="id1703770"></a>Parameters</h3>
89            </div>
90          </div>
91        </div>
92        <div class="sect3" lang="en" xml:lang="en">
93          <div class="titlepage">
94            <div>
95              <div>
96                <h4 class="title"><a id="id1704762"></a>envid</h4>
97              </div>
98            </div>
99          </div>
100          <p>
101                          The <span class="bold"><strong>envid</strong></span> parameter is the local
102                          environment's ID.  It must be a non-negative integer and uniquely identify
103                          this Berkeley DB database environment (see 
104                          <a href="../../programmer_reference/rep_id.html" class="olink">Replication environment IDs</a> 
105                          for more information).
106                     </p>
107        </div>
108        <div class="sect3" lang="en" xml:lang="en">
109          <div class="titlepage">
110            <div>
111              <div>
112                <h4 class="title"><a id="id1704895"></a>send</h4>
113              </div>
114            </div>
115          </div>
116          <p>
117                          The <span class="bold"><strong>send</strong></span> callback function is used to
118                          transmit data using the replication application's communication
119                          infrastructure.  The parameters to <span class="bold"><strong>send</strong></span> are as follows:
120                     </p>
121          <div class="itemizedlist">
122            <ul type="disc">
123              <li>
124                <p>
125                <code class="literal">dbenv</code>
126            </p>
127                <p>
128                 The <span class="bold"><strong>dbenv</strong></span> parameter is the enclosing
129                 database environment handle.
130            </p>
131              </li>
132              <li>
133                <p>
134                <code class="literal">control</code>
135            </p>
136                <p>
137                 The <span class="bold"><strong>control</strong></span> parameter is the first of
138                 the two data elements to be transmitted by the <span class="bold"><strong>send</strong></span> function.
139            </p>
140              </li>
141              <li>
142                <p>
143                <code class="literal">rec</code>
144            </p>
145                <p>
146                 The <span class="bold"><strong>rec</strong></span> parameter is the second of
147                 the two data elements to be transmitted by the <span class="bold"><strong>send</strong></span> function.
148            </p>
149              </li>
150              <li>
151                <p>
152                <code class="literal">lsnp</code>
153            </p>
154                <p>
155                 If the type of message to be sent has an LSN associated with it, then
156                 the <span class="bold"><strong>lsnp</strong></span> parameter contains the LSN
157                 of the record being sent. This LSN can be used to determine that
158                 certain records have been processed successfully by clients.
159            </p>
160              </li>
161              <li>
162                <p>
163                <code class="literal">envid</code>
164            </p>
165                <p>
166                 The <span class="bold"><strong>envid</strong></span> parameter is a positive
167                 integer identifier that specifies the replication environment to which
168                 the message should be sent (see <a href="../../programmer_reference/rep_id.html" class="olink">Replication environment IDs</a> for more
169                 information).
170            </p>
171                <p><a id="transport_DB_EID_BROADCAST"></a>
172                The special identifier <code class="literal">DB_EID_BROADCAST</code> indicates that a message
173                should be broadcast to every environment in the replication group.  The application
174                may use a true broadcast protocol or may send the message in sequence to each
175                machine with which it is in communication.  In both cases, the sending site should
176                not be asked to process the message.
177            </p>
178                <p>
179                The special identifier 
180                <a href="../../programmer_reference/rep_id.html#rep_id.DB_EID_INVALID" class="olink">DB_EID_INVALID</a>
181                indicates an invalid environment ID.  This may be used to initialize
182                values that are subsequently checked for validity.
183            </p>
184              </li>
185              <li>
186                <p>
187                <code class="literal">flags</code>
188            </p>
189                <p>
190                 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0
191                 or by bitwise inclusively <span class="bold"><strong>OR</strong></span>'ing
192                 together one or more of the following values:
193            </p>
194                <div class="itemizedlist">
195                  <ul type="circle">
196                    <li>
197                      <p><a id="transport_DB_REP_ANYWHERE"></a>
198                     <code class="literal">DB_REP_ANYWHERE</code>
199            </p>
200                      <p>
201                 The message is a client request that can be satisfied by another
202                 client as well as by the master.
203            </p>
204                    </li>
205                    <li>
206                      <p><a id="transport_DB_REP_NOBUFFER"></a>
207                  <code class="literal">DB_REP_NOBUFFER</code>
208            </p>
209                      <p>
210                 The record being sent should be transmitted immediately and not
211                 buffered or delayed.
212            </p>
213                    </li>
214                    <li>
215                      <p><a id="transport_DB_REP_PERMANENT"></a>
216                  <code class="literal">DB_REP_PERMANENT</code>
217            </p>
218                      <p>
219                 The record being sent is critical for maintaining database integrity
220                 (for example, the message includes a transaction commit).  The
221                 application should take appropriate action to enforce the reliability
222                 guarantees it has chosen, such as waiting for acknowledgement from one
223                 or more clients.
224            </p>
225                    </li>
226                    <li>
227                      <p><a id="transport_DB_REP_REREQUEST"></a>
228                  <code class="literal">DB_REP_REREQUEST</code>
229            </p>
230                      <p>
231                 The message is a client request that has already been made and to
232                 which no response was received.
233            </p>
234                    </li>
235                  </ul>
236                </div>
237              </li>
238            </ul>
239          </div>
240          <p>
241
242                    It may sometimes be useful to pass application-specific data to the send
243                    function; see <a href="../../programmer_reference/env_faq.html" class="olink">Environment FAQ</a>
244                    for a discussion on how to do this.
245
246            </p>
247          <p>
248                    The <span class="bold"><strong>send</strong></span> function must return 0 on success and non-zero on failure.
249                    If the send function fails, the message being sent is necessary to maintain database integrity, and
250                    the local log is not configured for synchronous flushing, the local log will be flushed; otherwise,
251                    any error from the <span class="bold"><strong>send</strong></span> function will be ignored.
252            </p>
253        </div>
254      </div>
255      <div class="sect2" lang="en" xml:lang="en">
256        <div class="titlepage">
257          <div>
258            <div>
259              <h3 class="title"><a id="id1704926"></a>Errors</h3>
260            </div>
261          </div>
262        </div>
263        <p>
264                         The <code class="methodname">DbEnv::rep_set_transport()</code> <span>
265            
266            <span>
267                method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 
268                exception, encapsulating one of the following non-zero errors, or return one
269                of the following non-zero errors:
270            </span>
271        </span>
272                    </p>
273        <div class="sect3" lang="en" xml:lang="en">
274          <div class="titlepage">
275            <div>
276              <div>
277                <h4 class="title"><a id="id1705322"></a>EINVAL</h4>
278              </div>
279            </div>
280          </div>
281          <p>
282                The method is called from a Replication Manager application; or an invalid flag value or 
283                parameter was specified.
284            </p>
285        </div>
286      </div>
287      <div class="sect2" lang="en" xml:lang="en">
288        <div class="titlepage">
289          <div>
290            <div>
291              <h3 class="title"><a id="id1704691"></a>Class</h3>
292            </div>
293          </div>
294        </div>
295        <p>
296                <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>  
297            </p>
298      </div>
299      <div class="sect2" lang="en" xml:lang="en">
300        <div class="titlepage">
301          <div>
302            <div>
303              <h3 class="title"><a id="id1704564"></a>See Also</h3>
304            </div>
305          </div>
306        </div>
307        <p>
308                     <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a> 
309                </p>
310      </div>
311    </div>
312    <div class="navfooter">
313      <hr />
314      <table width="100%" summary="Navigation footer">
315        <tr>
316          <td width="40%" align="left"><a accesskey="p" href="repset_timeout.html">Prev</a> </td>
317          <td width="20%" align="center">
318            <a accesskey="u" href="rep.html">Up</a>
319          </td>
320          <td width="40%" align="right"> <a accesskey="n" href="repstart.html">Next</a></td>
321        </tr>
322        <tr>
323          <td width="40%" align="left" valign="top">DbEnv::rep_set_timeout() </td>
324          <td width="20%" align="center">
325            <a accesskey="h" href="index.html">Home</a>
326          </td>
327          <td width="40%" align="right" valign="top"> DbEnv::rep_start()</td>
328        </tr>
329      </table>
330    </div>
331  </body>
332</html>
333