summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/execution_api/local/local_api.hpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/buildtool/execution_api/local/local_api.hpp b/src/buildtool/execution_api/local/local_api.hpp
index f919e9c9..d46be8ed 100644
--- a/src/buildtool/execution_api/local/local_api.hpp
+++ b/src/buildtool/execution_api/local/local_api.hpp
@@ -284,6 +284,34 @@ class LocalApi final : public IExecutionApi {
return true;
}
+ [[nodiscard]] auto UploadFile(std::filesystem::path const& file_path,
+ ObjectType type) noexcept -> bool override {
+ Logger::Log(LogLevel::Trace, [&file_path, &type]() {
+ return fmt::format("Storing {} of type {} directly to CAS.",
+ file_path.string(),
+ ToChar(type));
+ });
+ switch (type) {
+ case ObjectType::Tree:
+ return storage_->CAS()
+ .StoreTree</* kOwner= */ true>(file_path)
+ .has_value();
+ case ObjectType::Symlink:
+ case ObjectType::File:
+ return storage_->CAS()
+ .StoreBlob</* kOwner= */ true>(file_path,
+ /* is_executable= */ false)
+ .has_value();
+ case ObjectType::Executable:
+ return storage_->CAS()
+ .StoreBlob</* kOwner= */ true>(file_path,
+ /* is_executable= */ true)
+ .has_value();
+ }
+ Ensures(false); // unreachable
+ return false;
+ }
+
/// NOLINTNEXTLINE(misc-no-recursion)
[[nodiscard]] auto UploadBlobTree(BlobTreePtr const& blob_tree) noexcept
-> bool {