Debian Codegraph @

docs/api_reference/C/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>DB_ENV-&gt;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 DB_ENV Handle" />
11 <link rel="prev" href="envset_alloc.html" title="DB_ENV-&gt;set_alloc()" />
12 <link rel="next" href="envset_backup_callbacks.html" title="DB_ENV-&gt;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">DB_ENV-&gt;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 DB_ENV 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>DB_ENV-&gt;set_app_dispatch()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB_ENV-&gt;set_app_dispatch(DB_ENV *dbenv,
45 int (*tx_recover)(DB_ENV *dbenv,
46 DBT *log_rec, DB_LSN *lsn, db_recops op)); </pre>
47 <p>
48 Declare a function to be called during transaction abort and recovery
49 to process application-specific log records.
50 </p>
51 <p>
52 The <code class="methodname">DB_ENV-&gt;set_app_dispatch()</code> method configures operations performed
53 using the specified <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a> handle, not all
54 operations performed on the underlying database environment.
55 </p>
56 <p>
57 The <code class="methodname">DB_ENV-&gt;set_app_dispatch()</code> method may not be called after the
58 <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a> method is
59 called. If the database environment already exists when
60 <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a> is called, the
61 information specified to <code class="methodname">DB_ENV-&gt;set_app_dispatch()</code> must be
62 consistent with the existing environment or corruption can occur.
63 </p>
64 <p>
65 The <code class="methodname">DB_ENV-&gt;set_app_dispatch()</code> method returns a non-zero error value
66 on failure and 0 on success.
67 </p>
68 <div class="sect2" lang="en" xml:lang="en">
69 <div class="titlepage">
70 <div>
71 <div>
72 <h3 class="title"><a id="idp51796048"></a>Parameters</h3>
73 </div>
74 </div>
75 </div>
76 <div class="sect3" lang="en" xml:lang="en">
77 <div class="titlepage">
78 <div>
79 <div>
80 <h4 class="title"><a id="idp51796240"></a>tx_recover</h4>
81 </div>
82 </div>
83 </div>
84 <p>
85 The <span class="bold"><strong>tx_recover</strong></span> parameter is the
86 application's abort and recovery function. The function takes four
87 parameters:
88 </p>
89 <div class="itemizedlist">
90 <ul type="disc">
91 <li>
92 <p>
93 <code class="literal">dbenv</code>
94 </p>
95 <p>
96 The <span class="bold"><strong>dbenv</strong></span> parameter is the enclosing
97 database environment handle.
98 </p>
99 </li>
100 <li>
101 <p>
102 <code class="literal">log_rec</code>
103 </p>
104 <p>
105 The <span class="bold"><strong>log_rec</strong></span> parameter is a log
106 record.
107 </p>
108 </li>
109 <li>
110 <p>
111 <code class="literal">lsn</code>
112 </p>
113 <p>
114 The <span class="bold"><strong>lsn</strong></span> parameter is a log sequence
115 number.
116 </p>
117 </li>
118 <li>
119 <p>
120 <code class="literal">op</code>
121 </p>
122 <p>
123 The <span class="bold"><strong>op</strong></span> parameter is one of the
124 following values:
125 </p>
126 <div class="itemizedlist">
127 <ul type="circle">
128 <li>
129 <p><a id="set_app_dispatch_DB_TXN_BACKWARD_ROLL"></a>
130 <code class="literal">DB_TXN_BACKWARD_ROLL</code>
131 </p>
132 <p>
133 The log is being read backward to determine which transactions have
134 been committed and to abort those operations that were not; undo the
135 operation described by the log record.
136 </p>
137 </li>
138 <li>
139 <p><a id="set_app_dispatch_DB_TXN_FORWARD_ROLL"></a>
140 <code class="literal">DB_TXN_FORWARD_ROLL</code>
141 </p>
142 <p>
143 The log is being played forward; redo the operation described by the
144 log record.
145 </p>
146 </li>
147 <li>
148 <p><a id="set_app_dispatch_DB_TXN_ABORT"></a>
149 <code class="literal">DB_TXN_ABORT</code>
150 </p>
151 <p>
152 The log is being read backward during a transaction abort; undo the
153 operation described by the log record.
154 </p>
155 </li>
156 <li>
157 <p><a id="set_app_dispatch_DB_TXN_APPLY"></a>
158 <code class="literal">DB_TXN_APPLY</code>
159 </p>
160 <p>
161 The log is being applied on a replica site; redo the operation
162 described by the log record.
163 </p>
164 </li>
165 <li>
166 <p><a id="set_app_dispatch_DB_TXN_PRINT"></a>
167 <code class="literal">DB_TXN_PRINT</code>
168 </p>
169 <p>
170 The log is being printed for debugging purposes; print the contents of
171 this log record in the desired format.
172 </p>
173 </li>
174 </ul>
175 </div>
176 <p>
177 The DB_TXN_FORWARD_ROLL and DB_TXN_APPLY operations frequently imply
178 the same actions, redoing changes that appear in the log record,
179 although if a recovery function is to be used on a replication client
180 where reads may be taking place concurrently with the processing of
181 incoming messages, DB_TXN_APPLY operations should also perform
182 appropriate locking. The macro DB_REDO(op) checks that the operation
183 is one of DB_TXN_FORWARD_ROLL or DB_TXN_APPLY, and should be used in
184 the recovery code to refer to the conditions under which operations
185 should be redone. Similarly, the macro DB_UNDO(op) checks if the
186 operation is one of DB_TXN_BACKWARD_ROLL or DB_TXN_ABORT.
187 </p>
188 </li>
189 </ul>
190 </div>
191 <p>
192 The function must return 0 on success and either <span class="bold"><strong>errno</strong></span>
193 or a value outside of the Berkeley DB error name space on failure.
194 </p>
195 </div>
196 </div>
197 <div class="sect2" lang="en" xml:lang="en">
198 <div class="titlepage">
199 <div>
200 <div>
201 <h3 class="title"><a id="idp51819640"></a>Errors</h3>
202 </div>
203 </div>
204 </div>
205 <p>
206 The <code class="methodname">DB_ENV-&gt;set_app_dispatch()</code> <span>
207 <span>
208 method may fail and return one of the following non-zero errors:
209 </span>
210
211 </span>
212 </p>
213 <div class="sect3" lang="en" xml:lang="en">
214 <div class="titlepage">
215 <div>
216 <div>
217 <h4 class="title"><a id="idp51785432"></a>EINVAL</h4>
218 </div>
219 </div>
220 </div>
221 <p>
222 If the method was called after <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a>
223 was called; or if an invalid flag value or parameter was specified.
224 </p>
225 </div>
226 </div>
227 <div class="sect2" lang="en" xml:lang="en">
228 <div class="titlepage">
229 <div>
230 <div>
231 <h3 class="title"><a id="idp51827104"></a>Class</h3>
232 </div>
233 </div>
234 </div>
235 <p>
236 <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a>, <a class="link" href="txn.html" title="Chapter 12.  The DB_TXN Handle">DB_TXN</a>
237 </p>
238 </div>
239 <div class="sect2" lang="en" xml:lang="en">
240 <div class="titlepage">
241 <div>
242 <div>
243 <h3 class="title"><a id="idp51827840"></a>See Also</h3>
244 </div>
245 </div>
246 </div>
247 <p>
248 <a class="xref" href="txn.html#txnlist" title="Transaction Subsystem and Related Methods">Transaction Subsystem and Related Methods</a>
249 </p>
250 </div>
251 </div>
252 <div class="navfooter">
253 <hr />
254 <table width="100%" summary="Navigation footer">
255 <tr>
256 <td width="40%" align="left"><a accesskey="p" href="envset_alloc.html">Prev</a> </td>
257 <td width="20%" align="center">
258 <a accesskey="u" href="env.html">Up</a>
259 </td>
260 <td width="40%" align="right"> <a accesskey="n" href="envset_backup_callbacks.html">Next</a></td>
261 </tr>
262 <tr>
263 <td width="40%" align="left" valign="top">DB_ENV-&gt;set_alloc() </td>
264 <td width="20%" align="center">
265 <a accesskey="h" href="index.html">Home</a>
266 </td>
267 <td width="40%" align="right" valign="top"> DB_ENV-&gt;set_backup_callbacks()</td>
268 </tr>
269 </table>
270 </div>
271 </body>
272 </html>