diff options
Diffstat (limited to 'lib/backupstore')
-rw-r--r-- | lib/backupstore/BackupCommands.cpp | 46 | ||||
-rw-r--r-- | lib/backupstore/backupprotocol.txt | 22 |
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 + |