2 * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3 * Copyright (c) 2009, 2010 Zmanda, Inc. All Rights Reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published
7 * by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
19 * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
22 #ifndef XFER_DEST_TAPER_H
23 #define XFER_DEST_TAPER_H
29 * class declaration for XferDestTaper (an abstract base class)
32 GType xfer_dest_taper_get_type(void);
33 #define XFER_DEST_TAPER_TYPE (xfer_dest_taper_get_type())
34 #define XFER_DEST_TAPER(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_taper_get_type(), XferDestTaper)
35 #define XFER_DEST_TAPER_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_taper_get_type(), XferDestTaper const)
36 #define XFER_DEST_TAPER_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_dest_taper_get_type(), XferDestTaperClass)
37 #define IS_XFER_DEST_TAPER(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_dest_taper_get_type ())
38 #define XFER_DEST_TAPER_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_dest_taper_get_type(), XferDestTaperClass)
40 typedef struct XferDestTaper_ {
41 XferElement __parent__;
45 XferElementClass __parent__;
47 /* see xfer-device.h for details of these methods */
48 void (*start_part)(XferDestTaper *self, gboolean retry_part, dumpfile_t *header);
49 void (*use_device)(XferDestTaper *self, Device *device);
50 void (*cache_inform)(XferDestTaper *self, const char *filename, off_t offset,
52 guint64 (*get_part_bytes_written)(XferDestTaper *self);
55 /* Start writing the next part to the given device. The part will be written
56 * to the device given to use_device, which should be open and properly positioned.
57 * It should not have a file open yet.
59 * @param self: the XferDestTaper object
60 * @param retry_part: retry the previous (incomplete) part if true
61 * @param header: part header
63 void xfer_dest_taper_start_part(
68 /* Prepare to write subsequent parts to the given device. The device must
69 * not be started yet. It is not necessary to call this method for the first
70 * device used in a transfer.
72 * @param self: the XferDestTaper object
73 * @param device: the device
75 void xfer_dest_taper_use_device(
79 /* Add a slice of data to the cache for the element. This is used by the taper
80 * when reading from holding disk, to tell the element which holding disk files
81 * contain the data that might be needed when rewinding, but can be used in any
82 * situation where the part data is already on-disk. The order of calls to this
83 * function dictates the order in whch the files will be read, and no gaps or
84 * overlaps are supported. Note, too, that this must be called *before* any of
85 * the data in the new file is sent into the transfer.
87 * @param self: the XferDestTaper object
88 * @param filename: the fully qualified filename of the cache file
89 * @param offset: offset into the file at which data begins
90 * @param length: length of data in file
92 void xfer_dest_taper_cache_inform(
98 /* Return the number of bytes written for the current part.
100 * @param self: the XferDestTaper object
102 guint64 xfer_dest_taper_get_part_bytes_written(