[Box Backup-commit] COMMIT r2160 - box/trunk/lib/backupstore

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Tue May 6 23:20:11 BST 2008


Author: chris
Date: 2008-05-06 23:20:10 +0100 (Tue, 06 May 2008)
New Revision: 2160

Modified:
   box/trunk/lib/backupstore/BackupStoreCheck2.cpp
Log:
Remove obsolete BackupStoreCheck::InsertObjectIntoDirectory class,
replaced with BackupStoreDirectoryFixer.


Modified: box/trunk/lib/backupstore/BackupStoreCheck2.cpp
===================================================================
--- box/trunk/lib/backupstore/BackupStoreCheck2.cpp	2008-05-06 21:48:52 UTC (rev 2159)
+++ box/trunk/lib/backupstore/BackupStoreCheck2.cpp	2008-05-06 22:20:10 UTC (rev 2160)
@@ -472,91 +472,6 @@
 // --------------------------------------------------------------------------
 //
 // Function
-//		Name:    BackupStoreCheck::InsertObjectIntoDirectory(int64_t, int64_t, bool)
-//		Purpose: 
-//		Created: 22/4/04
-//
-// --------------------------------------------------------------------------
-void BackupStoreCheck::InsertObjectIntoDirectory(int64_t ObjectID, int64_t DirectoryID, bool IsDirectory)
-{
-	if(!mFixErrors)
-	{
-		// Don't do anything if we're not supposed to fix errors
-		return;
-	}
-
-	// Data for the object
-	BackupStoreFilename objectStoreFilename;
-	int64_t modTime = 100;	// something which isn't zero or a special time
-	int32_t sizeInBlocks = 0; // suitable for directories
-
-	if(IsDirectory)
-	{
-		// Directory -- simply generate a name for it.
-		char name[32];
-		::sprintf(name, "dir%08x", mLostDirNameSerial++);
-		objectStoreFilename.SetAsClearFilename(name);
-	}
-	else
-	{
-		// Files require a little more work...
-		// Open file
-		std::string fileFilename;
-		StoreStructure::MakeObjectFilename(ObjectID, mStoreRoot, mDiscSetNumber, fileFilename, false /* don't make sure the dir exists */);
-		std::auto_ptr<RaidFileRead> file(RaidFileRead::Open(mDiscSetNumber, fileFilename));
-		// Fill in size information
-		sizeInBlocks = file->GetDiscUsageInBlocks();
-		// Read in header
-		file_StreamFormat hdr;
-		if(file->Read(&hdr, sizeof(hdr)) != sizeof(hdr) || (ntohl(hdr.mMagicValue) != OBJECTMAGIC_FILE_MAGIC_VALUE_V1
-#ifndef BOX_DISABLE_BACKWARDS_COMPATIBILITY_BACKUPSTOREFILE
-			&& ntohl(hdr.mMagicValue) != OBJECTMAGIC_FILE_MAGIC_VALUE_V0
-#endif		
-			))
-		{
-			// This should never happen, everything has been checked before.
-			THROW_EXCEPTION(BackupStoreException, Internal)
-		}
-		// This tells us nice things
-		modTime = box_ntoh64(hdr.mModificationTime);
-		// And the filename comes next
-		objectStoreFilename.ReadFromStream(*file, IOStream::TimeOutInfinite);
-	}
-
-	// Directory object
-	BackupStoreDirectory dir;
-
-	// Generate filename
-	std::string filename;
-	StoreStructure::MakeObjectFilename(DirectoryID, mStoreRoot, mDiscSetNumber, filename, false /* don't make sure the dir exists */);
-	
-	// Read it in
-	{
-		std::auto_ptr<RaidFileRead> file(RaidFileRead::Open(mDiscSetNumber, filename));
-		dir.ReadFromStream(*file, IOStream::TimeOutInfinite);
-	}
-	
-	// Add a new entry in an appropriate place
-	dir.AddUnattactedObject(objectStoreFilename, modTime, ObjectID, sizeInBlocks,
-		IsDirectory?(BackupStoreDirectory::Entry::Flags_Dir):(BackupStoreDirectory::Entry::Flags_File));
-
-	// Fix any flags which have been broken, which there's a good chance of doing
-	dir.CheckAndFix();
-	
-	// Write it out
-	if(mFixErrors)
-	{
-		RaidFileWrite root(mDiscSetNumber, filename);
-		root.Open(true /* allow overwriting */);
-		dir.WriteToStream(root);
-		root.Commit(true /* convert to raid now */);
-	}
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Function
 //		Name:    BackupStoreCheck::FixDirsWithWrongContainerID()
 //		Purpose: Rewrites container IDs where required
 //		Created: 22/4/04




More information about the Boxbackup-commit mailing list