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
28 #include "xfer-dest-taper.h"
30 /* A transfer source that reads from a Device. The device must be positioned
31 * at the start of a file before the transfer is started. The transfer will
32 * continue until the end of the file.
34 * Implemented in xfer-source-device.c
36 * @param device: Device object to read from
37 * @return: new element
39 XferElement *xfer_source_device(
42 /* A transfer destination that writes bytes to a Device. The device should have a
43 * file started, ready for a device_write_block call. On completion of the transfer,
44 * the file will be finished. If a device error occurs, the transfer will be cancelled.
46 * If cancel_at_leom is true, then the transfer will also be cancelled on LEOM, with
47 * the error message containing the string "LEOM detected" (this is used by amtapetype).
49 * Implemented in xfer-dest-device.c
51 * @param device: the Device to write to, with a file started
52 * @param canel_at_leom: if true, the element will cancel the transfer at LEOM.
53 * @return: new element
55 XferElement *xfer_dest_device(
57 gboolean canel_at_leom);
59 /* Constructor for XferDestTaperSplitter, which writes data to devices block by
60 * block and splitting parts but no caching.
62 * @param first_device: the first device that will be used with this xfer, used
63 * to calculate some internal parameters
64 * @param max_memory: total amount of memory to use for buffers, or zero
65 * for a reasonable default.
66 * @param part_size: the desired size of each part
67 * @param expect_cache_inform: TRUE if this element will get cache_inform messages
68 * @return: new element
71 xfer_dest_taper_splitter(
75 gboolean expect_cache_inform);
77 /* Constructor for XferDestTaperCacher, which writes data to devices block by
78 * block and handles caching and splitting parts.
80 * @param first_device: the first device that will be used with this xfer, used
81 * to calculate some internal parameters
82 * @param max_memory: total amount of memory to use for buffers, or zero
83 * for a reasonable default.
84 * @param part_size: the desired size of each part
85 * @param use_mem_cache: if true, use the memory cache
86 * @param disk_cache_dirname: if not NULL, this is the directory in which the disk
87 * cache should be created
88 * @return: new element
91 xfer_dest_taper_cacher(
95 gboolean use_mem_cache,
96 const char *disk_cache_dirname);
98 /* Constructor for XferDestTaperDirectTCP, which uses DirectTCP to transfer data
99 * to devices (which must support the feature).
101 * @param first_device: the first device that will be used with this xfer, used
102 * to calculate some internal parameters
103 * @param part_size: the desired size of each part
104 * @return: new element
107 xfer_dest_taper_directtcp(
108 Device *first_device,
115 /* Create a new XferSourceRecovery object. Like XferDestTaper instances, this object
116 * will not start transferring data until xfer_source_recovery_start_part is called to
117 * give the device from which the data should flow.
119 * @param first device: teh first device that will be used with this xfer
120 * @returns: new element
123 xfer_source_recovery(
124 Device *first_device);
126 /* Start an XferSourceRecovery reading from a particular, pre-positioned device
128 * @param self: XferSourceRecovery object
129 * @param device: device to read from
132 xfer_source_recovery_start_part(
136 /* Prepare to read subsequent parts from the given device. The device must
137 * not be started yet. It is not necessary to call this method for the first
138 * device used in a transfer.
140 * @param self: the XferSourceRecovery object
141 * @param device: the device
143 void xfer_source_recovery_use_device(
148 xfer_source_recovery_get_bytes_read(