summaryrefslogtreecommitdiff
path: root/lib/backupstore
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-02-07 15:44:21 +0000
committerChris Wilson <chris+github@qwirx.com>2014-02-07 15:44:21 +0000
commit73d445e34b419d395935babbea9a75d1621a125a (patch)
tree247329d8b1ac27e70a3e32e65820586eef2c3b5f /lib/backupstore
parent3909553d3309ebbbbcdfb2c5f5ad1dab7b846eee (diff)
Add a BackupProtocolLocal2 convenience class.
Adds a nicer constructor and more helpful cleanup on QueryFinished() to the auto-generated BackupProtocolLocal.
Diffstat (limited to 'lib/backupstore')
-rw-r--r--lib/backupstore/BackupProtocol.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/lib/backupstore/BackupProtocol.h b/lib/backupstore/BackupProtocol.h
new file mode 100644
index 00000000..d2fe8b7f
--- /dev/null
+++ b/lib/backupstore/BackupProtocol.h
@@ -0,0 +1,57 @@
+// --------------------------------------------------------------------------
+//
+// File
+// Name: BackupProtocol.h
+// Purpose: A thin wrapper around autogen_BackupProtocol.h
+// Created: 2014/01/05
+//
+// --------------------------------------------------------------------------
+
+#ifndef BACKUPPROTOCOL__H
+#define BACKUPPROTOCOL__H
+
+#include <autogen_BackupProtocol.h>
+#include <BackupStoreConstants.h>
+#include <BackupStoreContext.h>
+
+// --------------------------------------------------------------------------
+//
+// Class
+// Name: BackupProtocolLocal2
+// Purpose: BackupProtocolLocal with a few more IQ points
+// Created: 2003/08/21
+//
+// --------------------------------------------------------------------------
+class BackupProtocolLocal2 : public BackupProtocolLocal
+{
+private:
+ BackupStoreContext mContext;
+
+public:
+ BackupProtocolLocal2(int32_t AccountNumber,
+ const std::string& ConnectionDetails,
+ const std::string& AccountRootDir, int DiscSetNumber,
+ bool ReadOnly)
+ // This is rather ugly: the BackupProtocolLocal constructor must not
+ // touch the Context, because it's not initialised yet!
+ : BackupProtocolLocal(mContext),
+ mContext(AccountNumber, *(HousekeepingInterface *)NULL,
+ ConnectionDetails)
+ {
+ mContext.SetClientHasAccount(AccountRootDir, DiscSetNumber);
+ QueryVersion(BACKUP_STORE_SERVER_VERSION);
+ QueryLogin(0x01234567,
+ ReadOnly ? BackupProtocolLogin::Flags_ReadOnly : 0);
+ }
+ virtual ~BackupProtocolLocal2() { }
+
+ std::auto_ptr<BackupProtocolFinished> Query(const BackupProtocolFinished &rQuery)
+ {
+ std::auto_ptr<BackupProtocolFinished> finished =
+ BackupProtocolLocal::Query(rQuery);
+ mContext.ReleaseWriteLock();
+ return finished;
+ }
+};
+
+#endif // BACKUPPROTOCOL__H