summaryrefslogtreecommitdiff
path: root/src/buildtool/storage/fs_utils.hpp
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-06-26 13:05:35 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-07-05 12:58:35 +0200
commit3440784e94de51c95d3dcca8509f8e46b4722ee6 (patch)
tree42b096e1766aa3706adf02b93508d721bed66efd /src/buildtool/storage/fs_utils.hpp
parent595b7c27d175b56bd296b33dc535818a05cdbadd (diff)
downloadjustbuild-3440784e94de51c95d3dcca8509f8e46b4722ee6.tar.gz
Pass Storage and StorageConfig to StorageUtils by reference
Diffstat (limited to 'src/buildtool/storage/fs_utils.hpp')
-rw-r--r--src/buildtool/storage/fs_utils.hpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/buildtool/storage/fs_utils.hpp b/src/buildtool/storage/fs_utils.hpp
index e24f50a3..bd4852a9 100644
--- a/src/buildtool/storage/fs_utils.hpp
+++ b/src/buildtool/storage/fs_utils.hpp
@@ -21,6 +21,8 @@
#include "src/buildtool/common/user_structs.hpp"
#include "src/buildtool/file_system/symlinks_map/pragma_special.hpp"
+#include "src/buildtool/storage/config.hpp"
+#include "src/buildtool/storage/storage.hpp"
/* Utilities related to CAS and paths therein */
@@ -28,35 +30,41 @@ namespace StorageUtils {
/// \brief Get location of Git repository. Defaults to the Git cache root when
/// no better location is found.
-[[nodiscard]] auto GetGitRoot(LocalPathsPtr const& just_mr_paths,
+[[nodiscard]] auto GetGitRoot(StorageConfig const& storage_config,
+ LocalPathsPtr const& just_mr_paths,
std::string const& repo_url) noexcept
-> std::filesystem::path;
/// \brief Get the path to the file storing the tree id associated with
/// a given commit.
-[[nodiscard]] auto GetCommitTreeIDFile(std::string const& commit) noexcept
+[[nodiscard]] auto GetCommitTreeIDFile(StorageConfig const& storage_config,
+ std::string const& commit) noexcept
-> std::filesystem::path;
/// \brief Get the path to the file storing the tree id of an archive
/// content.
-[[nodiscard]] auto GetArchiveTreeIDFile(std::string const& repo_type,
+[[nodiscard]] auto GetArchiveTreeIDFile(StorageConfig const& storage_config,
+ std::string const& repo_type,
std::string const& content) noexcept
-> std::filesystem::path;
/// \brief Get the path to the file storing the tree id of an archive
/// content.
-[[nodiscard]] auto GetForeignFileTreeIDFile(std::string const& content,
+[[nodiscard]] auto GetForeignFileTreeIDFile(StorageConfig const& storage_config,
+ std::string const& content,
std::string const& name,
bool executable) noexcept
-> std::filesystem::path;
/// \brief Get the path to the file storing the tree id of a distdir list
/// content.
-[[nodiscard]] auto GetDistdirTreeIDFile(std::string const& content) noexcept
+[[nodiscard]] auto GetDistdirTreeIDFile(StorageConfig const& storage_config,
+ std::string const& content) noexcept
-> std::filesystem::path;
/// \brief Get the path to the file storing a resolved tree hash.
[[nodiscard]] auto GetResolvedTreeIDFile(
+ StorageConfig const& storage_config,
std::string const& tree_hash,
PragmaSpecial const& pragma_special) noexcept -> std::filesystem::path;
@@ -66,11 +74,13 @@ namespace StorageUtils {
/// \brief Add data to file CAS.
/// Returns the path to the file added to CAS, or nullopt if not added.
-[[nodiscard]] auto AddToCAS(std::string const& data) noexcept
+[[nodiscard]] auto AddToCAS(Storage const& storage,
+ std::string const& data) noexcept
-> std::optional<std::filesystem::path>;
/// \brief Try to add distfile to CAS.
-void AddDistfileToCAS(std::filesystem::path const& distfile,
+void AddDistfileToCAS(Storage const& storage,
+ std::filesystem::path const& distfile,
LocalPathsPtr const& just_mr_paths) noexcept;
} // namespace StorageUtils