From 7e6330e7c2ecdee4cc7edf137b9e4616c55a57b1 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 16 Jul 2024 11:19:51 +0200 Subject: Storage config: change layout to support several storage generations --- src/buildtool/storage/config.hpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/buildtool/storage/config.hpp') 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 -- cgit v1.2.3