diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-07-16 11:19:51 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-07-19 15:50:15 +0200 |
commit | 7e6330e7c2ecdee4cc7edf137b9e4616c55a57b1 (patch) | |
tree | d0c019513a10abbb792323f3d1724f23476e1a8f /src/buildtool/storage/fs_utils.cpp | |
parent | ff8ecea73904cf6348fee13e83814809f55e26f5 (diff) | |
download | justbuild-7e6330e7c2ecdee4cc7edf137b9e4616c55a57b1.tar.gz |
Storage config: change layout to support several storage generations
Diffstat (limited to 'src/buildtool/storage/fs_utils.cpp')
-rw-r--r-- | src/buildtool/storage/fs_utils.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/buildtool/storage/fs_utils.cpp b/src/buildtool/storage/fs_utils.cpp index 3286c4ec..03ef75c6 100644 --- a/src/buildtool/storage/fs_utils.cpp +++ b/src/buildtool/storage/fs_utils.cpp @@ -52,22 +52,27 @@ auto GetGitRoot(StorageConfig const& storage_config, } auto GetCommitTreeIDFile(StorageConfig const& storage_config, - std::string const& commit) noexcept + std::string const& commit, + std::size_t generation) noexcept -> std::filesystem::path { - return storage_config.build_root / "commit-tree-map" / commit; + return storage_config.RepositoryGenerationRoot(generation) / + "commit-tree-map" / commit; } auto GetArchiveTreeIDFile(StorageConfig const& storage_config, std::string const& repo_type, - std::string const& content) noexcept + std::string const& content, + std::size_t generation) noexcept -> std::filesystem::path { - return storage_config.build_root / "tree-map" / repo_type / content; + return storage_config.RepositoryGenerationRoot(generation) / "tree-map" / + repo_type / content; } auto GetForeignFileTreeIDFile(StorageConfig const& storage_config, std::string const& content, std::string const& name, - bool executable) noexcept + bool executable, + std::size_t generation) noexcept -> std::filesystem::path { return GetDistdirTreeIDFile( storage_config, @@ -76,21 +81,26 @@ auto GetForeignFileTreeIDFile(StorageConfig const& storage_config, std::unordered_map<std::string, std::pair<std::string, bool>>{ {name, {content, executable}}}) .dump()) - .HexString()); + .HexString(), + generation); } auto GetDistdirTreeIDFile(StorageConfig const& storage_config, - std::string const& content) noexcept + std::string const& content, + std::size_t generation) noexcept -> std::filesystem::path { - return storage_config.build_root / "distfiles-tree-map" / content; + return storage_config.RepositoryGenerationRoot(generation) / + "distfiles-tree-map" / content; } auto GetResolvedTreeIDFile(StorageConfig const& storage_config, std::string const& tree_hash, - PragmaSpecial const& pragma_special) noexcept + PragmaSpecial const& pragma_special, + std::size_t generation) noexcept -> std::filesystem::path { - return storage_config.build_root / "special-tree-map" / - kPragmaSpecialInverseMap.at(pragma_special) / tree_hash; + return storage_config.RepositoryGenerationRoot(generation) / + "special-tree-map" / kPragmaSpecialInverseMap.at(pragma_special) / + tree_hash; } auto WriteTreeIDFile(std::filesystem::path const& tree_id_file, |