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-02-04 14:38:22 +03:00
|
|
|
#ifndef ZUTILS_HH_INCLUDED
|
|
|
|
#define ZUTILS_HH_INCLUDED
|
2013-07-18 21:33:25 +04:00
|
|
|
|
|
|
|
#include "chunk_storage.hh"
|
2014-11-27 19:20:41 +03:00
|
|
|
#include "zbackup_base.hh"
|
2013-07-18 21:33:25 +04:00
|
|
|
|
|
|
|
class ZBackup: public ZBackupBase
|
|
|
|
{
|
|
|
|
ChunkStorage::Writer chunkStorageWriter;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ZBackup( string const & storageDir, string const & password,
|
2015-01-18 03:42:52 +03:00
|
|
|
Config & configIn );
|
2013-07-18 21:33:25 +04:00
|
|
|
|
|
|
|
/// Backs up the data from stdin
|
|
|
|
void backupFromStdin( string const & outputFileName );
|
|
|
|
};
|
|
|
|
|
|
|
|
class ZRestore: public ZBackupBase
|
|
|
|
{
|
|
|
|
ChunkStorage::Reader chunkStorageReader;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ZRestore( string const & storageDir, string const & password,
|
2015-01-18 03:42:52 +03:00
|
|
|
Config & configIn );
|
2013-07-18 21:33:25 +04:00
|
|
|
|
2015-05-21 01:15:10 +03:00
|
|
|
/// Restores the data to file
|
|
|
|
void restoreToFile( string const & inputFileName, string const & outputFileName );
|
|
|
|
|
|
|
|
/// Restores the data to stdout
|
2013-07-18 21:33:25 +04:00
|
|
|
void restoreToStdin( string const & inputFileName );
|
2014-11-27 19:20:41 +03:00
|
|
|
};
|
|
|
|
|
2014-08-27 12:12:47 +04:00
|
|
|
class ZExchange
|
|
|
|
{
|
2014-09-30 14:36:28 +04:00
|
|
|
ZBackupBase srcZBackupBase;
|
|
|
|
ZBackupBase dstZBackupBase;
|
|
|
|
|
2014-08-27 12:12:47 +04:00
|
|
|
public:
|
|
|
|
ZExchange( string const & srcStorageDir, string const & srcPassword,
|
2015-01-18 03:42:52 +03:00
|
|
|
string const & dstStorageDir, string const & dstPassword,
|
|
|
|
Config & configIn );
|
|
|
|
|
|
|
|
Config config;
|
2014-08-27 12:12:47 +04:00
|
|
|
|
|
|
|
/// Exchanges the data between storages
|
2015-01-18 03:42:52 +03:00
|
|
|
void exchange();
|
2014-08-27 12:12:47 +04:00
|
|
|
};
|
|
|
|
|
2015-02-04 14:38:22 +03:00
|
|
|
class ZCollector : public ZBackupBase
|
|
|
|
{
|
|
|
|
ChunkStorage::Reader chunkStorageReader;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ZCollector( std::string const & storageDir, std::string const & password,
|
|
|
|
Config & configIn );
|
|
|
|
|
2015-08-19 10:32:16 +03:00
|
|
|
void gc( bool );
|
2015-02-04 14:38:22 +03:00
|
|
|
};
|
|
|
|
|
2013-07-18 21:33:25 +04:00
|
|
|
#endif
|