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: DbEnv::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>DbEnv::rep_start</b> 14</td> 15<td align=right> 16<a href="../api_cxx/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_cxx.h> 23<p> 24int 25DbEnv::rep_start(Dbt *cdata, u_int32_t flags); 26</pre></b> 27<hr size=1 noshade> 28<b>Description: DbEnv::rep_start</b> 29<p>The DbEnv::rep_start method configures the database environment as a client 30or master in a group of replicated database environments.</p> 31<p>The DbEnv::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_cxx/env_open.html">DbEnv::open</a> method and must already have been configured 43to send replication messages by calling the <a href="../api_cxx/rep_transport.html">DbEnv::rep_set_transport</a> method.</p> 44<p>The DbEnv::rep_start method 45either returns a non-zero error value 46or throws an exception that encapsulates a non-zero error value on 47failure, and returns 0 on success. 48</p> 49<b>Parameters</b> <br> 50 <b>cdata</b><ul compact><li>The <b>cdata</b> parameter is an opaque data item that is sent over the 51communication infrastructure when the client comes online (see 52<a href="../ref/rep/newsite.html">Connecting to a new site</a> for more 53information). If no such information is useful, <b>cdata</b> should 54be NULL.</ul> 55 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to one of the following values: 56<br> 57<b><a name="DB_REP_CLIENT">DB_REP_CLIENT</a></b><ul compact><li>Configure the environment as a replication client.</ul> 58<b><a name="DB_REP_MASTER">DB_REP_MASTER</a></b><ul compact><li>Configure the environment as a replication master.</ul> 59<br></ul> 60<br> 61<br><b>Errors</b> 62<p>The DbEnv::rep_start method 63may fail and throw 64<a href="../api_cxx/except_class.html">DbException</a>, 65encapsulating one of the following non-zero errors, or return one of 66the following non-zero errors:</p> 67<br> 68<b>EINVAL</b><ul compact><li>If the database environment was not already configured to communicate with 69a replication group by a call to <a href="../api_cxx/rep_transport.html">DbEnv::rep_set_transport</a>; 70the database environment was not already opened; or if an 71invalid flag value or parameter was specified.</ul> 72<br> 73<hr size=1 noshade> 74<br><b>Class</b> 75<a href="../api_cxx/env_class.html">DbEnv</a> 76<br><b>See Also</b> 77<a href="../api_cxx/rep_list.html">Replication and Related Methods</a> 78</tt> 79<table width="100%"><tr><td><br></td><td align=right> 80<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a> 81</td></tr></table> 82<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 83</body> 84</html> 85