Sindbad~EG File Manager
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Event Handling</title>
<link rel="stylesheet" href="gettingStarted.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
<link rel="start" href="index.html" title="Getting Started with Replicated Berkeley DB Applications" />
<link rel="up" href="introduction.html" title="Chapter 1. Introduction" />
<link rel="prev" href="permmessages.html" title="Permanent Message Handling" />
<link rel="next" href="txnapp.html" title="Chapter 2. Transactional Application" />
</head>
<body>
<div xmlns="" class="navheader">
<div class="libver">
<p>Library Version 18.1.40</p>
</div>
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">Event Handling</th>
</tr>
<tr>
<td width="20%" align="left"><a accesskey="p" href="permmessages.html">Prev</a> </td>
<th width="60%" align="center">Chapter 1. Introduction</th>
<td width="20%" align="right"> <a accesskey="n" href="txnapp.html">Next</a></td>
</tr>
</table>
<hr />
</div>
<div class="sect1" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a id="eventhandling"></a>Event Handling</h2>
</div>
</div>
</div>
<p>
The replication system is capable of reporting a great many
events to which your code might need to respond. To track and
respond to these events, you implement a
<span>callback</span>
whose function it is to respond to events that happen within
the DB library.
</p>
<p>
Note that this callback is usable for events beyond those
required for replication purposes. In this section, however, we
only discuss some of the replication-specific events.
</p>
<p>
The callback is required to determine which event has been
passed to it, and then take action depending on the event.
</p>
<p>
Some of the more commonly handled replication events are
described below. For a complete list of events, see the
<span>
<code class="methodname">DbEnv::set_event_notify()</code>
method in the <em class="citetitle">Berkeley DB C++ API Reference Guide</em>.
</span>
</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>
<code class="literal">DB_EVENT_REP_CLIENT</code>
</p>
<p>
The local environment is now a replica.
</p>
</li>
<li>
<p>
<code class="literal">DB_EVENT_REP_LOCAL_SITE_REMOVED</code>
</p>
<p>
The local Replication Manager site has been removed from the group.
</p>
</li>
<li>
<p>
<code class="literal">DB_EVENT_REP_MASTER</code>
</p>
<p>
The local environment is now a master.
</p>
</li>
<li>
<p>
<code class="literal">DB_EVENT_REP_NEWMASTER</code>
</p>
<p>
An election was held and a new environment was made a
master. However, the current environment
<span class="emphasis"><em>is not</em></span> the master. This event exists so
that you can cause your code to take some unique action
in the event that the replication groups switches
masters.
</p>
</li>
<li>
<p>
<code class="literal">DB_EVENT_REP_PERM_FAILED</code>
</p>
<p>
The Replication Manager did not receive enough acknowledgements to
ensure the transaction's durability within the
replicationg group. The Replication Manager has therefore flushed
the transaction to the master's local disk for storage.
</p>
<p>
How the Replication Manager knows whether the acknowledgements it has
received is determined by the acknowledgement policy you have set
for your applicaton. See
<a class="xref" href="fwrkpermmessage.html#fmwrkpermpolicy" title="Identifying Permanent Message Policies">Identifying Permanent Message Policies</a>
for more information.
</p>
</li>
<li>
<p>
<code class="literal">DB_EVENT_REP_SITE_ADDED</code>
</p>
<p>
A new Replication Manager site has joined the replication group.
</p>
</li>
<li>
<p>
<code class="literal">DB_EVENT_REP_SITE_REMOVED</code>
</p>
<p>
An existing Replication Manager site has been removed from the replication group.
</p>
</li>
<li>
<p>
<code class="literal">DB_EVENT_REP_STARTUPDONE</code>
</p>
<p>
The replica has completed startup synchronization and
is now processing log records received from the master.
</p>
</li>
</ul>
</div>
<p>
For an example of how to use this callback, see
<a class="xref" href="fwrkmasterreplica.html#determinestate" title="Determining State">Determining State</a>
</p>
</div>
<div class="navfooter">
<hr />
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left"><a accesskey="p" href="permmessages.html">Prev</a> </td>
<td width="20%" align="center">
<a accesskey="u" href="introduction.html">Up</a>
</td>
<td width="40%" align="right"> <a accesskey="n" href="txnapp.html">Next</a></td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Permanent Message Handling </td>
<td width="20%" align="center">
<a accesskey="h" href="index.html">Home</a>
</td>
<td width="40%" align="right" valign="top"> Chapter 2. Transactional Application</td>
</tr>
</table>
</div>
</body>
</html>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists