mirror of https://github.com/vitalif/zbackup
Added some boilerplates for backup exchanger
parent
9f8c631561
commit
55b9486473
|
@ -0,0 +1,12 @@
|
|||
// Part of ZBackup. Licensed under GNU GPLv2 or later
|
||||
|
||||
#include "storage_info_file.hh"
|
||||
|
||||
namespace BackupExchanger {
|
||||
|
||||
BackupExchanger::BackupExchanger( )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -4,6 +4,11 @@
|
|||
#define EXCHANGE_HH_INCLUDED__
|
||||
|
||||
#include <bitset>
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
namespace BackupExchanger {
|
||||
|
||||
|
|
21
zbackup.cc
21
zbackup.cc
|
@ -297,6 +297,16 @@ void ZRestore::restoreToStdin( string const & inputFileName )
|
|||
throw exChecksumError();
|
||||
}
|
||||
|
||||
ZExchange::ZExchange( string const & srcStorageDir, string const & srcPassword,
|
||||
string const & dstStorageDir, string const & dstPassword,
|
||||
bitset< BackupExchanger::Flags > const & exchange )
|
||||
{
|
||||
}
|
||||
|
||||
void ZExchange::exchange()
|
||||
{
|
||||
}
|
||||
|
||||
DEF_EX( exExchangeWithLessThanTwoKeys, "Specify password flag (--non-encrypted or --password-file)"
|
||||
" for import/export operation twice (first for source and second for destination)", std::exception )
|
||||
DEF_EX( exNonEncryptedWithKey, "--non-encrypted and --password-file are incompatible", std::exception )
|
||||
|
@ -508,16 +518,23 @@ int main( int argc, char *argv[] )
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
string src, dst = 0;
|
||||
if ( strcmp( args[ 0 ], "export" ) == 0 )
|
||||
{
|
||||
|
||||
src = args[ 1 ];
|
||||
dst = args[ 2 ];
|
||||
}
|
||||
else
|
||||
if ( strcmp( args[ 0 ], "import" ) == 0 )
|
||||
{
|
||||
|
||||
src = args[ 2 ];
|
||||
dst = args[ 1 ];
|
||||
}
|
||||
|
||||
ZExchange ze( ZBackup::deriveStorageDirFromBackupsFile( src ), passwords[ 0 ],
|
||||
ZBackup::deriveStorageDirFromBackupsFile( dst ), passwords[ 1 ],
|
||||
exchange );
|
||||
ze.exchange();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
14
zbackup.hh
14
zbackup.hh
|
@ -8,6 +8,7 @@
|
|||
#include <exception>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <bitset>
|
||||
|
||||
#include "chunk_id.hh"
|
||||
#include "chunk_index.hh"
|
||||
|
@ -16,9 +17,11 @@
|
|||
#include "ex.hh"
|
||||
#include "tmp_mgr.hh"
|
||||
#include "zbackup.pb.h"
|
||||
#include "backup_exchanger.hh"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::bitset;
|
||||
|
||||
struct Paths
|
||||
{
|
||||
|
@ -94,4 +97,15 @@ public:
|
|||
void restoreToStdin( string const & inputFileName );
|
||||
};
|
||||
|
||||
class ZExchange
|
||||
{
|
||||
public:
|
||||
ZExchange( string const & srcStorageDir, string const & srcPassword,
|
||||
string const & dstStorageDir, string const & dstPassword,
|
||||
bitset< BackupExchanger::Flags > const & exchange );
|
||||
|
||||
/// Exchanges the data between storages
|
||||
void exchange();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue