summaryrefslogtreecommitdiff
path: root/lib/backupstore/BackupStoreAccounts.h
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-02-07 15:44:07 +0000
committerChris Wilson <chris+github@qwirx.com>2014-02-07 15:44:07 +0000
commite370cf08364620cac777affb07088b59260025b2 (patch)
treea408fc0f8bb5b7313316707e6e8fa984a7219637 /lib/backupstore/BackupStoreAccounts.h
parent40b353bbe608ba440287650d6c276887e1e7c2f0 (diff)
Split bbstoreaccounts commands out into a separate class.
Allows us to call them from tests without shelling out, making debugging easier.
Diffstat (limited to 'lib/backupstore/BackupStoreAccounts.h')
-rw-r--r--lib/backupstore/BackupStoreAccounts.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/backupstore/BackupStoreAccounts.h b/lib/backupstore/BackupStoreAccounts.h
index 3163f15c..5ee67312 100644
--- a/lib/backupstore/BackupStoreAccounts.h
+++ b/lib/backupstore/BackupStoreAccounts.h
@@ -51,5 +51,39 @@ private:
BackupStoreAccountDatabase &mrDatabase;
};
+class Configuration;
+class UnixUser;
+
+class BackupStoreAccountsControl
+{
+private:
+ const Configuration& mConfig;
+ bool mMachineReadableOutput;
+
+public:
+ BackupStoreAccountsControl(const Configuration& config,
+ bool machineReadableOutput = false);
+
+ void CheckSoftHardLimits(int64_t SoftLimit, int64_t HardLimit);
+ int BlockSizeOfDiscSet(int discSetNum);
+ std::string BlockSizeToString(int64_t Blocks, int64_t MaxBlocks, int discSetNum);
+ int64_t SizeStringToBlocks(const char *string, int discSetNum);
+ bool OpenAccount(int32_t ID, std::string &rRootDirOut,
+ int &rDiscSetOut, std::auto_ptr<UnixUser> apUser, NamedLock* pLock);
+ int SetLimit(int32_t ID, const char *SoftLimitStr,
+ const char *HardLimitStr);
+ int SetAccountName(int32_t ID, const std::string& rNewAccountName);
+ int PrintAccountInfo(int32_t ID);
+ int SetAccountEnabled(int32_t ID, bool enabled);
+ int DeleteAccount(int32_t ID, bool AskForConfirmation);
+ int CheckAccount(int32_t ID, bool FixErrors, bool Quiet);
+ int CreateAccount(int32_t ID, int32_t DiscNumber, int32_t SoftLimit,
+ int32_t HardLimit);
+ int HousekeepAccountNow(int32_t ID);
+};
+
+// max size of soft limit as percent of hard limit
+#define MAX_SOFT_LIMIT_SIZE 97
+
#endif // BACKUPSTOREACCOUNTS__H