2014-12-11 10:50:15 +03:00
|
|
|
// Copyright (c) 2012-2014 Konstantin Isakov <ikm@zbackup.org> and ZBackup contributors, see CONTRIBUTORS
|
2014-10-10 13:50:55 +04:00
|
|
|
// Part of ZBackup. Licensed under GNU GPLv2 or later + OpenSSL, see LICENSE
|
2013-07-18 21:33:25 +04:00
|
|
|
|
2015-01-25 19:44:15 +03:00
|
|
|
#ifndef BACKUP_RESTORER_HH_INCLUDED
|
|
|
|
#define BACKUP_RESTORER_HH_INCLUDED
|
2013-07-18 21:33:25 +04:00
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <exception>
|
|
|
|
#include <string>
|
2014-07-14 00:11:01 +04:00
|
|
|
#include <set>
|
2013-07-18 21:33:25 +04:00
|
|
|
|
|
|
|
#include "chunk_storage.hh"
|
|
|
|
#include "ex.hh"
|
|
|
|
|
|
|
|
/// Generic interface to stream data out
|
|
|
|
class DataSink
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void saveData( void const * data, size_t size )=0;
|
|
|
|
virtual ~DataSink() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Restores the backup
|
|
|
|
namespace BackupRestorer {
|
|
|
|
|
|
|
|
DEF_EX( Ex, "Backup restorer exception", std::exception )
|
|
|
|
DEF_EX( exTooManyBytesToEmit, "A backup record asks to emit too many bytes", Ex )
|
|
|
|
|
2014-07-14 00:11:01 +04:00
|
|
|
typedef std::set< ChunkId > ChunkSet;
|
|
|
|
|
2013-07-18 21:33:25 +04:00
|
|
|
/// Restores the given backup
|
|
|
|
void restore( ChunkStorage::Reader &, std::string const & backupData,
|
2014-07-14 00:11:01 +04:00
|
|
|
DataSink *, ChunkSet * );
|
|
|
|
|
|
|
|
/// Performs restore iterations on backupData
|
|
|
|
void restoreIterations( ChunkStorage::Reader &, BackupInfo &, std::string &, ChunkSet * );
|
2013-07-18 21:33:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|