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