[Box Backup-commit] COMMIT r2981 - box/trunk/bin/bbackupd

subversion at boxbackup.org subversion at boxbackup.org
Sat Aug 27 14:41:36 BST 2011


Author: chris
Date: 2011-08-27 14:41:36 +0100 (Sat, 27 Aug 2011)
New Revision: 2981

Modified:
   box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp
   box/trunk/bin/bbackupd/BackupDaemon.cpp
   box/trunk/bin/bbackupd/BackupDaemon.h
   box/trunk/bin/bbackupd/BackupDaemonInterface.h
Log:
Log the number of files uploaded and directories created, as requested by Achim, closes #61.


Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp
===================================================================
--- box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp	2011-08-27 09:46:14 UTC (rev 2980)
+++ box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp	2011-08-27 13:41:36 UTC (rev 2981)
@@ -1387,6 +1387,9 @@
 					
 					// Flag as having done this for optimisation later
 					haveJustCreatedDirOnServer = true;
+					rNotifier.NotifyDirectoryCreated(subDirObjectID,
+						storeFilename.GetClearFilename(),
+						dirname);
 				}
 			}
 

Modified: box/trunk/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/trunk/bin/bbackupd/BackupDaemon.cpp	2011-08-27 09:46:14 UTC (rev 2980)
+++ box/trunk/bin/bbackupd/BackupDaemon.cpp	2011-08-27 13:41:36 UTC (rev 2981)
@@ -189,6 +189,8 @@
 	  mUpdateStoreInterval(0),
 	  mDeleteStoreObjectInfoFile(false),
 	  mDoSyncForcedByPreviousSyncError(false),
+	  mNumFilesUploaded(-1),
+	  mNumDirsCreated(-1),
 	  mLogAllFileAccess(false),
 	  mpProgressNotifier(this),
 	  mpLocationResolver(this),
@@ -917,6 +919,8 @@
 		conf.GetKeyValueInt("DiffingUploadSizeThreshold");
 	params.mMaxFileTimeInFuture = 
 		SecondsToBoxTime(conf.GetKeyValueInt("MaxFileTimeInFuture"));
+	mNumFilesUploaded = 0;
+	mNumDirsCreated = 0;
 
 	if(conf.KeyExists("MaxUploadRate"))
 	{
@@ -1631,7 +1635,9 @@
 			<< ", bytes already on server "
 			<< BackupStoreFile::msStats.mBytesAlreadyOnServer
 			<< ", encoded size "
-			<< BackupStoreFile::msStats.mTotalFileStreamSize);
+			<< BackupStoreFile::msStats.mTotalFileStreamSize
+			<< ", " << mNumFilesUploaded << " files uploaded, "
+			<< mNumDirsCreated << " dirs created");
 
 		// Reset statistics again
 		BackupStoreFile::ResetStats();

Modified: box/trunk/bin/bbackupd/BackupDaemon.h
===================================================================
--- box/trunk/bin/bbackupd/BackupDaemon.h	2011-08-27 09:46:14 UTC (rev 2980)
+++ box/trunk/bin/bbackupd/BackupDaemon.h	2011-08-27 13:41:36 UTC (rev 2981)
@@ -235,6 +235,7 @@
 	TLSContext mTlsContext;
 	bool mDeleteStoreObjectInfoFile;
 	bool mDoSyncForcedByPreviousSyncError;
+	int64_t mNumFilesUploaded, mNumDirsCreated;
 
 public:
  	bool StopRun() { return this->Daemon::StopRun(); }
@@ -477,7 +478,8 @@
 			BOX_NOTICE("Uploaded file: " << rLocalPath << ", "
 				"total size = " << FileSize << ", "
 				"uploaded size = " << UploadedSize);
-		} 
+		}
+		mNumFilesUploaded++;
 	}
  	virtual void NotifyFileSynchronised(
  		const BackupClientDirectoryRecord* pDirRecord,
@@ -489,6 +491,19 @@
 			BOX_INFO("Synchronised file: " << rLocalPath);
 		} 
 	}
+	virtual void NotifyDirectoryCreated(
+		int64_t ObjectID,
+		const std::string& rLocalPath,
+		const std::string& rRemotePath)
+	{
+		if (mLogAllFileAccess)
+		{
+			BOX_NOTICE("Created directory: " << rRemotePath << 
+				" (ID " << BOX_FORMAT_OBJECTID(ObjectID) <<
+				")");
+		}
+		mNumDirsCreated++;
+	}
 	virtual void NotifyDirectoryDeleted(
 		int64_t ObjectID,
 		const std::string& rRemotePath)

Modified: box/trunk/bin/bbackupd/BackupDaemonInterface.h
===================================================================
--- box/trunk/bin/bbackupd/BackupDaemonInterface.h	2011-08-27 09:46:14 UTC (rev 2980)
+++ box/trunk/bin/bbackupd/BackupDaemonInterface.h	2011-08-27 13:41:36 UTC (rev 2981)
@@ -134,6 +134,10 @@
 		const BackupClientDirectoryRecord* pDirRecord,
 		const std::string& rLocalPath,
 		int64_t FileSize) = 0;
+	virtual void NotifyDirectoryCreated(
+		int64_t ObjectID,
+		const std::string& rLocalPath,
+		const std::string& rRemotePath) = 0;
 	virtual void NotifyDirectoryDeleted(
 		int64_t ObjectID,
 		const std::string& rRemotePath) = 0;




More information about the Boxbackup-commit mailing list