Blame device-src/xfer-dest-taper.h

Packit Service 392537
/*
Packit Service 392537
 * Amanda, The Advanced Maryland Automatic Network Disk Archiver
Packit Service 392537
 * Copyright (c) 2009-2012 Zmanda, Inc.  All Rights Reserved.
Packit Service 392537
 * Copyright (c) 2013-2016 Carbonite, Inc.  All Rights Reserved.
Packit Service 392537
 *
Packit Service 392537
 * This program is free software; you can redistribute it and/or
Packit Service 392537
 * modify it under the terms of the GNU General Public License
Packit Service 392537
 * as published by the Free Software Foundation; either version 2
Packit Service 392537
 * of the License, or (at your option) any later version.
Packit Service 392537
 *
Packit Service 392537
 * This program is distributed in the hope that it will be useful, but
Packit Service 392537
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
Packit Service 392537
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
Packit Service 392537
 * for more details.
Packit Service 392537
 *
Packit Service 392537
 * You should have received a copy of the GNU General Public License along
Packit Service 392537
 * with this program; if not, write to the Free Software Foundation, Inc.,
Packit Service 392537
 * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
Packit Service 392537
 *
Packit Service 392537
 * Contact information: Carbonite Inc., 756 N Pastoria Ave
Packit Service 392537
 * Sunnyvale, CA 94085, or: http://www.zmanda.com
Packit Service 392537
 */
Packit Service 392537
Packit Service 392537
#ifndef XFER_DEST_TAPER_H
Packit Service 392537
#define XFER_DEST_TAPER_H
Packit Service 392537
Packit Service 392537
#include "amxfer.h"
Packit Service 392537
#include "device.h"
Packit Service 392537
Packit Service 392537
/*
Packit Service 392537
 * class declaration for XferDestTaper (an abstract base class)
Packit Service 392537
 */
Packit Service 392537
Packit Service 392537
GType xfer_dest_taper_get_type(void);
Packit Service 392537
#define XFER_DEST_TAPER_TYPE (xfer_dest_taper_get_type())
Packit Service 392537
#define XFER_DEST_TAPER(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_taper_get_type(), XferDestTaper)
Packit Service 392537
#define XFER_DEST_TAPER_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_taper_get_type(), XferDestTaper const)
Packit Service 392537
#define XFER_DEST_TAPER_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_dest_taper_get_type(), XferDestTaperClass)
Packit Service 392537
#define IS_XFER_DEST_TAPER(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_dest_taper_get_type ())
Packit Service 392537
#define XFER_DEST_TAPER_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_dest_taper_get_type(), XferDestTaperClass)
Packit Service 392537
Packit Service 392537
typedef struct XferDestTaper_ {
Packit Service 392537
    XferElement __parent__;
Packit Service 392537
} XferDestTaper;
Packit Service 392537
Packit Service 392537
typedef struct {
Packit Service 392537
    XferElementClass __parent__;
Packit Service 392537
Packit Service 392537
    /* see xfer-device.h for details of these methods */
Packit Service 392537
    void (*start_part)(XferDestTaper *self, gboolean retry_part, dumpfile_t *header);
Packit Service 392537
    void (*use_device)(XferDestTaper *self, Device *device);
Packit Service 392537
    void (*cache_inform)(XferDestTaper *self, const char *filename, off_t offset,
Packit Service 392537
			 off_t length);
Packit Service 392537
    void (*new_space_available)(XferDestTaper *self, int made_space);
Packit Service 392537
    guint64 (*get_part_bytes_written)(XferDestTaper *self);
Packit Service 392537
} XferDestTaperClass;
Packit Service 392537
Packit Service 392537
/* Start writing the next part to the given device.  The part will be written
Packit Service 392537
 * to the device given to use_device, which should be open and properly positioned.
Packit Service 392537
 * It should not have a file open yet.
Packit Service 392537
 *
Packit Service 392537
 * @param self: the XferDestTaper object
Packit Service 392537
 * @param retry_part: retry the previous (incomplete) part if true
Packit Service 392537
 * @param header: part header
Packit Service 392537
 */
Packit Service 392537
void xfer_dest_taper_start_part(
Packit Service 392537
    XferElement *self,
Packit Service 392537
    gboolean retry_part,
Packit Service 392537
    dumpfile_t *header);
Packit Service 392537
Packit Service 392537
/* Prepare to write subsequent parts to the given device.  The device must
Packit Service 392537
 * not be started yet.  It is not necessary to call this method for the first
Packit Service 392537
 * device used in a transfer.
Packit Service 392537
 *
Packit Service 392537
 * @param self: the XferDestTaper object
Packit Service 392537
 * @param device: the device
Packit Service 392537
 */
Packit Service 392537
void xfer_dest_taper_use_device(
Packit Service 392537
    XferElement *self,
Packit Service 392537
    Device *device);
Packit Service 392537
Packit Service 392537
/* Add a slice of data to the cache for the element.  This is used by the taper
Packit Service 392537
 * when reading from holding disk, to tell the element which holding disk files
Packit Service 392537
 * contain the data that might be needed when rewinding, but can be used in any
Packit Service 392537
 * situation where the part data is already on-disk.  The order of calls to this
Packit Service 392537
 * function dictates the order in whch the files will be read, and no gaps or
Packit Service 392537
 * overlaps are supported.  Note, too, that this must be called *before* any of
Packit Service 392537
 * the data in the new file is sent into the transfer.
Packit Service 392537
 *
Packit Service 392537
 * @param self: the XferDestTaper object
Packit Service 392537
 * @param filename: the fully qualified filename of the cache file
Packit Service 392537
 * @param offset: offset into the file at which data begins
Packit Service 392537
 * @param length: length of data in file
Packit Service 392537
 */
Packit Service 392537
void xfer_dest_taper_cache_inform(
Packit Service 392537
    XferElement *self,
Packit Service 392537
    const char *filename,
Packit Service 392537
    off_t offset,
Packit Service 392537
    off_t length);
Packit Service 392537
Packit Service 392537
void xfer_dest_taper_new_space_available(
Packit Service 392537
    XferElement *self,
Packit Service 392537
    int          made_space);
Packit Service 392537
Packit Service 392537
/* Return the number of bytes written for the current part.
Packit Service 392537
 *
Packit Service 392537
 * @param self: the XferDestTaper object
Packit Service 392537
 */
Packit Service 392537
guint64 xfer_dest_taper_get_part_bytes_written(
Packit Service 392537
    XferElement *self);
Packit Service 392537
Packit Service 392537
#endif