summaryrefslogtreecommitdiff
path: root/src/buildtool/tree_structure/tree_structure_utils.hpp
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2025-01-14 11:50:51 +0100
committerMaksim Denisov <denisov.maksim@huawei.com>2025-01-21 09:58:36 +0100
commit6fa286a674059f2f4a4dd6033aacb13b2d6d1e40 (patch)
treec3e6c198b38e39d520b7fc991ebe5d9ef1c127d3 /src/buildtool/tree_structure/tree_structure_utils.hpp
parent8196d143f343a11026293521e5dbe0a9731d5050 (diff)
downloadjustbuild-6fa286a674059f2f4a4dd6033aacb13b2d6d1e40.tar.gz
TreeStructureUtils: import to git
Unify logic from evaluator of precomputed roots.
Diffstat (limited to 'src/buildtool/tree_structure/tree_structure_utils.hpp')
-rw-r--r--src/buildtool/tree_structure/tree_structure_utils.hpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/buildtool/tree_structure/tree_structure_utils.hpp b/src/buildtool/tree_structure/tree_structure_utils.hpp
index 56dd1249..df2f9f5e 100644
--- a/src/buildtool/tree_structure/tree_structure_utils.hpp
+++ b/src/buildtool/tree_structure/tree_structure_utils.hpp
@@ -15,9 +15,13 @@
#ifndef INCLUDED_SRC_BUILDTOOL_TREE_STRUCTURE_TREE_STRUCTURE_UTILS_HPP
#define INCLUDED_SRC_BUILDTOOL_TREE_STRUCTURE_TREE_STRUCTURE_UTILS_HPP
+#include <mutex>
#include <string>
+#include "gsl/gsl"
#include "src/buildtool/common/artifact_digest.hpp"
+#include "src/buildtool/execution_api/common/execution_api.hpp"
+#include "src/buildtool/storage/config.hpp"
#include "src/buildtool/storage/storage.hpp"
#include "src/buildtool/tree_structure/tree_structure_cache.hpp"
#include "src/utils/cpp/expected.hpp"
@@ -39,6 +43,22 @@ class TreeStructureUtils final {
Storage const& storage,
TreeStructureCache const& cache) noexcept
-> expected<ArtifactDigest, std::string>;
+
+ /// \brief Import a git tree from the given source to storage_config's git
+ /// repo.
+ /// \param tree GitSHA1 tree to import
+ /// \param source_api The source of the tree. Must be capable of
+ /// processing GitSHA1 trees.
+ /// \param target_config Config with target git repo.
+ /// \param tagging_lock Mutex to protect critical tagging operation
+ /// \return Digest of the tree that is available in the repo after the
+ /// call or an error message on failure.
+ [[nodiscard]] static auto ImportToGit(
+ ArtifactDigest const& tree,
+ IExecutionApi const& source_api,
+ StorageConfig const& target_config,
+ gsl::not_null<std::mutex*> const& tagging_lock) noexcept
+ -> expected<ArtifactDigest, std::string>;
};
#endif // INCLUDED_SRC_BUILDTOOL_TREE_STRUCTURE_TREE_STRUCTURE_UTILS_HPP