1<!--$Id: rep_transport.so,v 1.37 2008/02/04 20:55:16 sue Exp $--> 2<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 3<!--See the file LICENSE for redistribution information.--> 4<html> 5<head> 6<title>Berkeley DB: DB_ENV->rep_set_transport</title> 7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 9</head> 10<body bgcolor=white> 11<table width="100%"><tr valign=top> 12<td> 13<b>DB_ENV->rep_set_transport</b> 14</td> 15<td align=right> 16<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a> 17<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td> 18</tr></table> 19<hr size=1 noshade> 20<tt> 21<b><pre> 22#include <db.h> 23<p> 24int 25DB_ENV->rep_set_transport(DB_ENV *env, int envid, 26 int (*send)(DB_ENV *dbenv, 27 const DBT *control, const DBT *rec, const DB_LSN *lsnp, 28 int envid, u_int32_t flags)); 29</pre></b> 30<hr size=1 noshade> 31<b>Description: DB_ENV->rep_set_transport</b> 32<p>The DB_ENV->rep_set_transport method initializes the communication infrastructure 33for a database environment participating in a replicated application.</p> 34<p>The DB_ENV->rep_set_transport method is not called by most replication 35applications. It should only be called by applications implementing 36their own network transport layer, explicitly holding replication group 37elections and handling replication messages outside of the replication 38manager framework.</p> 39<p>The DB_ENV->rep_set_transport method configures operations performed using the specified 40<a href="../api_c/env_class.html">DB_ENV</a> handle, not all operations performed on the underlying 41database environment.</p> 42<p>The DB_ENV->rep_set_transport method may be called at any time during the life of the 43application.</p> 44<p>The DB_ENV->rep_set_transport method 45returns a non-zero error value on failure 46and 0 on success. 47</p> 48<b>Parameters</b> <br> 49 <b>envid</b><ul compact><li>The <b>envid</b> parameter is the local environment's ID. It must be 50a non-negative integer and uniquely identify this Berkeley DB database environment 51(see <a href="../ref/rep/id.html">Replication environment IDs</a> for more 52information).</ul> 53 <b>send</b><ul compact><li>The <b>send</b> callback function is used to transmit data using the 54replication application's communication infrastructure. The parameters 55to <b>send</b> are as follows: 56<br> 57<b><b>dbenv</b></b><ul compact><li>The <b>dbenv</b> parameter is the enclosing database environment handle.</ul> 58<b><b>control</b></b><ul compact><li>The <b>control</b> parameter is the first of the two data elements to be 59transmitted by the <b>send</b> function.</ul> 60<b><b>rec</b></b><ul compact><li>The <b>rec</b> parameter is the second of the two data elements to be 61transmitted by the <b>send</b> function.</ul> 62<b><b>lsnp</b></b><ul compact><li>If the type of message to be sent has an LSN associated with it, then 63the <b>lsnp</b> parameter contains the LSN of the record being sent. 64This LSN can be used to determine that certain records have been 65processed successfully by clients.</ul> 66<b><b>envid</b></b><ul compact><li>The <b>envid</b> parameter is a positive integer identifier that 67specifies the replication environment to which the message should be 68sent (see <a href="../ref/rep/id.html">Replication environment IDs</a> for 69more information). 70<p>The special identifier DB_EID_BROADCAST indicates that a message 71should be broadcast to every environment in the replication group. The 72application may use a true broadcast protocol or may send the message 73in sequence to each machine with which it is in communication. In both 74cases, the sending site should not be asked to process the message.</p> 75<p>The special identifier <a href="../ref/rep/id.html#DB_EID_INVALID">DB_EID_INVALID</a> indicates an invalid 76environment ID. This may be used to initialize values that are 77subsequently checked for validity.</p></ul> 78<b><b>flags</b></b><ul compact><li>The <b>flags</b> parameter must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one 79or more of the following values: 80<br> 81<b><a name="DB_REP_ANYWHERE">DB_REP_ANYWHERE</a></b><ul compact><li>The message is a client request that can be satisfied by another client 82as well as by the master.</ul> 83<b><a name="DB_REP_NOBUFFER">DB_REP_NOBUFFER</a></b><ul compact><li>The record being sent should be transmitted immediately and not buffered 84or delayed.</ul> 85<b><a name="DB_REP_PERMANENT">DB_REP_PERMANENT</a></b><ul compact><li>The record being sent is critical for maintaining database integrity 86(for example, the message includes a transaction commit). The 87application should take appropriate action to enforce the reliability 88guarantees it has chosen, such as waiting for acknowledgement from one 89or more clients.</ul> 90<b><a name="DB_REP_REREQUEST">DB_REP_REREQUEST</a></b><ul compact><li>The message is a client request that has already been made and to which 91no response was received.</ul> 92<br></ul> 93<br> 94<p>It may sometimes be useful to pass application-specific data to the 95<b>send</b> function; see <a href="../ref/env/faq.html">Environment 96FAQ</a> for a discussion on how to do this.</p> 97<p>The <b>send</b> function must return 0 on success and non-zero on 98failure. If the <b>send</b> function fails, the message being sent is 99necessary to maintain database integrity, and the local log is not 100configured for synchronous flushing, the local log will be flushed; 101otherwise, any error from the <b>send</b> function will be ignored.</p> 102<p>Berkeley DB is not re-entrant. Callback functions should not attempt to make 103library calls (for example, to release locks or close open handles). 104Re-entering Berkeley DB is not guaranteed to work correctly, and the results 105are undefined.</p></ul> 106<br> 107<br><b>Errors</b> 108<p>The DB_ENV->rep_set_transport method 109may fail and return one of the following non-zero errors:</p> 110<br> 111<b>EINVAL</b><ul compact><li>An 112invalid flag value or parameter was specified.</ul> 113<br> 114<hr size=1 noshade> 115<br><b>Class</b> 116<a href="../api_c/env_class.html">DB_ENV</a> 117<br><b>See Also</b> 118<a href="../api_c/rep_list.html">Replication and Related Methods</a> 119</tt> 120<table width="100%"><tr><td><br></td><td align=right> 121<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a> 122</td></tr></table> 123<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 124</body> 125</html> 126