diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-08-01 17:44:23 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-09-11 14:52:07 +0200 |
commit | 2bc6d309c00161b2315b9f98645810699fff3126 (patch) | |
tree | 8185d375463e79b39485448920fa68cca2a206a2 /src/buildtool/storage/target_cache_entry.hpp | |
parent | abae1d3c8032fec872bda44de7f7d754654cf201 (diff) | |
download | justbuild-2bc6d309c00161b2315b9f98645810699fff3126.tar.gz |
Use HashFunction::Type to deserialize ArtifactDescription
Diffstat (limited to 'src/buildtool/storage/target_cache_entry.hpp')
-rw-r--r-- | src/buildtool/storage/target_cache_entry.hpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/buildtool/storage/target_cache_entry.hpp b/src/buildtool/storage/target_cache_entry.hpp index b0bd1020..a1cddf62 100644 --- a/src/buildtool/storage/target_cache_entry.hpp +++ b/src/buildtool/storage/target_cache_entry.hpp @@ -27,21 +27,25 @@ #include "src/buildtool/build_engine/expression/target_result.hpp" #include "src/buildtool/common/artifact.hpp" #include "src/buildtool/common/artifact_description.hpp" +#include "src/buildtool/crypto/hash_function.hpp" // Entry for target cache. Created from target, contains TargetResult. class TargetCacheEntry { public: - explicit TargetCacheEntry(nlohmann::json desc) : desc_(std::move(desc)) {} + explicit TargetCacheEntry(HashFunction::Type hash_type, nlohmann::json desc) + : hash_type_{hash_type}, desc_(std::move(desc)) {} // Create the entry from target with replacement artifacts/infos. // Replacement artifacts must replace all non-known artifacts by known. [[nodiscard]] static auto FromTarget( + HashFunction::Type hash_type, AnalysedTargetPtr const& target, std::unordered_map<ArtifactDescription, Artifact::ObjectInfo> const& replacements) noexcept -> std::optional<TargetCacheEntry>; // Create a target-cache entry from a json description. - [[nodiscard]] static auto FromJson(nlohmann::json desc) noexcept + [[nodiscard]] static auto FromJson(HashFunction::Type hash_type, + nlohmann::json desc) noexcept -> TargetCacheEntry; // Obtain TargetResult from cache entry. @@ -70,6 +74,7 @@ class TargetCacheEntry { } private: + HashFunction::Type hash_type_; nlohmann::json desc_; }; |