diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-07-07 17:28:05 +0200 |
---|---|---|
committer | Sascha Roloff <sascha.roloff@huawei.com> | 2022-08-05 14:41:31 +0200 |
commit | 13fd883b8cfa9531523f3113b32794f803c1176a (patch) | |
tree | a4cff4fb5a2b13c9ac2cf0e95ea28f2376c15337 /src | |
parent | a23aa232645364b2403f380c9e2bb50edf617cb0 (diff) | |
download | justbuild-13fd883b8cfa9531523f3113b32794f803c1176a.tar.gz |
LocalCAS: Support storing trees
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/execution_api/local/local_cas.hpp | 10 |
1 files changed, 7 insertions, 3 deletions
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<kType, StoreMode::FirstWins, /*kSetEpochTime=*/true> + FileStorage<kStorageType, StoreMode::FirstWins, /*kSetEpochTime=*/true> file_store_{LocalExecutionConfig::CASDir<kType>()}; [[nodiscard]] static auto CreateDigest(std::string const& bytes) noexcept -> std::optional<bazel_re::Digest> { - return ArtifactDigest::Create(bytes); + return ArtifactDigest::Create<kType>(bytes); } [[nodiscard]] static auto CreateDigest( @@ -66,7 +70,7 @@ class LocalCAS { -> std::optional<bazel_re::Digest> { auto const bytes = FileSystemManager::ReadFile(file_path); if (bytes.has_value()) { - return ArtifactDigest::Create(*bytes); + return ArtifactDigest::Create<kType>(*bytes); } return std::nullopt; } |