summaryrefslogtreecommitdiff
path: root/src/buildtool/serve_api/serve_service/source_tree.hpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2025-01-07 16:13:29 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2025-01-07 16:58:19 +0100
commit82340791f4362a3a92ea1dfa9ff111c1258be19f (patch)
treeeca01317b4e7c01fc6970dd5589162f05ba9c5f8 /src/buildtool/serve_api/serve_service/source_tree.hpp
parent972bc9108bc52ade30505ae32b38d663ab02b220 (diff)
downloadjustbuild-82340791f4362a3a92ea1dfa9ff111c1258be19f.tar.gz
source tree service: Ensure the Git cache exists
Similarly to just-mr, each SourceTree RPC must ensure that the Git cache folder exists and the Git cache repository is initialized before using it. While there, fix missing shared locks on the Git cache root.
Diffstat (limited to 'src/buildtool/serve_api/serve_service/source_tree.hpp')
-rw-r--r--src/buildtool/serve_api/serve_service/source_tree.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/buildtool/serve_api/serve_service/source_tree.hpp b/src/buildtool/serve_api/serve_service/source_tree.hpp
index 7b3d3cac..2b08a26f 100644
--- a/src/buildtool/serve_api/serve_service/source_tree.hpp
+++ b/src/buildtool/serve_api/serve_service/source_tree.hpp
@@ -23,6 +23,7 @@
#include <type_traits>
#include <unordered_map>
#include <utility>
+#include <variant>
#include <grpcpp/grpcpp.h>
@@ -142,6 +143,11 @@ class SourceTreeService final
// symlinks resolver map
ResolveSymlinksMap resolve_symlinks_map_{CreateResolveSymlinksMap()};
+ /// \brief Ensure that the Git cache repository exists.
+ /// \returns Error message on failure.
+ [[nodiscard]] auto EnsureGitCacheRoot()
+ -> expected<std::monostate, std::string>;
+
/// \brief Check if commit exists and tries to get the subtree if found.
/// \returns The subtree hash on success or an unexpected error (fatal or
/// commit was not found).