diff options
Diffstat (limited to 'docs/programmer_reference/rep_ex_rq.html')
| -rw-r--r-- | docs/programmer_reference/rep_ex_rq.html | 114 |
1 files changed, 65 insertions, 49 deletions
diff --git a/docs/programmer_reference/rep_ex_rq.html b/docs/programmer_reference/rep_ex_rq.html index 16fc9cb5..e59f30a7 100644 --- a/docs/programmer_reference/rep_ex_rq.html +++ b/docs/programmer_reference/rep_ex_rq.html @@ -14,17 +14,16 @@ <body> <div xmlns="" class="navheader"> <div class="libver"> - <p>Library Version 11.2.5.3</p> + <p>Library Version 12.1.6.1</p> </div> <table width="100%" summary="Navigation header"> <tr> - <th colspan="3" align="center">Ex_rep_base: putting it all together</th> + <th colspan="3" align="center">Ex_rep_base: putting it all + together</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="rep_ex_comm.html">Prev</a> </td> - <th width="60%" align="center">Chapter 12. - Berkeley DB Replication - </th> + <th width="60%" align="center">Chapter 12. Berkeley DB Replication </th> <td width="20%" align="right"> <a accesskey="n" href="rep_ex_chan.html">Next</a></td> </tr> </table> @@ -34,51 +33,69 @@ <div class="titlepage"> <div> <div> - <h2 class="title" style="clear: both"><a id="rep_ex_rq"></a>Ex_rep_base: putting it all together</h2> + <h2 class="title" style="clear: both"><a id="rep_ex_rq"></a>Ex_rep_base: putting it all + together</h2> </div> </div> </div> - <p>Beyond simply initializing a replicated environment, a Base API application -must set up its communication -infrastructure, and then make sure that incoming messages are received -and processed.</p> - <p>To initialize replication, ex_rep_base creates a Berkeley DB environment and -calls <a href="../api_reference/C/reptransport.html" class="olink">DB_ENV->rep_set_transport()</a> to establish a send function. (See -the main function in <code class="filename">ex_rep/base/rep_base.c</code>, including its -calls to the create_env and env_init functions in -<code class="filename">ex_rep/common/rep_common.c</code>.)</p> - <p>ex_rep_base opens a listening socket for incoming connections and opens -an outgoing connection to every machine that it knows about (that is, -all the sites listed in the <span class="bold"><strong>-r</strong></span> and -<span class="bold"><strong>-R</strong></span> command line arguments). -Applications can structure the details of this in different ways, but -ex_rep_base creates a user-level thread to listen on its socket, plus -a thread to loop and handle messages on each socket, in addition to the -threads needed to manage the user interface, update the database on the -master, and read from the database on the client (in other words, in -addition to the normal functionality of any database application).</p> - <p>Once the initial threads have all been started and the communications -infrastructure is initialized, the application signals that it is ready -for replication and joins a replication group by calling -<a href="../api_reference/C/repstart.html" class="olink">DB_ENV->rep_start()</a>. (Again, see the main function in -<code class="filename">ex_rep/base/rep_base.c</code>.)</p> - <p>Note the use of the optional second argument to <a href="../api_reference/C/repstart.html" class="olink">DB_ENV->rep_start()</a> in -the client initialization code. The argument "local" is a piece of -data, opaque to Berkeley DB, that will be broadcast to each member of a -replication group; it allows new clients to join a replication group, -without knowing the location of all its members; the new client will -be contacted by the members it does not know about, who will receive -the new client's contact information that was specified in "myaddr." -See <a class="xref" href="rep_newsite.html" title="Connecting to a new site">Connecting to a new site</a> for more -information.</p> - <p>The final piece of a replicated application is the code that loops, -receives, and processes messages from a given remote environment. -ex_rep_base runs one of these loops in a parallel thread for each -socket connection (see the hm_loop function in -<code class="filename">ex_rep/base/rep_msg.c</code>). Other applications may want to queue -messages somehow and process them asynchronously, or select() on a -number of sockets and either look up the correct environment ID for each -or encapsulate the ID in the communications protocol.</p> + <p> + Beyond simply initializing a replicated environment, a Base + API application must set up its communication infrastructure, + and then make sure that incoming messages are received and + processed. + </p> + <p> + To initialize replication, ex_rep_base creates a Berkeley DB + environment and calls <a href="../api_reference/C/reptransport.html" class="olink">DB_ENV->rep_set_transport()</a> to establish a send + function. (See the main function in + <code class="filename">ex_rep/base/rep_base.c</code>, including its + calls to the create_env and env_init functions in + <code class="filename">ex_rep/common/rep_common.c</code>.) + </p> + <p> + ex_rep_base opens a listening socket for incoming + connections and opens an outgoing connection to every machine + that it knows about (that is, all the sites listed in the + <span class="bold"><strong>-r</strong></span> and <span class="bold"><strong>-R</strong></span> command line arguments). + Applications can structure the details of this in different + ways, but ex_rep_base creates a user-level thread to listen on + its socket, plus a thread to loop and handle messages on each + socket, in addition to the threads needed to manage the user + interface, update the database on the master, and read from + the database on the client (in other words, in addition to the + normal functionality of any database application). + </p> + <p> + Once the initial threads have all been started and the + communications infrastructure is initialized, the application + signals that it is ready for replication and joins a + replication group by calling <a href="../api_reference/C/repstart.html" class="olink">DB_ENV->rep_start()</a>. (Again, see the main + function in + <code class="filename">ex_rep/base/rep_base.c</code>.) + </p> + <p> + Note the use of the optional second argument to <a href="../api_reference/C/repstart.html" class="olink">DB_ENV->rep_start()</a> + in the client initialization code. The argument "local" is a + piece of data, opaque to Berkeley DB, that will be broadcast + to each member of a replication group; it allows new clients + to join a replication group, without knowing the location of + all its members; the new client will be contacted by the + members it does not know about, who will receive the new + client's contact information that was specified in "myaddr." + See <a class="xref" href="rep_newsite.html" title="Connecting to a new site">Connecting to a new site</a> + for more information. + </p> + <p> + The final piece of a replicated application is the code that + loops, receives, and processes messages from a given remote + environment. ex_rep_base runs one of these loops in a parallel + thread for each socket connection (see the hm_loop function in + <code class="filename">ex_rep/base/rep_msg.c</code>). Other + applications may want to queue messages somehow and process + them asynchronously, or select() on a number of sockets and + either look up the correct environment ID for each or + encapsulate the ID in the communications protocol. + </p> </div> <div class="navfooter"> <hr /> @@ -95,8 +112,7 @@ or encapsulate the ID in the communications protocol.</p> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> - <td width="40%" align="right" valign="top"> Ex_rep_chan: a Replication Manager -channel example</td> + <td width="40%" align="right" valign="top"> Ex_rep_chan: a Replication Manager channel example</td> </tr> </table> </div> |
