diff options
Diffstat (limited to 'src')
6 files changed, 38 insertions, 34 deletions
diff --git a/src/buildtool/serve_api/remote/configuration_client.cpp b/src/buildtool/serve_api/remote/configuration_client.cpp index ccd4f2f9..6e6a5378 100644 --- a/src/buildtool/serve_api/remote/configuration_client.cpp +++ b/src/buildtool/serve_api/remote/configuration_client.cpp @@ -22,7 +22,7 @@ #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/serve_api/remote/config.hpp" -auto ConfigurationClient::CheckServeRemoteExecution() noexcept -> bool { +auto ConfigurationClient::CheckServeRemoteExecution() const noexcept -> bool { auto client_remote_address = RemoteExecutionConfig::RemoteAddress(); if (!client_remote_address) { logger_.Emit(LogLevel::Error, @@ -101,7 +101,7 @@ auto ConfigurationClient::CheckServeRemoteExecution() noexcept -> bool { return false; } -auto ConfigurationClient::IsCompatible() noexcept -> std::optional<bool> { +auto ConfigurationClient::IsCompatible() const noexcept -> std::optional<bool> { grpc::ClientContext context; justbuild::just_serve::CompatibilityRequest request{}; justbuild::just_serve::CompatibilityResponse response{}; diff --git a/src/buildtool/serve_api/remote/configuration_client.hpp b/src/buildtool/serve_api/remote/configuration_client.hpp index 45053c5e..eab0cbca 100644 --- a/src/buildtool/serve_api/remote/configuration_client.hpp +++ b/src/buildtool/serve_api/remote/configuration_client.hpp @@ -34,9 +34,9 @@ class ConfigurationClient { : stub_{justbuild::just_serve::Configuration::NewStub( CreateChannelWithCredentials(server, port))} {} - [[nodiscard]] auto CheckServeRemoteExecution() noexcept -> bool; + [[nodiscard]] auto CheckServeRemoteExecution() const noexcept -> bool; - [[nodiscard]] auto IsCompatible() noexcept -> std::optional<bool>; + [[nodiscard]] auto IsCompatible() const noexcept -> std::optional<bool>; private: std::unique_ptr<justbuild::just_serve::Configuration::Stub> stub_; diff --git a/src/buildtool/serve_api/remote/source_tree_client.cpp b/src/buildtool/serve_api/remote/source_tree_client.cpp index b734dae8..2d011cab 100644 --- a/src/buildtool/serve_api/remote/source_tree_client.cpp +++ b/src/buildtool/serve_api/remote/source_tree_client.cpp @@ -65,7 +65,8 @@ SourceTreeClient::SourceTreeClient(std::string const& server, auto SourceTreeClient::ServeCommitTree(std::string const& commit_id, std::string const& subdir, - bool sync_tree) noexcept -> result_t { + bool sync_tree) const noexcept + -> result_t { justbuild::just_serve::ServeCommitTreeRequest request{}; request.set_commit(commit_id); request.set_subdir(subdir); @@ -96,7 +97,7 @@ auto SourceTreeClient::ServeArchiveTree( std::string const& archive_type, std::string const& subdir, std::optional<PragmaSpecial> const& resolve_symlinks, - bool sync_tree) noexcept -> result_t { + bool sync_tree) const noexcept -> result_t { justbuild::just_serve::ServeArchiveTreeRequest request{}; request.set_content(content); request.set_archive_type(StringToArchiveType(archive_type)); @@ -128,7 +129,7 @@ auto SourceTreeClient::ServeArchiveTree( auto SourceTreeClient::ServeDistdirTree( std::shared_ptr<std::unordered_map<std::string, std::string>> const& distfiles, - bool sync_tree) noexcept -> result_t { + bool sync_tree) const noexcept -> result_t { justbuild::just_serve::ServeDistdirTreeRequest request{}; for (auto const& [k, v] : *distfiles) { auto* distfile = request.add_distfiles(); @@ -160,7 +161,7 @@ auto SourceTreeClient::ServeDistdirTree( auto SourceTreeClient::ServeForeignFileTree(const std::string& content, const std::string& name, - bool executable) noexcept + bool executable) const noexcept -> result_t { justbuild::just_serve::ServeDistdirTreeRequest request{}; auto* distfile = request.add_distfiles(); @@ -189,7 +190,7 @@ auto SourceTreeClient::ServeForeignFileTree(const std::string& content, return response.tree(); // success } -auto SourceTreeClient::ServeContent(std::string const& content) noexcept +auto SourceTreeClient::ServeContent(std::string const& content) const noexcept -> bool { justbuild::just_serve::ServeContentRequest request{}; request.set_content(content); @@ -212,7 +213,8 @@ auto SourceTreeClient::ServeContent(std::string const& content) noexcept return true; } -auto SourceTreeClient::ServeTree(std::string const& tree_id) noexcept -> bool { +auto SourceTreeClient::ServeTree(std::string const& tree_id) const noexcept + -> bool { justbuild::just_serve::ServeTreeRequest request{}; request.set_tree(tree_id); @@ -233,7 +235,7 @@ auto SourceTreeClient::ServeTree(std::string const& tree_id) noexcept -> bool { return true; } -auto SourceTreeClient::CheckRootTree(std::string const& tree_id) noexcept +auto SourceTreeClient::CheckRootTree(std::string const& tree_id) const noexcept -> std::optional<bool> { justbuild::just_serve::CheckRootTreeRequest request{}; request.set_tree(tree_id); @@ -260,7 +262,7 @@ auto SourceTreeClient::CheckRootTree(std::string const& tree_id) noexcept return true; // tree found } -auto SourceTreeClient::GetRemoteTree(std::string const& tree_id) noexcept +auto SourceTreeClient::GetRemoteTree(std::string const& tree_id) const noexcept -> bool { justbuild::just_serve::GetRemoteTreeRequest request{}; request.set_tree(tree_id); diff --git a/src/buildtool/serve_api/remote/source_tree_client.hpp b/src/buildtool/serve_api/remote/source_tree_client.hpp index 9eeef493..fdfd99f8 100644 --- a/src/buildtool/serve_api/remote/source_tree_client.hpp +++ b/src/buildtool/serve_api/remote/source_tree_client.hpp @@ -45,7 +45,8 @@ class SourceTreeClient { /// at index 1 the tree identifier on success. [[nodiscard]] auto ServeCommitTree(std::string const& commit_id, std::string const& subdir, - bool sync_tree) noexcept -> result_t; + bool sync_tree) const noexcept + -> result_t; /// \brief Retrieve the Git tree of an archive content, if known by the /// endpoint. It is a fatal error if the content blob is known to the @@ -64,7 +65,7 @@ class SourceTreeClient { std::string const& archive_type, std::string const& subdir, std::optional<PragmaSpecial> const& resolve_symlinks, - bool sync_tree) noexcept -> result_t; + bool sync_tree) const noexcept -> result_t; /// \brief Retrieve the Git tree of a directory of distfiles, if all the /// content blobs are known by the endpoint. It is a fatal error if all @@ -78,35 +79,36 @@ class SourceTreeClient { [[nodiscard]] auto ServeDistdirTree( std::shared_ptr<std::unordered_map<std::string, std::string>> const& distfiles, - bool sync_tree) noexcept -> result_t; + bool sync_tree) const noexcept -> result_t; /// \brief Retrieve the Git tree of a foreign-file directory, if all content /// blobs are known to the end point and, as a side effect, make that tree /// known to the serve endpoint. [[nodiscard]] auto ServeForeignFileTree(const std::string& content, const std::string& name, - bool executable) noexcept + bool executable) const noexcept -> result_t; /// \brief Make a given content blob available in remote CAS, if known by /// serve remote. /// \param[in] content Hash of the archive content to look up. /// \returns Flag to state whether content is in remote CAS. - [[nodiscard]] auto ServeContent(std::string const& content) noexcept + [[nodiscard]] auto ServeContent(std::string const& content) const noexcept -> bool; /// \brief Make a given tree available in remote CAS, if known by serve /// remote. /// \param[in] tree_id Identifier of the Git tree to look up. /// \returns Flag to state whether tree is in remote CAS. - [[nodiscard]] auto ServeTree(std::string const& tree_id) noexcept -> bool; + [[nodiscard]] auto ServeTree(std::string const& tree_id) const noexcept + -> bool; /// \brief Checks if the serve endpoint has a given tree locally available /// and makes it available for a serve-orchestrated build. /// \param[in] tree_id Identifier of the Git tree to look up. /// \returns Flag to state whether tree is known or not, or nullopt on /// errors. - [[nodiscard]] auto CheckRootTree(std::string const& tree_id) noexcept + [[nodiscard]] auto CheckRootTree(std::string const& tree_id) const noexcept -> std::optional<bool>; /// \brief Retrieve tree from the CAS of the associated remote-execution @@ -114,7 +116,7 @@ class SourceTreeClient { /// \param[in] tree_id Identifier of the Git tree to retrieve. /// \returns Flag to state whether tree was successfully imported into the /// local Git storage or not. - [[nodiscard]] auto GetRemoteTree(std::string const& tree_id) noexcept + [[nodiscard]] auto GetRemoteTree(std::string const& tree_id) const noexcept -> bool; private: diff --git a/src/buildtool/serve_api/remote/target_client.cpp b/src/buildtool/serve_api/remote/target_client.cpp index 67b50a84..97bb53c1 100644 --- a/src/buildtool/serve_api/remote/target_client.cpp +++ b/src/buildtool/serve_api/remote/target_client.cpp @@ -29,7 +29,7 @@ TargetClient::TargetClient(std::string const& server, Port port) noexcept { } auto TargetClient::ServeTarget(const TargetCacheKey& key, - const std::string& repo_key) noexcept + const std::string& repo_key) const noexcept -> std::optional<serve_target_result_t> { // make sure the blob containing the key is in the remote cas if (!local_api_->RetrieveToCas({key.Id()}, &*remote_api_)) { @@ -169,8 +169,8 @@ auto TargetClient::ServeTarget(const TargetCacheKey& key, auto TargetClient::ServeTargetVariables(std::string const& target_root_id, std::string const& target_file, - std::string const& target) noexcept - -> std::optional<std::vector<std::string>> { + std::string const& target) + const noexcept -> std::optional<std::vector<std::string>> { justbuild::just_serve::ServeTargetVariablesRequest request{}; request.set_root_tree(target_root_id); request.set_target_file(target_file); @@ -197,10 +197,10 @@ auto TargetClient::ServeTargetVariables(std::string const& target_root_id, return res; } -auto TargetClient::ServeTargetDescription(std::string const& target_root_id, - std::string const& target_file, - std::string const& target) noexcept - -> std::optional<ArtifactDigest> { +auto TargetClient::ServeTargetDescription( + std::string const& target_root_id, + std::string const& target_file, + std::string const& target) const noexcept -> std::optional<ArtifactDigest> { justbuild::just_serve::ServeTargetDescriptionRequest request{}; request.set_root_tree(target_root_id); request.set_target_file(target_file); diff --git a/src/buildtool/serve_api/remote/target_client.hpp b/src/buildtool/serve_api/remote/target_client.hpp index 0d34ea2d..15106317 100644 --- a/src/buildtool/serve_api/remote/target_client.hpp +++ b/src/buildtool/serve_api/remote/target_client.hpp @@ -60,7 +60,7 @@ class TargetClient { /// \returns A correspondingly populated result union, or nullopt if remote /// reported that the target was not found. [[nodiscard]] auto ServeTarget(const TargetCacheKey& key, - const std::string& repo_key) noexcept + const std::string& repo_key) const noexcept -> std::optional<serve_target_result_t>; /// \brief Retrieve the flexible config variables of an export target. @@ -70,8 +70,8 @@ class TargetClient { /// \returns The list of flexible config variables, or nullopt on errors. [[nodiscard]] auto ServeTargetVariables(std::string const& target_root_id, std::string const& target_file, - std::string const& target) noexcept - -> std::optional<std::vector<std::string>>; + std::string const& target) + const noexcept -> std::optional<std::vector<std::string>>; /// \brief Retrieve the artifact digest of the blob containing the export /// target description fields required by just describe. @@ -79,10 +79,10 @@ class TargetClient { /// \param[in] target_file Relative path of the target file. /// \param[in] target Name of the target to interrogate. /// \returns The artifact digest, or nullopt on errors. - [[nodiscard]] auto ServeTargetDescription( - std::string const& target_root_id, - std::string const& target_file, - std::string const& target) noexcept -> std::optional<ArtifactDigest>; + [[nodiscard]] auto ServeTargetDescription(std::string const& target_root_id, + std::string const& target_file, + std::string const& target) + const noexcept -> std::optional<ArtifactDigest>; private: std::unique_ptr<justbuild::just_serve::Target::Stub> stub_; |