summaryrefslogtreecommitdiff
path: root/src/buildtool/tree_structure/tree_structure_utils.hpp
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2025-01-15 12:30:53 +0100
committerMaksim Denisov <denisov.maksim@huawei.com>2025-01-21 09:58:36 +0100
commit58830989428eaf9151177abeb756f31c47755596 (patch)
tree18faea3d1dbe5a37fcda922ea1d6a65a43fdf14b /src/buildtool/tree_structure/tree_structure_utils.hpp
parentaa8635c6863646f5df78b54832f51db16aac25ba (diff)
downloadjustbuild-58830989428eaf9151177abeb756f31c47755596.tar.gz
TreeStructureUtils: implement local computation of tree structure
Diffstat (limited to 'src/buildtool/tree_structure/tree_structure_utils.hpp')
-rw-r--r--src/buildtool/tree_structure/tree_structure_utils.hpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/buildtool/tree_structure/tree_structure_utils.hpp b/src/buildtool/tree_structure/tree_structure_utils.hpp
index 4f908640..7cecf7f8 100644
--- a/src/buildtool/tree_structure/tree_structure_utils.hpp
+++ b/src/buildtool/tree_structure/tree_structure_utils.hpp
@@ -17,6 +17,7 @@
#include <filesystem>
#include <mutex>
+#include <optional>
#include <string>
#include <vector>
@@ -74,6 +75,22 @@ class TreeStructureUtils final {
std::vector<std::filesystem::path> const& source_repos,
IExecutionApi const& target_api) noexcept
-> expected<bool, std::string>;
+
+ /// \brief Find git tree locally and compute its tree structure.
+ /// \param tree Git tree to process
+ /// \param known_repositories Known git repositories to check
+ /// \param storage_config Storage to use for lookup and import.
+ /// \param tagging_lock Mutex to protect critical git operations
+ /// \return Digest of the tree structure that is available in
+ /// storage_config's git repo and in storage_config's CAS; std::nullopt if
+ /// the search failed to locate the tree's sources locally; an error string
+ /// on critical failure.
+ [[nodiscard]] static auto ComputeStructureLocally(
+ ArtifactDigest const& tree,
+ std::vector<std::filesystem::path> const& known_repositories,
+ StorageConfig const& storage_config,
+ gsl::not_null<std::mutex*> const& tagging_lock)
+ -> expected<std::optional<ArtifactDigest>, std::string>;
};
#endif // INCLUDED_SRC_BUILDTOOL_TREE_STRUCTURE_TREE_STRUCTURE_UTILS_HPP