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

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Thu Aug 31 09:01:44 BST 2006


Author: chris
Date: 2006-08-31 09:01:43 +0100 (Thu, 31 Aug 2006)
New Revision: 840

Modified:
   box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp
Log:
* bin/bbackupd/BackupClientDirectoryRecord.cpp
- Sync subdirectories even when store is full, allows user to exclude
  files to free up space to complete their backups


Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp
===================================================================
--- box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp	2006-08-30 19:51:59 UTC (rev 839)
+++ box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp	2006-08-31 08:01:43 UTC (rev 840)
@@ -922,11 +922,15 @@
 			// In the list, just use this pointer
 			psubDirRecord = e->second;
 		}
-		else if(!rParams.mrContext.StorageLimitExceeded())	// know we've got a connection if we get this far, as dir will have been modified.
+		else 
 		{
-			// Note: only think about adding directory records if there's space left on the server.
-			// If there isn't, this step will be repeated when there is some available.
-		
+			// Note: if we have exceeded our storage limit, then
+			// we should not upload any more data, nor create any
+			// DirectoryRecord representing data that would have
+			// been uploaded. This step will be repeated when 
+			// there is some space available.
+			bool doCreateDirectoryRecord = true;
+			
 			// Need to create the record. But do we need to create the directory on the server?
 			int64_t subDirObjectID = 0;
 			if(en != 0)
@@ -934,6 +938,12 @@
 				// No. Exists on the server, and we know about it from the listing.
 				subDirObjectID = en->GetObjectID();
 			}
+			else if(rParams.mrContext.StorageLimitExceeded())	
+			// know we've got a connection if we get this far,
+			// as dir will have been modified.
+			{
+				doCreateDirectoryRecord = false;
+			}				
 			else
 			{
 				// Yes, creation required!
@@ -1016,21 +1026,24 @@
 					haveJustCreatedDirOnServer = true;
 				}
 			}
-			
-			// New an object for this
-			psubDirRecord = new BackupClientDirectoryRecord(subDirObjectID, *d);
-			
-			// Store in list
-			try
-			{
-				mSubDirectories[*d] = psubDirRecord;
+
+			if (doCreateDirectoryRecord)
+			{				
+				// New an object for this
+				psubDirRecord = new BackupClientDirectoryRecord(subDirObjectID, *d);
+				
+				// Store in list
+				try
+				{
+					mSubDirectories[*d] = psubDirRecord;
+				}
+				catch(...)
+				{
+					delete psubDirRecord;
+					psubDirRecord = 0;
+					throw;
+				}
 			}
-			catch(...)
-			{
-				delete psubDirRecord;
-				psubDirRecord = 0;
-				throw;
-			}
 		}
 		
 		ASSERT(psubDirRecord != 0 || rParams.mrContext.StorageLimitExceeded());




More information about the Boxbackup-dev mailing list