diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-09-23 12:09:44 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-10-25 13:00:43 +0200 |
commit | 7571f74dbc53e9b4fe3b9000662ca686960db78e (patch) | |
tree | ba1adfd9bd5a2024de2c0ddb0e8c9e76e947bdc2 /src/buildtool/storage/fs_utils.cpp | |
parent | bfefe45f8731e10a92f739d630a3c027fc72bc5b (diff) | |
download | justbuild-7571f74dbc53e9b4fe3b9000662ca686960db78e.tar.gz |
StorageUtils: Add generation-aware rehashing ID file map
Such a file could be used to store mappings of digests from CAS or
Git cache to digests of different hash type that represent same
content.
Diffstat (limited to 'src/buildtool/storage/fs_utils.cpp')
-rw-r--r-- | src/buildtool/storage/fs_utils.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/buildtool/storage/fs_utils.cpp b/src/buildtool/storage/fs_utils.cpp index 171a5d1c..05883814 100644 --- a/src/buildtool/storage/fs_utils.cpp +++ b/src/buildtool/storage/fs_utils.cpp @@ -104,6 +104,16 @@ auto GetResolvedTreeIDFile(StorageConfig const& storage_config, tree_hash; } +auto GetRehashIDFile(StorageConfig const& storage_config, + HashFunction::Type target_hash_type, + std::string const& hash, + bool from_git, + std::size_t generation) noexcept -> std::filesystem::path { + return storage_config.GenerationCacheRoot(generation) / + fmt::format("to-{}", ToString(target_hash_type)) / + (from_git ? "from-git" : "from-cas") / hash; +} + auto WriteTreeIDFile(std::filesystem::path const& tree_id_file, std::string const& tree_id) noexcept -> bool { // needs to be done safely, so use the rename trick |