From 13fd883b8cfa9531523f3113b32794f803c1176a Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Thu, 7 Jul 2022 17:28:05 +0200 Subject: LocalCAS: Support storing trees --- src/buildtool/execution_api/local/local_cas.hpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/buildtool/execution_api/local/local_cas.hpp') diff --git a/src/buildtool/execution_api/local/local_cas.hpp b/src/buildtool/execution_api/local/local_cas.hpp index 310a3011..a4646d10 100644 --- a/src/buildtool/execution_api/local/local_cas.hpp +++ b/src/buildtool/execution_api/local/local_cas.hpp @@ -51,14 +51,18 @@ class LocalCAS { } private: + // For `Tree` the underlying storage type is non-executable file. + static constexpr auto kStorageType = + kType == ObjectType::Tree ? ObjectType::File : kType; + Logger logger_{std::string{"LocalCAS"} + ToChar(kType)}; - FileStorage + FileStorage file_store_{LocalExecutionConfig::CASDir()}; [[nodiscard]] static auto CreateDigest(std::string const& bytes) noexcept -> std::optional { - return ArtifactDigest::Create(bytes); + return ArtifactDigest::Create(bytes); } [[nodiscard]] static auto CreateDigest( @@ -66,7 +70,7 @@ class LocalCAS { -> std::optional { auto const bytes = FileSystemManager::ReadFile(file_path); if (bytes.has_value()) { - return ArtifactDigest::Create(*bytes); + return ArtifactDigest::Create(*bytes); } return std::nullopt; } -- cgit v1.2.3