[Box Backup-commit] COMMIT r3309 - box/trunk/lib/backupstore
subversion at boxbackup.org
subversion at boxbackup.org
Wed Apr 9 23:14:57 BST 2014
Author: chris
Date: 2014-04-09 23:14:57 +0100 (Wed, 09 Apr 2014)
New Revision: 3309
Modified:
box/trunk/lib/backupstore/BackupStoreContext.cpp
box/trunk/lib/backupstore/BackupStoreContext.h
Log:
Don't require passing the object ID into BackupStoreContext::SaveDirectory.
Passing the wrong object ID would just result in an assertion being thrown
(in debug builds) or silently doing the wrong thing (in release builds). I
can't see any useful use for this extra parameter, since we can get the
container ID from the directory anyway.
Modified: box/trunk/lib/backupstore/BackupStoreContext.cpp
===================================================================
--- box/trunk/lib/backupstore/BackupStoreContext.cpp 2014-04-09 22:14:54 UTC (rev 3308)
+++ box/trunk/lib/backupstore/BackupStoreContext.cpp 2014-04-09 22:14:57 UTC (rev 3309)
@@ -697,7 +697,7 @@
}
// Write the directory back to disc
- SaveDirectory(dir, InDirectory);
+ SaveDirectory(dir);
// Commit the old version's new patched version, now that the directory safely reflects
// the state of the files on disc.
@@ -832,7 +832,7 @@
if(madeChanges)
{
// Save the directory back
- SaveDirectory(dir, InDirectory);
+ SaveDirectory(dir);
SaveStoreInfo(false);
}
}
@@ -910,7 +910,7 @@
if(madeChanges)
{
// Save the directory back
- SaveDirectory(dir, InDirectory);
+ SaveDirectory(dir);
// Modify the store info, and write
mapStoreInfo->ChangeBlocksInDeletedFiles(blocksDel);
@@ -953,12 +953,12 @@
// --------------------------------------------------------------------------
//
// Function
-// Name: BackupStoreContext::SaveDirectory(BackupStoreDirectory &, int64_t)
+// Name: BackupStoreContext::SaveDirectory(BackupStoreDirectory &)
// Purpose: Save directory back to disc, update time in cache
// Created: 2003/09/04
//
// --------------------------------------------------------------------------
-void BackupStoreContext::SaveDirectory(BackupStoreDirectory &rDir, int64_t ObjectID)
+void BackupStoreContext::SaveDirectory(BackupStoreDirectory &rDir)
{
if(mapStoreInfo.get() == 0)
{
@@ -965,10 +965,7 @@
THROW_EXCEPTION(BackupStoreException, StoreInfoNotLoaded)
}
- if(rDir.GetObjectID() != ObjectID)
- {
- THROW_EXCEPTION(BackupStoreException, Internal)
- }
+ int64_t ObjectID = rDir.GetObjectID();
try
{
@@ -1110,7 +1107,7 @@
dir.AddEntry(rFilename, ModificationTime, id, dirSize,
BackupStoreDirectory::Entry::Flags_Dir,
0 /* attributes hash */);
- SaveDirectory(dir, InDirectory);
+ SaveDirectory(dir);
// Increment reference count on the new directory to one
mapRefCount->AddReference(id);
@@ -1196,7 +1193,7 @@
}
// Save it
- SaveDirectory(parentDir, InDirectory);
+ SaveDirectory(parentDir);
// Done
break;
@@ -1312,7 +1309,7 @@
// Save the directory
if(changesMade)
{
- SaveDirectory(dir, ObjectID);
+ SaveDirectory(dir);
}
}
}
@@ -1353,7 +1350,7 @@
dir.SetAttributes(Attributes, AttributesModTime);
// Save back
- SaveDirectory(dir, Directory);
+ SaveDirectory(dir);
}
catch(...)
{
@@ -1414,7 +1411,7 @@
}
// Save back
- SaveDirectory(dir, InDirectory);
+ SaveDirectory(dir);
}
catch(...)
{
@@ -1675,7 +1672,7 @@
}
// Save the directory back
- SaveDirectory(dir, MoveFromDirectory);
+ SaveDirectory(dir);
}
catch(...)
{
@@ -1769,7 +1766,7 @@
}
// Save back
- SaveDirectory(to, MoveToDirectory);
+ SaveDirectory(to);
}
// Thirdly... remove them from the first directory -- but if it fails, attempt to delete them from the to directory
@@ -1785,7 +1782,7 @@
}
// Save back
- SaveDirectory(from, MoveFromDirectory);
+ SaveDirectory(from);
}
catch(...)
{
@@ -1801,7 +1798,7 @@
}
// Save back
- SaveDirectory(to, MoveToDirectory);
+ SaveDirectory(to);
// Throw the error
throw;
@@ -1817,7 +1814,7 @@
change.SetContainerID(MoveToDirectory);
// Save it back
- SaveDirectory(change, *i);
+ SaveDirectory(change);
}
}
catch(...)
Modified: box/trunk/lib/backupstore/BackupStoreContext.h
===================================================================
--- box/trunk/lib/backupstore/BackupStoreContext.h 2014-04-09 22:14:54 UTC (rev 3308)
+++ box/trunk/lib/backupstore/BackupStoreContext.h 2014-04-09 22:14:57 UTC (rev 3309)
@@ -171,7 +171,7 @@
private:
void MakeObjectFilename(int64_t ObjectID, std::string &rOutput, bool EnsureDirectoryExists = false);
BackupStoreDirectory &GetDirectoryInternal(int64_t ObjectID);
- void SaveDirectory(BackupStoreDirectory &rDir, int64_t ObjectID);
+ void SaveDirectory(BackupStoreDirectory &rDir);
void RemoveDirectoryFromCache(int64_t ObjectID);
void ClearDirectoryCache();
void DeleteDirectoryRecurse(int64_t ObjectID, bool Undelete);
More information about the Boxbackup-commit
mailing list