summaryrefslogtreecommitdiff
path: root/src/buildtool/serve_api
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/serve_api')
-rw-r--r--src/buildtool/serve_api/remote/TARGETS5
-rw-r--r--src/buildtool/serve_api/remote/config.hpp14
-rw-r--r--src/buildtool/serve_api/serve_service/target.cpp3
3 files changed, 20 insertions, 2 deletions
diff --git a/src/buildtool/serve_api/remote/TARGETS b/src/buildtool/serve_api/remote/TARGETS
index f77fac04..8b64aee7 100644
--- a/src/buildtool/serve_api/remote/TARGETS
+++ b/src/buildtool/serve_api/remote/TARGETS
@@ -2,7 +2,10 @@
{ "type": ["@", "rules", "CC", "library"]
, "name": ["config"]
, "hdrs": ["config.hpp"]
- , "deps": [["src/buildtool/common/remote", "remote_common"]]
+ , "deps":
+ [ ["src/buildtool/common/remote", "remote_common"]
+ , ["src/buildtool/main", "build_utils"]
+ ]
, "stage": ["src", "buildtool", "serve_api", "remote"]
}
, "source_tree_client":
diff --git a/src/buildtool/serve_api/remote/config.hpp b/src/buildtool/serve_api/remote/config.hpp
index 94f00f8e..8978565b 100644
--- a/src/buildtool/serve_api/remote/config.hpp
+++ b/src/buildtool/serve_api/remote/config.hpp
@@ -21,6 +21,7 @@
#include <vector>
#include "src/buildtool/common/remote/remote_common.hpp"
+#include "src/buildtool/main/build_utils.hpp"
class RemoteServeConfig {
public:
@@ -65,6 +66,10 @@ class RemoteServeConfig {
return Instance().timeout_ > std::chrono::seconds{0};
}
+ static void SetTCStrategy(TargetCacheWriteStrategy strategy) noexcept {
+ Instance().tc_strategy_ = strategy;
+ }
+
// Remote execution address, if set
[[nodiscard]] static auto RemoteAddress() noexcept
-> std::optional<ServerAddress> {
@@ -93,6 +98,12 @@ class RemoteServeConfig {
return Instance().timeout_;
}
+ // Get the target-level cache write strategy
+ [[nodiscard]] static auto TCStrategy() noexcept
+ -> TargetCacheWriteStrategy {
+ return Instance().tc_strategy_;
+ }
+
private:
// Server address of remote execution.
std::optional<ServerAddress> remote_address_{};
@@ -108,6 +119,9 @@ class RemoteServeConfig {
// Action timeout
std::chrono::milliseconds timeout_{};
+
+ // Strategy for synchronizing target-level cache
+ TargetCacheWriteStrategy tc_strategy_{TargetCacheWriteStrategy::Sync};
};
#endif // INCLUDED_SRC_BUILDTOOL_SERVE_API_REMOTE_CONFIG_HPP
diff --git a/src/buildtool/serve_api/serve_service/target.cpp b/src/buildtool/serve_api/serve_service/target.cpp
index 8e097397..f36d60a9 100644
--- a/src/buildtool/serve_api/serve_service/target.cpp
+++ b/src/buildtool/serve_api/serve_service/target.cpp
@@ -541,7 +541,8 @@ auto TargetService::ServeTarget(
build_result->extra_infos,
jobs,
traverser.GetLocalApi(),
- traverser.GetRemoteApi());
+ traverser.GetRemoteApi(),
+ RemoteServeConfig::TCStrategy());
if (build_result->failed_artifacts) {
auto msg =