Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3361255
D5429.id18104.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D5429.id18104.diff
View Options
diff --git a/services/tunnelbroker/src/libcpp/Tunnelbroker.h b/services/tunnelbroker/src/libcpp/Tunnelbroker.h
new file mode 100644
--- /dev/null
+++ b/services/tunnelbroker/src/libcpp/Tunnelbroker.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#include "rust/cxx.h"
+
+void initialize();
diff --git a/services/tunnelbroker/src/libcpp/Tunnelbroker.cpp b/services/tunnelbroker/src/libcpp/Tunnelbroker.cpp
new file mode 100644
--- /dev/null
+++ b/services/tunnelbroker/src/libcpp/Tunnelbroker.cpp
@@ -0,0 +1,37 @@
+#include "Tunnelbroker.h"
+#include "AmqpManager.h"
+#include "AwsTools.h"
+#include "ConfigManager.h"
+#include "DatabaseManager.h"
+#include "GlobalTools.h"
+#include "Tools.h"
+
+#include "rust/cxx.h"
+
+void initialize() {
+ comm::network::tools::InitLogging("tunnelbroker");
+ comm::network::config::ConfigManager::getInstance().load();
+ Aws::InitAPI({});
+ // List of AWS DynamoDB tables to check if they are created and can be
+ // accessed before any AWS API methods
+ const std::list<std::string> tablesList = {
+ comm::network::config::ConfigManager::getInstance().getParameter(
+ comm::network::config::ConfigManager::OPTION_DYNAMODB_SESSIONS_TABLE),
+ comm::network::config::ConfigManager::getInstance().getParameter(
+ comm::network::config::ConfigManager::
+ OPTION_DYNAMODB_SESSIONS_VERIFICATION_TABLE),
+ comm::network::config::ConfigManager::getInstance().getParameter(
+ comm::network::config::ConfigManager::
+ OPTION_DYNAMODB_SESSIONS_PUBLIC_KEY_TABLE),
+ comm::network::config::ConfigManager::getInstance().getParameter(
+ comm::network::config::ConfigManager::
+ OPTION_DYNAMODB_MESSAGES_TABLE)};
+ for (const std::string &table : tablesList) {
+ if (!comm::network::database::DatabaseManager::getInstance()
+ .isTableAvailable(table)) {
+ throw std::runtime_error(
+ "Error: AWS DynamoDB table '" + table + "' is not available");
+ }
+ };
+ comm::network::AmqpManager::getInstance().init();
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 3:57 PM (20 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2579903
Default Alt Text
D5429.id18104.diff (2 KB)
Attached To
Mode
D5429: [services] Tunnelbroker - Initialization function exposed to Rust
Attached
Detach File
Event Timeline
Log In to Comment