From 01d9abcfc85d974763c3a7f8fed998342d92a681 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Thu, 27 Jun 2024 17:44:34 +0200 Subject: Use (un)expected for serve API --- src/buildtool/serve_api/remote/serve_api.hpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/buildtool/serve_api/remote/serve_api.hpp') diff --git a/src/buildtool/serve_api/remote/serve_api.hpp b/src/buildtool/serve_api/remote/serve_api.hpp index 9175857b..7d265c92 100644 --- a/src/buildtool/serve_api/remote/serve_api.hpp +++ b/src/buildtool/serve_api/remote/serve_api.hpp @@ -23,18 +23,19 @@ class ServeApi final {}; #include #include #include -#include #include "src/buildtool/common/artifact.hpp" #include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/common/remote/port.hpp" #include "src/buildtool/common/remote/remote_common.hpp" #include "src/buildtool/execution_api/common/api_bundle.hpp" +#include "src/buildtool/file_system/git_types.hpp" #include "src/buildtool/file_system/symlinks_map/pragma_special.hpp" #include "src/buildtool/serve_api/remote/config.hpp" #include "src/buildtool/serve_api/remote/configuration_client.hpp" #include "src/buildtool/serve_api/remote/source_tree_client.hpp" #include "src/buildtool/serve_api/remote/target_client.hpp" +#include "src/utils/cpp/expected.hpp" class ServeApi final { public: @@ -62,7 +63,7 @@ class ServeApi final { [[nodiscard]] auto RetrieveTreeFromCommit(std::string const& commit, std::string const& subdir = ".", bool sync_tree = false) - const noexcept -> std::variant { + const noexcept -> expected { return stc_.ServeCommitTree(commit, subdir, sync_tree); } @@ -72,7 +73,7 @@ class ServeApi final { std::string const& subdir = ".", std::optional const& resolve_symlinks = std::nullopt, bool sync_tree = false) const noexcept - -> std::variant { + -> expected { return stc_.ServeArchiveTree( content, archive_type, subdir, resolve_symlinks, sync_tree); } @@ -81,14 +82,14 @@ class ServeApi final { std::shared_ptr> const& distfiles, bool sync_tree = false) const noexcept - -> std::variant { + -> expected { return stc_.ServeDistdirTree(distfiles, sync_tree); } - [[nodiscard]] auto RetrieveTreeFromForeignFile( - const std::string& content, - const std::string& name, - bool executable) const noexcept -> std::variant { + [[nodiscard]] auto RetrieveTreeFromForeignFile(const std::string& content, + const std::string& name, + bool executable) + const noexcept -> expected { return stc_.ServeForeignFileTree(content, name, executable); } -- cgit v1.2.3