[Box Backup-dev] COMMIT r746 - box/chris/merge/bin/bbackupd

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Wed, 9 Aug 2006 17:59:56 +0000 (GMT)


Author: chris
Date: 2006-08-09 17:59:53 +0000 (Wed, 09 Aug 2006)
New Revision: 746

Modified:
   box/chris/merge/bin/bbackupd/BackupDaemon.cpp
   box/chris/merge/bin/bbackupd/BackupDaemon.h
Log:
* bbackupd/BackupDaemon.h
* bbackupd/BackupDaemon.cpp
- Made SerializeStoreObjectInfo() return a boolean, true if it 
  successfully saved the store object info file, false otherwise.


Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/chris/merge/bin/bbackupd/BackupDaemon.cpp	2006-08-09 17:55:23 UTC (rev 745)
+++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp	2006-08-09 17:59:53 UTC (rev 746)
@@ -2173,11 +2173,11 @@
 static const std::string STOREOBJECTINFO_MAGIC_ID_STRING = "BBACKUPD-STATE";
 static const int STOREOBJECTINFO_VERSION = 1;
 
-void BackupDaemon::SerializeStoreObjectInfo(int64_t aClientStoreMarker, box_time_t theLastSyncTime, box_time_t theNextSyncTime) const
+bool BackupDaemon::SerializeStoreObjectInfo(int64_t aClientStoreMarker, box_time_t theLastSyncTime, box_time_t theNextSyncTime) const
 {
 	if(!GetConfiguration().KeyExists("StoreObjectInfoFile"))
 	{
-		return;
+		return false;
 	}
 
 	std::string StoreObjectInfoFile = 
@@ -2185,13 +2185,17 @@
 
 	if (StoreObjectInfoFile.size() <= 0)
 	{
-		return;
+		return false;
 	}
 
+	bool created = false;
+
 	try
 	{
 		FileStream aFile(StoreObjectInfoFile.c_str(), 
 			O_WRONLY | O_CREAT | O_TRUNC);
+		created = true;
+
 		Archive anArchive(aFile, 0);
 
 		anArchive.Write(STOREOBJECTINFO_MAGIC_ID_VALUE);
@@ -2236,6 +2240,8 @@
 			"not accessible or could not be created", 
 			StoreObjectInfoFile.c_str());
 	}
+
+	return created;
 }
 
 // --------------------------------------------------------------------------

Modified: box/chris/merge/bin/bbackupd/BackupDaemon.h
===================================================================
--- box/chris/merge/bin/bbackupd/BackupDaemon.h	2006-08-09 17:55:23 UTC (rev 745)
+++ box/chris/merge/bin/bbackupd/BackupDaemon.h	2006-08-09 17:59:53 UTC (rev 746)
@@ -46,9 +46,12 @@
 	~BackupDaemon();
 
 private:
-	// methods below do partial (specialized) serialization of client state only
-	void SerializeStoreObjectInfo(int64_t aClientStoreMarker, box_time_t theLastSyncTime, box_time_t theNextSyncTime) const;
-	bool DeserializeStoreObjectInfo(int64_t & aClientStoreMarker, box_time_t & theLastSyncTime, box_time_t & theNextSyncTime);
+	// methods below do partial (specialized) serialization of 
+	// client state only
+	bool SerializeStoreObjectInfo(int64_t aClientStoreMarker, 
+		box_time_t theLastSyncTime, box_time_t theNextSyncTime) const;
+	bool DeserializeStoreObjectInfo(int64_t & aClientStoreMarker, 
+		box_time_t & theLastSyncTime, box_time_t & theNextSyncTime);
 	bool DeleteStoreObjectInfo() const;
 	BackupDaemon(const BackupDaemon &);
 public: