From 9ef2ffa9acdc19453c81696aa2ed4da7cb84078c Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Thu, 21 Sep 2023 18:19:58 +0200 Subject: RemoteServeConfig: Remove problematic inheritance This was causing the remote serve address to overwrite the one set for remote execution. Also, to keep things clean, some common remote server-related methods and definitions were moved into their own library. --- src/buildtool/execution_api/remote/config.hpp | 45 +-------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) (limited to 'src/buildtool/execution_api/remote/config.hpp') diff --git a/src/buildtool/execution_api/remote/config.hpp b/src/buildtool/execution_api/remote/config.hpp index e7ad3a57..bad729ab 100644 --- a/src/buildtool/execution_api/remote/config.hpp +++ b/src/buildtool/execution_api/remote/config.hpp @@ -19,29 +19,15 @@ #include #include #include -#include #include #include #include #include -#include -#include - -#include "src/buildtool/common/remote/port.hpp" +#include "src/buildtool/common/remote/remote_common.hpp" class RemoteExecutionConfig { public: - struct ServerAddress { - std::string host{}; - Port port{}; - - [[nodiscard]] auto ToJson() const noexcept -> nlohmann::json { - return nlohmann::json{ - fmt::format("{}:{}", host, static_cast(port))}; - } - }; - // Obtain global instance [[nodiscard]] static auto Instance() noexcept -> RemoteExecutionConfig& { static RemoteExecutionConfig config; @@ -114,35 +100,6 @@ class RemoteExecutionConfig { // Platform properties for execution. std::map platform_properties_{}; - - [[nodiscard]] static auto ParseAddress(std::string const& address) noexcept - -> std::optional { - std::istringstream iss(address); - std::string host; - std::string port; - if (not std::getline(iss, host, ':') or - not std::getline(iss, port, ':')) { - return std::nullopt; - } - auto port_num = ParsePort(port); - if (not host.empty() and port_num) { - return ServerAddress{std::move(host), *port_num}; - } - return std::nullopt; - } - - [[nodiscard]] static auto ParseProperty( - std::string const& property) noexcept - -> std::optional> { - std::istringstream pss(property); - std::string key; - std::string val; - if (not std::getline(pss, key, ':') or - not std::getline(pss, val, ':')) { - return std::nullopt; - } - return std::make_pair(key, val); - } }; #endif // INCLUDED_SRC_BUILDTOOL_EXECUTION_API_REMOTE_CONFIG_HPP -- cgit v1.2.3