summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/backupstore/BackupStoreCheck2.cpp13
-rw-r--r--lib/backupstore/BackupStoreInfo.cpp9
-rw-r--r--lib/backupstore/BackupStoreInfo.h9
3 files changed, 26 insertions, 5 deletions
diff --git a/lib/backupstore/BackupStoreCheck2.cpp b/lib/backupstore/BackupStoreCheck2.cpp
index ae5179ed..72ac9480 100644
--- a/lib/backupstore/BackupStoreCheck2.cpp
+++ b/lib/backupstore/BackupStoreCheck2.cpp
@@ -646,6 +646,15 @@ void BackupStoreCheck::WriteNewStoreInfo()
}
// Build a new store info
+ std::auto_ptr<MemBlockStream> extra_data;
+ if(pOldInfo.get())
+ {
+ extra_data.reset(new MemBlockStream(pOldInfo->GetExtraData()));
+ }
+ else
+ {
+ extra_data.reset(new MemBlockStream(/* empty */));
+ }
std::auto_ptr<BackupStoreInfo> info(BackupStoreInfo::CreateForRegeneration(
mAccountID,
mAccountName,
@@ -658,7 +667,9 @@ void BackupStoreCheck::WriteNewStoreInfo()
mBlocksInDeletedFiles,
mBlocksInDirectories,
softLimit,
- hardLimit));
+ hardLimit,
+ (pOldInfo.get() ? pOldInfo->IsAccountEnabled() : true),
+ *extra_data));
info->AdjustNumFiles(mNumFiles);
info->AdjustNumOldFiles(mNumOldFiles);
info->AdjustNumDeletedFiles(mNumDeletedFiles);
diff --git a/lib/backupstore/BackupStoreInfo.cpp b/lib/backupstore/BackupStoreInfo.cpp
index 8fbf591d..e9f0e16b 100644
--- a/lib/backupstore/BackupStoreInfo.cpp
+++ b/lib/backupstore/BackupStoreInfo.cpp
@@ -284,7 +284,8 @@ std::auto_ptr<BackupStoreInfo> BackupStoreInfo::CreateForRegeneration(
int64_t LastObjectID, int64_t BlocksUsed,
int64_t BlocksInCurrentFiles, int64_t BlocksInOldFiles,
int64_t BlocksInDeletedFiles, int64_t BlocksInDirectories,
- int64_t BlockSoftLimit, int64_t BlockHardLimit)
+ int64_t BlockSoftLimit, int64_t BlockHardLimit,
+ bool AccountEnabled, IOStream& ExtraData)
{
// Generate the filename
std::string fn(rRootDir + INFO_FILENAME);
@@ -298,7 +299,7 @@ std::auto_ptr<BackupStoreInfo> BackupStoreInfo::CreateForRegeneration(
info->mDiscSet = DiscSet;
info->mFilename = fn;
info->mReadOnly = false;
-
+
// Insert info starting info
info->mClientStoreMarker = 0;
info->mLastObjectIDUsed = LastObjectID;
@@ -309,7 +310,11 @@ std::auto_ptr<BackupStoreInfo> BackupStoreInfo::CreateForRegeneration(
info->mBlocksInDirectories = BlocksInDirectories;
info->mBlocksSoftLimit = BlockSoftLimit;
info->mBlocksHardLimit = BlockHardLimit;
+ info->mAccountEnabled = AccountEnabled;
+ ExtraData.CopyStreamTo(info->mExtraData);
+ info->mExtraData.SetForReading();
+
// return it to caller
return info;
}
diff --git a/lib/backupstore/BackupStoreInfo.h b/lib/backupstore/BackupStoreInfo.h
index 58a00cc1..752cc44a 100644
--- a/lib/backupstore/BackupStoreInfo.h
+++ b/lib/backupstore/BackupStoreInfo.h
@@ -139,15 +139,20 @@ public:
const CollectInBufferStream& GetExtraData() const { return mExtraData; }
void SetAccountEnabled(bool IsEnabled) {mAccountEnabled = IsEnabled; }
-private:
+ /**
+ * @return a new BackupStoreInfo with the requested properties.
+ * This is exposed to allow testing, do not use otherwise!
+ */
static std::auto_ptr<BackupStoreInfo> CreateForRegeneration(
int32_t AccountID, const std::string &rAccountName,
const std::string &rRootDir, int DiscSet,
int64_t LastObjectID, int64_t BlocksUsed,
int64_t BlocksInCurrentFiles, int64_t BlocksInOldFiles,
int64_t BlocksInDeletedFiles, int64_t BlocksInDirectories,
- int64_t BlockSoftLimit, int64_t BlockHardLimit);
+ int64_t BlockSoftLimit, int64_t BlockHardLimit,
+ bool AccountEnabled, IOStream& ExtraData);
+private:
// Location information
// Be VERY careful about changing types of these values, as
// they now define the sizes of fields on disk (via Archive).