[Box Backup-commit] COMMIT r3312 - in box/trunk: lib/backupstore test/backupstore

subversion at boxbackup.org subversion at boxbackup.org
Wed Apr 9 23:15:08 BST 2014


Author: chris
Date: 2014-04-09 23:15:08 +0100 (Wed, 09 Apr 2014)
New Revision: 3312

Modified:
   box/trunk/lib/backupstore/BackupProtocol.h
   box/trunk/test/backupstore/testbackupstore.cpp
Log:
Add a Reopen method to BackupProtocolLocal2 for convenience.

Modified: box/trunk/lib/backupstore/BackupProtocol.h
===================================================================
--- box/trunk/lib/backupstore/BackupProtocol.h	2014-04-09 22:15:04 UTC (rev 3311)
+++ box/trunk/lib/backupstore/BackupProtocol.h	2014-04-09 22:15:08 UTC (rev 3312)
@@ -26,6 +26,8 @@
 {
 private:
 	BackupStoreContext mContext;
+	int32_t mAccountNumber;
+	bool mReadOnly;
 
 public:
 	BackupProtocolLocal2(int32_t AccountNumber,
@@ -36,7 +38,9 @@
 	// touch the Context, because it's not initialised yet!
 	: BackupProtocolLocal(mContext),
 	  mContext(AccountNumber, (HousekeepingInterface *)NULL,
-		ConnectionDetails)
+		ConnectionDetails),
+	  mAccountNumber(AccountNumber),
+	  mReadOnly(ReadOnly)
 	{
 		mContext.SetClientHasAccount(AccountRootDir, DiscSetNumber);
 		QueryVersion(BACKUP_STORE_SERVER_VERSION);
@@ -52,6 +56,13 @@
 		mContext.ReleaseWriteLock();
 		return finished;
 	}
+
+	void Reopen()
+	{
+		QueryVersion(BACKUP_STORE_SERVER_VERSION);
+		QueryLogin(mAccountNumber,
+			mReadOnly ? BackupProtocolLogin::Flags_ReadOnly : 0);
+	}
 };
 
 #endif // BACKUPPROTOCOL__H

Modified: box/trunk/test/backupstore/testbackupstore.cpp
===================================================================
--- box/trunk/test/backupstore/testbackupstore.cpp	2014-04-09 22:15:04 UTC (rev 3311)
+++ box/trunk/test/backupstore/testbackupstore.cpp	2014-04-09 22:15:08 UTC (rev 3312)
@@ -991,8 +991,7 @@
 	// Housekeeping should not change anything just yet
 	protocol.QueryFinished();
 	TEST_THAT(run_housekeeping_and_check_account());
-	protocol.QueryVersion(BACKUP_STORE_SERVER_VERSION);
-	protocol.QueryLogin(0x01234567, 0);
+	protocol.Reopen();
 
 	TEST_THAT(check_num_files(1, 2, 0, 1));
 	TEST_THAT(check_num_blocks(protocol, file1_blocks, patch1_blocks + patch2_blocks, 0,
@@ -1027,8 +1026,7 @@
 	// Housekeeping should not change anything just yet
 	protocol.QueryFinished();
 	TEST_THAT(run_housekeeping_and_check_account());
-	protocol.QueryVersion(BACKUP_STORE_SERVER_VERSION);
-	protocol.QueryLogin(0x01234567, 0);
+	protocol.Reopen();
 
 	TEST_THAT(check_num_files(1, 3, 0, 1));
 	TEST_THAT(check_num_blocks(protocol, replaced_blocks, // current
@@ -1044,8 +1042,7 @@
 		"14B", // replaced_blocks + file1_blocks + root_dir_blocks
 		"2000B"));
 	TEST_THAT(run_housekeeping_and_check_account());
-	protocol.QueryVersion(BACKUP_STORE_SERVER_VERSION);
-	protocol.QueryLogin(0x01234567, 0);
+	protocol.Reopen();
 
 	TEST_THAT(check_num_files(1, 1, 0, 1));
 	TEST_THAT(check_num_blocks(protocol, replaced_blocks, // current
@@ -1072,8 +1069,7 @@
 	protocol.QueryFinished();
 	TEST_THAT(change_account_limits("0B", "2000B"));
 	TEST_THAT(run_housekeeping_and_check_account());
-	protocol.QueryVersion(BACKUP_STORE_SERVER_VERSION);
-	protocol.QueryLogin(0x01234567, 0);
+	protocol.Reopen();
 
 	TEST_THAT(check_num_files(0, 0, 0, 1));
 	TEST_THAT(check_num_blocks(protocol, 0, 0, 0, root_dir_blocks, root_dir_blocks));




More information about the Boxbackup-commit mailing list