Debian Codegraph @

docs/api_reference/CXX/envset_app_dispatch.html

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <title>DbEnv::set_app_dispatch()</title>
7 <link rel="stylesheet" href="apiReference.css" type="text/css" />
8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9 <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" />
10 <link rel="up" href="env.html" title="Chapter 5.  The DbEnv Handle" />
11 <link rel="prev" href="envset_alloc.html" title="DbEnv::set_alloc()" />
12 <link rel="next" href="envset_backup_callbacks.html" title="DbEnv::set_backup_callbacks()" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">DbEnv::set_app_dispatch()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="envset_alloc.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 5. 
26 The DbEnv Handle
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="envset_backup_callbacks.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title" style="clear: both"><a id="envset_app_dispatch"></a>DbEnv::set_app_dispatch()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db_cxx.h&gt;
42
43 int
44 DbEnv::set_app_dispatch(int (*tx_recover)(DbEnv *dbenv,
45 Dbt *log_rec, DbLsn *lsn, db_recops op));</pre>
46 <p>
47 Declare a function to be called during transaction abort and recovery
48 to process application-specific log records.
49 </p>
50 <p>
51 The <code class="methodname">DbEnv::set_app_dispatch()</code> method configures operations performed
52 using the specified <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a> handle, not all
53 operations performed on the underlying database environment.
54 </p>
55 <p>
56 The <code class="methodname">DbEnv::set_app_dispatch()</code> method may not be called after the
57 <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> method is
58 called. If the database environment already exists when
59 <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> is called, the
60 information specified to <code class="methodname">DbEnv::set_app_dispatch()</code> must be
61 consistent with the existing environment or corruption can occur.
62 </p>
63 <p>
64 The <code class="methodname">DbEnv::set_app_dispatch()</code> method returns a non-zero error value
65 on failure and 0 on success.
66 </p>
67 <div class="sect2" lang="en" xml:lang="en">
68 <div class="titlepage">
69 <div>
70 <div>
71 <h3 class="title"><a id="idp7101480"></a>Parameters</h3>
72 </div>
73 </div>
74 </div>
75 <div class="sect3" lang="en" xml:lang="en">
76 <div class="titlepage">
77 <div>
78 <div>
79 <h4 class="title"><a id="idp7131392"></a>tx_recover</h4>
80 </div>
81 </div>
82 </div>
83 <p>
84 The <span class="bold"><strong>tx_recover</strong></span> parameter is the
85 application's abort and recovery function. The function takes four
86 parameters:
87 </p>
88 <div class="itemizedlist">
89 <ul type="disc">
90 <li>
91 <p>
92 <code class="literal">dbenv</code>
93 </p>
94 <p>
95 The <span class="bold"><strong>dbenv</strong></span> parameter is the enclosing
96 database environment handle.
97 </p>
98 </li>
99 <li>
100 <p>
101 <code class="literal">log_rec</code>
102 </p>
103 <p>
104 The <span class="bold"><strong>log_rec</strong></span> parameter is a log
105 record.
106 </p>
107 </li>
108 <li>
109 <p>
110 <code class="literal">lsn</code>
111 </p>
112 <p>
113 The <span class="bold"><strong>lsn</strong></span> parameter is a log sequence
114 number.
115 </p>
116 </li>
117 <li>
118 <p>
119 <code class="literal">op</code>
120 </p>
121 <p>
122 The <span class="bold"><strong>op</strong></span> parameter is one of the
123 following values:
124 </p>
125 <div class="itemizedlist">
126 <ul type="circle">
127 <li>
128 <p><a id="set_app_dispatch_DB_TXN_BACKWARD_ROLL"></a>
129 <code class="literal">DB_TXN_BACKWARD_ROLL</code>
130 </p>
131 <p>
132 The log is being read backward to determine which transactions have
133 been committed and to abort those operations that were not; undo the
134 operation described by the log record.
135 </p>
136 </li>
137 <li>
138 <p><a id="set_app_dispatch_DB_TXN_FORWARD_ROLL"></a>
139 <code class="literal">DB_TXN_FORWARD_ROLL</code>
140 </p>
141 <p>
142 The log is being played forward; redo the operation described by the
143 log record.
144 </p>
145 </li>
146 <li>
147 <p><a id="set_app_dispatch_DB_TXN_ABORT"></a>
148 <code class="literal">DB_TXN_ABORT</code>
149 </p>
150 <p>
151 The log is being read backward during a transaction abort; undo the
152 operation described by the log record.
153 </p>
154 </li>
155 <li>
156 <p><a id="set_app_dispatch_DB_TXN_APPLY"></a>
157 <code class="literal">DB_TXN_APPLY</code>
158 </p>
159 <p>
160 The log is being applied on a replica site; redo the operation
161 described by the log record.
162 </p>
163 </li>
164 <li>
165 <p><a id="set_app_dispatch_DB_TXN_PRINT"></a>
166 <code class="literal">DB_TXN_PRINT</code>
167 </p>
168 <p>
169 The log is being printed for debugging purposes; print the contents of
170 this log record in the desired format.
171 </p>
172 </li>
173 </ul>
174 </div>
175 <p>
176 The DB_TXN_FORWARD_ROLL and DB_TXN_APPLY operations frequently imply
177 the same actions, redoing changes that appear in the log record,
178 although if a recovery function is to be used on a replication client
179 where reads may be taking place concurrently with the processing of
180 incoming messages, DB_TXN_APPLY operations should also perform
181 appropriate locking. The macro DB_REDO(op) checks that the operation
182 is one of DB_TXN_FORWARD_ROLL or DB_TXN_APPLY, and should be used in
183 the recovery code to refer to the conditions under which operations
184 should be redone. Similarly, the macro DB_UNDO(op) checks if the
185 operation is one of DB_TXN_BACKWARD_ROLL or DB_TXN_ABORT.
186 </p>
187 </li>
188 </ul>
189 </div>
190 <p>
191 The function must return 0 on success and either <span class="bold"><strong>errno</strong></span>
192 or a value outside of the Berkeley DB error name space on failure.
193 </p>
194 </div>
195 </div>
196 <div class="sect2" lang="en" xml:lang="en">
197 <div class="titlepage">
198 <div>
199 <div>
200 <h3 class="title"><a id="idp7150096"></a>Errors</h3>
201 </div>
202 </div>
203 </div>
204 <p>
205 The <code class="methodname">DbEnv::set_app_dispatch()</code> <span>
206
207 <span>
208 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a>
209 exception, encapsulating one of the following non-zero errors, or return one
210 of the following non-zero errors:
211 </span>
212 </span>
213 </p>
214 <div class="sect3" lang="en" xml:lang="en">
215 <div class="titlepage">
216 <div>
217 <div>
218 <h4 class="title"><a id="idp7147040"></a>EINVAL</h4>
219 </div>
220 </div>
221 </div>
222 <p>
223 If the method was called after <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a>
224 was called; or if an invalid flag value or parameter was specified.
225 </p>
226 </div>
227 </div>
228 <div class="sect2" lang="en" xml:lang="en">
229 <div class="titlepage">
230 <div>
231 <div>
232 <h3 class="title"><a id="idp7160048"></a>Class</h3>
233 </div>
234 </div>
235 </div>
236 <p>
237 <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>, <a class="link" href="txn.html" title="Chapter 13.  The DbTxn Handle">DbTxn</a>
238 </p>
239 </div>
240 <div class="sect2" lang="en" xml:lang="en">
241 <div class="titlepage">
242 <div>
243 <div>
244 <h3 class="title"><a id="idp7132544"></a>See Also</h3>
245 </div>
246 </div>
247 </div>
248 <p>
249 <a class="xref" href="txn.html#txnlist" title="Transaction Subsystem and Related Methods">Transaction Subsystem and Related Methods</a>
250 </p>
251 </div>
252 </div>
253 <div class="navfooter">
254 <hr />
255 <table width="100%" summary="Navigation footer">
256 <tr>
257 <td width="40%" align="left"><a accesskey="p" href="envset_alloc.html">Prev</a> </td>
258 <td width="20%" align="center">
259 <a accesskey="u" href="env.html">Up</a>
260 </td>
261 <td width="40%" align="right"> <a accesskey="n" href="envset_backup_callbacks.html">Next</a></td>
262 </tr>
263 <tr>
264 <td width="40%" align="left" valign="top">DbEnv::set_alloc() </td>
265 <td width="20%" align="center">
266 <a accesskey="h" href="index.html">Home</a>
267 </td>
268 <td width="40%" align="right" valign="top"> DbEnv::set_backup_callbacks()</td>
269 </tr>
270 </table>
271 </div>
272 </body>
273 </html>