diff options
Diffstat (limited to 'src/buildtool/serve_api')
4 files changed, 20 insertions, 18 deletions
diff --git a/src/buildtool/serve_api/serve_service/TARGETS b/src/buildtool/serve_api/serve_service/TARGETS index 6135cd5a..b9b2ca57 100644 --- a/src/buildtool/serve_api/serve_service/TARGETS +++ b/src/buildtool/serve_api/serve_service/TARGETS @@ -34,7 +34,7 @@ [ ["@", "fmt", "", "fmt"] , ["src/buildtool/common", "common"] , ["src/buildtool/common", "artifact_digest_factory"] - , ["src/buildtool/compatibility", "compatibility"] + , ["src/buildtool/common", "protocol_traits"] , ["src/buildtool/file_system", "git_repo"] , ["src/buildtool/logging", "log_level"] , ["src/buildtool/multithreading", "async_map_utils"] @@ -69,7 +69,7 @@ , ["@", "grpc", "", "grpc++"] , ["@", "json", "", "json"] , ["src/buildtool/common/remote", "port"] - , ["src/buildtool/compatibility", "compatibility"] + , ["src/buildtool/common", "protocol_traits"] , ["src/buildtool/logging", "log_level"] , ["src/buildtool/execution_api/execution_service", "execution_server"] , ["src/buildtool/execution_api/execution_service", "ac_server"] @@ -139,7 +139,7 @@ , "deps": [["@", "gsl", "", "gsl"], ["src/buildtool/execution_api/remote", "config"]] , "stage": ["src", "buildtool", "serve_api", "serve_service"] - , "private-deps": [["src/buildtool/compatibility", "compatibility"]] + , "private-deps": [["src/buildtool/common", "protocol_traits"]] } , "target_utils": { "type": ["@", "rules", "CC", "library"] diff --git a/src/buildtool/serve_api/serve_service/configuration.cpp b/src/buildtool/serve_api/serve_service/configuration.cpp index a5bd7655..8b340e8c 100644 --- a/src/buildtool/serve_api/serve_service/configuration.cpp +++ b/src/buildtool/serve_api/serve_service/configuration.cpp @@ -16,7 +16,7 @@ #include "src/buildtool/serve_api/serve_service/configuration.hpp" -#include "src/buildtool/compatibility/compatibility.hpp" +#include "src/buildtool/common/protocol_traits.hpp" auto ConfigurationService::RemoteExecutionEndpoint( ::grpc::ServerContext* /*context*/, @@ -33,7 +33,7 @@ auto ConfigurationService::Compatibility( const ::justbuild::just_serve::CompatibilityRequest* /*request*/, ::justbuild::just_serve::CompatibilityResponse* response) -> ::grpc::Status { - response->set_compatible(Compatibility::IsCompatible()); + response->set_compatible(ProtocolTraits::Instance().IsCompatible()); return ::grpc::Status::OK; } 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 7a398a1d..be307ba5 100644 --- a/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp +++ b/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp @@ -29,8 +29,8 @@ #include "fmt/core.h" #include "grpcpp/grpcpp.h" #include "nlohmann/json.hpp" +#include "src/buildtool/common/protocol_traits.hpp" #include "src/buildtool/common/remote/port.hpp" -#include "src/buildtool/compatibility/compatibility.hpp" #include "src/buildtool/execution_api/execution_service/ac_server.hpp" #include "src/buildtool/execution_api/execution_service/bytestream_server.hpp" #include "src/buildtool/execution_api/execution_service/capabilities_server.hpp" @@ -185,12 +185,14 @@ auto ServeServerImpl::Run( } auto const& info_str = nlohmann::to_string(info); - Logger::Log(LogLevel::Info, - fmt::format("{}serve{} service{} started: {}", - Compatibility::IsCompatible() ? "compatible " : "", - with_execute ? " and execute" : "", - with_execute ? "s" : "", - info_str)); + Logger::Log( + LogLevel::Info, + fmt::format( + "{}serve{} service{} started: {}", + ProtocolTraits::Instance().IsCompatible() ? "compatible " : "", + with_execute ? " and execute" : "", + with_execute ? "s" : "", + info_str)); if (not info_file_.empty()) { if (not TryWrite(info_file_, info_str)) { diff --git a/src/buildtool/serve_api/serve_service/source_tree.cpp b/src/buildtool/serve_api/serve_service/source_tree.cpp index acc29ba9..ed6fcae0 100644 --- a/src/buildtool/serve_api/serve_service/source_tree.cpp +++ b/src/buildtool/serve_api/serve_service/source_tree.cpp @@ -24,7 +24,7 @@ #include "src/buildtool/common/artifact.hpp" #include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/common/artifact_digest_factory.hpp" -#include "src/buildtool/compatibility/compatibility.hpp" +#include "src/buildtool/common/protocol_traits.hpp" #include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/git/git_api.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" @@ -287,7 +287,7 @@ auto SourceTreeService::SyncGitEntryToCas( std::string const& object_hash, std::filesystem::path const& repo_path) const noexcept -> std::remove_cvref_t<decltype(TResponse::OK)> { - if (IsTreeObject(kType) and Compatibility::IsCompatible()) { + if (IsTreeObject(kType) and ProtocolTraits::Instance().IsCompatible()) { logger_->Emit(LogLevel::Error, "Cannot sync tree {} from repository {} with " "the remote in compatible mode", @@ -984,7 +984,7 @@ auto SourceTreeService::ServeDistdirTree( 0, /*is_tree=*/false); - if (not Compatibility::IsCompatible()) { + if (not ProtocolTraits::Instance().IsCompatible()) { blob_found = digest and cas.BlobPath(*digest, kv.executable()); } if (blob_found) { @@ -1054,8 +1054,8 @@ auto SourceTreeService::ServeDistdirTree( } if (not blob_found) { // check remote CAS - if (not Compatibility::IsCompatible() and digest and - apis_.remote->IsAvailable(*digest)) { + if (not ProtocolTraits::Instance().IsCompatible() and + digest and apis_.remote->IsAvailable(*digest)) { // retrieve content to local CAS if (not apis_.remote->RetrieveToCas( {Artifact::ObjectInfo{ @@ -1320,7 +1320,7 @@ auto SourceTreeService::ServeTree( storage_config_.hash_function.GetType(), tree_id, 0, /*is_tree=*/true); if (digest and apis_.local->IsAvailable(*digest)) { // upload tree to remote CAS; only possible in native mode - if (Compatibility::IsCompatible()) { + if (ProtocolTraits::Instance().IsCompatible()) { logger_->Emit(LogLevel::Error, "Cannot sync tree {} from local CAS with the remote " "in compatible mode", |