Merge branch 'master' into grpc_namespace_server_credentials
This commit is contained in:
commit
0cedc27cb6
4
BUILD
4
BUILD
|
|
@ -219,6 +219,7 @@ GRPCXX_PUBLIC_HDRS = [
|
|||
"include/grpcpp/client_context.h",
|
||||
"include/grpcpp/completion_queue.h",
|
||||
"include/grpcpp/create_channel.h",
|
||||
"include/grpcpp/create_channel_impl.h",
|
||||
"include/grpcpp/create_channel_posix.h",
|
||||
"include/grpcpp/create_channel_posix_impl.h",
|
||||
"include/grpcpp/ext/health_check_service_server_builder_option.h",
|
||||
|
|
@ -248,6 +249,7 @@ GRPCXX_PUBLIC_HDRS = [
|
|||
"include/grpcpp/resource_quota_impl.h",
|
||||
"include/grpcpp/security/auth_context.h",
|
||||
"include/grpcpp/security/auth_metadata_processor.h",
|
||||
"include/grpcpp/security/auth_metadata_processor_impl.h",
|
||||
"include/grpcpp/security/credentials.h",
|
||||
"include/grpcpp/security/server_credentials.h",
|
||||
"include/grpcpp/security/server_credentials_impl.h",
|
||||
|
|
@ -400,6 +402,7 @@ grpc_cc_library(
|
|||
hdrs = [
|
||||
"include/grpc++/support/error_details.h",
|
||||
"include/grpcpp/support/error_details.h",
|
||||
"include/grpcpp/support/error_details_impl.h",
|
||||
],
|
||||
language = "c++",
|
||||
standalone = True,
|
||||
|
|
@ -1470,6 +1473,7 @@ grpc_cc_library(
|
|||
language = "c++",
|
||||
public_hdrs = [
|
||||
"include/grpcpp/ext/server_load_reporting.h",
|
||||
"include/grpcpp/ext/server_load_reporting_impl.h",
|
||||
],
|
||||
deps = [
|
||||
"lb_server_load_reporting_filter",
|
||||
|
|
|
|||
2
BUILD.gn
2
BUILD.gn
|
|
@ -1006,6 +1006,7 @@ config("grpc_config") {
|
|||
"include/grpcpp/client_context.h",
|
||||
"include/grpcpp/completion_queue.h",
|
||||
"include/grpcpp/create_channel.h",
|
||||
"include/grpcpp/create_channel_impl.h",
|
||||
"include/grpcpp/create_channel_posix.h",
|
||||
"include/grpcpp/create_channel_posix_impl.h",
|
||||
"include/grpcpp/ext/health_check_service_server_builder_option.h",
|
||||
|
|
@ -1079,6 +1080,7 @@ config("grpc_config") {
|
|||
"include/grpcpp/resource_quota_impl.h",
|
||||
"include/grpcpp/security/auth_context.h",
|
||||
"include/grpcpp/security/auth_metadata_processor.h",
|
||||
"include/grpcpp/security/auth_metadata_processor_impl.h",
|
||||
"include/grpcpp/security/credentials.h",
|
||||
"include/grpcpp/security/server_credentials.h",
|
||||
"include/grpcpp/server.h",
|
||||
|
|
|
|||
|
|
@ -3000,6 +3000,7 @@ foreach(_hdr
|
|||
include/grpcpp/client_context.h
|
||||
include/grpcpp/completion_queue.h
|
||||
include/grpcpp/create_channel.h
|
||||
include/grpcpp/create_channel_impl.h
|
||||
include/grpcpp/create_channel_posix.h
|
||||
include/grpcpp/create_channel_posix_impl.h
|
||||
include/grpcpp/ext/health_check_service_server_builder_option.h
|
||||
|
|
@ -3027,6 +3028,7 @@ foreach(_hdr
|
|||
include/grpcpp/resource_quota_impl.h
|
||||
include/grpcpp/security/auth_context.h
|
||||
include/grpcpp/security/auth_metadata_processor.h
|
||||
include/grpcpp/security/auth_metadata_processor_impl.h
|
||||
include/grpcpp/security/credentials.h
|
||||
include/grpcpp/security/server_credentials.h
|
||||
include/grpcpp/server.h
|
||||
|
|
@ -3597,6 +3599,7 @@ foreach(_hdr
|
|||
include/grpcpp/client_context.h
|
||||
include/grpcpp/completion_queue.h
|
||||
include/grpcpp/create_channel.h
|
||||
include/grpcpp/create_channel_impl.h
|
||||
include/grpcpp/create_channel_posix.h
|
||||
include/grpcpp/create_channel_posix_impl.h
|
||||
include/grpcpp/ext/health_check_service_server_builder_option.h
|
||||
|
|
@ -3624,6 +3627,7 @@ foreach(_hdr
|
|||
include/grpcpp/resource_quota_impl.h
|
||||
include/grpcpp/security/auth_context.h
|
||||
include/grpcpp/security/auth_metadata_processor.h
|
||||
include/grpcpp/security/auth_metadata_processor_impl.h
|
||||
include/grpcpp/security/credentials.h
|
||||
include/grpcpp/security/server_credentials.h
|
||||
include/grpcpp/server.h
|
||||
|
|
@ -3838,6 +3842,7 @@ target_link_libraries(grpc++_error_details
|
|||
foreach(_hdr
|
||||
include/grpc++/support/error_details.h
|
||||
include/grpcpp/support/error_details.h
|
||||
include/grpcpp/support/error_details_impl.h
|
||||
)
|
||||
string(REPLACE "include/" "" _path ${_hdr})
|
||||
get_filename_component(_path ${_path} PATH)
|
||||
|
|
@ -4566,6 +4571,7 @@ foreach(_hdr
|
|||
include/grpcpp/client_context.h
|
||||
include/grpcpp/completion_queue.h
|
||||
include/grpcpp/create_channel.h
|
||||
include/grpcpp/create_channel_impl.h
|
||||
include/grpcpp/create_channel_posix.h
|
||||
include/grpcpp/create_channel_posix_impl.h
|
||||
include/grpcpp/ext/health_check_service_server_builder_option.h
|
||||
|
|
@ -4593,6 +4599,7 @@ foreach(_hdr
|
|||
include/grpcpp/resource_quota_impl.h
|
||||
include/grpcpp/security/auth_context.h
|
||||
include/grpcpp/security/auth_metadata_processor.h
|
||||
include/grpcpp/security/auth_metadata_processor_impl.h
|
||||
include/grpcpp/security/credentials.h
|
||||
include/grpcpp/security/server_credentials.h
|
||||
include/grpcpp/server.h
|
||||
|
|
|
|||
7
Makefile
7
Makefile
|
|
@ -5331,6 +5331,7 @@ PUBLIC_HEADERS_CXX += \
|
|||
include/grpcpp/client_context.h \
|
||||
include/grpcpp/completion_queue.h \
|
||||
include/grpcpp/create_channel.h \
|
||||
include/grpcpp/create_channel_impl.h \
|
||||
include/grpcpp/create_channel_posix.h \
|
||||
include/grpcpp/create_channel_posix_impl.h \
|
||||
include/grpcpp/ext/health_check_service_server_builder_option.h \
|
||||
|
|
@ -5358,6 +5359,7 @@ PUBLIC_HEADERS_CXX += \
|
|||
include/grpcpp/resource_quota_impl.h \
|
||||
include/grpcpp/security/auth_context.h \
|
||||
include/grpcpp/security/auth_metadata_processor.h \
|
||||
include/grpcpp/security/auth_metadata_processor_impl.h \
|
||||
include/grpcpp/security/credentials.h \
|
||||
include/grpcpp/security/server_credentials.h \
|
||||
include/grpcpp/server.h \
|
||||
|
|
@ -5936,6 +5938,7 @@ PUBLIC_HEADERS_CXX += \
|
|||
include/grpcpp/client_context.h \
|
||||
include/grpcpp/completion_queue.h \
|
||||
include/grpcpp/create_channel.h \
|
||||
include/grpcpp/create_channel_impl.h \
|
||||
include/grpcpp/create_channel_posix.h \
|
||||
include/grpcpp/create_channel_posix_impl.h \
|
||||
include/grpcpp/ext/health_check_service_server_builder_option.h \
|
||||
|
|
@ -5963,6 +5966,7 @@ PUBLIC_HEADERS_CXX += \
|
|||
include/grpcpp/resource_quota_impl.h \
|
||||
include/grpcpp/security/auth_context.h \
|
||||
include/grpcpp/security/auth_metadata_processor.h \
|
||||
include/grpcpp/security/auth_metadata_processor_impl.h \
|
||||
include/grpcpp/security/credentials.h \
|
||||
include/grpcpp/security/server_credentials.h \
|
||||
include/grpcpp/server.h \
|
||||
|
|
@ -6183,6 +6187,7 @@ LIBGRPC++_ERROR_DETAILS_SRC = \
|
|||
PUBLIC_HEADERS_CXX += \
|
||||
include/grpc++/support/error_details.h \
|
||||
include/grpcpp/support/error_details.h \
|
||||
include/grpcpp/support/error_details_impl.h \
|
||||
|
||||
LIBGRPC++_ERROR_DETAILS_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_ERROR_DETAILS_SRC))))
|
||||
|
||||
|
|
@ -6854,6 +6859,7 @@ PUBLIC_HEADERS_CXX += \
|
|||
include/grpcpp/client_context.h \
|
||||
include/grpcpp/completion_queue.h \
|
||||
include/grpcpp/create_channel.h \
|
||||
include/grpcpp/create_channel_impl.h \
|
||||
include/grpcpp/create_channel_posix.h \
|
||||
include/grpcpp/create_channel_posix_impl.h \
|
||||
include/grpcpp/ext/health_check_service_server_builder_option.h \
|
||||
|
|
@ -6881,6 +6887,7 @@ PUBLIC_HEADERS_CXX += \
|
|||
include/grpcpp/resource_quota_impl.h \
|
||||
include/grpcpp/security/auth_context.h \
|
||||
include/grpcpp/security/auth_metadata_processor.h \
|
||||
include/grpcpp/security/auth_metadata_processor_impl.h \
|
||||
include/grpcpp/security/credentials.h \
|
||||
include/grpcpp/security/server_credentials.h \
|
||||
include/grpcpp/server.h \
|
||||
|
|
|
|||
|
|
@ -1346,6 +1346,7 @@ filegroups:
|
|||
- include/grpcpp/client_context.h
|
||||
- include/grpcpp/completion_queue.h
|
||||
- include/grpcpp/create_channel.h
|
||||
- include/grpcpp/create_channel_impl.h
|
||||
- include/grpcpp/create_channel_posix.h
|
||||
- include/grpcpp/create_channel_posix_impl.h
|
||||
- include/grpcpp/ext/health_check_service_server_builder_option.h
|
||||
|
|
@ -1373,6 +1374,7 @@ filegroups:
|
|||
- include/grpcpp/resource_quota_impl.h
|
||||
- include/grpcpp/security/auth_context.h
|
||||
- include/grpcpp/security/auth_metadata_processor.h
|
||||
- include/grpcpp/security/auth_metadata_processor_impl.h
|
||||
- include/grpcpp/security/credentials.h
|
||||
- include/grpcpp/security/server_credentials.h
|
||||
- include/grpcpp/server.h
|
||||
|
|
@ -1722,6 +1724,7 @@ libs:
|
|||
public_headers:
|
||||
- include/grpc++/support/error_details.h
|
||||
- include/grpcpp/support/error_details.h
|
||||
- include/grpcpp/support/error_details_impl.h
|
||||
src:
|
||||
- src/proto/grpc/status/status.proto
|
||||
- src/cpp/util/error_details.cc
|
||||
|
|
|
|||
|
|
@ -151,24 +151,25 @@ class RouteGuideImpl final : public RouteGuide::Service {
|
|||
|
||||
Status RouteChat(ServerContext* context,
|
||||
ServerReaderWriter<RouteNote, RouteNote>* stream) override {
|
||||
std::vector<RouteNote> received_notes;
|
||||
RouteNote note;
|
||||
while (stream->Read(¬e)) {
|
||||
for (const RouteNote& n : received_notes) {
|
||||
std::unique_lock<std::mutex> lock(mu_);
|
||||
for (const RouteNote& n : received_notes_) {
|
||||
if (n.location().latitude() == note.location().latitude() &&
|
||||
n.location().longitude() == note.location().longitude()) {
|
||||
stream->Write(n);
|
||||
}
|
||||
}
|
||||
received_notes.push_back(note);
|
||||
received_notes_.push_back(note);
|
||||
}
|
||||
|
||||
return Status::OK;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::vector<Feature> feature_list_;
|
||||
std::mutex mu_;
|
||||
std::vector<RouteNote> received_notes_;
|
||||
};
|
||||
|
||||
void RunServer(const std::string& db_path) {
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ Pod::Spec.new do |s|
|
|||
'include/grpcpp/client_context.h',
|
||||
'include/grpcpp/completion_queue.h',
|
||||
'include/grpcpp/create_channel.h',
|
||||
'include/grpcpp/create_channel_impl.h',
|
||||
'include/grpcpp/create_channel_posix.h',
|
||||
'include/grpcpp/create_channel_posix_impl.h',
|
||||
'include/grpcpp/ext/health_check_service_server_builder_option.h',
|
||||
|
|
@ -112,6 +113,7 @@ Pod::Spec.new do |s|
|
|||
'include/grpcpp/resource_quota_impl.h',
|
||||
'include/grpcpp/security/auth_context.h',
|
||||
'include/grpcpp/security/auth_metadata_processor.h',
|
||||
'include/grpcpp/security/auth_metadata_processor_impl.h',
|
||||
'include/grpcpp/security/credentials.h',
|
||||
'include/grpcpp/security/server_credentials.h',
|
||||
'include/grpcpp/server.h',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
* Copyright 2019 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -19,60 +19,36 @@
|
|||
#ifndef GRPCPP_CREATE_CHANNEL_H
|
||||
#define GRPCPP_CREATE_CHANNEL_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <grpcpp/channel.h>
|
||||
#include <grpcpp/impl/codegen/client_interceptor.h>
|
||||
#include <grpcpp/security/credentials.h>
|
||||
#include <grpcpp/support/channel_arguments.h>
|
||||
#include <grpcpp/support/config.h>
|
||||
#include <grpcpp/create_channel_impl.h>
|
||||
|
||||
namespace grpc {
|
||||
|
||||
/// Create a new \a Channel pointing to \a target.
|
||||
///
|
||||
/// \param target The URI of the endpoint to connect to.
|
||||
/// \param creds Credentials to use for the created channel. If it does not
|
||||
/// hold an object or is invalid, a lame channel (one on which all operations
|
||||
/// fail) is returned.
|
||||
std::shared_ptr<Channel> CreateChannel(
|
||||
static inline std::shared_ptr<Channel> CreateChannel(
|
||||
const grpc::string& target,
|
||||
const std::shared_ptr<ChannelCredentials>& creds);
|
||||
const std::shared_ptr<ChannelCredentials>& creds) {
|
||||
return ::grpc_impl::CreateChannel(target, creds);
|
||||
}
|
||||
|
||||
/// Create a new \em custom \a Channel pointing to \a target.
|
||||
///
|
||||
/// \warning For advanced use and testing ONLY. Override default channel
|
||||
/// arguments only if necessary.
|
||||
///
|
||||
/// \param target The URI of the endpoint to connect to.
|
||||
/// \param creds Credentials to use for the created channel. If it does not
|
||||
/// hold an object or is invalid, a lame channel (one on which all operations
|
||||
/// fail) is returned.
|
||||
/// \param args Options for channel creation.
|
||||
std::shared_ptr<Channel> CreateCustomChannel(
|
||||
static inline std::shared_ptr<Channel> CreateCustomChannel(
|
||||
const grpc::string& target,
|
||||
const std::shared_ptr<ChannelCredentials>& creds,
|
||||
const ChannelArguments& args);
|
||||
const ChannelArguments& args) {
|
||||
return ::grpc_impl::CreateCustomChannel(target, creds, args);
|
||||
}
|
||||
|
||||
namespace experimental {
|
||||
/// Create a new \em custom \a Channel pointing to \a target with \a
|
||||
/// interceptors being invoked per call.
|
||||
///
|
||||
/// \warning For advanced use and testing ONLY. Override default channel
|
||||
/// arguments only if necessary.
|
||||
///
|
||||
/// \param target The URI of the endpoint to connect to.
|
||||
/// \param creds Credentials to use for the created channel. If it does not
|
||||
/// hold an object or is invalid, a lame channel (one on which all operations
|
||||
/// fail) is returned.
|
||||
/// \param args Options for channel creation.
|
||||
std::shared_ptr<Channel> CreateCustomChannelWithInterceptors(
|
||||
|
||||
static inline std::shared_ptr<Channel> CreateCustomChannelWithInterceptors(
|
||||
const grpc::string& target,
|
||||
const std::shared_ptr<ChannelCredentials>& creds,
|
||||
const ChannelArguments& args,
|
||||
std::vector<
|
||||
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
|
||||
interceptor_creators);
|
||||
interceptor_creators) {
|
||||
return ::grpc_impl::experimental::CreateCustomChannelWithInterceptors(
|
||||
target, creds, args, std::move(interceptor_creators));
|
||||
}
|
||||
|
||||
} // namespace experimental
|
||||
} // namespace grpc
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPCPP_CREATE_CHANNEL_IMPL_H
|
||||
#define GRPCPP_CREATE_CHANNEL_IMPL_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <grpcpp/channel.h>
|
||||
#include <grpcpp/impl/codegen/client_interceptor.h>
|
||||
#include <grpcpp/security/credentials.h>
|
||||
#include <grpcpp/support/channel_arguments.h>
|
||||
#include <grpcpp/support/config.h>
|
||||
|
||||
namespace grpc_impl {
|
||||
|
||||
/// Create a new \a Channel pointing to \a target.
|
||||
///
|
||||
/// \param target The URI of the endpoint to connect to.
|
||||
/// \param creds Credentials to use for the created channel. If it does not
|
||||
/// hold an object or is invalid, a lame channel (one on which all operations
|
||||
/// fail) is returned.
|
||||
std::shared_ptr<grpc::Channel> CreateChannel(
|
||||
const grpc::string& target,
|
||||
const std::shared_ptr<grpc::ChannelCredentials>& creds);
|
||||
|
||||
/// Create a new \em custom \a Channel pointing to \a target.
|
||||
///
|
||||
/// \warning For advanced use and testing ONLY. Override default channel
|
||||
/// arguments only if necessary.
|
||||
///
|
||||
/// \param target The URI of the endpoint to connect to.
|
||||
/// \param creds Credentials to use for the created channel. If it does not
|
||||
/// hold an object or is invalid, a lame channel (one on which all operations
|
||||
/// fail) is returned.
|
||||
/// \param args Options for channel creation.
|
||||
std::shared_ptr<grpc::Channel> CreateCustomChannel(
|
||||
const grpc::string& target,
|
||||
const std::shared_ptr<grpc::ChannelCredentials>& creds,
|
||||
const grpc::ChannelArguments& args);
|
||||
|
||||
namespace experimental {
|
||||
/// Create a new \em custom \a Channel pointing to \a target with \a
|
||||
/// interceptors being invoked per call.
|
||||
///
|
||||
/// \warning For advanced use and testing ONLY. Override default channel
|
||||
/// arguments only if necessary.
|
||||
///
|
||||
/// \param target The URI of the endpoint to connect to.
|
||||
/// \param creds Credentials to use for the created channel. If it does not
|
||||
/// hold an object or is invalid, a lame channel (one on which all operations
|
||||
/// fail) is returned.
|
||||
/// \param args Options for channel creation.
|
||||
std::shared_ptr<grpc::Channel> CreateCustomChannelWithInterceptors(
|
||||
const grpc::string& target,
|
||||
const std::shared_ptr<grpc::ChannelCredentials>& creds,
|
||||
const grpc::ChannelArguments& args,
|
||||
std::vector<
|
||||
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
|
||||
interceptor_creators);
|
||||
} // namespace experimental
|
||||
} // namespace grpc_impl
|
||||
|
||||
#endif // GRPCPP_CREATE_CHANNEL_IMPL_H
|
||||
|
|
@ -19,32 +19,22 @@
|
|||
#ifndef GRPCPP_EXT_SERVER_LOAD_REPORTING_H
|
||||
#define GRPCPP_EXT_SERVER_LOAD_REPORTING_H
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#include <grpc/load_reporting.h>
|
||||
#include <grpcpp/impl/codegen/config.h>
|
||||
#include <grpcpp/impl/codegen/server_context.h>
|
||||
#include <grpcpp/impl/server_builder_option.h>
|
||||
#include <grpcpp/ext/server_load_reporting_impl.h>
|
||||
|
||||
namespace grpc {
|
||||
namespace load_reporter {
|
||||
namespace experimental {
|
||||
|
||||
// The ServerBuilderOption to enable server-side load reporting feature. To
|
||||
// enable the feature, please make sure the binary builds with the
|
||||
// grpcpp_server_load_reporting library and set this option in the
|
||||
// ServerBuilder.
|
||||
class LoadReportingServiceServerBuilderOption : public ServerBuilderOption {
|
||||
public:
|
||||
void UpdateArguments(::grpc::ChannelArguments* args) override;
|
||||
void UpdatePlugins(std::vector<std::unique_ptr<::grpc::ServerBuilderPlugin>>*
|
||||
plugins) override;
|
||||
};
|
||||
typedef ::grpc_impl::load_reporter::experimental::
|
||||
LoadReportingServiceServerBuilderOption
|
||||
LoadReportingServiceServerBuilderOption;
|
||||
|
||||
// Adds the load reporting cost with \a cost_name and \a cost_value in the
|
||||
// trailing metadata of the server context.
|
||||
void AddLoadReportingCost(grpc::ServerContext* ctx,
|
||||
const grpc::string& cost_name, double cost_value);
|
||||
static inline void AddLoadReportingCost(grpc::ServerContext* ctx,
|
||||
const grpc::string& cost_name,
|
||||
double cost_value) {
|
||||
::grpc_impl::load_reporter::experimental::AddLoadReportingCost(ctx, cost_name,
|
||||
cost_value);
|
||||
}
|
||||
|
||||
} // namespace experimental
|
||||
} // namespace load_reporter
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2018 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPCPP_EXT_SERVER_LOAD_REPORTING_IMPL_H
|
||||
#define GRPCPP_EXT_SERVER_LOAD_REPORTING_IMPL_H
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#include <grpc/load_reporting.h>
|
||||
#include <grpcpp/impl/codegen/config.h>
|
||||
#include <grpcpp/impl/codegen/server_context.h>
|
||||
#include <grpcpp/impl/server_builder_option.h>
|
||||
|
||||
namespace grpc_impl {
|
||||
namespace load_reporter {
|
||||
namespace experimental {
|
||||
|
||||
// The ServerBuilderOption to enable server-side load reporting feature. To
|
||||
// enable the feature, please make sure the binary builds with the
|
||||
// grpcpp_server_load_reporting library and set this option in the
|
||||
// ServerBuilder.
|
||||
class LoadReportingServiceServerBuilderOption
|
||||
: public grpc::ServerBuilderOption {
|
||||
public:
|
||||
void UpdateArguments(::grpc::ChannelArguments* args) override;
|
||||
void UpdatePlugins(std::vector<std::unique_ptr<::grpc::ServerBuilderPlugin>>*
|
||||
plugins) override;
|
||||
};
|
||||
|
||||
// Adds the load reporting cost with \a cost_name and \a cost_value in the
|
||||
// trailing metadata of the server context.
|
||||
void AddLoadReportingCost(grpc::ServerContext* ctx,
|
||||
const grpc::string& cost_name, double cost_value);
|
||||
|
||||
} // namespace experimental
|
||||
} // namespace load_reporter
|
||||
} // namespace grpc_impl
|
||||
|
||||
#endif // GRPCPP_EXT_SERVER_LOAD_REPORTING_IMPL_H
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
* Copyright 2019 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -19,42 +19,11 @@
|
|||
#ifndef GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_H
|
||||
#define GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_H
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <grpcpp/security/auth_context.h>
|
||||
#include <grpcpp/support/status.h>
|
||||
#include <grpcpp/support/string_ref.h>
|
||||
#include <grpcpp/security/auth_metadata_processor_impl.h>
|
||||
|
||||
namespace grpc {
|
||||
|
||||
/// Interface allowing custom server-side authorization based on credentials
|
||||
/// encoded in metadata. Objects of this type can be passed to
|
||||
/// \a ServerCredentials::SetAuthMetadataProcessor().
|
||||
class AuthMetadataProcessor {
|
||||
public:
|
||||
typedef std::multimap<grpc::string_ref, grpc::string_ref> InputMetadata;
|
||||
typedef std::multimap<grpc::string, grpc::string> OutputMetadata;
|
||||
|
||||
virtual ~AuthMetadataProcessor() {}
|
||||
|
||||
/// If this method returns true, the \a Process function will be scheduled in
|
||||
/// a different thread from the one processing the call.
|
||||
virtual bool IsBlocking() const { return true; }
|
||||
|
||||
/// context is read/write: it contains the properties of the channel peer and
|
||||
/// it is the job of the Process method to augment it with properties derived
|
||||
/// from the passed-in auth_metadata.
|
||||
/// consumed_auth_metadata needs to be filled with metadata that has been
|
||||
/// consumed by the processor and will be removed from the call.
|
||||
/// response_metadata is the metadata that will be sent as part of the
|
||||
/// response.
|
||||
/// If the return value is not Status::OK, the rpc call will be aborted with
|
||||
/// the error code and error message sent back to the client.
|
||||
virtual Status Process(const InputMetadata& auth_metadata,
|
||||
AuthContext* context,
|
||||
OutputMetadata* consumed_auth_metadata,
|
||||
OutputMetadata* response_metadata) = 0;
|
||||
};
|
||||
typedef ::grpc_impl::AuthMetadataProcessor AuthMetadataProcessor;
|
||||
|
||||
} // namespace grpc
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2015 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_IMPL_H
|
||||
#define GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_IMPL_H
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <grpcpp/security/auth_context.h>
|
||||
#include <grpcpp/support/status.h>
|
||||
#include <grpcpp/support/string_ref.h>
|
||||
|
||||
namespace grpc_impl {
|
||||
|
||||
/// Interface allowing custom server-side authorization based on credentials
|
||||
/// encoded in metadata. Objects of this type can be passed to
|
||||
/// \a ServerCredentials::SetAuthMetadataProcessor().
|
||||
class AuthMetadataProcessor {
|
||||
public:
|
||||
typedef std::multimap<grpc::string_ref, grpc::string_ref> InputMetadata;
|
||||
typedef std::multimap<grpc::string, grpc::string> OutputMetadata;
|
||||
|
||||
virtual ~AuthMetadataProcessor() {}
|
||||
|
||||
/// If this method returns true, the \a Process function will be scheduled in
|
||||
/// a different thread from the one processing the call.
|
||||
virtual bool IsBlocking() const { return true; }
|
||||
|
||||
/// context is read/write: it contains the properties of the channel peer and
|
||||
/// it is the job of the Process method to augment it with properties derived
|
||||
/// from the passed-in auth_metadata.
|
||||
/// consumed_auth_metadata needs to be filled with metadata that has been
|
||||
/// consumed by the processor and will be removed from the call.
|
||||
/// response_metadata is the metadata that will be sent as part of the
|
||||
/// response.
|
||||
/// If the return value is not Status::OK, the rpc call will be aborted with
|
||||
/// the error code and error message sent back to the client.
|
||||
virtual grpc::Status Process(const InputMetadata& auth_metadata,
|
||||
grpc::AuthContext* context,
|
||||
OutputMetadata* consumed_auth_metadata,
|
||||
OutputMetadata* response_metadata) = 0;
|
||||
};
|
||||
|
||||
} // namespace grpc_impl
|
||||
|
||||
#endif // GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_IMPL_H
|
||||
|
|
@ -33,23 +33,31 @@
|
|||
struct grpc_call;
|
||||
|
||||
namespace grpc {
|
||||
class ChannelArguments;
|
||||
class Channel;
|
||||
class SecureChannelCredentials;
|
||||
class CallCredentials;
|
||||
class SecureCallCredentials;
|
||||
|
||||
class CallCredentials;
|
||||
class ChannelArguments;
|
||||
class ChannelCredentials;
|
||||
} // namespace grpc
|
||||
namespace grpc_impl {
|
||||
std::shared_ptr<grpc::Channel> CreateCustomChannel(
|
||||
const grpc::string& target,
|
||||
const std::shared_ptr<grpc::ChannelCredentials>& creds,
|
||||
const grpc::ChannelArguments& args);
|
||||
|
||||
namespace experimental {
|
||||
std::shared_ptr<Channel> CreateCustomChannelWithInterceptors(
|
||||
std::shared_ptr<grpc::Channel> CreateCustomChannelWithInterceptors(
|
||||
const grpc::string& target,
|
||||
const std::shared_ptr<ChannelCredentials>& creds,
|
||||
const ChannelArguments& args,
|
||||
const std::shared_ptr<grpc::ChannelCredentials>& creds,
|
||||
const grpc::ChannelArguments& args,
|
||||
std::vector<
|
||||
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
|
||||
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
|
||||
interceptor_creators);
|
||||
} // namespace experimental
|
||||
} // namespace grpc_impl
|
||||
namespace grpc {
|
||||
class Channel;
|
||||
class SecureChannelCredentials;
|
||||
class SecureCallCredentials;
|
||||
|
||||
/// A channel credentials object encapsulates all the state needed by a client
|
||||
/// to authenticate with a server for a given channel.
|
||||
|
|
@ -70,18 +78,18 @@ class ChannelCredentials : private GrpcLibraryCodegen {
|
|||
virtual SecureChannelCredentials* AsSecureCredentials() = 0;
|
||||
|
||||
private:
|
||||
friend std::shared_ptr<Channel> CreateCustomChannel(
|
||||
friend std::shared_ptr<Channel> grpc_impl::CreateCustomChannel(
|
||||
const grpc::string& target,
|
||||
const std::shared_ptr<ChannelCredentials>& creds,
|
||||
const ChannelArguments& args);
|
||||
const grpc::ChannelArguments& args);
|
||||
|
||||
friend std::shared_ptr<Channel>
|
||||
experimental::CreateCustomChannelWithInterceptors(
|
||||
grpc_impl::experimental::CreateCustomChannelWithInterceptors(
|
||||
const grpc::string& target,
|
||||
const std::shared_ptr<ChannelCredentials>& creds,
|
||||
const ChannelArguments& args,
|
||||
std::vector<
|
||||
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
|
||||
const grpc::ChannelArguments& args,
|
||||
std::vector<std::unique_ptr<
|
||||
grpc::experimental::ClientInterceptorFactoryInterface>>
|
||||
interceptor_creators);
|
||||
|
||||
virtual std::shared_ptr<Channel> CreateChannel(
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#ifndef GRPCPP_SUPPORT_ERROR_DETAILS_H
|
||||
#define GRPCPP_SUPPORT_ERROR_DETAILS_H
|
||||
|
||||
#include <grpcpp/support/status.h>
|
||||
#include <grpcpp/support/error_details_impl.h>
|
||||
|
||||
namespace google {
|
||||
namespace rpc {
|
||||
|
|
@ -29,17 +29,15 @@ class Status;
|
|||
|
||||
namespace grpc {
|
||||
|
||||
/// Map a \a grpc::Status to a \a google::rpc::Status.
|
||||
/// The given \a to object will be cleared.
|
||||
/// On success, returns status with OK.
|
||||
/// Returns status with \a INVALID_ARGUMENT, if failed to deserialize.
|
||||
/// Returns status with \a FAILED_PRECONDITION, if \a to is nullptr.
|
||||
Status ExtractErrorDetails(const Status& from, ::google::rpc::Status* to);
|
||||
static inline Status ExtractErrorDetails(const Status& from,
|
||||
::google::rpc::Status* to) {
|
||||
return ::grpc_impl::ExtractErrorDetails(from, to);
|
||||
}
|
||||
|
||||
/// Map \a google::rpc::Status to a \a grpc::Status.
|
||||
/// Returns OK on success.
|
||||
/// Returns status with \a FAILED_PRECONDITION if \a to is nullptr.
|
||||
Status SetErrorDetails(const ::google::rpc::Status& from, Status* to);
|
||||
static inline Status SetErrorDetails(const ::google::rpc::Status& from,
|
||||
Status* to) {
|
||||
return ::grpc_impl::SetErrorDetails(from, to);
|
||||
}
|
||||
|
||||
} // namespace grpc
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2017 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GRPCPP_SUPPORT_ERROR_DETAILS_IMPL_H
|
||||
#define GRPCPP_SUPPORT_ERROR_DETAILS_IMPL_H
|
||||
|
||||
#include <grpcpp/support/status.h>
|
||||
|
||||
namespace google {
|
||||
namespace rpc {
|
||||
class Status;
|
||||
} // namespace rpc
|
||||
} // namespace google
|
||||
|
||||
namespace grpc_impl {
|
||||
|
||||
/// Map a \a grpc::Status to a \a google::rpc::Status.
|
||||
/// The given \a to object will be cleared.
|
||||
/// On success, returns status with OK.
|
||||
/// Returns status with \a INVALID_ARGUMENT, if failed to deserialize.
|
||||
/// Returns status with \a FAILED_PRECONDITION, if \a to is nullptr.
|
||||
grpc::Status ExtractErrorDetails(const grpc::Status& from,
|
||||
::google::rpc::Status* to);
|
||||
|
||||
/// Map \a google::rpc::Status to a \a grpc::Status.
|
||||
/// Returns OK on success.
|
||||
/// Returns status with \a FAILED_PRECONDITION if \a to is nullptr.
|
||||
grpc::Status SetErrorDetails(const ::google::rpc::Status& from,
|
||||
grpc::Status* to);
|
||||
|
||||
} // namespace grpc_impl
|
||||
|
||||
#endif // GRPCPP_SUPPORT_ERROR_DETAILS_IMPL_H
|
||||
|
|
@ -349,7 +349,6 @@ void HealthCheckClient::CallState::StartCall() {
|
|||
return;
|
||||
}
|
||||
// Initialize payload and batch.
|
||||
memset(&batch_, 0, sizeof(batch_));
|
||||
payload_.context = context_;
|
||||
batch_.payload = &payload_;
|
||||
// on_complete callback takes ref, handled manually.
|
||||
|
|
@ -401,8 +400,6 @@ void HealthCheckClient::CallState::StartCall() {
|
|||
// Start batch.
|
||||
StartBatch(&batch_);
|
||||
// Initialize recv_trailing_metadata batch.
|
||||
memset(&recv_trailing_metadata_batch_, 0,
|
||||
sizeof(recv_trailing_metadata_batch_));
|
||||
recv_trailing_metadata_batch_.payload = &payload_;
|
||||
// Add recv_trailing_metadata op.
|
||||
grpc_metadata_batch_init(&recv_trailing_metadata_);
|
||||
|
|
@ -507,7 +504,6 @@ void HealthCheckClient::CallState::DoneReadingRecvMessage(grpc_error* error) {
|
|||
// This re-uses the ref we're holding.
|
||||
// Note: Can't just reuse batch_ here, since we don't know that all
|
||||
// callbacks from the original batch have completed yet.
|
||||
memset(&recv_message_batch_, 0, sizeof(recv_message_batch_));
|
||||
recv_message_batch_.payload = &payload_;
|
||||
payload_.recv_message.recv_message = &recv_message_;
|
||||
payload_.recv_message.recv_message_ready = GRPC_CLOSURE_INIT(
|
||||
|
|
|
|||
|
|
@ -172,7 +172,6 @@ static int is_metadata_server_reachable() {
|
|||
detector.pollent = grpc_polling_entity_create_from_pollset(pollset);
|
||||
detector.is_done = 0;
|
||||
detector.success = 0;
|
||||
memset(&detector.response, 0, sizeof(detector.response));
|
||||
memset(&request, 0, sizeof(grpc_httpcli_request));
|
||||
request.host = (char*)GRPC_COMPUTE_ENGINE_DETECTION_HOST;
|
||||
request.http.path = (char*)"/";
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "src/core/lib/gpr/alloc.h"
|
||||
#include "src/core/lib/gpr/string.h"
|
||||
#include "src/core/lib/gprpp/memory.h"
|
||||
#include "src/core/lib/iomgr/executor.h"
|
||||
#include "src/core/lib/iomgr/iomgr.h"
|
||||
#include "src/core/lib/slice/slice_internal.h"
|
||||
|
|
@ -243,25 +244,26 @@ void grpc_transport_stream_op_batch_finish_with_failure(
|
|||
GRPC_ERROR_UNREF(error);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
struct made_transport_op {
|
||||
grpc_closure outer_on_complete;
|
||||
grpc_closure* inner_on_complete;
|
||||
grpc_closure* inner_on_complete = nullptr;
|
||||
grpc_transport_op op;
|
||||
} made_transport_op;
|
||||
made_transport_op() {
|
||||
memset(&outer_on_complete, 0, sizeof(outer_on_complete));
|
||||
}
|
||||
};
|
||||
|
||||
static void destroy_made_transport_op(void* arg, grpc_error* error) {
|
||||
made_transport_op* op = static_cast<made_transport_op*>(arg);
|
||||
GRPC_CLOSURE_SCHED(op->inner_on_complete, GRPC_ERROR_REF(error));
|
||||
gpr_free(op);
|
||||
grpc_core::Delete<made_transport_op>(op);
|
||||
}
|
||||
|
||||
grpc_transport_op* grpc_make_transport_op(grpc_closure* on_complete) {
|
||||
made_transport_op* op =
|
||||
static_cast<made_transport_op*>(gpr_malloc(sizeof(*op)));
|
||||
made_transport_op* op = grpc_core::New<made_transport_op>();
|
||||
GRPC_CLOSURE_INIT(&op->outer_on_complete, destroy_made_transport_op, op,
|
||||
grpc_schedule_on_exec_ctx);
|
||||
op->inner_on_complete = on_complete;
|
||||
memset(&op->op, 0, sizeof(op->op));
|
||||
op->op.on_consumed = &op->outer_on_complete;
|
||||
return &op->op;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,34 +19,38 @@
|
|||
#include <memory>
|
||||
|
||||
#include <grpcpp/channel.h>
|
||||
#include <grpcpp/create_channel.h>
|
||||
#include <grpcpp/create_channel_impl.h>
|
||||
#include <grpcpp/impl/grpc_library.h>
|
||||
#include <grpcpp/support/channel_arguments.h>
|
||||
|
||||
#include "src/cpp/client/create_channel_internal.h"
|
||||
|
||||
namespace grpc {
|
||||
class ChannelArguments;
|
||||
|
||||
std::shared_ptr<Channel> CreateChannel(
|
||||
class ChannelArguments;
|
||||
}
|
||||
namespace grpc_impl {
|
||||
std::shared_ptr<grpc::Channel> CreateChannel(
|
||||
const grpc::string& target,
|
||||
const std::shared_ptr<ChannelCredentials>& creds) {
|
||||
return CreateCustomChannel(target, creds, ChannelArguments());
|
||||
const std::shared_ptr<grpc::ChannelCredentials>& creds) {
|
||||
return CreateCustomChannel(target, creds, grpc::ChannelArguments());
|
||||
}
|
||||
|
||||
std::shared_ptr<Channel> CreateCustomChannel(
|
||||
std::shared_ptr<grpc::Channel> CreateCustomChannel(
|
||||
const grpc::string& target,
|
||||
const std::shared_ptr<ChannelCredentials>& creds,
|
||||
const ChannelArguments& args) {
|
||||
GrpcLibraryCodegen init_lib; // We need to call init in case of a bad creds.
|
||||
const std::shared_ptr<grpc::ChannelCredentials>& creds,
|
||||
const grpc::ChannelArguments& args) {
|
||||
grpc::GrpcLibraryCodegen
|
||||
init_lib; // We need to call init in case of a bad creds.
|
||||
return creds ? creds->CreateChannel(target, args)
|
||||
: CreateChannelInternal(
|
||||
: grpc::CreateChannelInternal(
|
||||
"",
|
||||
grpc_lame_client_channel_create(
|
||||
nullptr, GRPC_STATUS_INVALID_ARGUMENT,
|
||||
"Invalid credentials."),
|
||||
std::vector<std::unique_ptr<
|
||||
experimental::ClientInterceptorFactoryInterface>>());
|
||||
grpc::experimental::
|
||||
ClientInterceptorFactoryInterface>>());
|
||||
}
|
||||
|
||||
namespace experimental {
|
||||
|
|
@ -61,23 +65,24 @@ namespace experimental {
|
|||
/// hold an object or is invalid, a lame channel (one on which all operations
|
||||
/// fail) is returned.
|
||||
/// \param args Options for channel creation.
|
||||
std::shared_ptr<Channel> CreateCustomChannelWithInterceptors(
|
||||
std::shared_ptr<grpc::Channel> CreateCustomChannelWithInterceptors(
|
||||
const grpc::string& target,
|
||||
const std::shared_ptr<ChannelCredentials>& creds,
|
||||
const ChannelArguments& args,
|
||||
const std::shared_ptr<grpc::ChannelCredentials>& creds,
|
||||
const grpc::ChannelArguments& args,
|
||||
std::vector<
|
||||
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
|
||||
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
|
||||
interceptor_creators) {
|
||||
return creds ? creds->CreateChannelWithInterceptors(
|
||||
target, args, std::move(interceptor_creators))
|
||||
: CreateChannelInternal(
|
||||
: grpc::CreateChannelInternal(
|
||||
"",
|
||||
grpc_lame_client_channel_create(
|
||||
nullptr, GRPC_STATUS_INVALID_ARGUMENT,
|
||||
"Invalid credentials."),
|
||||
std::vector<std::unique_ptr<
|
||||
experimental::ClientInterceptorFactoryInterface>>());
|
||||
grpc::experimental::
|
||||
ClientInterceptorFactoryInterface>>());
|
||||
}
|
||||
} // namespace experimental
|
||||
|
||||
} // namespace grpc
|
||||
} // namespace grpc_impl
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "src/cpp/server/load_reporter/load_reporting_service_server_builder_plugin.h"
|
||||
|
||||
namespace grpc {
|
||||
namespace grpc_impl {
|
||||
namespace load_reporter {
|
||||
namespace experimental {
|
||||
|
||||
|
|
@ -33,9 +33,10 @@ void LoadReportingServiceServerBuilderOption::UpdateArguments(
|
|||
|
||||
void LoadReportingServiceServerBuilderOption::UpdatePlugins(
|
||||
std::vector<std::unique_ptr<::grpc::ServerBuilderPlugin>>* plugins) {
|
||||
plugins->emplace_back(new LoadReportingServiceServerBuilderPlugin());
|
||||
plugins->emplace_back(
|
||||
new grpc::load_reporter::LoadReportingServiceServerBuilderPlugin());
|
||||
}
|
||||
|
||||
} // namespace experimental
|
||||
} // namespace load_reporter
|
||||
} // namespace grpc
|
||||
} // namespace grpc_impl
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <grpc/support/log.h>
|
||||
|
||||
namespace grpc {
|
||||
namespace grpc_impl {
|
||||
namespace load_reporter {
|
||||
namespace experimental {
|
||||
|
||||
|
|
@ -44,4 +44,4 @@ void AddLoadReportingCost(grpc::ServerContext* ctx,
|
|||
|
||||
} // namespace experimental
|
||||
} // namespace load_reporter
|
||||
} // namespace grpc
|
||||
} // namespace grpc_impl
|
||||
|
|
|
|||
|
|
@ -20,29 +20,31 @@
|
|||
|
||||
#include "src/proto/grpc/status/status.pb.h"
|
||||
|
||||
namespace grpc {
|
||||
namespace grpc_impl {
|
||||
|
||||
Status ExtractErrorDetails(const Status& from, ::google::rpc::Status* to) {
|
||||
grpc::Status ExtractErrorDetails(const grpc::Status& from,
|
||||
::google::rpc::Status* to) {
|
||||
if (to == nullptr) {
|
||||
return Status(StatusCode::FAILED_PRECONDITION, "");
|
||||
return grpc::Status(grpc::StatusCode::FAILED_PRECONDITION, "");
|
||||
}
|
||||
if (!to->ParseFromString(from.error_details())) {
|
||||
return Status(StatusCode::INVALID_ARGUMENT, "");
|
||||
return grpc::Status(grpc::StatusCode::INVALID_ARGUMENT, "");
|
||||
}
|
||||
return Status::OK;
|
||||
return grpc::Status::OK;
|
||||
}
|
||||
|
||||
Status SetErrorDetails(const ::google::rpc::Status& from, Status* to) {
|
||||
grpc::Status SetErrorDetails(const ::google::rpc::Status& from,
|
||||
grpc::Status* to) {
|
||||
if (to == nullptr) {
|
||||
return Status(StatusCode::FAILED_PRECONDITION, "");
|
||||
return grpc::Status(grpc::StatusCode::FAILED_PRECONDITION, "");
|
||||
}
|
||||
StatusCode code = StatusCode::UNKNOWN;
|
||||
if (from.code() >= StatusCode::OK &&
|
||||
from.code() <= StatusCode::UNAUTHENTICATED) {
|
||||
code = static_cast<StatusCode>(from.code());
|
||||
grpc::StatusCode code = grpc::StatusCode::UNKNOWN;
|
||||
if (from.code() >= grpc::StatusCode::OK &&
|
||||
from.code() <= grpc::StatusCode::UNAUTHENTICATED) {
|
||||
code = static_cast<grpc::StatusCode>(from.code());
|
||||
}
|
||||
*to = Status(code, from.message(), from.SerializeAsString());
|
||||
return Status::OK;
|
||||
*to = grpc::Status(code, from.message(), from.SerializeAsString());
|
||||
return grpc::Status::OK;
|
||||
}
|
||||
|
||||
} // namespace grpc
|
||||
} // namespace grpc_impl
|
||||
|
|
|
|||
|
|
@ -930,6 +930,7 @@ include/grpcpp/channel.h \
|
|||
include/grpcpp/client_context.h \
|
||||
include/grpcpp/completion_queue.h \
|
||||
include/grpcpp/create_channel.h \
|
||||
include/grpcpp/create_channel_impl.h \
|
||||
include/grpcpp/create_channel_posix.h \
|
||||
include/grpcpp/create_channel_posix_impl.h \
|
||||
include/grpcpp/ext/health_check_service_server_builder_option.h \
|
||||
|
|
@ -1002,6 +1003,7 @@ include/grpcpp/resource_quota.h \
|
|||
include/grpcpp/resource_quota_impl.h \
|
||||
include/grpcpp/security/auth_context.h \
|
||||
include/grpcpp/security/auth_metadata_processor.h \
|
||||
include/grpcpp/security/auth_metadata_processor_impl.h \
|
||||
include/grpcpp/security/credentials.h \
|
||||
include/grpcpp/security/server_credentials.h \
|
||||
include/grpcpp/server.h \
|
||||
|
|
|
|||
|
|
@ -931,6 +931,7 @@ include/grpcpp/channel.h \
|
|||
include/grpcpp/client_context.h \
|
||||
include/grpcpp/completion_queue.h \
|
||||
include/grpcpp/create_channel.h \
|
||||
include/grpcpp/create_channel_impl.h \
|
||||
include/grpcpp/create_channel_posix.h \
|
||||
include/grpcpp/create_channel_posix_impl.h \
|
||||
include/grpcpp/ext/health_check_service_server_builder_option.h \
|
||||
|
|
@ -1004,6 +1005,7 @@ include/grpcpp/resource_quota.h \
|
|||
include/grpcpp/resource_quota_impl.h \
|
||||
include/grpcpp/security/auth_context.h \
|
||||
include/grpcpp/security/auth_metadata_processor.h \
|
||||
include/grpcpp/security/auth_metadata_processor_impl.h \
|
||||
include/grpcpp/security/credentials.h \
|
||||
include/grpcpp/security/server_credentials.h \
|
||||
include/grpcpp/server.h \
|
||||
|
|
|
|||
|
|
@ -6606,6 +6606,7 @@
|
|||
"headers": [
|
||||
"include/grpc++/support/error_details.h",
|
||||
"include/grpcpp/support/error_details.h",
|
||||
"include/grpcpp/support/error_details_impl.h",
|
||||
"src/proto/grpc/status/status.grpc.pb.h",
|
||||
"src/proto/grpc/status/status.pb.h",
|
||||
"src/proto/grpc/status/status_mock.grpc.pb.h"
|
||||
|
|
@ -6616,6 +6617,7 @@
|
|||
"src": [
|
||||
"include/grpc++/support/error_details.h",
|
||||
"include/grpcpp/support/error_details.h",
|
||||
"include/grpcpp/support/error_details_impl.h",
|
||||
"src/cpp/util/error_details.cc"
|
||||
],
|
||||
"third_party": false,
|
||||
|
|
@ -10091,6 +10093,7 @@
|
|||
"include/grpcpp/client_context.h",
|
||||
"include/grpcpp/completion_queue.h",
|
||||
"include/grpcpp/create_channel.h",
|
||||
"include/grpcpp/create_channel_impl.h",
|
||||
"include/grpcpp/create_channel_posix.h",
|
||||
"include/grpcpp/create_channel_posix_impl.h",
|
||||
"include/grpcpp/ext/health_check_service_server_builder_option.h",
|
||||
|
|
@ -10118,6 +10121,7 @@
|
|||
"include/grpcpp/resource_quota_impl.h",
|
||||
"include/grpcpp/security/auth_context.h",
|
||||
"include/grpcpp/security/auth_metadata_processor.h",
|
||||
"include/grpcpp/security/auth_metadata_processor_impl.h",
|
||||
"include/grpcpp/security/credentials.h",
|
||||
"include/grpcpp/security/server_credentials.h",
|
||||
"include/grpcpp/server.h",
|
||||
|
|
@ -10206,6 +10210,7 @@
|
|||
"include/grpcpp/client_context.h",
|
||||
"include/grpcpp/completion_queue.h",
|
||||
"include/grpcpp/create_channel.h",
|
||||
"include/grpcpp/create_channel_impl.h",
|
||||
"include/grpcpp/create_channel_posix.h",
|
||||
"include/grpcpp/create_channel_posix_impl.h",
|
||||
"include/grpcpp/ext/health_check_service_server_builder_option.h",
|
||||
|
|
@ -10233,6 +10238,7 @@
|
|||
"include/grpcpp/resource_quota_impl.h",
|
||||
"include/grpcpp/security/auth_context.h",
|
||||
"include/grpcpp/security/auth_metadata_processor.h",
|
||||
"include/grpcpp/security/auth_metadata_processor_impl.h",
|
||||
"include/grpcpp/security/credentials.h",
|
||||
"include/grpcpp/security/server_credentials.h",
|
||||
"include/grpcpp/server.h",
|
||||
|
|
|
|||
Loading…
Reference in New Issue