Debian Codegraph @

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