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">
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <title>DB_ENV->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 10. Replication Methods" />
11 <link rel="prev" href="repset_timeout.html" title="DB_ENV->rep_set_timeout()" />
12 <link rel="next" href="repstart.html" title="DB_ENV->rep_start()" />
15 <div xmlns="" class="navheader">
17 <p>Library Version 11.2.5.3</p>
19 <table width="100%" summary="Navigation header">
21 <th colspan="3" align="center">DB_ENV->rep_set_transport()</th>
24 <td width="20%" align="left"><a accesskey="p" href="repset_timeout.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 10.
28 <td width="20%" align="right"> <a accesskey="n" href="repstart.html">Next</a></td>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
37 <h2 class="title" style="clear: both"><a id="reptransport"></a>DB_ENV->rep_set_transport()</h2>
41 <pre class="programlisting">#include <db.h>
44 DB_ENV->rep_set_transport(DB_ENV *env, int envid,
45 int (*send)(DB_ENV *dbenv,
46 const DBT *control, const DBT *rec, const DB_LSN *lsnp,
47 int envid, u_int32_t flags)); </pre>
49 The <code class="methodname">DB_ENV->rep_set_transport()</code> method initializes the communication
50 infrastructure for a database environment participating in a replicated application.
53 The <code class="methodname">DB_ENV->rep_set_transport()</code> method is not called by most
54 replication applications. It should only be called by Base API applications
55 implementing their own network transport layer, explicitly holding
56 replication group elections and handling replication messages outside
57 of the Replication Manager framework.
60 The <code class="methodname">DB_ENV->rep_set_transport()</code> method configures operations
61 performed using the specified <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handle,
62 not all operations performed on the underlying database environment.
65 The <code class="methodname">DB_ENV->rep_set_transport()</code> method may be called at any time
66 during the life of the application.
69 The <code class="methodname">DB_ENV->rep_set_transport()</code> <span>
71 method returns a non-zero error value on failure and 0 on success.
76 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
77 <h3 class="title">Note</h3>
79 Berkeley DB is not re-entrant. The callback function
80 for this method should not attempt to make
81 library calls (for example, to release locks or close open handles). Re-entering
82 Berkeley DB is not guaranteed to work correctly, and the results are undefined.
85 <div class="sect2" lang="en" xml:lang="en">
86 <div class="titlepage">
89 <h3 class="title"><a id="idp62161184"></a>Parameters</h3>
93 <div class="sect3" lang="en" xml:lang="en">
94 <div class="titlepage">
97 <h4 class="title"><a id="idp62161464"></a>envid</h4>
102 The <span class="bold"><strong>envid</strong></span> parameter is the local
103 environment's ID. It must be a non-negative integer and uniquely identify
104 this Berkeley DB database environment (see
105 <a href="../../programmer_reference/rep_id.html" class="olink">Replication environment IDs</a>
106 for more information).
109 <div class="sect3" lang="en" xml:lang="en">
110 <div class="titlepage">
113 <h4 class="title"><a id="idp62173296"></a>send</h4>
118 The <span class="bold"><strong>send</strong></span> callback function is used to
119 transmit data using the replication application's communication
120 infrastructure. The parameters to <span class="bold"><strong>send</strong></span> are as follows:
122 <div class="itemizedlist">
126 <code class="literal">dbenv</code>
129 The <span class="bold"><strong>dbenv</strong></span> parameter is the enclosing
130 database environment handle.
135 <code class="literal">control</code>
138 The <span class="bold"><strong>control</strong></span> parameter is the first of
139 the two data elements to be transmitted by the <span class="bold"><strong>send</strong></span> function.
144 <code class="literal">rec</code>
147 The <span class="bold"><strong>rec</strong></span> parameter is the second of
148 the two data elements to be transmitted by the <span class="bold"><strong>send</strong></span> function.
153 <code class="literal">lsnp</code>
156 If the type of message to be sent has an LSN associated with it, then
157 the <span class="bold"><strong>lsnp</strong></span> parameter contains the LSN
158 of the record being sent. This LSN can be used to determine that
159 certain records have been processed successfully by clients.
164 <code class="literal">envid</code>
167 The <span class="bold"><strong>envid</strong></span> parameter is a positive
168 integer identifier that specifies the replication environment to which
169 the message should be sent (see <a href="../../programmer_reference/rep_id.html" class="olink">Replication environment IDs</a> for more
172 <p><a id="transport_DB_EID_BROADCAST"></a>
173 The special identifier <code class="literal">DB_EID_BROADCAST</code> indicates that a message
174 should be broadcast to every environment in the replication group. The application
175 may use a true broadcast protocol or may send the message in sequence to each
176 machine with which it is in communication. In both cases, the sending site should
177 not be asked to process the message.
180 The special identifier
181 <a href="../../programmer_reference/rep_id.html#rep_id.DB_EID_INVALID" class="olink">DB_EID_INVALID</a>
182 indicates an invalid environment ID. This may be used to initialize
183 values that are subsequently checked for validity.
188 <code class="literal">flags</code>
191 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0
192 or by bitwise inclusively <span class="bold"><strong>OR</strong></span>'ing
193 together one or more of the following values:
195 <div class="itemizedlist">
198 <p><a id="transport_DB_REP_ANYWHERE"></a>
199 <code class="literal">DB_REP_ANYWHERE</code>
202 The message is a client request that can be satisfied by another
203 client as well as by the master.
207 <p><a id="transport_DB_REP_NOBUFFER"></a>
208 <code class="literal">DB_REP_NOBUFFER</code>
211 The record being sent should be transmitted immediately and not
216 <p><a id="transport_DB_REP_PERMANENT"></a>
217 <code class="literal">DB_REP_PERMANENT</code>
220 The record being sent is critical for maintaining database integrity
221 (for example, the message includes a transaction commit). The
222 application should take appropriate action to enforce the reliability
223 guarantees it has chosen, such as waiting for acknowledgement from one
228 <p><a id="transport_DB_REP_REREQUEST"></a>
229 <code class="literal">DB_REP_REREQUEST</code>
232 The message is a client request that has already been made and to
233 which no response was received.
243 It may sometimes be useful to pass application-specific data to the send
244 function; see <a href="../../programmer_reference/env_faq.html" class="olink">Environment FAQ</a>
245 for a discussion on how to do this.
249 The <span class="bold"><strong>send</strong></span> function must return 0 on success and non-zero on failure.
250 If the send function fails, the message being sent is necessary to maintain database integrity, and
251 the local log is not configured for synchronous flushing, the local log will be flushed; otherwise,
252 any error from the <span class="bold"><strong>send</strong></span> function will be ignored.
256 <div class="sect2" lang="en" xml:lang="en">
257 <div class="titlepage">
260 <h3 class="title"><a id="idp62198640"></a>Errors</h3>
265 The <code class="methodname">DB_ENV->rep_set_transport()</code> <span>
267 method may fail and return one of the following non-zero errors:
272 <div class="sect3" lang="en" xml:lang="en">
273 <div class="titlepage">
276 <h4 class="title"><a id="idp62217728"></a>EINVAL</h4>
281 The method is called from a Replication Manager application; or an invalid flag value or
282 parameter was specified.
286 <div class="sect2" lang="en" xml:lang="en">
287 <div class="titlepage">
290 <h3 class="title"><a id="idp62128728"></a>Class</h3>
295 <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a>
298 <div class="sect2" lang="en" xml:lang="en">
299 <div class="titlepage">
302 <h3 class="title"><a id="idp62196440"></a>See Also</h3>
307 <a class="xref" href="rep.html#replist" title="Replication and Related Methods">Replication and Related Methods</a>
311 <div class="navfooter">
313 <table width="100%" summary="Navigation footer">
315 <td width="40%" align="left"><a accesskey="p" href="repset_timeout.html">Prev</a> </td>
316 <td width="20%" align="center">
317 <a accesskey="u" href="rep.html">Up</a>
319 <td width="40%" align="right"> <a accesskey="n" href="repstart.html">Next</a></td>
322 <td width="40%" align="left" valign="top">DB_ENV->rep_set_timeout() </td>
323 <td width="20%" align="center">
324 <a accesskey="h" href="index.html">Home</a>
326 <td width="40%" align="right" valign="top"> DB_ENV->rep_start()</td>