rep_transport.html   [plain text]


<!--$Id: rep_transport.so,v 1.37 2008/02/04 20:55:16 sue Exp $-->
<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: DB_ENV-&gt;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>
<b>DB_ENV-&gt;rep_set_transport</b>
</td>
<td align=right>
<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></td>
</tr></table>
<hr size=1 noshade>
<tt>
<b><pre>
#include &lt;db.h&gt;
<p>
int
DB_ENV-&gt;rep_set_transport(DB_ENV *env, int envid,
    int (*send)(DB_ENV *dbenv,
    const DBT *control, const DBT *rec, const DB_LSN *lsnp,
    int envid, u_int32_t flags));
</pre></b>
<hr size=1 noshade>
<b>Description: DB_ENV-&gt;rep_set_transport</b>
<p>The DB_ENV-&gt;rep_set_transport method initializes the communication infrastructure
for a database environment participating in a replicated application.</p>
<p>The DB_ENV-&gt;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 DB_ENV-&gt;rep_set_transport method configures operations performed using the specified
<a href="../api_c/env_class.html">DB_ENV</a> handle, not all operations performed on the underlying
database environment.</p>
<p>The DB_ENV-&gt;rep_set_transport method may be called at any time during the life of the
application.</p>
<p>The DB_ENV-&gt;rep_set_transport method
returns a non-zero error value on failure
and 0 on success.
</p>
<b>Parameters</b> <br>
 <b>envid</b><ul compact><li>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="../ref/rep/id.html">Replication environment IDs</a> for more
information).</ul>
 <b>send</b><ul compact><li>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:
<br>
<b><b>dbenv</b></b><ul compact><li>The <b>dbenv</b> parameter is the enclosing database environment handle.</ul>
<b><b>control</b></b><ul compact><li>The <b>control</b> parameter is the first of the two data elements to be
transmitted by the <b>send</b> function.</ul>
<b><b>rec</b></b><ul compact><li>The <b>rec</b> parameter is the second of the two data elements to be
transmitted by the <b>send</b> function.</ul>
<b><b>lsnp</b></b><ul compact><li>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.</ul>
<b><b>envid</b></b><ul compact><li>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="../ref/rep/id.html">Replication environment IDs</a> for
more information).
<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>
<p>The special identifier <a href="../ref/rep/id.html#DB_EID_INVALID">DB_EID_INVALID</a> indicates an invalid
environment ID.  This may be used to initialize values that are
subsequently checked for validity.</p></ul>
<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
or more of the following values:
<br>
<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
as well as by the master.</ul>
<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
or delayed.</ul>
<b><a name="DB_REP_PERMANENT">DB_REP_PERMANENT</a></b><ul compact><li>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.</ul>
<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
no response was received.</ul>
<br></ul>
<br>
<p>It may sometimes be useful to pass application-specific data to the
<b>send</b> function; see <a href="../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></ul>
<br>
<br><b>Errors</b>
<p>The DB_ENV-&gt;rep_set_transport method
may fail and return one of the following non-zero errors:</p>
<br>
<b>EINVAL</b><ul compact><li>An
invalid flag value or parameter was specified.</ul>
<br>
<hr size=1 noshade>
<br><b>Class</b>
<a href="../api_c/env_class.html">DB_ENV</a>
<br><b>See Also</b>
<a href="../api_c/rep_list.html">Replication and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<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>
</td></tr></table>
<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
</body>
</html>