summaryrefslogtreecommitdiff
path: root/src/buildtool/serve_api/remote/config.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/serve_api/remote/config.hpp')
-rw-r--r--src/buildtool/serve_api/remote/config.hpp20
1 files changed, 18 insertions, 2 deletions
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_{};
};