summaryrefslogtreecommitdiff
path: root/src/buildtool/main/main.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-15 10:19:16 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-19 09:50:37 +0200
commita5f048e3b2504959994cc9545a70fde01b70d99a (patch)
tree42ef3e92abdba766e4c56ed8e0dbfff37de22416 /src/buildtool/main/main.cpp
parent1acde5fa1f37b8e4856f96aba092a38faaac737f (diff)
downloadjustbuild-a5f048e3b2504959994cc9545a70fde01b70d99a.tar.gz
Make OperationCache a general class, not singleton
As it is used by just execute only, instantiate it inside the ExecutionServer, which reads and writes to the cache map, and pass a const ref to OperationsServer, which only queries.
Diffstat (limited to 'src/buildtool/main/main.cpp')
-rw-r--r--src/buildtool/main/main.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index ffff2985..5e9ff7b8 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -71,7 +71,6 @@
#include "fmt/core.h"
#include "src/buildtool/auth/authentication.hpp"
#include "src/buildtool/execution_api/common/api_bundle.hpp"
-#include "src/buildtool/execution_api/execution_service/operation_cache.hpp"
#include "src/buildtool/execution_api/execution_service/server_implementation.hpp"
#include "src/buildtool/execution_api/remote/config.hpp"
#include "src/buildtool/graph_traverser/graph_traverser.hpp"
@@ -254,9 +253,6 @@ void SetupExecutionServiceConfig(ServiceArguments const& args) {
std::exit(kExitFailure);
}
}
- if (args.op_exponent) {
- OperationCache::SetExponent(*args.op_exponent);
- }
}
void SetupHashFunction() {
@@ -844,8 +840,10 @@ auto main(int argc, char* argv[]) -> int {
/*repo_config=*/nullptr,
&*auth_config,
&remote_exec_config};
- if (not ServerImpl::Instance().Run(
- *storage_config, storage, exec_apis)) {
+ if (not ServerImpl::Instance().Run(*storage_config,
+ storage,
+ exec_apis,
+ arguments.service.op_exponent)) {
return kExitFailure;
}
return kExitSuccess;
@@ -892,14 +890,20 @@ auto main(int argc, char* argv[]) -> int {
&*remote_exec_config};
auto serve =
ServeApi::Create(*serve_config, &storage, &serve_apis);
+
bool with_execute =
not remote_exec_config->remote_address.has_value();
+ // Operation cache only relevant for just execute
+ auto const op_exponent =
+ with_execute ? arguments.service.op_exponent : std::nullopt;
+
return serve_server->Run(*serve_config,
*storage_config,
storage,
*local_exec_config,
serve,
serve_apis,
+ op_exponent,
with_execute)
? kExitSuccess
: kExitFailure;