summaryrefslogtreecommitdiff
path: root/src/buildtool/serve_api/remote
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/serve_api/remote')
-rw-r--r--src/buildtool/serve_api/remote/TARGETS2
-rw-r--r--src/buildtool/serve_api/remote/config.hpp20
2 files changed, 19 insertions, 3 deletions
diff --git a/src/buildtool/serve_api/remote/TARGETS b/src/buildtool/serve_api/remote/TARGETS
index 71f82b82..45114f57 100644
--- a/src/buildtool/serve_api/remote/TARGETS
+++ b/src/buildtool/serve_api/remote/TARGETS
@@ -2,7 +2,7 @@
{ "type": ["@", "rules", "CC", "library"]
, "name": ["config"]
, "hdrs": ["config.hpp"]
- , "deps": [["src/buildtool/execution_api/remote", "config"]]
+ , "deps": [["src/buildtool/common/remote", "remote_common"]]
, "stage": ["src", "buildtool", "serve_api", "remote"]
}
, "serve_target_level_cache_client":
diff --git a/src/buildtool/serve_api/remote/config.hpp b/src/buildtool/serve_api/remote/config.hpp
index dac7fabf..6ea927cb 100644
--- a/src/buildtool/serve_api/remote/config.hpp
+++ b/src/buildtool/serve_api/remote/config.hpp
@@ -16,9 +16,9 @@
#include <iterator>
#include <vector>
-#include "src/buildtool/execution_api/remote/config.hpp"
+#include "src/buildtool/common/remote/remote_common.hpp"
-class RemoteServeConfig : public RemoteExecutionConfig {
+class RemoteServeConfig {
public:
// Obtain global instance
[[nodiscard]] static auto Instance() noexcept -> RemoteServeConfig& {
@@ -26,6 +26,13 @@ class RemoteServeConfig : public RemoteExecutionConfig {
return config;
}
+ // Set remote execution and cache address, unsets if parsing `address` fails
+ [[nodiscard]] static auto SetRemoteAddress(
+ std::string const& address) noexcept -> bool {
+ auto& inst = Instance();
+ return static_cast<bool>(inst.remote_address_ = ParseAddress(address));
+ }
+
// Set the list of known repositories
[[nodiscard]] static auto SetKnownRepositories(
std::vector<std::filesystem::path> const& repos) noexcept -> bool {
@@ -36,6 +43,12 @@ class RemoteServeConfig : public RemoteExecutionConfig {
return repos.size() == inst.repositories_.size();
}
+ // Remote execution address, if set
+ [[nodiscard]] static auto RemoteAddress() noexcept
+ -> std::optional<ServerAddress> {
+ return Instance().remote_address_;
+ }
+
// Repositories known to 'just serve'
[[nodiscard]] static auto KnownRepositories() noexcept
-> const std::vector<std::filesystem::path>& {
@@ -43,6 +56,9 @@ class RemoteServeConfig : public RemoteExecutionConfig {
}
private:
+ // Server address of remote execution.
+ std::optional<ServerAddress> remote_address_{};
+
// Known Git repositories to serve server.
std::vector<std::filesystem::path> repositories_{};
};