summaryrefslogtreecommitdiff
path: root/lib/backupstore
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-02-07 22:06:23 +0000
committerChris Wilson <chris+github@qwirx.com>2014-02-07 22:06:23 +0000
commiteb8f880803ee6577263d53c75442b55fe399a8a6 (patch)
tree95c291b08080b1d3bde79c0813568b40e2df902a /lib/backupstore
parentbcee6057f946d5fc70e7ef93d1bed6bbcdb23fcf (diff)
Add an AccountUsage2 command to backup protocol.
Allows us to get information about the account that's not available using the old AccountUsage command. Currently only used in tests.
Diffstat (limited to 'lib/backupstore')
-rw-r--r--lib/backupstore/BackupCommands.cpp46
-rw-r--r--lib/backupstore/backupprotocol.txt22
2 files changed, 68 insertions, 0 deletions
diff --git a/lib/backupstore/BackupCommands.cpp b/lib/backupstore/BackupCommands.cpp
index d2326869..471ed56a 100644
--- a/lib/backupstore/BackupCommands.cpp
+++ b/lib/backupstore/BackupCommands.cpp
@@ -953,3 +953,49 @@ std::auto_ptr<BackupProtocolMessage> BackupProtocolGetIsAlive::DoCommand(BackupP
//
return std::auto_ptr<BackupProtocolMessage>(new BackupProtocolIsAlive());
}
+
+// --------------------------------------------------------------------------
+//
+// Function
+// Name: BackupProtocolGetAccountUsage2::DoCommand(BackupProtocolReplyable &, BackupStoreContext &)
+// Purpose: Return the amount of disc space used
+// Created: 26/12/13
+//
+// --------------------------------------------------------------------------
+std::auto_ptr<BackupProtocolMessage> BackupProtocolGetAccountUsage2::DoCommand(
+ BackupProtocolReplyable &rProtocol, BackupStoreContext &rContext) const
+{
+ CHECK_PHASE(Phase_Commands)
+
+ // Get store info from context
+ const BackupStoreInfo &info(rContext.GetBackupStoreInfo());
+
+ // Find block size
+ RaidFileController &rcontroller(RaidFileController::GetController());
+ RaidFileDiscSet &rdiscSet(rcontroller.GetDiscSet(info.GetDiscSetNumber()));
+
+ // Return info
+ BackupProtocolAccountUsage2* usage = new BackupProtocolAccountUsage2();
+ std::auto_ptr<BackupProtocolMessage> reply(usage);
+ #define COPY(name) usage->Set ## name (info.Get ## name ())
+ COPY(AccountName);
+ usage->SetAccountEnabled(info.IsAccountEnabled());
+ COPY(ClientStoreMarker);
+ usage->SetBlockSize(rdiscSet.GetBlockSize());
+ COPY(LastObjectIDUsed);
+ COPY(BlocksUsed);
+ COPY(BlocksInCurrentFiles);
+ COPY(BlocksInOldFiles);
+ COPY(BlocksInDeletedFiles);
+ COPY(BlocksInDirectories);
+ COPY(BlocksSoftLimit);
+ COPY(BlocksHardLimit);
+ COPY(NumCurrentFiles);
+ COPY(NumOldFiles);
+ COPY(NumDeletedFiles);
+ COPY(NumDirectories);
+ #undef COPY
+
+ return reply;
+}
+
diff --git a/lib/backupstore/backupprotocol.txt b/lib/backupstore/backupprotocol.txt
index aa987e70..24dd2e44 100644
--- a/lib/backupstore/backupprotocol.txt
+++ b/lib/backupstore/backupprotocol.txt
@@ -7,6 +7,7 @@ IdentString Box-Backup:v=C
ServerContextClass BackupStoreContext BackupStoreContext.h
AddType Filename BackupStoreFilenameClear BackupStoreFilenameClear.h
+AddType String std::string
ImplementLog Server syslog
ImplementLog Client syslog
@@ -233,3 +234,24 @@ GetIsAlive 42 Command(IsAlive)
IsAlive 43 Reply
# no data members
+GetAccountUsage2 44 Command(AccountUsage2)
+ # no data members
+
+AccountUsage2 45 Reply
+ String AccountName
+ bool AccountEnabled
+ int64 ClientStoreMarker
+ int32 BlockSize
+ int64 LastObjectIDUsed
+ int64 BlocksUsed
+ int64 BlocksInCurrentFiles
+ int64 BlocksInOldFiles
+ int64 BlocksInDeletedFiles
+ int64 BlocksInDirectories
+ int64 BlocksSoftLimit
+ int64 BlocksHardLimit
+ int64 NumCurrentFiles
+ int64 NumOldFiles
+ int64 NumDeletedFiles
+ int64 NumDirectories
+