<!--$Id: rep_transport.so,v 1.35 2006/06/05 23:03:53 alanb Exp $--> <!--Copyright (c) 1997,2007 Oracle. All rights reserved.--> <!--See the file LICENSE for redistribution information.--> <html> <head> <title>Berkeley DB: DbEnv::rep_set_transport</title> <meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> <meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> </head> <body bgcolor=white> <table width="100%"><tr valign=top> <td> <h3>DbEnv::rep_set_transport</h3> </td> <td align=right> <a href="../../db46-devel-4.6.21/api_cxx/api_core.html"><img src="../../db46-devel-4.6.21/images/api.gif" alt="API"></a> <a href="../../db46-devel-4.6.21/ref/toc.html"><img src="../../db46-devel-4.6.21/images/ref.gif" alt="Ref"></a></td> </tr></table> <hr size=1 noshade> <tt> <h3><pre> #include <db_cxx.h> <p> int DbEnv::rep_set_transport(int envid, int (*send)(DB_ENV *dbenv, const Dbt *control, const Dbt *rec, const DbLsn *lsnp, int envid, u_int32_t flags)); </pre></h3> <hr size=1 noshade> <h3>Description: DbEnv::rep_set_transport</h3> <p>The DbEnv::rep_set_transport method initializes the communication infrastructure for a database environment participating in a replicated application.</p> <p>The DbEnv::rep_set_transport method is not called by most replication applications. It should only be called by applications implementing their own network transport layer, explicitly holding replication group elections and handling replication messages outside of the replication manager framework.</p> <p>The DbEnv::rep_set_transport method configures operations performed using the specified <a href="../../db46-devel-4.6.21/api_cxx/env_class.html">DbEnv</a> handle, not all operations performed on the underlying database environment.</p> <p>The DbEnv::rep_set_transport method may be called at any time during the life of the application.</p> <p>The DbEnv::rep_set_transport method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success. </p> <h3>Parameters</h3> <dl compact> <dt><b>envid</b><dd>The <b>envid</b> parameter is the local environment's ID. It must be a non-negative integer and uniquely identify this Berkeley DB database environment (see <a href="../../db46-devel-4.6.21/ref/rep/id.html">Replication environment IDs</a> for more information). <dt><b>send</b><dd>The <b>send</b> callback function is used to transmit data using the replication application's communication infrastructure. The parameters to <b>send</b> are as follows: <dl compact> <dt><b>dbenv</b><dd>The <b>dbenv</b> parameter is the enclosing database environment handle. <dt><b>control</b><dd>The <b>control</b> parameter is the first of the two data elements to be transmitted by the <b>send</b> function. <dt><b>rec</b><dd>The <b>rec</b> parameter is the second of the two data elements to be transmitted by the <b>send</b> function. <dt><b>lsnp</b><dd>If the type of message to be sent has an LSN associated with it, then the <b>lsnp</b> parameter contains the LSN of the record being sent. This LSN can be used to determine that certain records have been processed successfully by clients. <dt><b>envid</b><dd>The <b>envid</b> parameter is a positive integer identifier that specifies the replication environment to which the message should be sent (see <a href="../../db46-devel-4.6.21/ref/rep/id.html">Replication environment IDs</a> for more information). <a name="2"><!--meow--></a> <p>The special identifier DB_EID_BROADCAST indicates that a message should be broadcast to every environment in the replication group. The application may use a true broadcast protocol or may send the message in sequence to each machine with which it is in communication. In both cases, the sending site should not be asked to process the message.</p> <dt><b>flags</b><dd>The <b>flags</b> parameter must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one or more of the following values: <dl compact> <dt><a name="DB_REP_ANYWHERE">DB_REP_ANYWHERE</a><dd>The message is a client request that can be satisfied by another client as well as by the master. <dt><a name="DB_REP_NOBUFFER">DB_REP_NOBUFFER</a><dd>The record being sent should be transmitted immediately and not buffered or delayed. <dt><a name="DB_REP_PERMANENT">DB_REP_PERMANENT</a><dd>The record being sent is critical for maintaining database integrity (for example, the message includes a transaction commit). The application should take appropriate action to enforce the reliability guarantees it has chosen, such as waiting for acknowledgement from one or more clients. <dt><a name="DB_REP_REREQUEST">DB_REP_REREQUEST</a><dd>The message is a client request that has already been made and to which no response was received. </dl> </dl> <p>It may sometimes be useful to pass application-specific data to the <b>send</b> function; see <a href="../../db46-devel-4.6.21/ref/env/faq.html">Environment FAQ</a> for a discussion on how to do this.</p> <p>The <b>send</b> function must return 0 on success and non-zero on failure. If the <b>send</b> function fails, the message being sent is necessary to maintain database integrity, and the local log is not configured for synchronous flushing, the local log will be flushed; otherwise, any error from the <b>send</b> function will be ignored.</p> <p>Berkeley DB is not re-entrant. Callback functions should not attempt to make library calls (for example, to release locks or close open handles). Re-entering Berkeley DB is not guaranteed to work correctly, and the results are undefined.</p> </dl> <h3>Errors</h3> <p>The DbEnv::rep_set_transport method may fail and throw <a href="../../db46-devel-4.6.21/api_cxx/except_class.html">DbException</a>, encapsulating one of the following non-zero errors, or return one of the following non-zero errors:</p> <dl compact> <dt>EINVAL<dd>An invalid flag value or parameter was specified. </dl> <hr size=1 noshade> <h3>Class</h3> <a href="../../db46-devel-4.6.21/api_cxx/env_class.html">DbEnv</a> <h3>See Also</h3> <a href="../../db46-devel-4.6.21/api_cxx/rep_list.html">Replication and Related Methods</a> </tt> <table width="100%"><tr><td><br></td><td align=right> <a href="../../db46-devel-4.6.21/api_cxx/api_core.html"><img src="../../db46-devel-4.6.21/images/api.gif" alt="API"></a><a href="../../db46-devel-4.6.21/ref/toc.html"><img src="../../db46-devel-4.6.21/images/ref.gif" alt="Ref"></a> </td></tr></table> <p><font size=1>Copyright (c) 1996,2007 Oracle. All rights reserved.</font> </body> </html>