summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api/execution_service/cas_server.hpp
diff options
context:
space:
mode:
authorSascha Roloff <sascha.roloff@huawei.com>2023-10-31 20:48:32 +0100
committerSascha Roloff <sascha.roloff@huawei.com>2023-11-22 16:18:17 +0100
commit44a7c680289ba6812583746013f350d63942c894 (patch)
treeb6482b81c89768fcae95363080e0c9dc765b33be /src/buildtool/execution_api/execution_service/cas_server.hpp
parent9dc43626cf863ecfee29ef36fe3637e52b876f85 (diff)
downloadjustbuild-44a7c680289ba6812583746013f350d63942c894.tar.gz
Implement blob splitting protocol on just server side
Diffstat (limited to 'src/buildtool/execution_api/execution_service/cas_server.hpp')
-rw-r--r--src/buildtool/execution_api/execution_service/cas_server.hpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/buildtool/execution_api/execution_service/cas_server.hpp b/src/buildtool/execution_api/execution_service/cas_server.hpp
index 520263b6..afea2658 100644
--- a/src/buildtool/execution_api/execution_service/cas_server.hpp
+++ b/src/buildtool/execution_api/execution_service/cas_server.hpp
@@ -14,7 +14,12 @@
#ifndef CAS_SERVER_HPP
#define CAS_SERVER_HPP
+
+#include <optional>
+#include <string>
+
#include "build/bazel/remote/execution/v2/remote_execution.grpc.pb.h"
+#include "gsl/gsl"
#include "src/buildtool/common/bazel_types.hpp"
#include "src/buildtool/logging/logger.hpp"
#include "src/buildtool/storage/storage.hpp"
@@ -113,6 +118,29 @@ class CASServiceImpl final
const ::bazel_re::GetTreeRequest* request,
::grpc::ServerWriter< ::bazel_re::GetTreeResponse>* writer)
-> ::grpc::Status override;
+ // Split a blob into chunks.
+ //
+ // Clients can use this API before downloading a blob to determine which
+ // parts of the blob are already present locally and do not need to be
+ // downloaded again.
+ //
+ // The blob is split into chunks which are individually stored in the CAS. A
+ // list of the chunk digests is returned in the order in which the chunks
+ // have to be concatenated to assemble the requested blob.
+ //
+ // Using this API is optional but it allows clients to download only the
+ // missing parts of a blob instead of the entire blob data, which in turn
+ // can considerably reduce network traffic.
+ //
+ // Errors:
+ //
+ // * `NOT_FOUND`: The requested blob is not present in the CAS.
+ // * `RESOURCE_EXHAUSTED`: There is insufficient disk quota to store the
+ // blob chunks.
+ auto SplitBlob(::grpc::ServerContext* context,
+ const ::bazel_re::SplitBlobRequest* request,
+ ::bazel_re::SplitBlobResponse* response)
+ -> ::grpc::Status override;
private:
[[nodiscard]] auto CheckDigestConsistency(std::string const& ref,