summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-09-12 09:58:46 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-09-13 14:41:00 +0200
commit53893aa9c7109ab157afecc4f073a27b32d372b4 (patch)
tree30bd6b65003703bb01b50988dfd16cbe216c9ecd /src
parentdba28855e291dcb587cf1493446cae79f2528223 (diff)
downloadjustbuild-53893aa9c7109ab157afecc4f073a27b32d372b4.tar.gz
Pass HashFunction::Type to ConfigurationService
...to get the protocol type.
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/serve_api/serve_service/TARGETS5
-rw-r--r--src/buildtool/serve_api/serve_service/configuration.cpp2
-rw-r--r--src/buildtool/serve_api/serve_service/configuration.hpp5
-rw-r--r--src/buildtool/serve_api/serve_service/serve_server_implementation.cpp2
4 files changed, 10 insertions, 4 deletions
diff --git a/src/buildtool/serve_api/serve_service/TARGETS b/src/buildtool/serve_api/serve_service/TARGETS
index b9b2ca57..dea65ee0 100644
--- a/src/buildtool/serve_api/serve_service/TARGETS
+++ b/src/buildtool/serve_api/serve_service/TARGETS
@@ -137,7 +137,10 @@
, "srcs": ["configuration.cpp"]
, "proto": ["just_serve_proto"]
, "deps":
- [["@", "gsl", "", "gsl"], ["src/buildtool/execution_api/remote", "config"]]
+ [ ["@", "gsl", "", "gsl"]
+ , ["src/buildtool/execution_api/remote", "config"]
+ , ["src/buildtool/crypto", "hash_function"]
+ ]
, "stage": ["src", "buildtool", "serve_api", "serve_service"]
, "private-deps": [["src/buildtool/common", "protocol_traits"]]
}
diff --git a/src/buildtool/serve_api/serve_service/configuration.cpp b/src/buildtool/serve_api/serve_service/configuration.cpp
index 8b340e8c..86cf14a7 100644
--- a/src/buildtool/serve_api/serve_service/configuration.cpp
+++ b/src/buildtool/serve_api/serve_service/configuration.cpp
@@ -33,7 +33,7 @@ auto ConfigurationService::Compatibility(
const ::justbuild::just_serve::CompatibilityRequest* /*request*/,
::justbuild::just_serve::CompatibilityResponse* response)
-> ::grpc::Status {
- response->set_compatible(ProtocolTraits::Instance().IsCompatible());
+ response->set_compatible(not ProtocolTraits::IsNative(hash_type_));
return ::grpc::Status::OK;
}
diff --git a/src/buildtool/serve_api/serve_service/configuration.hpp b/src/buildtool/serve_api/serve_service/configuration.hpp
index b374148a..90dceab2 100644
--- a/src/buildtool/serve_api/serve_service/configuration.hpp
+++ b/src/buildtool/serve_api/serve_service/configuration.hpp
@@ -17,6 +17,7 @@
#include "gsl/gsl"
#include "justbuild/just_serve/just_serve.grpc.pb.h"
+#include "src/buildtool/crypto/hash_function.hpp"
#include "src/buildtool/execution_api/remote/config.hpp"
// This service can be used by the client to double-check the server
@@ -25,9 +26,10 @@ class ConfigurationService final
: public justbuild::just_serve::Configuration::Service {
public:
explicit ConfigurationService(
+ HashFunction::Type hash_type,
gsl::not_null<RemoteExecutionConfig const*> const&
remote_config) noexcept
- : remote_config_{*remote_config} {};
+ : hash_type_{hash_type}, remote_config_{*remote_config} {};
// Returns the address of the associated remote endpoint, if set,
// or an empty string signaling that the serve endpoint acts also
@@ -51,6 +53,7 @@ class ConfigurationService final
-> ::grpc::Status override;
private:
+ HashFunction::Type hash_type_;
RemoteExecutionConfig const& remote_config_;
};
diff --git a/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp b/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp
index f912894d..bfa5bde0 100644
--- a/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp
+++ b/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp
@@ -120,7 +120,7 @@ auto ServeServerImpl::Run(
remote_context,
&apis,
serve ? &*serve : nullptr};
- ConfigurationService cs{remote_context->exec_config};
+ ConfigurationService cs{hash_type, remote_context->exec_config};
grpc::ServerBuilder builder;