2
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
3
<!--All rights reserved.-->
4
<!--See the file LICENSE for redistribution information.-->
7
<title>Berkeley DB: DbEnv::set_rep_transport</title>
8
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
9
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
12
<a name="2"><!--meow--></a>
13
<table width="100%"><tr valign=top>
15
<h1>DbEnv::set_rep_transport</h1>
18
<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
23
#include <db_cxx.h>
26
DbEnv::set_rep_transport(int envid,
27
int (*send)(DB_ENV *dbenv,
28
const Dbt *control, const Dbt *rec, int envid, u_int32_t flags));
31
<p>The DbEnv::set_rep_transport method initializes the communication infrastructure
32
for a database environment participating in a replicated application.
33
<p>The <b>envid</b> parameter is the local environment's ID. It must be
34
a positive integer and uniquely identify this Berkeley DB database environment
35
(see <a href="../ref/rep/id.html">Replication environment IDs</a> for more
37
<p>The <b>send</b> parameter is a callback interface used to transmit data
38
using the replication application's communication infrastructure. The
39
parameters to <b>send</b> are as follows:
41
<p><dt>dbenv<dd>The enclosing database environment.
42
<p><dt>control<dd>The control parameter is the first of the two data elements to be
43
transmitted by the <b>send</b> interface.
44
<p><dt>rec<dd>The rec parameter is the second of the two data elements to be
45
transmitted by the <b>send</b> interface.
46
<p><dt>envid<dd>The <b>envid</b> parameter is a positive integer identifier that
47
specifies the replication environment to which the message should be
48
sent (see <a href="../ref/rep/id.html">Replication environment IDs</a> for
50
<p><a name="3"><!--meow--></a>
51
The special identifier DB_EID_BROADCAST indicates that a message
52
should be broadcast to every environment in the replication group. The
53
application may use a true broadcast protocol, or may send the message
54
in sequence to each machine with which it is in communication.
56
<p>The <b>flags</b> value must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one or
57
more of the following values:
59
<p><dt><a name="DB_REP_PERMANENT">DB_REP_PERMANENT</a><dd>The record being sent is critical for maintaining database integrity
60
(for example, the message includes a transaction commit). The
61
application should take appropriate action to enforce the reliability
62
guarantees it has chosen, such as waiting for acknowledgement from one
66
<p>The <b>send</b> interface must return 0 on success and non-zero on
67
failure. If the <b>send</b> interface fails, the message being sent
68
is necessary to maintain database integrity, and the local log is not
69
configured for synchronous flushing, the local log will be flushed;
70
otherwise, any error from the <b>send</b> interface will be ignored.
71
<p>It may sometimes be useful to pass application-specific data to the
72
<b>send</b> interface; see <a href="../ref/env/faq.html">Environment
73
FAQ</a> for a discussion on how to do this.
74
<p>The DbEnv::set_rep_transport method configures operations performed using the specified
75
<a href="../api_cxx/env_class.html">DbEnv</a> handle, not all operations performed on the underlying
77
<p>The DbEnv::set_rep_transport interface may be called at any time during the life of
79
<p>The DbEnv::set_rep_transport method either returns a non-zero error value or throws an exception that
80
encapsulates a non-zero error value on failure, and returns 0 on success.
82
<p>The DbEnv::set_rep_transport method may fail and throw an exception or return a non-zero error for errors specified for other Berkeley DB and C library or system methods.
83
If a catastrophic error has occurred, the DbEnv::set_rep_transport method may fail and
84
either return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> or throw a
85
<a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>,
86
in which case all subsequent Berkeley DB calls will fail in the same way.
88
<a href="../api_cxx/env_class.html">DbEnv</a>
90
<a href="../api_cxx/rep_list.html">Replication and Related Methods</a>
92
<table width="100%"><tr><td><br></td><td align=right>
93
<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
95
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>