summaryrefslogtreecommitdiff
path: root/src/buildtool/storage/config.hpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-07-16 11:19:51 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-07-19 15:50:15 +0200
commit7e6330e7c2ecdee4cc7edf137b9e4616c55a57b1 (patch)
treed0c019513a10abbb792323f3d1724f23476e1a8f /src/buildtool/storage/config.hpp
parentff8ecea73904cf6348fee13e83814809f55e26f5 (diff)
downloadjustbuild-7e6330e7c2ecdee4cc7edf137b9e4616c55a57b1.tar.gz
Storage config: change layout to support several storage generations
Diffstat (limited to 'src/buildtool/storage/config.hpp')
-rw-r--r--src/buildtool/storage/config.hpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/buildtool/storage/config.hpp b/src/buildtool/storage/config.hpp
index 39bb74ac..4bc8911c 100644
--- a/src/buildtool/storage/config.hpp
+++ b/src/buildtool/storage/config.hpp
@@ -72,9 +72,29 @@ struct StorageConfig final {
return build_root / "protocol-dependent";
}
+ /// \brief Root directory of all repository generations.
+ [[nodiscard]] auto RepositoryRoot() const noexcept
+ -> std::filesystem::path {
+ return build_root / "repositories";
+ }
+
+ /// \brief Directory for the given generation of stored repositories
+ [[nodiscard]] auto RepositoryGenerationRoot(
+ std::size_t index) const noexcept -> std::filesystem::path {
+ ExpectsAudit(index < num_generations);
+ auto generation = std::string{"generation-"} + std::to_string(index);
+ return RepositoryRoot() / generation;
+ }
+
+ /// \brief Directory for the git repository of the given generation
+ [[nodiscard]] auto GitGenerationRoot(std::size_t index) const noexcept
+ -> std::filesystem::path {
+ return RepositoryGenerationRoot(index) / "git";
+ }
+
/// \brief Directory for the git repository storing various roots
[[nodiscard]] auto GitRoot() const noexcept -> std::filesystem::path {
- return build_root / "git";
+ return GitGenerationRoot(0);
}
/// \brief Root directory of specific storage generation