1<!--$Id: rep_start.so,v 1.17 2006/03/15 19:39:22 bostic 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-&gt;rep_start</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-&gt;rep_start</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 &lt;db.h&gt;
23<p>
24int
25DB_ENV-&gt;rep_start(DB_ENV *env, DBT *cdata, u_int32_t flags);
26</pre></b>
27<hr size=1 noshade>
28<b>Description: DB_ENV-&gt;rep_start</b>
29<p>The DB_ENV-&gt;rep_start method configures the database environment as a client
30or master in a group of replicated database environments.</p>
31<p>The DB_ENV-&gt;rep_start method is not called by most replication
32applications.  It should only be called by applications implementing
33their own network transport layer, explicitly holding replication group
34elections and handling replication messages outside of the replication
35manager framework.</p>
36<p>Replication master environments are the only database environments where
37replicated databases may be modified.  Replication client environments
38are read-only as long as they are clients.  Replication client
39environments may be upgraded to be replication master environments in
40the case that the current master fails or there is no master present.</p>
41<p>The enclosing database environment must already have been opened by
42calling the <a href="../api_c/env_open.html">DB_ENV-&gt;open</a> method and must already have been configured
43to send replication messages by calling the <a href="../api_c/rep_transport.html">DB_ENV-&gt;rep_set_transport</a> method.</p>
44<p>The DB_ENV-&gt;rep_start method
45returns a non-zero error value on failure
46and 0 on success.
47</p>
48<b>Parameters</b> <br>
49 <b>cdata</b><ul compact><li>The <b>cdata</b> parameter is an opaque data item that is sent over the
50communication infrastructure when the client comes online (see
51<a href="../ref/rep/newsite.html">Connecting to a new site</a> for more
52information).  If no such information is useful, <b>cdata</b> should
53be NULL.</ul>
54 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to one of the following values:
55<br>
56<b><a name="DB_REP_CLIENT">DB_REP_CLIENT</a></b><ul compact><li>Configure the environment as a replication client.</ul>
57<b><a name="DB_REP_MASTER">DB_REP_MASTER</a></b><ul compact><li>Configure the environment as a replication master.</ul>
58<br></ul>
59<br>
60<br><b>Errors</b>
61<p>The DB_ENV-&gt;rep_start method
62may fail and return one of the following non-zero errors:</p>
63<br>
64<b>EINVAL</b><ul compact><li>If the database environment was not already configured to communicate with
65a replication group by a call to <a href="../api_c/rep_transport.html">DB_ENV-&gt;rep_set_transport</a>;
66the database environment was not already opened; or if an
67invalid flag value or parameter was specified.</ul>
68<br>
69<hr size=1 noshade>
70<br><b>Class</b>
71<a href="../api_c/env_class.html">DB_ENV</a>
72<br><b>See Also</b>
73<a href="../api_c/rep_list.html">Replication and Related Methods</a>
74</tt>
75<table width="100%"><tr><td><br></td><td align=right>
76<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>
77</td></tr></table>
78<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
79</body>
80</html>
81