Browse Source

use the CV2 db instance if the path prefix is cv2://

Grant Limberg 4 months ago
parent
commit
1d2130610c
3 changed files with 9 additions and 7 deletions
  1. 3 3
      controller/CV1.hpp
  2. 3 3
      controller/CV2.hpp
  3. 3 1
      controller/EmbeddedNetworkController.cpp

+ 3 - 3
controller/CV1.hpp

@@ -15,8 +15,8 @@
 
 #ifdef ZT_CONTROLLER_USE_LIBPQ
 
-#ifndef ZT_CONTROLLER_LIBPQ_HPP
-#define ZT_CONTROLLER_LIBPQ_HPP
+#ifndef ZT_CONTROLLER_CV1_HPP
+#define ZT_CONTROLLER_CV1_HPP
 
 #define ZT_CENTRAL_CONTROLLER_COMMIT_THREADS 4
 
@@ -138,6 +138,6 @@ private:
 
 } // namespace ZeroTier
 
-#endif // ZT_CONTROLLER_LIBPQ_HPP
+#endif // ZT_CONTROLLER_CV1_HPP
 
 #endif // ZT_CONTROLLER_USE_LIBPQ

+ 3 - 3
controller/CV2.hpp

@@ -15,8 +15,8 @@
 
 #ifdef ZT_CONTROLLER_USE_LIBPQ
 
-#ifndef ZT_CONTROLLER_LIBPQ_HPP
-#define ZT_CONTROLLER_LIBPQ_HPP
+#ifndef ZT_CONTROLLER_CV2_HPP
+#define ZT_CONTROLLER_CV2_HPP
 
 #define ZT_CENTRAL_CONTROLLER_COMMIT_THREADS 4
 
@@ -108,5 +108,5 @@ private:
 
 } // namespace Zerotier
 
-#endif // ZT_CONTROLLER_LIBPQ_HPP
+#endif // ZT_CONTROLLER_CV2_HPP
 #endif // ZT_CONTROLLER_USE_LIBPQ

+ 3 - 1
controller/EmbeddedNetworkController.cpp

@@ -40,8 +40,8 @@
 #include "LFDB.hpp"
 #include "FileDB.hpp"
 #ifdef ZT_CONTROLLER_USE_LIBPQ
-#include "PostgreSQL.hpp"
 #include "CV1.hpp"
+#include "CV2.hpp"
 #endif
 
 #include "../node/Node.hpp"
@@ -536,6 +536,8 @@ void EmbeddedNetworkController::init(const Identity &signingId,Sender *sender)
 #ifdef ZT_CONTROLLER_USE_LIBPQ
 	if ((_path.length() > 9)&&(_path.substr(0,9) == "postgres:")) {
 		_db.addDB(std::shared_ptr<DB>(new CV1(_signingId,_path.substr(9).c_str(), _listenPort, _rc)));
+	} else if ((_path.length() > 3)&&(_path.substr(0,3) == "cv2:")) {
+		_db.addDB(std::shared_ptr<DB>(new CV2(_signingId,_path.c_str(),_listenPort)));
 	} else {
 #endif
 		_db.addDB(std::shared_ptr<DB>(new FileDB(_path.c_str())));