Debian Codegraph @

device-src/xfer-dest-taper.h

raw
1 /*
2 * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3 * Copyright (c) 2009-2012 Zmanda, Inc. All Rights Reserved.
4 * Copyright (c) 2013-2016 Carbonite, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * Contact information: Carbonite Inc., 756 N Pastoria Ave
21 * Sunnyvale, CA 94085, or: http://www.zmanda.com
22 */
23
24 #ifndef XFER_DEST_TAPER_H
25 #define XFER_DEST_TAPER_H
26
27 #include "amxfer.h"
28 #include "device.h"
29
30 /*
31 * class declaration for XferDestTaper (an abstract base class)
32 */
33
34 GType xfer_dest_taper_get_type(void);
35 #define XFER_DEST_TAPER_TYPE (xfer_dest_taper_get_type())
36 #define XFER_DEST_TAPER(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_taper_get_type(), XferDestTaper)
37 #define XFER_DEST_TAPER_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_taper_get_type(), XferDestTaper const)
38 #define XFER_DEST_TAPER_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_dest_taper_get_type(), XferDestTaperClass)
39 #define IS_XFER_DEST_TAPER(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_dest_taper_get_type ())
40 #define XFER_DEST_TAPER_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_dest_taper_get_type(), XferDestTaperClass)
41
42 typedef struct XferDestTaper_ {
43 XferElement __parent__;
44 } XferDestTaper;
45
46 typedef struct {
47 XferElementClass __parent__;
48
49 /* see xfer-device.h for details of these methods */
50 void (*start_part)(XferDestTaper *self, gboolean retry_part, dumpfile_t *header);
51 void (*use_device)(XferDestTaper *self, Device *device);
52 void (*cache_inform)(XferDestTaper *self, const char *filename, off_t offset,
53 off_t length);
54 void (*new_space_available)(XferDestTaper *self, int made_space);
55 guint64 (*get_part_bytes_written)(XferDestTaper *self);
56 } XferDestTaperClass;
57
58 /* Start writing the next part to the given device. The part will be written
59 * to the device given to use_device, which should be open and properly positioned.
60 * It should not have a file open yet.
61 *
62 * @param self: the XferDestTaper object
63 * @param retry_part: retry the previous (incomplete) part if true
64 * @param header: part header
65 */
66 void xfer_dest_taper_start_part(
67 XferElement *self,
68 gboolean retry_part,
69 dumpfile_t *header);
70
71 /* Prepare to write subsequent parts to the given device. The device must
72 * not be started yet. It is not necessary to call this method for the first
73 * device used in a transfer.
74 *
75 * @param self: the XferDestTaper object
76 * @param device: the device
77 */
78 void xfer_dest_taper_use_device(
79 XferElement *self,
80 Device *device);
81
82 /* Add a slice of data to the cache for the element. This is used by the taper
83 * when reading from holding disk, to tell the element which holding disk files
84 * contain the data that might be needed when rewinding, but can be used in any
85 * situation where the part data is already on-disk. The order of calls to this
86 * function dictates the order in whch the files will be read, and no gaps or
87 * overlaps are supported. Note, too, that this must be called *before* any of
88 * the data in the new file is sent into the transfer.
89 *
90 * @param self: the XferDestTaper object
91 * @param filename: the fully qualified filename of the cache file
92 * @param offset: offset into the file at which data begins
93 * @param length: length of data in file
94 */
95 void xfer_dest_taper_cache_inform(
96 XferElement *self,
97 const char *filename,
98 off_t offset,
99 off_t length);
100
101 void xfer_dest_taper_new_space_available(
102 XferElement *self,
103 int made_space);
104
105 /* Return the number of bytes written for the current part.
106 *
107 * @param self: the XferDestTaper object
108 */
109 guint64 xfer_dest_taper_get_part_bytes_written(
110 XferElement *self);
111
112 #endif