[Box Backup-commit] COMMIT r1672 - box/chris/general/bin/bbackupd

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Fri May 18 21:29:49 BST 2007


Author: chris
Date: 2007-05-18 21:29:49 +0100 (Fri, 18 May 2007)
New Revision: 1672

Modified:
   box/chris/general/bin/bbackupd/BackupDaemon.cpp
Log:
Fixed object store read/write, fixes #18 properly, thanks Gary!


Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/chris/general/bin/bbackupd/BackupDaemon.cpp	2007-05-18 20:13:55 UTC (rev 1671)
+++ box/chris/general/bin/bbackupd/BackupDaemon.cpp	2007-05-18 20:29:49 UTC (rev 1672)
@@ -2558,7 +2558,7 @@
 
 static const int STOREOBJECTINFO_MAGIC_ID_VALUE = 0x7777525F;
 static const std::string STOREOBJECTINFO_MAGIC_ID_STRING = "BBACKUPD-STATE";
-static const int STOREOBJECTINFO_VERSION = 1;
+static const int STOREOBJECTINFO_VERSION = 2;
 
 bool BackupDaemon::SerializeStoreObjectInfo(int64_t aClientStoreMarker, box_time_t theLastSyncTime, box_time_t theNextSyncTime) const
 {
@@ -2617,9 +2617,27 @@
 		//
 		//
 		//
+		iCount = mUnusedRootDirEntries.size();
+		anArchive.Write(iCount);
+
+		for(int v = 0; v < iCount; v++)
+		{
+			anArchive.Write(mUnusedRootDirEntries[v].first);
+			anArchive.Write(mUnusedRootDirEntries[v].second);
+		}
+
+		if (iCount > 0)
+		{
+			anArchive.Write(mDeleteUnusedRootDirEntriesAfter);
+		}
+
+		//
+		//
+		//
 		aFile.Close();
-		BOX_INFO("Saved store object info file: "
-			<< StoreObjectInfoFile);
+		BOX_INFO("Saved store object info file version " <<
+			STOREOBJECTINFO_VERSION << " (" <<
+			StoreObjectInfoFile << ")");
 	}
 	catch(std::exception &e)
 	{
@@ -2777,9 +2795,29 @@
 		//
 		//
 		//
+		iCount = 0;
+		anArchive.Read(iCount);
+
+		for(int v = 0; v < iCount; v++)
+		{
+			int64_t anId;
+			anArchive.Read(anId);
+
+			std::string aName;
+			anArchive.Read(aName);
+
+			mUnusedRootDirEntries.push_back(std::pair<int64_t, std::string>(anId, aName));
+		}
+
+		if (iCount > 0)
+			anArchive.Read(mDeleteUnusedRootDirEntriesAfter);
+
+		//
+		//
+		//
 		aFile.Close();
 		BOX_INFO("Loaded store object info file version " << iVersion
-			<< "(" << StoreObjectInfoFile << ")");
+			<< " (" << StoreObjectInfoFile << ")");
 		
 		return true;
 	} 




More information about the Boxbackup-commit mailing list