summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/execution_api')
-rw-r--r--src/buildtool/execution_api/execution_service/bytestream_server.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/buildtool/execution_api/execution_service/bytestream_server.cpp b/src/buildtool/execution_api/execution_service/bytestream_server.cpp
index 64d5e9eb..37bfebc6 100644
--- a/src/buildtool/execution_api/execution_service/bytestream_server.cpp
+++ b/src/buildtool/execution_api/execution_service/bytestream_server.cpp
@@ -53,30 +53,28 @@ auto BytestreamServiceImpl::Read(
return ::grpc::Status{::grpc::StatusCode::INVALID_ARGUMENT, str};
}
- std::optional<std::filesystem::path> path{};
auto lock = GarbageCollector::SharedLock();
if (!lock) {
auto str = fmt::format("Could not acquire SharedLock");
logger_.Emit(LogLevel::Error, str);
return grpc::Status{grpc::StatusCode::INTERNAL, str};
}
+
+ std::optional<std::filesystem::path> path{};
+
if (NativeSupport::IsTree(*hash)) {
ArtifactDigest dgst{NativeSupport::Unprefix(*hash), 0, true};
path = storage_.TreePath(static_cast<bazel_re::Digest>(dgst));
- if (!path) {
- auto str = fmt::format("could not find {}", *hash);
- logger_.Emit(LogLevel::Error, str);
- return ::grpc::Status{::grpc::StatusCode::NOT_FOUND, str};
- }
}
- ArtifactDigest dgst{NativeSupport::Unprefix(*hash), 0, false};
- path = storage_.BlobPath(static_cast<bazel_re::Digest>(dgst), false);
+ else {
+ ArtifactDigest dgst{NativeSupport::Unprefix(*hash), 0, false};
+ path = storage_.BlobPath(static_cast<bazel_re::Digest>(dgst), false);
+ }
if (!path) {
auto str = fmt::format("could not find {}", *hash);
logger_.Emit(LogLevel::Error, str);
return ::grpc::Status{::grpc::StatusCode::NOT_FOUND, str};
}
-
std::ifstream blob{*path};
::google::bytestream::ReadResponse response;