mirror of https://github.com/vitalif/zbackup
Added migrator for old repos
parent
31e1f54efa
commit
9b1eb8ab9e
|
@ -13,12 +13,10 @@
|
|||
|
||||
// TODO: make *_storable to be variadic
|
||||
#define SET_STORABLE( storage, property, value ) \
|
||||
({ \
|
||||
dPrintf( "storable->mutable_"#storage"()->set_"#property"( "#value" )\n" ); \
|
||||
storable->mutable_##storage()->set_##property( value ); \
|
||||
})
|
||||
storable->mutable_##storage()->set_##property( value )
|
||||
|
||||
#define GET_STORABLE( storage, property ) storable->storage().property()
|
||||
#define GET_STORABLE( storage, property ) \
|
||||
storable->storage().property()
|
||||
|
||||
using std::string;
|
||||
using std::bitset;
|
||||
|
|
|
@ -139,12 +139,35 @@ StorageInfo ZBackupBase::loadStorageInfo()
|
|||
ExtendedStorageInfo ZBackupBase::loadExtendedStorageInfo(
|
||||
EncryptionKey const & encryptionkey )
|
||||
{
|
||||
ExtendedStorageInfo extendedStorageInfo;
|
||||
try
|
||||
{
|
||||
ExtendedStorageInfo extendedStorageInfo;
|
||||
|
||||
ExtendedStorageInfoFile::load( getExtendedStorageInfoPath(), encryptionkey,
|
||||
extendedStorageInfo );
|
||||
ExtendedStorageInfoFile::load( getExtendedStorageInfoPath(), encryptionkey,
|
||||
extendedStorageInfo );
|
||||
|
||||
return extendedStorageInfo;
|
||||
return extendedStorageInfo;
|
||||
}
|
||||
catch ( UnbufferedFile::exCantOpen & ex )
|
||||
{
|
||||
verbosePrintf( "Can't open extended storage info (info_extended)!\n"
|
||||
"Starting repo migration.\n" );
|
||||
|
||||
ExtendedStorageInfo extendedStorageInfo;
|
||||
Config config( extendedStorageInfo.mutable_config() );
|
||||
config.SET_STORABLE( chunk, max_size, storageInfo.chunk_max_size() );
|
||||
config.SET_STORABLE( bundle, max_payload_size,
|
||||
storageInfo.bundle_max_payload_size() );
|
||||
config.SET_STORABLE( bundle, compression_method,
|
||||
storageInfo.default_compression_method() );
|
||||
|
||||
ExtendedStorageInfoFile::save( getExtendedStorageInfoPath(), encryptionkey,
|
||||
extendedStorageInfo );
|
||||
|
||||
verbosePrintf( "Done.\n" );
|
||||
|
||||
return loadExtendedStorageInfo( encryptionkey );
|
||||
}
|
||||
}
|
||||
|
||||
void ZBackupBase::initStorage( string const & storageDir,
|
||||
|
|
Loading…
Reference in New Issue