summaryrefslogtreecommitdiff
path: root/controller/SqliteNetworkController.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-11-03 15:52:10 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-11-03 15:52:10 -0800
commit7903f24a8fbe8e45a4cd242efdf1ca64c0356d43 (patch)
tree86bb1242299ca74e13023c9a99fe5fe6d89d2acf /controller/SqliteNetworkController.hpp
parent4b655ab22c1209ebdab5cee909bd01c244a84e2d (diff)
downloadinfinitytier-7903f24a8fbe8e45a4cd242efdf1ca64c0356d43.tar.gz
infinitytier-7903f24a8fbe8e45a4cd242efdf1ca64c0356d43.zip
Create periodic backup copies of controller.db in network controller from the main process itself to facilitate easier and safer backups of controller.db.
Diffstat (limited to 'controller/SqliteNetworkController.hpp')
-rw-r--r--controller/SqliteNetworkController.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/controller/SqliteNetworkController.hpp b/controller/SqliteNetworkController.hpp
index a3d5dfc7..0e2bb63e 100644
--- a/controller/SqliteNetworkController.hpp
+++ b/controller/SqliteNetworkController.hpp
@@ -39,6 +39,7 @@
#include "../node/Constants.hpp"
#include "../node/NetworkController.hpp"
#include "../node/Mutex.hpp"
+#include "../osdep/Thread.hpp"
// Number of in-memory last log entries to maintain per user
#define ZT_SQLITENETWORKCONTROLLER_IN_MEMORY_LOG_SIZE 32
@@ -86,6 +87,10 @@ public:
std::string &responseBody,
std::string &responseContentType);
+ // threadMain() for backup thread -- do not call directly
+ void threadMain()
+ throw();
+
private:
enum IpAssignmentType {
// IP assignment is a static IP address
@@ -112,6 +117,8 @@ private:
static void _circuitTestCallback(ZT_Node *node,ZT_CircuitTest *test,const ZT_CircuitTestReport *report);
Node *_node;
+ Thread _backupThread;
+ volatile bool _backupThreadRun;
std::string _dbPath;
std::string _circuitTestPath;
std::string _instanceId;