Debian Codegraph @

docs/api_reference/CXX/envset_backup_callbacks.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_backup_callbacks()</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_app_dispatch.html" title="DbEnv::set_app_dispatch()" />
12 <link rel="next" href="envset_backup_config.html" title="DbEnv::set_backup_config()" />
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_backup_callbacks()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="envset_app_dispatch.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_config.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_backup_callbacks"></a>DbEnv::set_backup_callbacks()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db_cxx.h&gt;
42
43 DB_ENV-&gt;set_backup_callbacks(
44 int (*open_func)(DB_ENV *, const char *dbname,
45 const char *target, void **handle),
46 int (*write_func)(DB_ENV *, u_int32_t offset_gbytes,
47 u_int32_t offset_bytes, u_int32_t size,
48 u_int8_t *buf, void *handle),
49 int (*close_func)(DB_ENV *, const char *dbname, void *handle)); </pre>
50 <p>
51 The <code class="methodname">DbEnv::set_backup_callbacks()</code> method
52 configures three callback functions which can be used by the
53 <a class="xref" href="envbackup.html" title="DbEnv::backup()">DbEnv::backup()</a>
54 or
55 <a class="xref" href="envdbbackup.html" title="DbEnv::dbbackup()">DbEnv::dbbackup()</a>
56 methods to override their default behavior. If one callback is
57 configured, then all three callbacks must be configured.
58 These callbacks are required if the <code class="literal">target</code> parameter is
59 set to <code class="literal">NULL</code> for the
60 <a class="xref" href="envbackup.html" title="DbEnv::backup()">DbEnv::backup()</a>
61 or
62 <a class="xref" href="envdbbackup.html" title="DbEnv::dbbackup()">DbEnv::dbbackup()</a>
63 methods.
64 </p>
65 <p>
66 The <code class="methodname">DbEnv::set_backup_callbacks()</code> method
67 configures operations performed using the specified
68 <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a> handle, not all operations
69 performed on the underlying database environment.
70 </p>
71 <p>
72 The <code class="methodname">DbEnv::set_backup_callbacks()</code> method may
73 be called at any time during the life of the application.
74 </p>
75 <p>
76 The <code class="methodname">DbEnv::set_backup_callbacks()</code> <span>
77
78 <span>
79 method either returns a non-zero error value or throws an
80 exception that encapsulates a non-zero error value on
81 failure, and returns 0 on success.
82 </span>
83 </span>
84 </p>
85 <div class="sect2" lang="en" xml:lang="en">
86 <div class="titlepage">
87 <div>
88 <div>
89 <h3 class="title"><a id="idp7155192"></a>Parameters</h3>
90 </div>
91 </div>
92 </div>
93 <div class="sect3" lang="en" xml:lang="en">
94 <div class="titlepage">
95 <div>
96 <div>
97 <h4 class="title"><a id="idp7140248"></a>open_func</h4>
98 </div>
99 </div>
100 </div>
101 <p>
102 The <span class="bold"><strong>open_func</strong></span> parameter
103 is the function used when a target location is opened
104 during a backup. This function should do whatever is
105 necessary to prepare the backup destination for
106 writing the data.
107 </p>
108 <p>
109 This function takes four parameters:
110 </p>
111 <div class="itemizedlist">
112 <ul type="disc">
113 <li>
114 <p>
115 <code class="literal">dbenv</code>
116 </p>
117 <p>
118 The <span class="bold"><strong>dbenv</strong></span>
119 parameter is the enclosing database environment
120 handle.
121 </p>
122 </li>
123 <li>
124 <p>
125 <code class="literal">dbname</code>
126 </p>
127 <p>
128 The <span class="bold"><strong>dbname</strong></span> parameter is the
129 name of the database being backed up.
130 </p>
131 </li>
132 <li>
133 <p>
134 <code class="literal">target</code>
135 </p>
136 <p>
137 The <span class="bold"><strong>target</strong></span> parameter is the
138 backup's directory destination.
139 </p>
140 </li>
141 <li>
142 <p>
143 <code class="literal">handle</code>
144 </p>
145 <p>
146 The <span class="bold"><strong>handle</strong></span> parameter references
147 the handle (usually a file handle) to which the backup will be
148 written.
149 </p>
150 </li>
151 </ul>
152 </div>
153 </div>
154 <div class="sect3" lang="en" xml:lang="en">
155 <div class="titlepage">
156 <div>
157 <div>
158 <h4 class="title"><a id="idp7133616"></a>write_func</h4>
159 </div>
160 </div>
161 </div>
162 <p>
163 The <span class="bold"><strong>write_func</strong></span> parameter
164 is the function used to write data during a backup.
165 The function takes six parameters:
166 </p>
167 <div class="itemizedlist">
168 <ul type="disc">
169 <li>
170 <p>
171 <code class="literal">dbenv</code>
172 </p>
173 <p>
174 The <span class="bold"><strong>dbenv</strong></span>
175 parameter is the enclosing database environment
176 handle.
177 </p>
178 </li>
179 <li>
180 <p>
181 <code class="literal">offset_gbytes</code>
182 </p>
183 <p>
184 The <span class="bold"><strong>offset_gbytes</strong></span>
185 parameter specifies the number of gigabytes into
186 the output handle where the data can should be
187 written. This value, plus the value specified on
188 <code class="literal">offset_bytes</code>, indicates the
189 offset within the output handle where the backup
190 should begin.
191 </p>
192 </li>
193 <li>
194 <p>
195 <code class="literal">offset_bytes</code>
196 </p>
197 <p>
198 The <span class="bold"><strong>offset_bytes</strong></span>
199 parameter specifies the number of bytes into the
200 output handle where the data can be located. This
201 value, plus the value specified on
202 <code class="literal">offset_gbytes</code>, indicates the
203 offset within the output handle where the backup
204 should begin.
205 </p>
206 </li>
207 <li>
208 <p>
209 <code class="literal">size</code>
210 </p>
211 <p>
212 The <span class="bold"><strong>size</strong></span>
213 parameter specifies the number of bytes to back up
214 from the buffer.
215 </p>
216 </li>
217 <li>
218 <p>
219 <code class="literal">buf</code>
220 </p>
221 <p>
222 The <span class="bold"><strong>buf</strong></span>
223 parameter is the buffer which contains the data to
224 be backed up.
225 </p>
226 </li>
227 <li>
228 <p>
229 <code class="literal">handle</code>
230 </p>
231 <p>
232 The <span class="bold"><strong>handle</strong></span>
233 parameter references the handle (usually a file
234 handle) to which the backup will be written.
235 </p>
236 </li>
237 </ul>
238 </div>
239 </div>
240 <div class="sect3" lang="en" xml:lang="en">
241 <div class="titlepage">
242 <div>
243 <div>
244 <h4 class="title"><a id="idp7142656"></a>close_func</h4>
245 </div>
246 </div>
247 </div>
248 <p>
249 The <span class="bold"><strong>close_func</strong></span> parameter
250 is the function used when ending a backup and closing a
251 backup target. The function takes three parameters:
252 </p>
253 <div class="itemizedlist">
254 <ul type="disc">
255 <li>
256 <p>
257 <code class="literal">dbenv</code>
258 </p>
259 <p>
260 The <span class="bold"><strong>dbenv</strong></span>
261 parameter is the enclosing database environment
262 handle.
263 </p>
264 </li>
265 <li>
266 <p>
267 <code class="literal">dbname</code>
268 </p>
269 <p>
270 The <span class="bold"><strong>dbname</strong></span> parameter is the
271 name of the database that has now been backed up.
272 </p>
273 </li>
274 <li>
275 <p>
276 <code class="literal">handle</code>
277 </p>
278 <p>
279 The <span class="bold"><strong>handle</strong></span>
280 parameter references the handle (usually a file
281 handle) to which the backup was written, and which
282 now must be closed or otherwise discarded.
283 </p>
284 </li>
285 </ul>
286 </div>
287 </div>
288 </div>
289 <div class="sect2" lang="en" xml:lang="en">
290 <div class="titlepage">
291 <div>
292 <div>
293 <h3 class="title"><a id="idp7182008"></a>Class</h3>
294 </div>
295 </div>
296 </div>
297 <p>
298 <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>
299 </p>
300 </div>
301 <div class="sect2" lang="en" xml:lang="en">
302 <div class="titlepage">
303 <div>
304 <div>
305 <h3 class="title"><a id="idp7171648"></a>See Also</h3>
306 </div>
307 </div>
308 </div>
309 <p>
310 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a>,
311 <a class="xref" href="envget_backup_callbacks.html" title="DbEnv::get_backup_callbacks()">DbEnv::get_backup_callbacks()</a>,
312 <a class="xref" href="envbackup.html" title="DbEnv::backup()">DbEnv::backup()</a>, and
313 <a class="xref" href="envdbbackup.html" title="DbEnv::dbbackup()">DbEnv::dbbackup()</a>.
314 </p>
315 </div>
316 </div>
317 <div class="navfooter">
318 <hr />
319 <table width="100%" summary="Navigation footer">
320 <tr>
321 <td width="40%" align="left"><a accesskey="p" href="envset_app_dispatch.html">Prev</a> </td>
322 <td width="20%" align="center">
323 <a accesskey="u" href="env.html">Up</a>
324 </td>
325 <td width="40%" align="right"> <a accesskey="n" href="envset_backup_config.html">Next</a></td>
326 </tr>
327 <tr>
328 <td width="40%" align="left" valign="top">DbEnv::set_app_dispatch() </td>
329 <td width="20%" align="center">
330 <a accesskey="h" href="index.html">Home</a>
331 </td>
332 <td width="40%" align="right" valign="top"> DbEnv::set_backup_config()</td>
333 </tr>
334 </table>
335 </div>
336 </body>
337 </html>