[Box Backup-dev] COMMIT r792 - box/trunk/bin/bbackupd
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Sun, 20 Aug 2006 00:41:19 +0100
Author: chris
Date: 2006-08-20 00:41:19 +0100 (Sun, 20 Aug 2006)
New Revision: 792
Modified:
box/trunk/bin/bbackupd/BackupDaemon.cpp
box/trunk/bin/bbackupd/BackupDaemon.h
Log:
* bbackupd/BackupDaemon.h
* bbackupd/BackupDaemon.cpp
- Made SerializeStoreObjectInfo() return a boolean, true if it created a
store object info file (which we must delete later), false otherwise.
Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/trunk/bin/bbackupd/BackupDaemon.cpp 2006-08-19 23:39:38 UTC (rev 791)
+++ box/trunk/bin/bbackupd/BackupDaemon.cpp 2006-08-19 23:41:19 UTC (rev 792)
@@ -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/trunk/bin/bbackupd/BackupDaemon.h
===================================================================
--- box/trunk/bin/bbackupd/BackupDaemon.h 2006-08-19 23:39:38 UTC (rev 791)
+++ box/trunk/bin/bbackupd/BackupDaemon.h 2006-08-19 23:41:19 UTC (rev 792)
@@ -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: