aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/grpc/include/grpcpp
diff options
context:
space:
mode:
authorheretic <heretic@yandex-team.ru>2022-03-25 12:34:53 +0300
committerheretic <heretic@yandex-team.ru>2022-03-25 12:34:53 +0300
commita41f3739eed6fceb6f62056a7620d220958a47e7 (patch)
tree278103258b510cb4a96761ea79d6ccd397ca05a0 /contrib/libs/grpc/include/grpcpp
parent73d3613a82e5c217fcbe0ab8bbf8120c1ed1af55 (diff)
downloadydb-a41f3739eed6fceb6f62056a7620d220958a47e7.tar.gz
Update grpc to 1.43.2 DTCC-864
ref:50a492c335cda70f458797cf945e49fe739c2715
Diffstat (limited to 'contrib/libs/grpc/include/grpcpp')
-rw-r--r--contrib/libs/grpc/include/grpcpp/alarm.h27
-rw-r--r--contrib/libs/grpc/include/grpcpp/channel.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/client_context.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/completion_queue.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/create_channel_binder.h86
-rw-r--r--contrib/libs/grpc/include/grpcpp/create_channel_posix.h3
-rw-r--r--contrib/libs/grpc/include/grpcpp/generic/async_generic_service.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/generic/generic_stub.h99
-rw-r--r--contrib/libs/grpc/include/grpcpp/grpcpp.h1
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/call.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/client_unary_call.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/async_generic_service.h9
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/async_stream.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/async_unary_call.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/byte_buffer.h14
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/call.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/call_hook.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/call_op_set.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/call_op_set_interface.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/callback_common.h14
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/channel_interface.h3
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/client_callback.h51
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/client_context.h28
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/client_interceptor.h11
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/client_unary_call.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/completion_queue.h11
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/completion_queue_tag.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/config.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/config_protobuf.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/core_codegen.h3
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/core_codegen_interface.h3
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/create_auth_context.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/delegating_channel.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/grpc_library.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/intercepted_channel.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/interceptor.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/interceptor_common.h5
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/message_allocator.h24
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/metadata_map.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/method_handler.h14
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/method_handler_impl.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/proto_buffer_reader.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/proto_buffer_writer.h9
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/proto_utils.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/rpc_method.h23
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/rpc_service_method.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/security/auth_context.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/serialization_traits.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/server_callback.h16
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/server_callback_handlers.h31
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/server_context.h91
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/server_interceptor.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/server_interface.h32
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/service_type.h47
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/slice.h16
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/status.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/status_code_enum.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/string_ref.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/stub_options.h17
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/sync.h12
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/sync_stream.h14
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/codegen/time.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/grpc_library.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/rpc_method.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/rpc_service_method.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/serialization_traits.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/impl/service_type.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/security/alts_context.h6
-rw-r--r--contrib/libs/grpc/include/grpcpp/security/alts_util.h4
-rw-r--r--contrib/libs/grpc/include/grpcpp/security/auth_context.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/security/authorization_policy_provider.h92
-rw-r--r--contrib/libs/grpc/include/grpcpp/security/binder_credentials.h43
-rw-r--r--contrib/libs/grpc/include/grpcpp/security/binder_security_policy.h58
-rw-r--r--contrib/libs/grpc/include/grpcpp/security/credentials.h10
-rw-r--r--contrib/libs/grpc/include/grpcpp/security/server_credentials.h11
-rw-r--r--contrib/libs/grpc/include/grpcpp/security/tls_certificate_provider.h6
-rw-r--r--contrib/libs/grpc/include/grpcpp/security/tls_certificate_verifier.h225
-rw-r--r--contrib/libs/grpc/include/grpcpp/security/tls_credentials_options.h139
-rw-r--r--contrib/libs/grpc/include/grpcpp/server.h52
-rw-r--r--contrib/libs/grpc/include/grpcpp/server_builder.h52
-rw-r--r--contrib/libs/grpc/include/grpcpp/server_context.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/server_posix.h3
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/async_stream.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/async_unary_call.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/byte_buffer.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/channel_arguments.h8
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/client_callback.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/client_interceptor.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/config.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/interceptor.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/message_allocator.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/method_handler.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/proto_buffer_reader.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/proto_buffer_writer.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/server_callback.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/server_interceptor.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/slice.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/status.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/status_code_enum.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/string_ref.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/stub_options.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/sync_stream.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/support/time.h2
-rw-r--r--contrib/libs/grpc/include/grpcpp/test/client_context_test_peer.h62
-rw-r--r--contrib/libs/grpc/include/grpcpp/test/default_reactor_test_peer.h15
-rw-r--r--contrib/libs/grpc/include/grpcpp/test/mock_stream.h49
-rw-r--r--contrib/libs/grpc/include/grpcpp/xds_server_builder.h50
107 files changed, 1097 insertions, 622 deletions
diff --git a/contrib/libs/grpc/include/grpcpp/alarm.h b/contrib/libs/grpc/include/grpcpp/alarm.h
index 6723e136c4..7d0b4bee54 100644
--- a/contrib/libs/grpc/include/grpcpp/alarm.h
+++ b/contrib/libs/grpc/include/grpcpp/alarm.h
@@ -81,7 +81,6 @@ class Alarm : private ::grpc::GrpcLibraryCodegen {
/// has already fired has no effect.
void Cancel();
-#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
/// Set an alarm to invoke callback \a f. The argument to the callback
/// states whether the alarm expired at \a deadline (true) or was cancelled
/// (false)
@@ -89,32 +88,6 @@ class Alarm : private ::grpc::GrpcLibraryCodegen {
void Set(const T& deadline, std::function<void(bool)> f) {
SetInternal(::grpc::TimePoint<T>(deadline).raw_time(), std::move(f));
}
-#endif
-
- /// NOTE: class experimental_type is not part of the public API of this class
- /// TODO(vjpai): Move these contents to the public API of Alarm when
- /// they are no longer experimental
- class experimental_type {
- public:
- explicit experimental_type(Alarm* alarm) : alarm_(alarm) {}
-
- /// Set an alarm to invoke callback \a f. The argument to the callback
- /// states whether the alarm expired at \a deadline (true) or was cancelled
- /// (false)
- template <typename T>
- void Set(const T& deadline, std::function<void(bool)> f) {
- alarm_->SetInternal(::grpc::TimePoint<T>(deadline).raw_time(),
- std::move(f));
- }
-
- private:
- Alarm* alarm_;
- };
-
- /// NOTE: The function experimental() is not stable public API. It is a view
- /// to the experimental components of this class. It may be changed or removed
- /// at any time.
- experimental_type experimental() { return experimental_type(this); }
private:
void SetInternal(::grpc::CompletionQueue* cq, gpr_timespec deadline,
diff --git a/contrib/libs/grpc/include/grpcpp/channel.h b/contrib/libs/grpc/include/grpcpp/channel.h
index 6383698a31..38decec377 100644
--- a/contrib/libs/grpc/include/grpcpp/channel.h
+++ b/contrib/libs/grpc/include/grpcpp/channel.h
@@ -114,7 +114,7 @@ class Channel final : public ::grpc::ChannelInterface,
// with this channel (if any). It is set on the first call to CallbackCQ().
// It is _not owned_ by the channel; ownership belongs with its internal
// shutdown callback tag (invoked when the CQ is fully shutdown).
- ::grpc::CompletionQueue* callback_cq_ = nullptr;
+ std::atomic<CompletionQueue*> callback_cq_{nullptr};
std::vector<
std::unique_ptr<::grpc::experimental::ClientInterceptorFactoryInterface>>
diff --git a/contrib/libs/grpc/include/grpcpp/client_context.h b/contrib/libs/grpc/include/grpcpp/client_context.h
index 1994fcc6bc..74a91e2642 100644
--- a/contrib/libs/grpc/include/grpcpp/client_context.h
+++ b/contrib/libs/grpc/include/grpcpp/client_context.h
@@ -34,6 +34,6 @@
#ifndef GRPCPP_CLIENT_CONTEXT_H
#define GRPCPP_CLIENT_CONTEXT_H
-#include <grpcpp/impl/codegen/client_context.h>
+#include <grpcpp/impl/codegen/client_context.h> // IWYU pragma: export
#endif // GRPCPP_CLIENT_CONTEXT_H
diff --git a/contrib/libs/grpc/include/grpcpp/completion_queue.h b/contrib/libs/grpc/include/grpcpp/completion_queue.h
index 123b277f5f..42637b5927 100644
--- a/contrib/libs/grpc/include/grpcpp/completion_queue.h
+++ b/contrib/libs/grpc/include/grpcpp/completion_queue.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_COMPLETION_QUEUE_H
#define GRPCPP_COMPLETION_QUEUE_H
-#include <grpcpp/impl/codegen/completion_queue.h>
+#include <grpcpp/impl/codegen/completion_queue.h> // IWYU pragma: export
#endif // GRPCPP_COMPLETION_QUEUE_H
diff --git a/contrib/libs/grpc/include/grpcpp/create_channel_binder.h b/contrib/libs/grpc/include/grpcpp/create_channel_binder.h
new file mode 100644
index 0000000000..6d6dfb22d6
--- /dev/null
+++ b/contrib/libs/grpc/include/grpcpp/create_channel_binder.h
@@ -0,0 +1,86 @@
+// Copyright 2021 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_BINDER_H
+#define GRPCPP_CREATE_CHANNEL_BINDER_H
+
+#include <grpc/support/port_platform.h>
+
+#ifdef GPR_ANDROID
+
+#error #include <jni.h>
+
+#include <memory>
+
+#include "y_absl/strings/string_view.h"
+
+#include <grpcpp/channel.h>
+#include <grpcpp/security/binder_security_policy.h>
+#include <grpcpp/support/channel_arguments.h>
+
+namespace grpc {
+namespace experimental {
+
+/// EXPERIMENTAL Create a new \a Channel based on binder transport. The package
+/// name and class name will be used identify the specific application component
+/// to connect to.
+///
+/// \param jni_env Pointer to a JNIEnv structure
+/// \param context The context that we will use to invoke \a bindService See
+/// https://developer.android.com/reference/android/content/Context#bindService(android.content.Intent,%20android.content.ServiceConnection,%20int)
+/// for detail.
+/// \param package_name Package name of the component to be connected to
+/// \param class_name Class name of the component to be connected to
+/// \param security_policy Used for checking if remote component is allowed to
+/// connect
+std::shared_ptr<grpc::Channel> CreateBinderChannel(
+ void* jni_env, jobject context, y_absl::string_view package_name,
+ y_absl::string_view class_name,
+ std::shared_ptr<grpc::experimental::binder::SecurityPolicy>
+ security_policy);
+
+/// EXPERIMENTAL Create a new \a Channel based on binder transport. The package
+/// name and class name will be used identify the specific application component
+/// to connect to.
+///
+/// \param jni_env Pointer to a JNIEnv structure
+/// \param context The context that we will use to invoke \a bindService See
+/// https://developer.android.com/reference/android/content/Context#bindService(android.content.Intent,%20android.content.ServiceConnection,%20int)
+/// for detail.
+/// \param package_name Package name of the component to be connected to
+/// \param class_name Class name of the component to be connected to
+/// \param security_policy Used for checking if remote component is allowed to
+/// connect
+/// \param args Options for channel creation.
+std::shared_ptr<grpc::Channel> CreateCustomBinderChannel(
+ void* jni_env_void, jobject application, y_absl::string_view package_name,
+ y_absl::string_view class_name,
+ std::shared_ptr<grpc::experimental::binder::SecurityPolicy> security_policy,
+ const ChannelArguments& args);
+
+/// EXPERIMENTAL Finds internal binder transport Java code. To create channels
+/// in threads created in native code, it is required to call this function
+/// once beforehand in a thread that is not created in native code.
+/// See
+/// https://developer.android.com/training/articles/perf-jni#faq:-why-didnt-findclass-find-my-class
+/// for details of this limitation.
+/// Returns true when the initialization is successful.
+bool InitializeBinderChannelJavaClass(void* jni_env_void);
+
+} // namespace experimental
+} // namespace grpc
+
+#endif
+
+#endif // GRPCPP_CREATE_CHANNEL_BINDER_H
diff --git a/contrib/libs/grpc/include/grpcpp/create_channel_posix.h b/contrib/libs/grpc/include/grpcpp/create_channel_posix.h
index 899d8e6658..a57b4deeb1 100644
--- a/contrib/libs/grpc/include/grpcpp/create_channel_posix.h
+++ b/contrib/libs/grpc/include/grpcpp/create_channel_posix.h
@@ -19,9 +19,10 @@
#ifndef GRPCPP_CREATE_CHANNEL_POSIX_H
#define GRPCPP_CREATE_CHANNEL_POSIX_H
+#include <grpc/support/port_platform.h>
+
#include <memory>
-#include <grpc/support/port_platform.h>
#include <grpcpp/channel.h>
#include <grpcpp/support/channel_arguments.h>
diff --git a/contrib/libs/grpc/include/grpcpp/generic/async_generic_service.h b/contrib/libs/grpc/include/grpcpp/generic/async_generic_service.h
index 2c67edc517..01c79428e2 100644
--- a/contrib/libs/grpc/include/grpcpp/generic/async_generic_service.h
+++ b/contrib/libs/grpc/include/grpcpp/generic/async_generic_service.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_GENERIC_ASYNC_GENERIC_SERVICE_H
#define GRPCPP_GENERIC_ASYNC_GENERIC_SERVICE_H
-#include <grpcpp/impl/codegen/async_generic_service.h>
+#include <grpcpp/impl/codegen/async_generic_service.h> // IWYU pragma: export
#endif // GRPCPP_GENERIC_ASYNC_GENERIC_SERVICE_H
diff --git a/contrib/libs/grpc/include/grpcpp/generic/generic_stub.h b/contrib/libs/grpc/include/grpcpp/generic/generic_stub.h
index 6789cefb9c..1f88438a2f 100644
--- a/contrib/libs/grpc/include/grpcpp/generic/generic_stub.h
+++ b/contrib/libs/grpc/include/grpcpp/generic/generic_stub.h
@@ -22,6 +22,7 @@
#include <functional>
#include <grpcpp/client_context.h>
+#include <grpcpp/impl/codegen/stub_options.h>
#include <grpcpp/impl/rpc_method.h>
#include <grpcpp/support/async_stream.h>
#include <grpcpp/support/async_unary_call.h>
@@ -53,7 +54,8 @@ class TemplatedGenericStub final {
std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType>>
PrepareCall(ClientContext* context, const TString& method,
::grpc::CompletionQueue* cq) {
- return CallInternal(channel_.get(), context, method, cq, false, nullptr);
+ return CallInternal(channel_.get(), context, method, /*options=*/{}, cq,
+ false, nullptr);
}
/// Setup a unary call to a named method \a method using \a context, and don't
@@ -67,6 +69,7 @@ class TemplatedGenericStub final {
internal::ClientAsyncResponseReaderHelper::Create<ResponseType>(
channel_.get(), cq,
grpc::internal::RpcMethod(method.c_str(),
+ /*suffix_for_stats=*/nullptr,
grpc::internal::RpcMethod::NORMAL_RPC),
context, request));
}
@@ -80,16 +83,17 @@ class TemplatedGenericStub final {
std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType>> Call(
ClientContext* context, const TString& method,
::grpc::CompletionQueue* cq, void* tag) {
- return CallInternal(channel_.get(), context, method, cq, true, tag);
+ return CallInternal(channel_.get(), context, method, /*options=*/{}, cq,
+ true, tag);
}
-#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
/// Setup and start a unary call to a named method \a method using
/// \a context and specifying the \a request and \a response buffers.
void UnaryCall(ClientContext* context, const TString& method,
- const RequestType* request, ResponseType* response,
+ StubOptions options, const RequestType* request,
+ ResponseType* response,
std::function<void(grpc::Status)> on_completion) {
- UnaryCallInternal(context, method, request, response,
+ UnaryCallInternal(context, method, options, request, response,
std::move(on_completion));
}
@@ -98,112 +102,69 @@ class TemplatedGenericStub final {
/// Like any other reactor-based RPC, it will not be activated until
/// StartCall is invoked on its reactor.
void PrepareUnaryCall(ClientContext* context, const TString& method,
- const RequestType* request, ResponseType* response,
- ClientUnaryReactor* reactor) {
- PrepareUnaryCallInternal(context, method, request, response, reactor);
+ StubOptions options, const RequestType* request,
+ ResponseType* response, ClientUnaryReactor* reactor) {
+ PrepareUnaryCallInternal(context, method, options, request, response,
+ reactor);
}
/// Setup a call to a named method \a method using \a context and tied to
/// \a reactor . Like any other bidi streaming RPC, it will not be activated
/// until StartCall is invoked on its reactor.
void PrepareBidiStreamingCall(
- ClientContext* context, const TString& method,
+ ClientContext* context, const TString& method, StubOptions options,
ClientBidiReactor<RequestType, ResponseType>* reactor) {
- PrepareBidiStreamingCallInternal(context, method, reactor);
+ PrepareBidiStreamingCallInternal(context, method, options, reactor);
}
-#endif
-
- /// NOTE: class experimental_type is not part of the public API of this class
- /// TODO(vjpai): Move these contents to the public API of GenericStub when
- /// they are no longer experimental
- class experimental_type {
- public:
- explicit experimental_type(TemplatedGenericStub* stub) : stub_(stub) {}
-
- /// Setup and start a unary call to a named method \a method using
- /// \a context and specifying the \a request and \a response buffers.
- void UnaryCall(ClientContext* context, const TString& method,
- const RequestType* request, ResponseType* response,
- std::function<void(grpc::Status)> on_completion) {
- stub_->UnaryCallInternal(context, method, request, response,
- std::move(on_completion));
- }
-
- /// Setup a unary call to a named method \a method using
- /// \a context and specifying the \a request and \a response buffers.
- /// Like any other reactor-based RPC, it will not be activated until
- /// StartCall is invoked on its reactor.
- void PrepareUnaryCall(ClientContext* context, const TString& method,
- const RequestType* request, ResponseType* response,
- ClientUnaryReactor* reactor) {
- stub_->PrepareUnaryCallInternal(context, method, request, response,
- reactor);
- }
-
- /// Setup a call to a named method \a method using \a context and tied to
- /// \a reactor . Like any other bidi streaming RPC, it will not be activated
- /// until StartCall is invoked on its reactor.
- void PrepareBidiStreamingCall(
- ClientContext* context, const TString& method,
- ClientBidiReactor<RequestType, ResponseType>* reactor) {
- stub_->PrepareBidiStreamingCallInternal(context, method, reactor);
- }
-
- private:
- TemplatedGenericStub* stub_;
- };
-
- /// NOTE: The function experimental() is not stable public API. It is a view
- /// to the experimental components of this class. It may be changed or removed
- /// at any time.
- experimental_type experimental() { return experimental_type(this); }
private:
std::shared_ptr<grpc::ChannelInterface> channel_;
void UnaryCallInternal(ClientContext* context, const TString& method,
- const RequestType* request, ResponseType* response,
+ StubOptions options, const RequestType* request,
+ ResponseType* response,
std::function<void(grpc::Status)> on_completion) {
internal::CallbackUnaryCall(
channel_.get(),
- grpc::internal::RpcMethod(method.c_str(),
+ grpc::internal::RpcMethod(method.c_str(), options.suffix_for_stats(),
grpc::internal::RpcMethod::NORMAL_RPC),
context, request, response, std::move(on_completion));
}
void PrepareUnaryCallInternal(ClientContext* context,
- const TString& method,
+ const TString& method, StubOptions options,
const RequestType* request,
ResponseType* response,
ClientUnaryReactor* reactor) {
internal::ClientCallbackUnaryFactory::Create<RequestType, ResponseType>(
channel_.get(),
- grpc::internal::RpcMethod(method.c_str(),
+ grpc::internal::RpcMethod(method.c_str(), options.suffix_for_stats(),
grpc::internal::RpcMethod::NORMAL_RPC),
context, request, response, reactor);
}
void PrepareBidiStreamingCallInternal(
- ClientContext* context, const TString& method,
+ ClientContext* context, const TString& method, StubOptions options,
ClientBidiReactor<RequestType, ResponseType>* reactor) {
internal::ClientCallbackReaderWriterFactory<RequestType, ResponseType>::
Create(channel_.get(),
grpc::internal::RpcMethod(
- method.c_str(), grpc::internal::RpcMethod::BIDI_STREAMING),
+ method.c_str(), options.suffix_for_stats(),
+ grpc::internal::RpcMethod::BIDI_STREAMING),
context, reactor);
}
std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType>>
CallInternal(grpc::ChannelInterface* channel, ClientContext* context,
- const TString& method, ::grpc::CompletionQueue* cq,
- bool start, void* tag) {
+ const TString& method, StubOptions options,
+ ::grpc::CompletionQueue* cq, bool start, void* tag) {
return std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType>>(
internal::ClientAsyncReaderWriterFactory<RequestType, ResponseType>::
- Create(
- channel, cq,
- grpc::internal::RpcMethod(
- method.c_str(), grpc::internal::RpcMethod::BIDI_STREAMING),
- context, start, tag));
+ Create(channel, cq,
+ grpc::internal::RpcMethod(
+ method.c_str(), options.suffix_for_stats(),
+ grpc::internal::RpcMethod::BIDI_STREAMING),
+ context, start, tag));
}
};
diff --git a/contrib/libs/grpc/include/grpcpp/grpcpp.h b/contrib/libs/grpc/include/grpcpp/grpcpp.h
index d37258cf3b..fbc161bec1 100644
--- a/contrib/libs/grpc/include/grpcpp/grpcpp.h
+++ b/contrib/libs/grpc/include/grpcpp/grpcpp.h
@@ -49,7 +49,6 @@
// headers are not private for grpcpp.h and are part of its interface.
// IWYU pragma: begin_exports
#include <grpc/grpc.h>
-
#include <grpcpp/channel.h>
#include <grpcpp/client_context.h>
#include <grpcpp/completion_queue.h>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/call.h b/contrib/libs/grpc/include/grpcpp/impl/call.h
index a6b1312693..97d8fdfc7c 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/call.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/call.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_IMPL_CALL_H
#define GRPCPP_IMPL_CALL_H
-#include <grpcpp/impl/codegen/call.h>
+#include <grpcpp/impl/codegen/call.h> // IWYU pragma: export
#endif // GRPCPP_IMPL_CALL_H
diff --git a/contrib/libs/grpc/include/grpcpp/impl/client_unary_call.h b/contrib/libs/grpc/include/grpcpp/impl/client_unary_call.h
index 378482c540..7ecf3548f2 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/client_unary_call.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/client_unary_call.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_IMPL_CLIENT_UNARY_CALL_H
#define GRPCPP_IMPL_CLIENT_UNARY_CALL_H
-#include <grpcpp/impl/codegen/client_unary_call.h>
+#include <grpcpp/impl/codegen/client_unary_call.h> // IWYU pragma: export
#endif // GRPCPP_IMPL_CLIENT_UNARY_CALL_H
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/async_generic_service.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/async_generic_service.h
index a812b086a2..6499f63f68 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/async_generic_service.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/async_generic_service.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_ASYNC_GENERIC_SERVICE_H
#define GRPCPP_IMPL_CODEGEN_ASYNC_GENERIC_SERVICE_H
+// IWYU pragma: private, include <grpcpp/generic/async_generic_service.h>
+
#include <grpc/impl/codegen/port_platform.h>
#include <grpcpp/impl/codegen/async_stream.h>
@@ -79,10 +81,6 @@ class AsyncGenericService final {
grpc::Server* server_;
};
-#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
-namespace experimental {
-#endif
-
/// \a ServerGenericBidiReactor is the reactor class for bidi streaming RPCs
/// invoked on a CallbackGenericService. It is just a ServerBidi reactor with
/// ByteBuffer arguments.
@@ -134,9 +132,6 @@ class CallbackGenericService {
grpc::Server* server_{nullptr};
};
-#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
-} // namespace experimental
-#endif
} // namespace grpc
#endif // GRPCPP_IMPL_CODEGEN_ASYNC_GENERIC_SERVICE_H
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/async_stream.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/async_stream.h
index aaee93df93..db5b3747a2 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/async_stream.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/async_stream.h
@@ -18,6 +18,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_ASYNC_STREAM_H
#define GRPCPP_IMPL_CODEGEN_ASYNC_STREAM_H
+// IWYU pragma: private, include <grpcpp/support/async_stream.h>
+
#include <grpcpp/impl/codegen/call.h>
#include <grpcpp/impl/codegen/channel_interface.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/async_unary_call.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/async_unary_call.h
index 7cb7cc6f16..d7a3b57314 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/async_unary_call.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/async_unary_call.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_ASYNC_UNARY_CALL_H
#define GRPCPP_IMPL_CODEGEN_ASYNC_UNARY_CALL_H
+// IWYU pragma: private, include <grpcpp/support/async_unary_call.h>
+
#include <grpcpp/impl/codegen/call.h>
#include <grpcpp/impl/codegen/call_op_set.h>
#include <grpcpp/impl/codegen/call_op_set_interface.h>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/byte_buffer.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/byte_buffer.h
index 2c015f2266..d94ac3bc7b 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/byte_buffer.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/byte_buffer.h
@@ -19,16 +19,17 @@
#ifndef GRPCPP_IMPL_CODEGEN_BYTE_BUFFER_H
#define GRPCPP_IMPL_CODEGEN_BYTE_BUFFER_H
-#include <grpc/impl/codegen/byte_buffer.h>
+// IWYU pragma: private, include <grpcpp/support/byte_buffer.h>
+
+#include <vector>
+#include <grpc/impl/codegen/byte_buffer.h>
#include <grpcpp/impl/codegen/config.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/codegen/serialization_traits.h>
#include <grpcpp/impl/codegen/slice.h>
#include <grpcpp/impl/codegen/status.h>
-#include <vector>
-
namespace grpc {
class ServerInterface;
@@ -114,6 +115,13 @@ class ByteBuffer final {
return *this;
}
+ // If this ByteBuffer's representation is a single flat slice, returns a
+ // slice referencing that array.
+ Status TrySingleSlice(Slice* slice) const;
+
+ /// Dump (read) the buffer contents into \a slics.
+ Status DumpToSingleSlice(Slice* slice) const;
+
/// Dump (read) the buffer contents into \a slices.
Status Dump(std::vector<Slice>* slices) const;
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/call.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/call.h
index b229286215..96d0de53e3 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/call.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/call.h
@@ -18,6 +18,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_CALL_H
#define GRPCPP_IMPL_CODEGEN_CALL_H
+// IWYU pragma: private, include <grpcpp/impl/call.h>
+
#include <grpc/impl/codegen/grpc_types.h>
#include <grpcpp/impl/codegen/call_hook.h>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/call_hook.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/call_hook.h
index 4f7d370c4f..8c4278e7dc 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/call_hook.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/call_hook.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_CALL_HOOK_H
#define GRPCPP_IMPL_CODEGEN_CALL_HOOK_H
+// IWYU pragma: private
+
namespace grpc {
namespace internal {
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/call_op_set.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/call_op_set.h
index 6df16a1125..5ad0a74d83 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/call_op_set.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/call_op_set.h
@@ -23,6 +23,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_CALL_OP_SET_H
#define GRPCPP_IMPL_CODEGEN_CALL_OP_SET_H
+// IWYU pragma: private
+
#include <cstring>
#include <map>
#include <memory>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/call_op_set_interface.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/call_op_set_interface.h
index 3b74566a6d..a8eed9f619 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/call_op_set_interface.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/call_op_set_interface.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_CALL_OP_SET_INTERFACE_H
#define GRPCPP_IMPL_CODEGEN_CALL_OP_SET_INTERFACE_H
+// IWYU pragma: private
+
#include <grpcpp/impl/codegen/completion_queue_tag.h>
namespace grpc {
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/callback_common.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/callback_common.h
index 612b820066..f0ce27ae8f 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/callback_common.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/callback_common.h
@@ -23,6 +23,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_CALLBACK_COMMON_H
#define GRPCPP_IMPL_CODEGEN_CALLBACK_COMMON_H
+// IWYU pragma: private
+
#include <functional>
#include <grpc/impl/codegen/grpc_types.h>
@@ -70,8 +72,7 @@ Reactor* CatchingReactorGetter(Func&& func, Args&&... args) {
// constructed and then fired at exactly one point. There is no expectation
// that they can be reused without reconstruction.
-class CallbackWithStatusTag
- : public grpc_experimental_completion_queue_functor {
+class CallbackWithStatusTag : public grpc_completion_queue_functor {
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
@@ -112,8 +113,7 @@ class CallbackWithStatusTag
CompletionQueueTag* ops_;
Status status_;
- static void StaticRun(grpc_experimental_completion_queue_functor* cb,
- int ok) {
+ static void StaticRun(grpc_completion_queue_functor* cb, int ok) {
static_cast<CallbackWithStatusTag*>(cb)->Run(static_cast<bool>(ok));
}
void Run(bool ok) {
@@ -138,8 +138,7 @@ class CallbackWithStatusTag
/// CallbackWithSuccessTag can be reused multiple times, and will be used in
/// this fashion for streaming operations. As a result, it shouldn't clear
/// anything up until its destructor
-class CallbackWithSuccessTag
- : public grpc_experimental_completion_queue_functor {
+class CallbackWithSuccessTag : public grpc_completion_queue_functor {
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
@@ -202,8 +201,7 @@ class CallbackWithSuccessTag
std::function<void(bool)> func_;
CompletionQueueTag* ops_;
- static void StaticRun(grpc_experimental_completion_queue_functor* cb,
- int ok) {
+ static void StaticRun(grpc_completion_queue_functor* cb, int ok) {
static_cast<CallbackWithSuccessTag*>(cb)->Run(static_cast<bool>(ok));
}
void Run(bool ok) {
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/channel_interface.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/channel_interface.h
index 7f03fb0345..09e67ae45d 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/channel_interface.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/channel_interface.h
@@ -23,6 +23,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_CHANNEL_INTERFACE_H
#define GRPCPP_IMPL_CODEGEN_CHANNEL_INTERFACE_H
+// IWYU pragma: private
+
#include <grpc/impl/codegen/connectivity_state.h>
#include <grpcpp/impl/codegen/call.h>
#include <grpcpp/impl/codegen/status.h>
@@ -160,7 +162,6 @@ class ChannelInterface {
return internal::Call();
}
- // EXPERIMENTAL
// A method to get the callbackable completion queue associated with this
// channel. If the return value is nullptr, this channel doesn't support
// callback operations.
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/client_callback.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/client_callback.h
index a73d525003..ca65f6f414 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/client_callback.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/client_callback.h
@@ -17,6 +17,9 @@
#ifndef GRPCPP_IMPL_CODEGEN_CLIENT_CALLBACK_H
#define GRPCPP_IMPL_CODEGEN_CLIENT_CALLBACK_H
+
+// IWYU pragma: private, include <grpcpp/support/client_callback.h>
+
#include <atomic>
#include <functional>
@@ -130,6 +133,15 @@ class ClientReactor {
/// heavyweight and the cost of the virtual call is not much in comparison.
/// This function may be removed or devirtualized in the future.
virtual void InternalScheduleOnDone(::grpc::Status s);
+
+ /// InternalTrailersOnly is not part of the API and is not meant to be
+ /// overridden. It is virtual to allow successful builds for certain bazel
+ /// build users that only want to depend on gRPC codegen headers and not the
+ /// full library (although this is not a generally-supported option). Although
+ /// the virtual call is slower than a direct call, this function is
+ /// heavyweight and the cost of the virtual call is not much in comparison.
+ /// This function may be removed or devirtualized in the future.
+ virtual bool InternalTrailersOnly(const grpc_call* call) const;
};
} // namespace internal
@@ -594,7 +606,8 @@ class ClientCallbackReaderWriterImpl
start_tag_.Set(
call_.call(),
[this](bool ok) {
- reactor_->OnReadInitialMetadataDone(ok);
+ reactor_->OnReadInitialMetadataDone(
+ ok && !reactor_->InternalTrailersOnly(call_.call()));
MaybeFinish(/*from_reaction=*/true);
},
&start_ops_, /*can_inline=*/false);
@@ -737,7 +750,8 @@ class ClientCallbackReaderImpl : public ClientCallbackReader<Response> {
start_tag_.Set(
call_.call(),
[this](bool ok) {
- reactor_->OnReadInitialMetadataDone(ok);
+ reactor_->OnReadInitialMetadataDone(
+ ok && !reactor_->InternalTrailersOnly(call_.call()));
MaybeFinish(/*from_reaction=*/true);
},
&start_ops_, /*can_inline=*/false);
@@ -995,7 +1009,8 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter<Request> {
start_tag_.Set(
call_.call(),
[this](bool ok) {
- reactor_->OnReadInitialMetadataDone(ok);
+ reactor_->OnReadInitialMetadataDone(
+ ok && !reactor_->InternalTrailersOnly(call_.call()));
MaybeFinish(/*from_reaction=*/true);
},
&start_ops_, /*can_inline=*/false);
@@ -1121,7 +1136,8 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary {
start_tag_.Set(
call_.call(),
[this](bool ok) {
- reactor_->OnReadInitialMetadataDone(ok);
+ reactor_->OnReadInitialMetadataDone(
+ ok && !reactor_->InternalTrailersOnly(call_.call()));
MaybeFinish();
},
&start_ops_, /*can_inline=*/false);
@@ -1213,32 +1229,5 @@ class ClientCallbackUnaryFactory {
};
} // namespace internal
-
-// TODO(vjpai): Remove namespace experimental when de-experimentalized fully.
-namespace experimental {
-
-template <class Response>
-using ClientCallbackReader = ::grpc::ClientCallbackReader<Response>;
-
-template <class Request>
-using ClientCallbackWriter = ::grpc::ClientCallbackWriter<Request>;
-
-template <class Request, class Response>
-using ClientCallbackReaderWriter =
- ::grpc::ClientCallbackReaderWriter<Request, Response>;
-
-template <class Response>
-using ClientReadReactor = ::grpc::ClientReadReactor<Response>;
-
-template <class Request>
-using ClientWriteReactor = ::grpc::ClientWriteReactor<Request>;
-
-template <class Request, class Response>
-using ClientBidiReactor = ::grpc::ClientBidiReactor<Request, Response>;
-
-typedef ::grpc::ClientUnaryReactor ClientUnaryReactor;
-
-} // namespace experimental
-
} // namespace grpc
#endif // GRPCPP_IMPL_CODEGEN_CLIENT_CALLBACK_H
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/client_context.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/client_context.h
index 82b93587a8..d8204fafde 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/client_context.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/client_context.h
@@ -34,6 +34,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_H
#define GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_H
+// IWYU pragma: private, include <grpcpp/client_context.h>
+
#include <map>
#include <memory>
#include <util/generic/string.h>
@@ -92,6 +94,7 @@ class ClientAsyncResponseReader;
namespace testing {
class InteropClientContextInspector;
+class ClientContextTestPeer;
} // namespace testing
namespace internal {
@@ -205,7 +208,7 @@ class ClientContext {
/// \return A newly constructed \a ClientContext instance based on \a
/// server_context, with traits propagated (copied) according to \a options.
static std::unique_ptr<ClientContext> FromServerContext(
- const grpc::ServerContext& server_context,
+ const grpc::ServerContextBase& server_context,
PropagationOptions options = PropagationOptions());
static std::unique_ptr<ClientContext> FromCallbackServerContext(
const grpc::CallbackServerContext& server_context,
@@ -223,11 +226,16 @@ class ClientContext {
/// must end in "-bin".
///
/// Metadata must conform to the following format:
- /// Custom-Metadata -> Binary-Header / ASCII-Header
- /// Binary-Header -> {Header-Name "-bin" } {binary value}
- /// ASCII-Header -> Header-Name ASCII-Value
- /// Header-Name -> 1*( %x30-39 / %x61-7A / "_" / "-" / ".") ; 0-9 a-z _ - .
- /// ASCII-Value -> 1*( %x20-%x7E ) ; space and printable ASCII
+ /**
+ \verbatim
+ Custom-Metadata -> Binary-Header / ASCII-Header
+ Binary-Header -> {Header-Name "-bin" } {binary value}
+ ASCII-Header -> Header-Name ASCII-Value
+ Header-Name -> 1*( %x30-39 / %x61-7A / "_" / "-" / ".") ; 0-9 a-z _ - .
+ ASCII-Value -> 1*( %x20-%x7E ) ; space and printable ASCII
+ Custom-Metadata -> Binary-Header / ASCII-Header
+ \endverbatim
+ **/
void AddMetadata(const TString& meta_key, const TString& meta_value);
/// Return a collection of initial metadata key-value pairs. Note that keys
@@ -423,6 +431,7 @@ class ClientContext {
ClientContext& operator=(const ClientContext&);
friend class ::grpc::testing::InteropClientContextInspector;
+ friend class ::grpc::testing::ClientContextTestPeer;
friend class ::grpc::internal::CallOpClientRecvStatus;
friend class ::grpc::internal::CallOpRecvInitialMetadata;
friend class ::grpc::Channel;
@@ -464,12 +473,13 @@ class ClientContext {
const std::shared_ptr<::grpc::Channel>& channel);
grpc::experimental::ClientRpcInfo* set_client_rpc_info(
- const char* method, grpc::internal::RpcMethod::RpcType type,
- grpc::ChannelInterface* channel,
+ const char* method, const char* suffix_for_stats,
+ grpc::internal::RpcMethod::RpcType type, grpc::ChannelInterface* channel,
const std::vector<std::unique_ptr<
grpc::experimental::ClientInterceptorFactoryInterface>>& creators,
size_t interceptor_pos) {
- rpc_info_ = grpc::experimental::ClientRpcInfo(this, type, method, channel);
+ rpc_info_ = grpc::experimental::ClientRpcInfo(this, type, method,
+ suffix_for_stats, channel);
rpc_info_.RegisterInterceptors(creators, interceptor_pos);
return &rpc_info_;
}
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/client_interceptor.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/client_interceptor.h
index 78be1f7597..f3560b5ad2 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/client_interceptor.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/client_interceptor.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_CLIENT_INTERCEPTOR_H
#define GRPCPP_IMPL_CODEGEN_CLIENT_INTERCEPTOR_H
+// IWYU pragma: private, include <grpcpp/support/client_interceptor.h>
+
#include <memory>
#include <vector>
@@ -87,6 +89,10 @@ class ClientRpcInfo {
/// Return the fully-specified method name
const char* method() const { return method_; }
+ /// Return an identifying suffix for the client stub, or nullptr if one wasn't
+ /// specified.
+ const char* suffix_for_stats() const { return suffix_for_stats_; }
+
/// Return a pointer to the channel on which the RPC is being sent
ChannelInterface* channel() { return channel_; }
@@ -116,10 +122,12 @@ class ClientRpcInfo {
// Constructor will only be called from ClientContext
ClientRpcInfo(grpc::ClientContext* ctx, internal::RpcMethod::RpcType type,
- const char* method, grpc::ChannelInterface* channel)
+ const char* method, const char* suffix_for_stats,
+ grpc::ChannelInterface* channel)
: ctx_(ctx),
type_(static_cast<Type>(type)),
method_(method),
+ suffix_for_stats_(suffix_for_stats),
channel_(channel) {}
// Move assignment should only be used by ClientContext
@@ -162,6 +170,7 @@ class ClientRpcInfo {
// TODO(yashykt): make type_ const once move-assignment is deleted
Type type_{Type::UNKNOWN};
const char* method_ = nullptr;
+ const char* suffix_for_stats_ = nullptr;
grpc::ChannelInterface* channel_ = nullptr;
std::vector<std::unique_ptr<experimental::Interceptor>> interceptors_;
bool hijacked_ = false;
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/client_unary_call.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/client_unary_call.h
index d41ea1ad2d..bad60a23bc 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/client_unary_call.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/client_unary_call.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_CLIENT_UNARY_CALL_H
#define GRPCPP_IMPL_CODEGEN_CLIENT_UNARY_CALL_H
+// IWYU pragma: private, include <grpcpp/impl/client_unary_call.h>
+
#include <grpcpp/impl/codegen/call.h>
#include <grpcpp/impl/codegen/call_op_set.h>
#include <grpcpp/impl/codegen/channel_interface.h>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/completion_queue.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/completion_queue.h
index d23e0e2bb3..ef0c7f1498 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/completion_queue.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/completion_queue.h
@@ -32,6 +32,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_H
#define GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_H
+// IWYU pragma: private, include <grpcpp/completion_queue.h>
+
#include <list>
#include <grpc/impl/codegen/atm.h>
@@ -175,9 +177,14 @@ class CompletionQueue : private ::grpc::GrpcLibraryCodegen {
/// \return true if got an event, false if the queue is fully drained and
/// shut down.
bool Next(void** tag, bool* ok) {
+ // Check return type == GOT_EVENT... cases:
+ // SHUTDOWN - queue has been shutdown, return false.
+ // TIMEOUT - we passed infinity time => queue has been shutdown, return
+ // false.
+ // GOT_EVENT - we actually got an event, return true.
return (AsyncNextInternal(tag, ok,
::grpc::g_core_codegen_interface->gpr_inf_future(
- GPR_CLOCK_REALTIME)) != SHUTDOWN);
+ GPR_CLOCK_REALTIME)) == GOT_EVENT);
}
/// Read from the queue, blocking up to \a deadline (or the queue's shutdown).
@@ -443,7 +450,7 @@ class ServerCompletionQueue : public CompletionQueue {
/// \param shutdown_cb is the shutdown callback used for CALLBACK api queues
ServerCompletionQueue(grpc_cq_completion_type completion_type,
grpc_cq_polling_type polling_type,
- grpc_experimental_completion_queue_functor* shutdown_cb)
+ grpc_completion_queue_functor* shutdown_cb)
: CompletionQueue(grpc_completion_queue_attributes{
GRPC_CQ_CURRENT_VERSION, completion_type, polling_type,
shutdown_cb}),
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/completion_queue_tag.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/completion_queue_tag.h
index 304386a9ec..9af470b750 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/completion_queue_tag.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/completion_queue_tag.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H
#define GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H
+// IWYU pragma: private
+
namespace grpc {
namespace internal {
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/config.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/config.h
index d177668551..85350b6776 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/config.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/config.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_CONFIG_H
#define GRPCPP_IMPL_CODEGEN_CONFIG_H
+// IWYU pragma: private, include <grpcpp/support/config.h>
+
#include <util/generic/string.h>
/// The following macros are deprecated and appear only for users
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/config_protobuf.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/config_protobuf.h
index 49db4c5dc3..da874c58eb 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/config_protobuf.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/config_protobuf.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_CONFIG_PROTOBUF_H
#define GRPCPP_IMPL_CODEGEN_CONFIG_PROTOBUF_H
+// IWYU pragma: private
+
#define GRPC_OPEN_SOURCE_PROTO
#ifndef GRPC_CUSTOM_MESSAGE
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/core_codegen.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/core_codegen.h
index df2a03cd25..e0440ffe3b 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/core_codegen.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/core_codegen.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_H
#define GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_H
+// IWYU pragma: private
+
// This file should be compiled as part of grpcpp.
#include <grpc/byte_buffer.h>
@@ -70,6 +72,7 @@ class CoreCodegen final : public CoreCodegenInterface {
grpc_status_code status,
const char* description,
void* reserved) override;
+ int grpc_call_failed_before_recv_message(const grpc_call* c) override;
void grpc_call_ref(grpc_call* call) override;
void grpc_call_unref(grpc_call* call) override;
void* grpc_call_arena_alloc(grpc_call* call, size_t length) override;
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/core_codegen_interface.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/core_codegen_interface.h
index c08cf6c683..0b23bf46e6 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/core_codegen_interface.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/core_codegen_interface.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H
#define GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H
+// IWYU pragma: private
+
#include <grpc/impl/codegen/byte_buffer.h>
#include <grpc/impl/codegen/byte_buffer_reader.h>
#include <grpc/impl/codegen/grpc_types.h>
@@ -111,6 +113,7 @@ class CoreCodegenInterface {
grpc_status_code status,
const char* description,
void* reserved) = 0;
+ virtual int grpc_call_failed_before_recv_message(const grpc_call* c) = 0;
virtual void grpc_call_ref(grpc_call* call) = 0;
virtual void grpc_call_unref(grpc_call* call) = 0;
virtual void* grpc_call_arena_alloc(grpc_call* call, size_t length) = 0;
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/create_auth_context.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/create_auth_context.h
index cb6095c3a5..817988f3aa 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/create_auth_context.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/create_auth_context.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H
#define GRPCPP_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H
+// IWYU pragma: private
+
#include <memory>
#include <grpc/impl/codegen/grpc_types.h>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/delegating_channel.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/delegating_channel.h
index 0479567b86..f4f6794b42 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/delegating_channel.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/delegating_channel.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_DELEGATING_CHANNEL_H
#define GRPCPP_IMPL_CODEGEN_DELEGATING_CHANNEL_H
+// IWYU pragma: private
+
#include <memory>
#include <grpcpp/impl/codegen/channel_interface.h>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/grpc_library.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/grpc_library.h
index 660d6d0abd..9f83a7f938 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/grpc_library.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/grpc_library.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_GRPC_LIBRARY_H
#define GRPCPP_IMPL_CODEGEN_GRPC_LIBRARY_H
+// IWYU pragma: private, include <grpcpp/impl/grpc_library.h>
+
#include <grpcpp/impl/codegen/core_codegen_interface.h>
namespace grpc {
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/intercepted_channel.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/intercepted_channel.h
index e3a4c8e768..d3df6caa04 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/intercepted_channel.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/intercepted_channel.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_INTERCEPTED_CHANNEL_H
#define GRPCPP_IMPL_CODEGEN_INTERCEPTED_CHANNEL_H
+// IWYU pragma: private
+
#include <grpcpp/impl/codegen/channel_interface.h>
namespace grpc {
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/interceptor.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/interceptor.h
index d0afa03a17..0818d5c534 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/interceptor.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/interceptor.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_INTERCEPTOR_H
#define GRPCPP_IMPL_CODEGEN_INTERCEPTOR_H
+// IWYU pragma: private, include <grpcpp/support/interceptor.h>
+
#include <memory>
#include <grpc/impl/codegen/grpc_types.h>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/interceptor_common.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/interceptor_common.h
index 72d8009ded..46a5d1ac6b 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/interceptor_common.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/interceptor_common.h
@@ -23,17 +23,18 @@
#ifndef GRPCPP_IMPL_CODEGEN_INTERCEPTOR_COMMON_H
#define GRPCPP_IMPL_CODEGEN_INTERCEPTOR_COMMON_H
+// IWYU pragma: private
+
#include <array>
#include <functional>
+#include <grpc/impl/codegen/grpc_types.h>
#include <grpcpp/impl/codegen/call.h>
#include <grpcpp/impl/codegen/call_op_set_interface.h>
#include <grpcpp/impl/codegen/client_interceptor.h>
#include <grpcpp/impl/codegen/intercepted_channel.h>
#include <grpcpp/impl/codegen/server_interceptor.h>
-#include <grpc/impl/codegen/grpc_types.h>
-
namespace grpc {
namespace internal {
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/message_allocator.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/message_allocator.h
index 4048ea1197..440c7f1d23 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/message_allocator.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/message_allocator.h
@@ -19,10 +19,9 @@
#ifndef GRPCPP_IMPL_CODEGEN_MESSAGE_ALLOCATOR_H
#define GRPCPP_IMPL_CODEGEN_MESSAGE_ALLOCATOR_H
+// IWYU pragma: private, include <grpcpp/support/message_allocator.h>
+
namespace grpc {
-#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
-namespace experimental {
-#endif
// NOTE: This is an API for advanced users who need custom allocators.
// Per rpc struct for the allocator. This is the interface to return to user.
@@ -69,25 +68,6 @@ class MessageAllocator {
virtual MessageHolder<RequestT, ResponseT>* AllocateMessages() = 0;
};
-#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
-} // namespace experimental
-#endif
-
-// TODO(vjpai): Remove namespace experimental when de-experimentalized fully.
-#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
-namespace experimental {
-
-using ::grpc::RpcAllocatorState;
-
-template <typename RequestT, typename ResponseT>
-using MessageHolder = ::grpc::MessageHolder<RequestT, ResponseT>;
-
-template <typename RequestT, typename ResponseT>
-using MessageAllocator = ::grpc::MessageAllocator<RequestT, ResponseT>;
-
-} // namespace experimental
-#endif
-
} // namespace grpc
#endif // GRPCPP_IMPL_CODEGEN_MESSAGE_ALLOCATOR_H
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/metadata_map.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/metadata_map.h
index 03afc0781a..430d6b6744 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/metadata_map.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/metadata_map.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_METADATA_MAP_H
#define GRPCPP_IMPL_CODEGEN_METADATA_MAP_H
+// IWYU pragma: private
+
#include <map>
#include <grpc/impl/codegen/log.h>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/method_handler.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/method_handler.h
index 756f4aae75..090d672ae2 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/method_handler.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/method_handler.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_METHOD_HANDLER_H
#define GRPCPP_IMPL_CODEGEN_METHOD_HANDLER_H
+// IWYU pragma: private, include <grpcpp/support/method_handler.h>
+
#include <grpcpp/impl/codegen/byte_buffer.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/codegen/rpc_service_method.h>
@@ -357,9 +359,12 @@ class SplitServerStreamingHandler
template <::grpc::StatusCode code>
class ErrorMethodHandler : public ::grpc::internal::MethodHandler {
public:
+ explicit ErrorMethodHandler(const TString& message) : message_(message) {}
+
template <class T>
- static void FillOps(::grpc::ServerContextBase* context, T* ops) {
- ::grpc::Status status(code, "");
+ static void FillOps(::grpc::ServerContextBase* context,
+ const TString& message, T* ops) {
+ ::grpc::Status status(code, message);
if (!context->sent_initial_metadata_) {
ops->SendInitialMetadata(&context->initial_metadata_,
context->initial_metadata_flags());
@@ -375,7 +380,7 @@ class ErrorMethodHandler : public ::grpc::internal::MethodHandler {
::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
::grpc::internal::CallOpServerSendStatus>
ops;
- FillOps(param.server_context, &ops);
+ FillOps(param.server_context, message_, &ops);
param.call->PerformOps(&ops);
param.call->cq()->Pluck(&ops);
}
@@ -388,6 +393,9 @@ class ErrorMethodHandler : public ::grpc::internal::MethodHandler {
}
return nullptr;
}
+
+ private:
+ const TString message_;
};
typedef ErrorMethodHandler<::grpc::StatusCode::UNIMPLEMENTED>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/method_handler_impl.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/method_handler_impl.h
index cc88a135ca..3f1d573ba5 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/method_handler_impl.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/method_handler_impl.h
@@ -19,4 +19,6 @@
#ifndef GRPCPP_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H
#define GRPCPP_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H
+// IWYU pragma: private
+
#endif // GRPCPP_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/proto_buffer_reader.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/proto_buffer_reader.h
index d25b79a402..d3baa2cd29 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/proto_buffer_reader.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/proto_buffer_reader.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_READER_H
#define GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_READER_H
+// IWYU pragma: private, include <grpcpp/support/proto_buffer_reader.h>
+
#include <type_traits>
#include <grpc/impl/codegen/byte_buffer_reader.h>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/proto_buffer_writer.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/proto_buffer_writer.h
index cd9d70c5a5..204620bb01 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/proto_buffer_writer.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/proto_buffer_writer.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_WRITER_H
#define GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_WRITER_H
+// IWYU pragma: private, include <grpcpp/support/proto_buffer_writer.h>
+
#include <type_traits>
#include <grpc/impl/codegen/grpc_types.h>
@@ -116,6 +118,13 @@ class ProtoBufferWriter : public ::grpc::protobuf::io::ZeroCopyOutputStream {
/// (only used in the last buffer). \a count must be less than or equal too
/// the last buffer returned from next.
void BackUp(int count) override {
+ // count == 0 is invoked by ZeroCopyOutputStream users indicating that any
+ // potential buffer obtained through a previous call to Next() is final.
+ // ZeroCopyOutputStream implementations such as streaming output can use
+ // these calls to flush any temporary buffer and flush the output. The logic
+ // below is not robust against count == 0 invocations, so directly return.
+ if (count == 0) return;
+
/// 1. Remove the partially-used last slice from the slice buffer
/// 2. Split it into the needed (if any) and unneeded part
/// 3. Add the needed part back to the slice buffer
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/proto_utils.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/proto_utils.h
index 7f5c6e9a99..4f6d87415a 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/proto_utils.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/proto_utils.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_PROTO_UTILS_H
#define GRPCPP_IMPL_CODEGEN_PROTO_UTILS_H
+// IWYU pragma: private
+
#include <type_traits>
#include <grpc/impl/codegen/byte_buffer_reader.h>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/rpc_method.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/rpc_method.h
index 394a29b837..83dedda42c 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/rpc_method.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/rpc_method.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_RPC_METHOD_H
#define GRPCPP_IMPL_CODEGEN_RPC_METHOD_H
+// IWYU pragma: private, include <grpcpp/impl/rpc_method.h>
+
#include <memory>
#include <grpcpp/impl/codegen/channel_interface.h>
@@ -36,21 +38,40 @@ class RpcMethod {
};
RpcMethod(const char* name, RpcType type)
- : name_(name), method_type_(type), channel_tag_(nullptr) {}
+ : name_(name),
+ suffix_for_stats_(nullptr),
+ method_type_(type),
+ channel_tag_(nullptr) {}
+
+ RpcMethod(const char* name, const char* suffix_for_stats, RpcType type)
+ : name_(name),
+ suffix_for_stats_(suffix_for_stats),
+ method_type_(type),
+ channel_tag_(nullptr) {}
RpcMethod(const char* name, RpcType type,
const std::shared_ptr<ChannelInterface>& channel)
: name_(name),
+ suffix_for_stats_(nullptr),
+ method_type_(type),
+ channel_tag_(channel->RegisterMethod(name)) {}
+
+ RpcMethod(const char* name, const char* suffix_for_stats, RpcType type,
+ const std::shared_ptr<ChannelInterface>& channel)
+ : name_(name),
+ suffix_for_stats_(suffix_for_stats),
method_type_(type),
channel_tag_(channel->RegisterMethod(name)) {}
const char* name() const { return name_; }
+ const char* suffix_for_stats() const { return suffix_for_stats_; }
RpcType method_type() const { return method_type_; }
void SetMethodType(RpcType type) { method_type_ = type; }
void* channel_tag() const { return channel_tag_; }
private:
const char* const name_;
+ const char* const suffix_for_stats_;
RpcType method_type_;
void* const channel_tag_;
};
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/rpc_service_method.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/rpc_service_method.h
index 4fcc211243..f34cc8b17c 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/rpc_service_method.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/rpc_service_method.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_RPC_SERVICE_METHOD_H
#define GRPCPP_IMPL_CODEGEN_RPC_SERVICE_METHOD_H
+// IWYU pragma: private, include <grpcpp/impl/rpc_service_method.h>
+
#include <climits>
#include <functional>
#include <map>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/security/auth_context.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/security/auth_context.h
index e2b0435652..3079fecbc4 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/security/auth_context.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/security/auth_context.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H
#define GRPCPP_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H
+// IWYU pragma: private, include <grpcpp/security/auth_context.h>
+
#include <iterator>
#include <vector>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/serialization_traits.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/serialization_traits.h
index 8f79223290..3148dffc80 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/serialization_traits.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/serialization_traits.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_SERIALIZATION_TRAITS_H
#define GRPCPP_IMPL_CODEGEN_SERIALIZATION_TRAITS_H
+// IWYU pragma: private, include <grpcpp/impl/serialization_traits.h>
+
namespace grpc {
/// Defines how to serialize and deserialize some type.
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/server_callback.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/server_callback.h
index 701ef561a3..fb6bdbccac 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/server_callback.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/server_callback.h
@@ -18,6 +18,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_SERVER_CALLBACK_H
#define GRPCPP_IMPL_CODEGEN_SERVER_CALLBACK_H
+// IWYU pragma: private, include <grpcpp/support/server_callback.h>
+
#include <atomic>
#include <functional>
#include <type_traits>
@@ -158,8 +160,7 @@ class ServerCallbackCall {
};
template <class Request, class Response>
-class DefaultMessageHolder
- : public ::grpc::experimental::MessageHolder<Request, Response> {
+class DefaultMessageHolder : public MessageHolder<Request, Response> {
public:
DefaultMessageHolder() {
this->set_request(&request_obj_);
@@ -784,20 +785,13 @@ using UnimplementedBidiReactor =
} // namespace internal
-// TODO(vjpai): Remove namespace experimental when de-experimentalized fully.
+// TODO(vjpai): Remove namespace experimental when last known users are migrated
+// off.
namespace experimental {
-template <class Request>
-using ServerReadReactor = ::grpc::ServerReadReactor<Request>;
-
-template <class Response>
-using ServerWriteReactor = ::grpc::ServerWriteReactor<Response>;
-
template <class Request, class Response>
using ServerBidiReactor = ::grpc::ServerBidiReactor<Request, Response>;
-using ServerUnaryReactor = ::grpc::ServerUnaryReactor;
-
} // namespace experimental
} // namespace grpc
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/server_callback_handlers.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/server_callback_handlers.h
index 76e655a9b3..8713d3eb30 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/server_callback_handlers.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/server_callback_handlers.h
@@ -18,6 +18,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_SERVER_CALLBACK_HANDLERS_H
#define GRPCPP_IMPL_CODEGEN_SERVER_CALLBACK_HANDLERS_H
+// IWYU pragma: private
+
#include <grpcpp/impl/codegen/message_allocator.h>
#include <grpcpp/impl/codegen/rpc_service_method.h>
#include <grpcpp/impl/codegen/server_callback.h>
@@ -37,17 +39,16 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler {
: get_reactor_(std::move(get_reactor)) {}
void SetMessageAllocator(
- ::grpc::experimental::MessageAllocator<RequestType, ResponseType>*
- allocator) {
+ MessageAllocator<RequestType, ResponseType>* allocator) {
allocator_ = allocator;
}
void RunHandler(const HandlerParameter& param) final {
// Arena allocate a controller structure (that includes request/response)
::grpc::g_core_codegen_interface->grpc_call_ref(param.call->call());
- auto* allocator_state = static_cast<
- ::grpc::experimental::MessageHolder<RequestType, ResponseType>*>(
- param.internal_data);
+ auto* allocator_state =
+ static_cast<MessageHolder<RequestType, ResponseType>*>(
+ param.internal_data);
auto* call = new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
param.call->call(), sizeof(ServerCallbackUnaryImpl)))
@@ -82,8 +83,7 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler {
::grpc::ByteBuffer buf;
buf.set_buffer(req);
RequestType* request = nullptr;
- ::grpc::experimental::MessageHolder<RequestType, ResponseType>*
- allocator_state = nullptr;
+ MessageHolder<RequestType, ResponseType>* allocator_state;
if (allocator_ != nullptr) {
allocator_state = allocator_->AllocateMessages();
} else {
@@ -100,8 +100,6 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler {
if (status->ok()) {
return request;
}
- // Clean up on deserialization failure.
- allocator_state->Release();
return nullptr;
}
@@ -109,8 +107,7 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler {
std::function<ServerUnaryReactor*(::grpc::CallbackServerContext*,
const RequestType*, ResponseType*)>
get_reactor_;
- ::grpc::experimental::MessageAllocator<RequestType, ResponseType>*
- allocator_ = nullptr;
+ MessageAllocator<RequestType, ResponseType>* allocator_ = nullptr;
class ServerCallbackUnaryImpl : public ServerCallbackUnary {
public:
@@ -181,8 +178,7 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler {
ServerCallbackUnaryImpl(
::grpc::CallbackServerContext* ctx, ::grpc::internal::Call* call,
- ::grpc::experimental::MessageHolder<RequestType, ResponseType>*
- allocator_state,
+ MessageHolder<RequestType, ResponseType>* allocator_state,
std::function<void()> call_requester)
: ctx_(ctx),
call_(*call),
@@ -233,8 +229,7 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler {
::grpc::CallbackServerContext* const ctx_;
::grpc::internal::Call call_;
- ::grpc::experimental::MessageHolder<RequestType, ResponseType>* const
- allocator_state_;
+ MessageHolder<RequestType, ResponseType>* const allocator_state_;
std::function<void()> call_requester_;
// reactor_ can always be loaded/stored with relaxed memory ordering because
// its value is only set once, independently of other data in the object,
@@ -384,6 +379,9 @@ class CallbackClientStreamingHandler : public ::grpc::internal::MethodHandler {
read_tag_.Set(
call_.call(),
[this, reactor](bool ok) {
+ if (GPR_UNLIKELY(!ok)) {
+ ctx_->MaybeMarkCancelledOnRead();
+ }
reactor->OnReadDone(ok);
this->MaybeDone(/*inlineable_ondone=*/true);
},
@@ -831,6 +829,9 @@ class CallbackBidiHandler : public ::grpc::internal::MethodHandler {
read_tag_.Set(
call_.call(),
[this, reactor](bool ok) {
+ if (GPR_UNLIKELY(!ok)) {
+ ctx_->MaybeMarkCancelledOnRead();
+ }
reactor->OnReadDone(ok);
this->MaybeDone(/*inlineable_ondone=*/true);
},
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/server_context.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/server_context.h
index a73155e59f..b92bf17864 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/server_context.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/server_context.h
@@ -19,6 +19,10 @@
#ifndef GRPCPP_IMPL_CODEGEN_SERVER_CONTEXT_H
#define GRPCPP_IMPL_CODEGEN_SERVER_CONTEXT_H
+// IWYU pragma: private, include <grpcpp/server_context.h>
+
+#include <grpc/impl/codegen/port_platform.h>
+
#include <atomic>
#include <cassert>
#include <map>
@@ -26,8 +30,6 @@
#include <type_traits>
#include <vector>
-#include <grpc/impl/codegen/port_platform.h>
-
#include <grpc/impl/codegen/compression_types.h>
#include <grpcpp/impl/codegen/call.h>
#include <grpcpp/impl/codegen/call_op_set.h>
@@ -63,6 +65,8 @@ class ServerReader;
template <class W>
class ServerWriter;
+extern CoreCodegenInterface* g_core_codegen_interface;
+
namespace internal {
template <class ServiceType, class RequestType, class ResponseType>
class BidiStreamingHandler;
@@ -101,22 +105,8 @@ class GenericServerContext;
class Server;
class ServerInterface;
class ContextAllocator;
-
-// TODO(vjpai): Remove namespace experimental when de-experimentalized fully.
-namespace experimental {
-
-typedef ::grpc::ServerContextBase ServerContextBase;
-typedef ::grpc::CallbackServerContext CallbackServerContext;
-
-} // namespace experimental
-
-#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
-namespace experimental {
-#endif
class GenericCallbackServerContext;
-#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
-} // namespace experimental
-#endif
+
namespace internal {
class Call;
} // namespace internal
@@ -127,7 +117,7 @@ class ServerContextTestSpouse;
class DefaultReactorTestPeer;
} // namespace testing
-/// Base class of ServerContext. Experimental until callback API is final.
+/// Base class of ServerContext.
class ServerContextBase {
public:
virtual ~ServerContextBase();
@@ -154,11 +144,15 @@ class ServerContextBase {
/// must end in "-bin".
///
/// Metadata must conform to the following format:
- /// Custom-Metadata -> Binary-Header / ASCII-Header
- /// Binary-Header -> {Header-Name "-bin" } {binary value}
- /// ASCII-Header -> Header-Name ASCII-Value
- /// Header-Name -> 1*( %x30-39 / %x61-7A / "_" / "-" / ".") ; 0-9 a-z _ - .
- /// ASCII-Value -> 1*( %x20-%x7E ) ; space and printable ASCII
+ /**
+ \verbatim
+ Custom-Metadata -> Binary-Header / ASCII-Header
+ Binary-Header -> {Header-Name "-bin" } {binary value}
+ ASCII-Header -> Header-Name ASCII-Value
+ Header-Name -> 1*( %x30-39 / %x61-7A / "_" / "-" / ".") ; 0-9 a-z _ - .
+ ASCII-Value -> 1*( %x20-%x7E ) ; space and printable ASCII
+ \endverbatim
+ **/
void AddInitialMetadata(const TString& key, const TString& value);
/// Add the (\a key, \a value) pair to the initial metadata
@@ -175,11 +169,15 @@ class ServerContextBase {
/// must end in "-bin".
///
/// Metadata must conform to the following format:
- /// Custom-Metadata -> Binary-Header / ASCII-Header
- /// Binary-Header -> {Header-Name "-bin" } {binary value}
- /// ASCII-Header -> Header-Name ASCII-Value
- /// Header-Name -> 1*( %x30-39 / %x61-7A / "_" / "-" / ".") ; 0-9 a-z _ - .
- /// ASCII-Value -> 1*( %x20-%x7E ) ; space and printable ASCII
+ /**
+ \verbatim
+ Custom-Metadata -> Binary-Header / ASCII-Header
+ Binary-Header -> {Header-Name "-bin" } {binary value}
+ ASCII-Header -> Header-Name ASCII-Value
+ Header-Name -> 1*( %x30-39 / %x61-7A / "_" / "-" / ".") ; 0-9 a-z _ - .
+ ASCII-Value -> 1*( %x20-%x7E ) ; space and printable ASCII
+ \endverbatim
+ **/
void AddTrailingMetadata(const TString& key, const TString& value);
/// Return whether this RPC failed before the server could provide its status
@@ -299,10 +297,7 @@ class ServerContextBase {
/// NOTE: This is an API for advanced users who need custom allocators.
/// Get and maybe mutate the allocator state associated with the current RPC.
/// Currently only applicable for callback unary RPC methods.
- /// WARNING: This is experimental API and could be changed or removed.
- ::grpc::experimental::RpcAllocatorState* GetRpcAllocatorState() {
- return message_allocator_state_;
- }
+ RpcAllocatorState* GetRpcAllocatorState() { return message_allocator_state_; }
/// Get a library-owned default unary reactor for use in minimal reaction
/// cases. This supports typical unary RPC usage of providing a response and
@@ -318,8 +313,6 @@ class ServerContextBase {
///
/// This method should not be called more than once or called after return
/// from the method handler.
- ///
- /// WARNING: This is experimental API and could be changed or removed.
::grpc::ServerUnaryReactor* DefaultReactor() {
// Short-circuit the case where a default reactor was already set up by
// the TestPeer.
@@ -394,11 +387,7 @@ class ServerContextBase {
friend class ::grpc::internal::FinishOnlyReactor;
friend class ::grpc::ClientContext;
friend class ::grpc::GenericServerContext;
-#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
friend class ::grpc::GenericCallbackServerContext;
-#else
- friend class ::grpc::experimental::GenericCallbackServerContext;
-#endif
/// Prevent copying.
ServerContextBase(const ServerContextBase&);
@@ -429,11 +418,17 @@ class ServerContextBase {
return rpc_info_;
}
- void set_message_allocator_state(
- ::grpc::experimental::RpcAllocatorState* allocator_state) {
+ void set_message_allocator_state(RpcAllocatorState* allocator_state) {
message_allocator_state_ = allocator_state;
}
+ void MaybeMarkCancelledOnRead() {
+ if (g_core_codegen_interface->grpc_call_failed_before_recv_message(
+ call_.call)) {
+ marked_cancelled_.store(true, std::memory_order_release);
+ }
+ }
+
struct CallWrapper {
~CallWrapper();
@@ -469,7 +464,7 @@ class ServerContextBase {
bool has_pending_ops_ = false;
::grpc::experimental::ServerRpcInfo* rpc_info_ = nullptr;
- ::grpc::experimental::RpcAllocatorState* message_allocator_state_ = nullptr;
+ RpcAllocatorState* message_allocator_state_ = nullptr;
ContextAllocator* context_allocator_ = nullptr;
class Reactor : public ::grpc::ServerUnaryReactor {
@@ -524,6 +519,9 @@ class ServerContextBase {
typename std::aligned_storage<sizeof(Reactor), alignof(Reactor)>::type
default_reactor_;
std::atomic_bool default_reactor_used_{false};
+
+ std::atomic_bool marked_cancelled_{false};
+
std::unique_ptr<TestServerCallbackUnary> test_unary_;
};
@@ -633,24 +631,13 @@ class ContextAllocator {
virtual CallbackServerContext* NewCallbackServerContext() { return nullptr; }
-#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
- virtual experimental::GenericCallbackServerContext*
- NewGenericCallbackServerContext() {
- return nullptr;
- }
-#else
virtual GenericCallbackServerContext* NewGenericCallbackServerContext() {
return nullptr;
}
-#endif
virtual void Release(CallbackServerContext*) {}
-#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
- virtual void Release(experimental::GenericCallbackServerContext*) {}
-#else
virtual void Release(GenericCallbackServerContext*) {}
-#endif
};
} // namespace grpc
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/server_interceptor.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/server_interceptor.h
index 7598e72a40..3a8fd52acb 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/server_interceptor.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/server_interceptor.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_SERVER_INTERCEPTOR_H
#define GRPCPP_IMPL_CODEGEN_SERVER_INTERCEPTOR_H
+// IWYU pragma: private, include <grpcpp/support/server_interceptor.h>
+
#include <atomic>
#include <vector>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/server_interface.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/server_interface.h
index 7fb5038826..e23b95c224 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/server_interface.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/server_interface.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_SERVER_INTERFACE_H
#define GRPCPP_IMPL_CODEGEN_SERVER_INTERFACE_H
+// IWYU pragma: private
+
#include <grpc/impl/codegen/port_platform.h>
#include <grpc/impl/codegen/grpc_types.h>
@@ -50,13 +52,7 @@ namespace internal {
class ServerAsyncStreamingInterface;
} // namespace internal
-#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
-namespace experimental {
-#endif
class CallbackGenericService;
-#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
-} // namespace experimental
-#endif
namespace experimental {
class ServerInterceptorFactoryInterface;
@@ -130,35 +126,12 @@ class ServerInterface : public internal::CallHook {
/// service. The service must exist for the lifetime of the Server instance.
virtual void RegisterAsyncGenericService(AsyncGenericService* service) = 0;
-#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
/// Register a callback generic service. This call does not take ownership of
/// the service. The service must exist for the lifetime of the Server
/// instance. May not be abstract since this is a post-1.0 API addition.
virtual void RegisterCallbackGenericService(CallbackGenericService*
/*service*/) {}
-#else
- /// NOTE: class experimental_registration_interface is not part of the public
- /// API of this class
- /// TODO(vjpai): Move these contents to public API when no longer experimental
- class experimental_registration_interface {
- public:
- virtual ~experimental_registration_interface() {}
- /// May not be abstract since this is a post-1.0 API addition
- virtual void RegisterCallbackGenericService(
- experimental::CallbackGenericService* /*service*/) {}
- virtual void RegisterContextAllocator(
- std::unique_ptr<ContextAllocator> /*context_allocator*/) {}
- };
-
- /// NOTE: The function experimental_registration() is not stable public API.
- /// It is a view to the experimental components of this class. It may be
- /// changed or removed at any time. May not be abstract since this is a
- /// post-1.0 API addition
- virtual experimental_registration_interface* experimental_registration() {
- return nullptr;
- }
-#endif
/// Tries to bind \a server to the given \a addr.
///
@@ -383,7 +356,6 @@ class ServerInterface : public internal::CallHook {
return nullptr;
}
- // EXPERIMENTAL
// A method to get the callbackable completion queue associated with this
// server. If the return value is nullptr, this server doesn't support
// callback operations.
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/service_type.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/service_type.h
index 57ca9f0944..182570ef2f 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/service_type.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/service_type.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_SERVICE_TYPE_H
#define GRPCPP_IMPL_CODEGEN_SERVICE_TYPE_H
+// IWYU pragma: private, include <grpcpp/impl/service_type.h>
+
#include <grpcpp/impl/codegen/config.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/codegen/rpc_service_method.h>
@@ -99,29 +101,6 @@ class Service {
}
protected:
- // TODO(vjpai): Promote experimental contents once callback API is accepted
- class experimental_type {
- public:
- explicit experimental_type(Service* service) : service_(service) {}
-
- void MarkMethodCallback(int index, internal::MethodHandler* handler) {
- service_->MarkMethodCallbackInternal(index, handler);
- }
-
- void MarkMethodRawCallback(int index, internal::MethodHandler* handler) {
- service_->MarkMethodRawCallbackInternal(index, handler);
- }
-
- internal::MethodHandler* GetHandler(int index) {
- return service_->GetHandlerInternal(index);
- }
-
- private:
- Service* service_;
- };
-
- experimental_type experimental() { return experimental_type(this); }
-
template <class Message>
void RequestAsyncUnary(int index, ::grpc::ServerContext* context,
Message* request,
@@ -216,23 +195,7 @@ class Service {
methods_[idx]->SetMethodType(internal::RpcMethod::BIDI_STREAMING);
}
-#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
void MarkMethodCallback(int index, internal::MethodHandler* handler) {
- MarkMethodCallbackInternal(index, handler);
- }
-
- void MarkMethodRawCallback(int index, internal::MethodHandler* handler) {
- MarkMethodRawCallbackInternal(index, handler);
- }
-
- internal::MethodHandler* GetHandler(int index) {
- return GetHandlerInternal(index);
- }
-#endif
- private:
- // TODO(vjpai): migrate the Internal functions to mainline functions once
- // callback API is fully de-experimental
- void MarkMethodCallbackInternal(int index, internal::MethodHandler* handler) {
// This does not have to be a hard error, however no one has approached us
// with a use case yet. Please file an issue if you believe you have one.
size_t idx = static_cast<size_t>(index);
@@ -245,8 +208,7 @@ class Service {
internal::RpcServiceMethod::ApiType::CALL_BACK);
}
- void MarkMethodRawCallbackInternal(int index,
- internal::MethodHandler* handler) {
+ void MarkMethodRawCallback(int index, internal::MethodHandler* handler) {
// This does not have to be a hard error, however no one has approached us
// with a use case yet. Please file an issue if you believe you have one.
size_t idx = static_cast<size_t>(index);
@@ -259,11 +221,12 @@ class Service {
internal::RpcServiceMethod::ApiType::RAW_CALL_BACK);
}
- internal::MethodHandler* GetHandlerInternal(int index) {
+ internal::MethodHandler* GetHandler(int index) {
size_t idx = static_cast<size_t>(index);
return methods_[idx]->handler();
}
+ private:
friend class Server;
friend class ServerInterface;
ServerInterface* server_;
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/slice.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/slice.h
index 0b9752ccff..3de44c8f90 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/slice.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/slice.h
@@ -19,12 +19,13 @@
#ifndef GRPCPP_IMPL_CODEGEN_SLICE_H
#define GRPCPP_IMPL_CODEGEN_SLICE_H
+// IWYU pragma: private, include <grpcpp/support/slice.h>
+
+#include <grpc/impl/codegen/slice.h>
#include <grpcpp/impl/codegen/config.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/codegen/string_ref.h>
-#include <grpc/impl/codegen/slice.h>
-
namespace grpc {
/// A wrapper around \a grpc_slice.
@@ -74,6 +75,11 @@ class Slice final {
Slice(const Slice& other)
: slice_(g_core_codegen_interface->grpc_slice_ref(other.slice_)) {}
+ /// Move constructor, steals a reference.
+ Slice(Slice&& other) noexcept : slice_(other.slice_) {
+ other.slice_ = g_core_codegen_interface->grpc_empty_slice();
+ }
+
/// Assignment, reference count is unchanged.
Slice& operator=(Slice other) {
std::swap(slice_, other.slice_);
@@ -107,6 +113,12 @@ class Slice final {
/// Raw pointer to the end (one byte \em past the last element) of the slice.
const uint8_t* end() const { return GRPC_SLICE_END_PTR(slice_); }
+ /// Returns a substring of the `slice` as another slice.
+ Slice sub(size_t begin, size_t end) const {
+ return Slice(g_core_codegen_interface->grpc_slice_sub(slice_, begin, end),
+ STEAL_REF);
+ }
+
/// Raw C slice. Caller needs to call grpc_slice_unref when done.
grpc_slice c_slice() const {
return g_core_codegen_interface->grpc_slice_ref(slice_);
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/status.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/status.h
index a5ad6f32fe..358f2bb7f9 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/status.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/status.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_STATUS_H
#define GRPCPP_IMPL_CODEGEN_STATUS_H
+// IWYU pragma: private, include <grpcpp/support/status.h>
+
#include <grpc/impl/codegen/status.h>
#include <grpcpp/impl/codegen/config.h>
#include <grpcpp/impl/codegen/status_code_enum.h>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/status_code_enum.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/status_code_enum.h
index bdd7ead6ad..36ea24fdfd 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/status_code_enum.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/status_code_enum.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_STATUS_CODE_ENUM_H
#define GRPCPP_IMPL_CODEGEN_STATUS_CODE_ENUM_H
+// IWYU pragma: private, include <grpcpp/support/status_code_enum.h>
+
namespace grpc {
enum StatusCode {
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/string_ref.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/string_ref.h
index a13533eca5..f0bb76ea5c 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/string_ref.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/string_ref.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_STRING_REF_H
#define GRPCPP_IMPL_CODEGEN_STRING_REF_H
+// IWYU pragma: private, include <grpcpp/support/string_ref.h>
+
#include <string.h>
#include <algorithm>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/stub_options.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/stub_options.h
index a56695a8f8..efa1e38ee0 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/stub_options.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/stub_options.h
@@ -19,10 +19,25 @@
#ifndef GRPCPP_IMPL_CODEGEN_STUB_OPTIONS_H
#define GRPCPP_IMPL_CODEGEN_STUB_OPTIONS_H
+// IWYU pragma: private, include <grpcpp/support/stub_options.h>
+
namespace grpc {
/// Useful interface for generated stubs
-class StubOptions {};
+class StubOptions {
+ public:
+ StubOptions() = default;
+ explicit StubOptions(const char* suffix_for_stats)
+ : suffix_for_stats_(suffix_for_stats) {}
+
+ void set_suffix_for_stats(const char* suffix_for_stats) {
+ suffix_for_stats_ = suffix_for_stats;
+ }
+ const char* suffix_for_stats() const { return suffix_for_stats_; }
+
+ private:
+ const char* suffix_for_stats_ = nullptr;
+};
} // namespace grpc
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/sync.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/sync.h
index bf89a0e39a..e3954cc731 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/sync.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/sync.h
@@ -19,6 +19,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_SYNC_H
#define GRPCPP_IMPL_CODEGEN_SYNC_H
+// IWYU pragma: private
+
#include <grpc/impl/codegen/port_platform.h>
#ifdef GPR_HAS_PTHREAD_H
@@ -27,13 +29,12 @@
#include <mutex>
+#include "y_absl/synchronization/mutex.h"
+
#include <grpc/impl/codegen/log.h>
#include <grpc/impl/codegen/sync.h>
-
#include <grpcpp/impl/codegen/core_codegen_interface.h>
-#include "y_absl/synchronization/mutex.h"
-
// The core library is not accessible in C++ codegen headers, and vice versa.
// Thus, we need to have duplicate headers with similar functionality.
// Make sure any change to this file is also reflected in
@@ -46,7 +47,7 @@
namespace grpc {
namespace internal {
-#ifdef GRPCPP_ABSEIL_SYNC
+#ifdef GPR_ABSEIL_SYNC
using Mutex = y_absl::Mutex;
using MutexLock = y_absl::MutexLock;
@@ -141,9 +142,10 @@ class CondVar {
gpr_cv cv_;
};
-#endif // GRPCPP_ABSEIL_SYNC
+#endif // GPR_ABSEIL_SYNC
template <typename Predicate>
+GRPC_DEPRECATED("incompatible with thread safety analysis")
static void WaitUntil(CondVar* cv, Mutex* mu, Predicate pred) {
while (!pred()) {
cv->Wait(mu);
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/sync_stream.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/sync_stream.h
index 408f42f280..1ce3acdaf7 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/sync_stream.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/sync_stream.h
@@ -18,6 +18,8 @@
#ifndef GRPCPP_IMPL_CODEGEN_SYNC_STREAM_H
#define GRPCPP_IMPL_CODEGEN_SYNC_STREAM_H
+// IWYU pragma: private, include <grpcpp/support/sync_stream.h>
+
#include <grpcpp/impl/codegen/call.h>
#include <grpcpp/impl/codegen/channel_interface.h>
#include <grpcpp/impl/codegen/client_context.h>
@@ -607,7 +609,11 @@ class ServerReader final : public ServerReaderInterface<R> {
::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvMessage<R>> ops;
ops.RecvMessage(msg);
call_->PerformOps(&ops);
- return call_->cq()->Pluck(&ops) && ops.got_message;
+ bool ok = call_->cq()->Pluck(&ops) && ops.got_message;
+ if (!ok) {
+ ctx_->MaybeMarkCancelledOnRead();
+ }
+ return ok;
}
private:
@@ -734,7 +740,11 @@ class ServerReaderWriterBody final {
::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvMessage<R>> ops;
ops.RecvMessage(msg);
call_->PerformOps(&ops);
- return call_->cq()->Pluck(&ops) && ops.got_message;
+ bool ok = call_->cq()->Pluck(&ops) && ops.got_message;
+ if (!ok) {
+ ctx_->MaybeMarkCancelledOnRead();
+ }
+ return ok;
}
bool Write(const W& msg, ::grpc::WriteOptions options) {
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/time.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/time.h
index 88cf12fd82..41bf69f376 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/codegen/time.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/time.h
@@ -23,6 +23,8 @@
#pragma GCC system_header
#endif
+// IWYU pragma: private, include <grpcpp/support/time.h>
+
#include <chrono>
#include <grpc/impl/codegen/grpc_types.h>
diff --git a/contrib/libs/grpc/include/grpcpp/impl/grpc_library.h b/contrib/libs/grpc/include/grpcpp/impl/grpc_library.h
index 3711c09879..0afca8e46f 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/grpc_library.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/grpc_library.h
@@ -24,7 +24,7 @@
#include <grpc/grpc.h>
#include <grpcpp/impl/codegen/config.h>
#include <grpcpp/impl/codegen/core_codegen.h>
-#include <grpcpp/impl/codegen/grpc_library.h>
+#include <grpcpp/impl/codegen/grpc_library.h> // IWYU pragma: export
namespace grpc {
diff --git a/contrib/libs/grpc/include/grpcpp/impl/rpc_method.h b/contrib/libs/grpc/include/grpcpp/impl/rpc_method.h
index 5da7041671..aeef8b778c 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/rpc_method.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/rpc_method.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_IMPL_RPC_METHOD_H
#define GRPCPP_IMPL_RPC_METHOD_H
-#include <grpcpp/impl/codegen/rpc_method.h>
+#include <grpcpp/impl/codegen/rpc_method.h> // IWYU pragma: export
#endif // GRPCPP_IMPL_RPC_METHOD_H
diff --git a/contrib/libs/grpc/include/grpcpp/impl/rpc_service_method.h b/contrib/libs/grpc/include/grpcpp/impl/rpc_service_method.h
index ef70a3a100..86cb2dc5a7 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/rpc_service_method.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/rpc_service_method.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_IMPL_RPC_SERVICE_METHOD_H
#define GRPCPP_IMPL_RPC_SERVICE_METHOD_H
-#include <grpcpp/impl/codegen/rpc_service_method.h>
+#include <grpcpp/impl/codegen/rpc_service_method.h> // IWYU pragma: export
#endif // GRPCPP_IMPL_RPC_SERVICE_METHOD_H
diff --git a/contrib/libs/grpc/include/grpcpp/impl/serialization_traits.h b/contrib/libs/grpc/include/grpcpp/impl/serialization_traits.h
index 95194fbd89..6da8b4dfcc 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/serialization_traits.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/serialization_traits.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_IMPL_SERIALIZATION_TRAITS_H
#define GRPCPP_IMPL_SERIALIZATION_TRAITS_H
-#include <grpcpp/impl/codegen/serialization_traits.h>
+#include <grpcpp/impl/codegen/serialization_traits.h> // IWYU pragma: export
#endif // GRPCPP_IMPL_SERIALIZATION_TRAITS_H
diff --git a/contrib/libs/grpc/include/grpcpp/impl/service_type.h b/contrib/libs/grpc/include/grpcpp/impl/service_type.h
index 250bc8cd56..de45c4266a 100644
--- a/contrib/libs/grpc/include/grpcpp/impl/service_type.h
+++ b/contrib/libs/grpc/include/grpcpp/impl/service_type.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_IMPL_SERVICE_TYPE_H
#define GRPCPP_IMPL_SERVICE_TYPE_H
-#include <grpcpp/impl/codegen/service_type.h>
+#include <grpcpp/impl/codegen/service_type.h> // IWYU pragma: export
#endif // GRPCPP_IMPL_SERVICE_TYPE_H
diff --git a/contrib/libs/grpc/include/grpcpp/security/alts_context.h b/contrib/libs/grpc/include/grpcpp/security/alts_context.h
index cd1f640a76..125d25310f 100644
--- a/contrib/libs/grpc/include/grpcpp/security/alts_context.h
+++ b/contrib/libs/grpc/include/grpcpp/security/alts_context.h
@@ -19,12 +19,12 @@
#ifndef GRPCPP_SECURITY_ALTS_CONTEXT_H
#define GRPCPP_SECURITY_ALTS_CONTEXT_H
-#include <grpc/grpc_security_constants.h>
-#include <grpcpp/security/auth_context.h>
-
#include <map>
#include <memory>
+#include <grpc/grpc_security_constants.h>
+#include <grpcpp/security/auth_context.h>
+
struct grpc_gcp_AltsContext;
namespace grpc {
diff --git a/contrib/libs/grpc/include/grpcpp/security/alts_util.h b/contrib/libs/grpc/include/grpcpp/security/alts_util.h
index b8f935ad95..25322e31ce 100644
--- a/contrib/libs/grpc/include/grpcpp/security/alts_util.h
+++ b/contrib/libs/grpc/include/grpcpp/security/alts_util.h
@@ -19,13 +19,13 @@
#ifndef GRPCPP_SECURITY_ALTS_UTIL_H
#define GRPCPP_SECURITY_ALTS_UTIL_H
+#include <memory>
+
#include <grpc/grpc_security_constants.h>
#include <grpcpp/impl/codegen/status.h>
#include <grpcpp/security/alts_context.h>
#include <grpcpp/security/auth_context.h>
-#include <memory>
-
struct grpc_gcp_AltsContext;
namespace grpc {
diff --git a/contrib/libs/grpc/include/grpcpp/security/auth_context.h b/contrib/libs/grpc/include/grpcpp/security/auth_context.h
index 7a6f2cb718..17784508e2 100644
--- a/contrib/libs/grpc/include/grpcpp/security/auth_context.h
+++ b/contrib/libs/grpc/include/grpcpp/security/auth_context.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SECURITY_AUTH_CONTEXT_H
#define GRPCPP_SECURITY_AUTH_CONTEXT_H
-#include <grpcpp/impl/codegen/security/auth_context.h>
+#include <grpcpp/impl/codegen/security/auth_context.h> // IWYU pragma: export
#endif // GRPCPP_SECURITY_AUTH_CONTEXT_H
diff --git a/contrib/libs/grpc/include/grpcpp/security/authorization_policy_provider.h b/contrib/libs/grpc/include/grpcpp/security/authorization_policy_provider.h
new file mode 100644
index 0000000000..1d18f700ca
--- /dev/null
+++ b/contrib/libs/grpc/include/grpcpp/security/authorization_policy_provider.h
@@ -0,0 +1,92 @@
+// Copyright 2021 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_AUTHORIZATION_POLICY_PROVIDER_H
+#define GRPCPP_SECURITY_AUTHORIZATION_POLICY_PROVIDER_H
+
+#include <memory>
+
+#include <grpc/status.h>
+#include <grpcpp/impl/codegen/grpc_library.h>
+
+// TODO(yihuazhang): remove the forward declarations here and include
+// <grpc/grpc_security.h> directly once the insecure builds are cleaned up.
+typedef struct grpc_authorization_policy_provider
+ grpc_authorization_policy_provider;
+
+namespace grpc {
+namespace experimental {
+
+// Wrapper around C-core grpc_authorization_policy_provider. Internally, it
+// handles creating and updating authorization engine objects, using SDK
+// authorization policy.
+class AuthorizationPolicyProviderInterface {
+ public:
+ virtual ~AuthorizationPolicyProviderInterface() = default;
+ virtual grpc_authorization_policy_provider* c_provider() = 0;
+};
+
+// Implementation obtains authorization policy from static string. This provider
+// will always return the same authorization engines.
+class StaticDataAuthorizationPolicyProvider
+ : public AuthorizationPolicyProviderInterface {
+ public:
+ static std::shared_ptr<StaticDataAuthorizationPolicyProvider> Create(
+ const TString& authz_policy, grpc::Status* status);
+
+ // Use factory method "Create" to create an instance of
+ // StaticDataAuthorizationPolicyProvider.
+ explicit StaticDataAuthorizationPolicyProvider(
+ grpc_authorization_policy_provider* provider)
+ : c_provider_(provider) {}
+
+ ~StaticDataAuthorizationPolicyProvider() override;
+
+ grpc_authorization_policy_provider* c_provider() override {
+ return c_provider_;
+ }
+
+ private:
+ grpc_authorization_policy_provider* c_provider_ = nullptr;
+};
+
+// Implementation obtains authorization policy by watching for changes in
+// filesystem.
+class FileWatcherAuthorizationPolicyProvider
+ : public AuthorizationPolicyProviderInterface {
+ public:
+ static std::shared_ptr<FileWatcherAuthorizationPolicyProvider> Create(
+ const TString& authz_policy_path, unsigned int refresh_interval_sec,
+ grpc::Status* status);
+
+ // Use factory method "Create" to create an instance of
+ // FileWatcherAuthorizationPolicyProvider.
+ explicit FileWatcherAuthorizationPolicyProvider(
+ grpc_authorization_policy_provider* provider)
+ : c_provider_(provider) {}
+
+ ~FileWatcherAuthorizationPolicyProvider() override;
+
+ grpc_authorization_policy_provider* c_provider() override {
+ return c_provider_;
+ }
+
+ private:
+ grpc_authorization_policy_provider* c_provider_ = nullptr;
+};
+
+} // namespace experimental
+} // namespace grpc
+
+#endif // GRPCPP_SECURITY_AUTHORIZATION_POLICY_PROVIDER_H
diff --git a/contrib/libs/grpc/include/grpcpp/security/binder_credentials.h b/contrib/libs/grpc/include/grpcpp/security/binder_credentials.h
new file mode 100644
index 0000000000..f511837ef2
--- /dev/null
+++ b/contrib/libs/grpc/include/grpcpp/security/binder_credentials.h
@@ -0,0 +1,43 @@
+// Copyright 2021 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_BINDER_CREDENTIALS_H
+#define GRPCPP_SECURITY_BINDER_CREDENTIALS_H
+
+#include <memory>
+
+#include <grpcpp/security/binder_security_policy.h>
+#include <grpcpp/security/server_credentials.h>
+
+namespace grpc {
+
+class ChannelCredentials;
+
+namespace experimental {
+
+/// EXPERIMENTAL Builds Binder ServerCredentials.
+///
+/// This should be used along with `binder:` URI scheme. The path in the URI can
+/// later be used to access the server's endpoint binder.
+/// Note that calling \a ServerBuilder::AddListeningPort() with Binder
+/// ServerCredentials in a non-supported environment will make the subsequent
+/// call to \a ServerBuilder::BuildAndStart() return a null pointer.
+std::shared_ptr<grpc::ServerCredentials> BinderServerCredentials(
+ std::shared_ptr<grpc::experimental::binder::SecurityPolicy>
+ security_policy);
+
+} // namespace experimental
+} // namespace grpc
+
+#endif // GRPCPP_SECURITY_BINDER_CREDENTIALS_H
diff --git a/contrib/libs/grpc/include/grpcpp/security/binder_security_policy.h b/contrib/libs/grpc/include/grpcpp/security/binder_security_policy.h
new file mode 100644
index 0000000000..9b825e759b
--- /dev/null
+++ b/contrib/libs/grpc/include/grpcpp/security/binder_security_policy.h
@@ -0,0 +1,58 @@
+// Copyright 2021 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_BINDER_SECURITY_POLICY_H
+#define GRPCPP_SECURITY_BINDER_SECURITY_POLICY_H
+
+#include <memory>
+
+namespace grpc {
+namespace experimental {
+namespace binder {
+
+// EXPERIMENTAL Determinines if a connection is allowed to be
+// established on Android. See https://source.android.com/security/app-sandbox
+// for more info about UID.
+class SecurityPolicy {
+ public:
+ virtual ~SecurityPolicy() = default;
+ // Returns true if the UID is authorized to connect.
+ // Must return the same value for the same inputs so callers can safely cache
+ // the result.
+ virtual bool IsAuthorized(int uid) = 0;
+};
+
+// EXPERIMENTAL Allows all connection. Anything on the Android device will be
+// able to connect, use with caution!
+class UntrustedSecurityPolicy : public SecurityPolicy {
+ public:
+ UntrustedSecurityPolicy();
+ ~UntrustedSecurityPolicy() override;
+ bool IsAuthorized(int uid) override;
+};
+
+// EXPERIMENTAL Only allows the connections from processes with the same UID. In
+// most cases this means "from the same APK".
+class InternalOnlySecurityPolicy : public SecurityPolicy {
+ public:
+ InternalOnlySecurityPolicy();
+ ~InternalOnlySecurityPolicy() override;
+ bool IsAuthorized(int uid) override;
+};
+
+} // namespace binder
+} // namespace experimental
+} // namespace grpc
+
+#endif // GRPCPP_SECURITY_BINDER_SECURITY_POLICY_H
diff --git a/contrib/libs/grpc/include/grpcpp/security/credentials.h b/contrib/libs/grpc/include/grpcpp/security/credentials.h
index fded203821..d6fb5a42be 100644
--- a/contrib/libs/grpc/include/grpcpp/security/credentials.h
+++ b/contrib/libs/grpc/include/grpcpp/security/credentials.h
@@ -59,11 +59,17 @@ std::shared_ptr<grpc::Channel> CreateCustomChannelWithInterceptors(
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators);
-/// Builds XDS Credentials.
+GRPC_DEPRECATED(
+ "Use grpc::XdsCredentials instead. The experimental version will be "
+ "deleted after the 1.41 release.")
std::shared_ptr<ChannelCredentials> XdsCredentials(
const std::shared_ptr<ChannelCredentials>& fallback_creds);
} // namespace experimental
+/// Builds XDS Credentials.
+std::shared_ptr<ChannelCredentials> XdsCredentials(
+ const std::shared_ptr<ChannelCredentials>& fallback_creds);
+
/// A channel credentials object encapsulates all the state needed by a client
/// to authenticate with a server for a given channel.
/// It can make various assertions, e.g., about the client’s identity, role
@@ -84,7 +90,7 @@ class ChannelCredentials : private grpc::GrpcLibraryCodegen {
// AsSecureCredentials(). Once we are able to remove insecure builds from gRPC
// (and also internal dependencies on the indirect method of creating a
// channel through credentials), we would be able to remove this.
- friend std::shared_ptr<ChannelCredentials> grpc::experimental::XdsCredentials(
+ friend std::shared_ptr<ChannelCredentials> grpc::XdsCredentials(
const std::shared_ptr<ChannelCredentials>& fallback_creds);
virtual SecureChannelCredentials* AsSecureCredentials() = 0;
diff --git a/contrib/libs/grpc/include/grpcpp/security/server_credentials.h b/contrib/libs/grpc/include/grpcpp/security/server_credentials.h
index 290b410c1c..d402cd62a7 100644
--- a/contrib/libs/grpc/include/grpcpp/security/server_credentials.h
+++ b/contrib/libs/grpc/include/grpcpp/security/server_credentials.h
@@ -60,10 +60,16 @@ struct SslServerCredentialsOptions {
grpc_ssl_client_certificate_request_type client_certificate_request;
};
-namespace experimental {
/// Builds Xds ServerCredentials given fallback credentials
std::shared_ptr<ServerCredentials> XdsServerCredentials(
const std::shared_ptr<ServerCredentials>& fallback_credentials);
+
+namespace experimental {
+GRPC_DEPRECATED(
+ "Use grpc::XdsServerCredentials instead. The experimental version will be "
+ "deleted after the 1.41 release.")
+std::shared_ptr<ServerCredentials> XdsServerCredentials(
+ const std::shared_ptr<ServerCredentials>& fallback_credentials);
} // namespace experimental
/// Wrapper around \a grpc_server_credentials, a way to authenticate a server.
@@ -83,8 +89,7 @@ class ServerCredentials : private grpc::GrpcLibraryCodegen {
// We need this friend declaration for access to Insecure() and
// AsSecureServerCredentials(). When these two functions are no longer
// necessary, this friend declaration can be removed too.
- friend std::shared_ptr<ServerCredentials>
- grpc::experimental::XdsServerCredentials(
+ friend std::shared_ptr<ServerCredentials> grpc::XdsServerCredentials(
const std::shared_ptr<ServerCredentials>& fallback_credentials);
/// Tries to bind \a server to the given \a addr (eg, localhost:1234,
diff --git a/contrib/libs/grpc/include/grpcpp/security/tls_certificate_provider.h b/contrib/libs/grpc/include/grpcpp/security/tls_certificate_provider.h
index 12c60452d2..80bc668d8a 100644
--- a/contrib/libs/grpc/include/grpcpp/security/tls_certificate_provider.h
+++ b/contrib/libs/grpc/include/grpcpp/security/tls_certificate_provider.h
@@ -17,15 +17,15 @@
#ifndef GRPCPP_SECURITY_TLS_CERTIFICATE_PROVIDER_H
#define GRPCPP_SECURITY_TLS_CERTIFICATE_PROVIDER_H
+#include <memory>
+#include <vector>
+
#include <grpc/grpc_security_constants.h>
#include <grpc/status.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/codegen/grpc_library.h>
#include <grpcpp/support/config.h>
-#include <memory>
-#include <vector>
-
// TODO(yihuazhang): remove the forward declaration here and include
// <grpc/grpc_security.h> directly once the insecure builds are cleaned up.
typedef struct grpc_tls_certificate_provider grpc_tls_certificate_provider;
diff --git a/contrib/libs/grpc/include/grpcpp/security/tls_certificate_verifier.h b/contrib/libs/grpc/include/grpcpp/security/tls_certificate_verifier.h
new file mode 100644
index 0000000000..63f285ece4
--- /dev/null
+++ b/contrib/libs/grpc/include/grpcpp/security/tls_certificate_verifier.h
@@ -0,0 +1,225 @@
+//
+// Copyright 2021 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_TLS_CERTIFICATE_VERIFIER_H
+#define GRPCPP_SECURITY_TLS_CERTIFICATE_VERIFIER_H
+
+#include <functional>
+#include <map>
+#include <memory>
+#include <utility>
+#include <vector>
+
+#include <grpc/grpc_security_constants.h>
+#include <grpc/status.h>
+#include <grpc/support/log.h>
+#include <grpcpp/impl/codegen/grpc_library.h>
+#include <grpcpp/impl/codegen/sync.h>
+#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/support/config.h>
+#include <grpcpp/support/string_ref.h>
+
+// TODO(yihuazhang): remove the forward declaration here and include
+// <grpc/grpc_security.h> directly once the insecure builds are cleaned up.
+typedef struct grpc_tls_custom_verification_check_request
+ grpc_tls_custom_verification_check_request;
+typedef struct grpc_tls_certificate_verifier grpc_tls_certificate_verifier;
+typedef struct grpc_tls_certificate_verifier_external
+ grpc_tls_certificate_verifier_external;
+typedef void (*grpc_tls_on_custom_verification_check_done_cb)(
+ grpc_tls_custom_verification_check_request* request, void* callback_arg,
+ grpc_status_code status, const char* error_details);
+extern "C" grpc_tls_certificate_verifier*
+grpc_tls_certificate_verifier_external_create(
+ grpc_tls_certificate_verifier_external* external_verifier);
+
+namespace grpc {
+namespace experimental {
+
+// Contains the verification-related information associated with a connection
+// request. Users should not directly create or destroy this request object, but
+// shall interact with it through CertificateVerifier's Verify() and Cancel().
+class TlsCustomVerificationCheckRequest {
+ public:
+ explicit TlsCustomVerificationCheckRequest(
+ grpc_tls_custom_verification_check_request* request);
+ ~TlsCustomVerificationCheckRequest() {}
+
+ grpc::string_ref target_name() const;
+ grpc::string_ref peer_cert() const;
+ grpc::string_ref peer_cert_full_chain() const;
+ grpc::string_ref common_name() const;
+ std::vector<grpc::string_ref> uri_names() const;
+ std::vector<grpc::string_ref> dns_names() const;
+ std::vector<grpc::string_ref> email_names() const;
+ std::vector<grpc::string_ref> ip_names() const;
+
+ grpc_tls_custom_verification_check_request* c_request() { return c_request_; }
+
+ private:
+ grpc_tls_custom_verification_check_request* c_request_ = nullptr;
+};
+
+// The base class of all internal verifier implementations, and the ultimate
+// class that all external verifiers will eventually be transformed into.
+// To implement a custom verifier, do not extend this class; instead,
+// implement a subclass of ExternalCertificateVerifier. Note that custom
+// verifier implementations can compose their functionality with existing
+// implementations of this interface, such as HostnameVerifier, by delegating
+// to an instance of that class.
+class CertificateVerifier {
+ public:
+ explicit CertificateVerifier(grpc_tls_certificate_verifier* v);
+
+ ~CertificateVerifier();
+
+ // Verifies a connection request, based on the logic specified in an internal
+ // verifier. The check on each internal verifier could be either synchronous
+ // or asynchronous, and we will need to use return value to know.
+ //
+ // request: the verification information associated with this request
+ // callback: This will only take effect if the verifier is asynchronous.
+ // The function that gRPC will invoke when the verifier has already
+ // completed its asynchronous check. Callers can use this function
+ // to perform any additional checks. The input parameter of the
+ // std::function indicates the status of the verifier check.
+ // sync_status: This will only be useful if the verifier is synchronous.
+ // The status of the verifier as it has already done it's
+ // synchronous check.
+ // return: return true if executed synchronously, otherwise return false
+ bool Verify(TlsCustomVerificationCheckRequest* request,
+ std::function<void(grpc::Status)> callback,
+ grpc::Status* sync_status);
+
+ // Cancels a verification request previously started via Verify().
+ // Used when the connection attempt times out or is cancelled while an async
+ // verification request is pending.
+ //
+ // request: the verification information associated with this request
+ void Cancel(TlsCustomVerificationCheckRequest* request);
+
+ // Gets the core verifier used internally.
+ grpc_tls_certificate_verifier* c_verifier() { return verifier_; }
+
+ private:
+ static void AsyncCheckDone(
+ grpc_tls_custom_verification_check_request* request, void* callback_arg,
+ grpc_status_code status, const char* error_details);
+
+ grpc_tls_certificate_verifier* verifier_ = nullptr;
+ grpc::internal::Mutex mu_;
+ std::map<grpc_tls_custom_verification_check_request*,
+ std::function<void(grpc::Status)>>
+ request_map_ Y_ABSL_GUARDED_BY(mu_);
+};
+
+// The base class of all external, user-specified verifiers. Users should
+// inherit this class to implement a custom verifier.
+// Note that while implementing the custom verifier that extends this class, it
+// is possible to compose an existing ExternalCertificateVerifier or
+// CertificateVerifier, inside the Verify() and Cancel() function of the new
+// custom verifier.
+class ExternalCertificateVerifier {
+ public:
+ // A factory method for creating a |CertificateVerifier| from this class. All
+ // the user-implemented verifiers should use this function to be converted to
+ // verifiers compatible with |TlsCredentialsOptions|.
+ // The resulting CertificateVerifier takes ownership of the newly instantiated
+ // Subclass.
+ template <typename Subclass, typename... Args>
+ static std::shared_ptr<CertificateVerifier> Create(Args&&... args) {
+ grpc::internal::GrpcLibraryInitializer g_gli_initializer;
+ g_gli_initializer.summon();
+ auto* external_verifier = new Subclass(std::forward<Args>(args)...);
+ return std::make_shared<CertificateVerifier>(
+ grpc_tls_certificate_verifier_external_create(
+ external_verifier->base_));
+ }
+
+ // The verification logic that will be performed after the TLS handshake
+ // completes. Implementers can choose to do their checks synchronously or
+ // asynchronously.
+ //
+ // request: the verification information associated with this request
+ // callback: This should only be used if your check is done asynchronously.
+ // When the asynchronous work is done, invoke this callback function
+ // with the proper status, indicating the success or the failure of
+ // the check. The implementer MUST NOT invoke this |callback| in the
+ // same thread before Verify() returns, otherwise it can lead to
+ // deadlocks.
+ // sync_status: This should only be used if your check is done synchronously.
+ // Modifies this value to indicate the success or the failure of
+ // the check.
+ // return: return true if your check is done synchronously, otherwise return
+ // false
+ virtual bool Verify(TlsCustomVerificationCheckRequest* request,
+ std::function<void(grpc::Status)> callback,
+ grpc::Status* sync_status) = 0;
+
+ // Cancels a verification request previously started via Verify().
+ // Used when the connection attempt times out or is cancelled while an async
+ // verification request is pending. The implementation should abort whatever
+ // async operation it is waiting for and quickly invoke the callback that was
+ // passed to Verify() with a status indicating the cancellation.
+ //
+ // request: the verification information associated with this request
+ virtual void Cancel(TlsCustomVerificationCheckRequest* request) = 0;
+
+ protected:
+ ExternalCertificateVerifier();
+
+ virtual ~ExternalCertificateVerifier();
+
+ private:
+ struct AsyncRequestState {
+ AsyncRequestState(grpc_tls_on_custom_verification_check_done_cb cb,
+ void* arg,
+ grpc_tls_custom_verification_check_request* request)
+ : callback(cb), callback_arg(arg), cpp_request(request) {}
+
+ grpc_tls_on_custom_verification_check_done_cb callback;
+ void* callback_arg;
+ TlsCustomVerificationCheckRequest cpp_request;
+ };
+
+ static int VerifyInCoreExternalVerifier(
+ void* user_data, grpc_tls_custom_verification_check_request* request,
+ grpc_tls_on_custom_verification_check_done_cb callback,
+ void* callback_arg, grpc_status_code* sync_status,
+ char** sync_error_details);
+
+ static void CancelInCoreExternalVerifier(
+ void* user_data, grpc_tls_custom_verification_check_request* request);
+
+ static void DestructInCoreExternalVerifier(void* user_data);
+
+ // TODO(yihuazhang): after the insecure build is removed, make this an object
+ // member instead of a pointer.
+ grpc_tls_certificate_verifier_external* base_ = nullptr;
+ grpc::internal::Mutex mu_;
+ std::map<grpc_tls_custom_verification_check_request*, AsyncRequestState>
+ request_map_ Y_ABSL_GUARDED_BY(mu_);
+};
+
+class HostNameCertificateVerifier : public CertificateVerifier {
+ public:
+ HostNameCertificateVerifier();
+};
+
+} // namespace experimental
+} // namespace grpc
+
+#endif // GRPCPP_SECURITY_TLS_CERTIFICATE_VERIFIER_H
diff --git a/contrib/libs/grpc/include/grpcpp/security/tls_credentials_options.h b/contrib/libs/grpc/include/grpcpp/security/tls_credentials_options.h
index b849ec2e6b..471e23be0a 100644
--- a/contrib/libs/grpc/include/grpcpp/security/tls_credentials_options.h
+++ b/contrib/libs/grpc/include/grpcpp/security/tls_credentials_options.h
@@ -19,15 +19,16 @@
#ifndef GRPCPP_SECURITY_TLS_CREDENTIALS_OPTIONS_H
#define GRPCPP_SECURITY_TLS_CREDENTIALS_OPTIONS_H
+#include <memory>
+#include <vector>
+
#include <grpc/grpc_security_constants.h>
#include <grpc/status.h>
#include <grpc/support/log.h>
#include <grpcpp/security/tls_certificate_provider.h>
+#include <grpcpp/security/tls_certificate_verifier.h>
#include <grpcpp/support/config.h>
-#include <memory>
-#include <vector>
-
// TODO(yihuazhang): remove the forward declaration here and include
// <grpc/grpc_security.h> directly once the insecure builds are cleaned up.
typedef struct grpc_tls_server_authorization_check_arg
@@ -36,116 +37,11 @@ typedef struct grpc_tls_server_authorization_check_config
grpc_tls_server_authorization_check_config;
typedef struct grpc_tls_credentials_options grpc_tls_credentials_options;
typedef struct grpc_tls_certificate_provider grpc_tls_certificate_provider;
+typedef struct grpc_tls_certificate_verifier grpc_tls_certificate_verifier;
namespace grpc {
namespace experimental {
-/** TLS server authorization check arguments, wraps
- * grpc_tls_server_authorization_check_arg. It is used for experimental
- * purposes for now and it is subject to change.
- *
- * The server authorization check arg contains all the info necessary to
- * schedule/cancel a server authorization check request. The callback function
- * must be called after finishing the schedule operation. See the description
- * of the grpc_tls_server_authorization_check_arg struct in grpc_security.h for
- * more details. **/
-class TlsServerAuthorizationCheckArg {
- public:
- /** TlsServerAuthorizationCheckArg does not take ownership of the C arg passed
- * to the constructor. One must remember to free any memory allocated to the
- * C arg after using the setter functions below. **/
- explicit TlsServerAuthorizationCheckArg(
- grpc_tls_server_authorization_check_arg* arg);
- ~TlsServerAuthorizationCheckArg();
-
- /** Getters for member fields. **/
- void* cb_user_data() const;
- int success() const;
- TString target_name() const;
- TString peer_cert() const;
- TString peer_cert_full_chain() const;
- grpc_status_code status() const;
- TString error_details() const;
-
- /** Setters for member fields. **/
- void set_cb_user_data(void* cb_user_data);
- void set_success(int success);
- void set_target_name(const TString& target_name);
- void set_peer_cert(const TString& peer_cert);
- void set_peer_cert_full_chain(const TString& peer_cert_full_chain);
- void set_status(grpc_status_code status);
- void set_error_details(const TString& error_details);
-
- /** Calls the C arg's callback function. **/
- void OnServerAuthorizationCheckDoneCallback();
-
- private:
- grpc_tls_server_authorization_check_arg* c_arg_;
-};
-
-/** An interface that the application derives and uses to instantiate a
- * TlsServerAuthorizationCheckConfig instance. Refer to the definition of the
- * grpc_tls_server_authorization_check_config in grpc_tls_credentials_options.h
- * for more details on the expectations of the member functions of the
- * interface.
- * **/
-struct TlsServerAuthorizationCheckInterface {
- virtual ~TlsServerAuthorizationCheckInterface() = default;
- /** A callback that invokes the server authorization check. **/
- virtual int Schedule(TlsServerAuthorizationCheckArg* arg) = 0;
- /** A callback that cancels a server authorization check request. **/
- virtual void Cancel(TlsServerAuthorizationCheckArg* /* arg */) {}
-};
-
-/** TLS server authorization check config, wraps
- * grps_tls_server_authorization_check_config. It is used for experimental
- * purposes for now and it is subject to change. **/
-class TlsServerAuthorizationCheckConfig {
- public:
- explicit TlsServerAuthorizationCheckConfig(
- std::shared_ptr<TlsServerAuthorizationCheckInterface>
- server_authorization_check_interface);
- ~TlsServerAuthorizationCheckConfig();
-
- int Schedule(TlsServerAuthorizationCheckArg* arg) const {
- if (server_authorization_check_interface_ == nullptr) {
- gpr_log(GPR_ERROR, "server authorization check interface is nullptr");
- if (arg != nullptr) {
- arg->set_status(GRPC_STATUS_NOT_FOUND);
- arg->set_error_details(
- "the interface of the server authorization check config is "
- "nullptr");
- }
- return 1;
- }
- return server_authorization_check_interface_->Schedule(arg);
- }
-
- void Cancel(TlsServerAuthorizationCheckArg* arg) const {
- if (server_authorization_check_interface_ == nullptr) {
- gpr_log(GPR_ERROR, "server authorization check interface is nullptr");
- if (arg != nullptr) {
- arg->set_status(GRPC_STATUS_NOT_FOUND);
- arg->set_error_details(
- "the interface of the server authorization check config is "
- "nullptr");
- }
- return;
- }
- server_authorization_check_interface_->Cancel(arg);
- }
-
- /** Returns C struct for the server authorization check config. **/
- grpc_tls_server_authorization_check_config* c_config() const {
- return c_config_;
- }
-
- private:
- grpc_tls_server_authorization_check_config* c_config_;
- std::shared_ptr<TlsServerAuthorizationCheckInterface>
- server_authorization_check_interface_;
-};
-
// Base class of configurable options specified by users to configure their
// certain security features supported in TLS. It is used for experimental
// purposes for now and it is subject to change.
@@ -187,6 +83,19 @@ class TlsCredentialsOptions {
//
// @param identity_cert_name the name of identity key-cert pairs being set.
void set_identity_cert_name(const TString& identity_cert_name);
+ // Sets the certificate verifier used to perform post-handshake peer identity
+ // checks.
+ void set_certificate_verifier(
+ std::shared_ptr<CertificateVerifier> certificate_verifier);
+ // Sets the options of whether to check the hostname of the peer on a per-call
+ // basis. This is usually used in a combination with virtual hosting at the
+ // client side, where each individual call on a channel can have a different
+ // host associated with it.
+ // This check is intended to verify that the host specified for the individual
+ // call is covered by the cert that the peer presented.
+ // We will perform such checks by default. This should be disabled if
+ // verifiers other than the host name verifier is used.
+ void set_check_call_host(bool check_call_host);
// ----- Getters for member fields ----
// Get the internal c options. This function shall be used only internally.
@@ -196,6 +105,7 @@ class TlsCredentialsOptions {
private:
std::shared_ptr<CertificateProviderInterface> certificate_provider_;
+ std::shared_ptr<CertificateVerifier> certificate_verifier_;
grpc_tls_credentials_options* c_credentials_options_ = nullptr;
};
@@ -207,14 +117,9 @@ class TlsCredentialsOptions {
// It is used for experimental purposes for now and it is subject to change.
class TlsChannelCredentialsOptions final : public TlsCredentialsOptions {
public:
- // Sets the option to verify the server.
- // The default is GRPC_TLS_SERVER_VERIFICATION.
- void set_server_verification_option(
- grpc_tls_server_verification_option server_verification_option);
- // Sets the custom authorization config.
- void set_server_authorization_check_config(
- std::shared_ptr<TlsServerAuthorizationCheckConfig>
- authorization_check_config);
+ // Sets the decision of whether to do a crypto check on the server certs.
+ // The default is true.
+ void set_verify_server_certs(bool verify_server_certs);
private:
};
diff --git a/contrib/libs/grpc/include/grpcpp/server.h b/contrib/libs/grpc/include/grpcpp/server.h
index 06e6e80e5b..379a465ee3 100644
--- a/contrib/libs/grpc/include/grpcpp/server.h
+++ b/contrib/libs/grpc/include/grpcpp/server.h
@@ -23,12 +23,12 @@
#pragma GCC system_header
#endif
+#include <grpc/impl/codegen/port_platform.h>
+
#include <list>
#include <memory>
#include <vector>
-#include <grpc/impl/codegen/port_platform.h>
-
#include <grpc/compression.h>
#include <grpc/support/atm.h>
#include <grpcpp/channel.h>
@@ -241,7 +241,6 @@ class Server : public ServerInterface, private GrpcLibraryCodegen {
/// service. The service must exist for the lifetime of the Server instance.
void RegisterAsyncGenericService(AsyncGenericService* service) override;
-#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
/// Register a callback-based generic service. This call does not take
/// ownership of theservice. The service must exist for the lifetime of the
/// Server instance.
@@ -252,41 +251,6 @@ class Server : public ServerInterface, private GrpcLibraryCodegen {
context_allocator_ = std::move(context_allocator);
}
-#else
- /// NOTE: class experimental_registration_type is not part of the public API
- /// of this class
- /// TODO(vjpai): Move these contents to the public API of Server when
- /// they are no longer experimental
- class experimental_registration_type final
- : public experimental_registration_interface {
- public:
- explicit experimental_registration_type(Server* server) : server_(server) {}
- void RegisterCallbackGenericService(
- experimental::CallbackGenericService* service) override {
- server_->RegisterCallbackGenericService(service);
- }
-
- void RegisterContextAllocator(
- std::unique_ptr<ContextAllocator> context_allocator) override {
- server_->context_allocator_ = std::move(context_allocator);
- }
-
- private:
- Server* server_;
- };
-
- /// TODO(vjpai): Mark this override when experimental type above is deleted
- void RegisterCallbackGenericService(
- experimental::CallbackGenericService* service);
-
- /// NOTE: The function experimental_registration() is not stable public API.
- /// It is a view to the experimental components of this class. It may be
- /// changed or removed at any time.
- experimental_registration_interface* experimental_registration() override {
- return &experimental_registration_;
- }
-#endif
-
void PerformOpsOnCall(internal::CallOpSetInterface* ops,
internal::Call* call) override;
@@ -331,12 +295,6 @@ class Server : public ServerInterface, private GrpcLibraryCodegen {
/// the \a sync_server_cqs)
std::vector<std::unique_ptr<SyncRequestThreadManager>> sync_req_mgrs_;
-#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
- // For registering experimental callback generic service; remove when that
- // method longer experimental
- experimental_registration_type experimental_registration_{this};
-#endif
-
// Server status
internal::Mutex mu_;
bool started_;
@@ -368,11 +326,7 @@ class Server : public ServerInterface, private GrpcLibraryCodegen {
// When appropriate, use a default callback generic service to handle
// unimplemented methods
-#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
std::unique_ptr<CallbackGenericService> unimplemented_service_;
-#else
- std::unique_ptr<experimental::CallbackGenericService> unimplemented_service_;
-#endif
// A special handler for resource exhausted in sync case
std::unique_ptr<internal::MethodHandler> resource_exhausted_handler_;
@@ -384,7 +338,7 @@ class Server : public ServerInterface, private GrpcLibraryCodegen {
// with this server (if any). It is set on the first call to CallbackCQ().
// It is _not owned_ by the server; ownership belongs with its internal
// shutdown callback tag (invoked when the CQ is fully shutdown).
- CompletionQueue* callback_cq_ Y_ABSL_GUARDED_BY(mu_) = nullptr;
+ std::atomic<CompletionQueue*> callback_cq_{nullptr};
// List of CQs passed in by user that must be Shutdown only after Server is
// Shutdown. Even though this is only used with NDEBUG, instantiate it in all
diff --git a/contrib/libs/grpc/include/grpcpp/server_builder.h b/contrib/libs/grpc/include/grpcpp/server_builder.h
index 109514facd..7146484274 100644
--- a/contrib/libs/grpc/include/grpcpp/server_builder.h
+++ b/contrib/libs/grpc/include/grpcpp/server_builder.h
@@ -19,13 +19,13 @@
#ifndef GRPCPP_SERVER_BUILDER_H
#define GRPCPP_SERVER_BUILDER_H
+#include <grpc/impl/codegen/port_platform.h>
+
#include <climits>
#include <map>
#include <memory>
#include <vector>
-#include <grpc/impl/codegen/port_platform.h>
-
#include <grpc/compression.h>
#include <grpc/support/cpu.h>
#include <grpc/support/workaround_list.h>
@@ -33,6 +33,7 @@
#include <grpcpp/impl/codegen/server_interceptor.h>
#include <grpcpp/impl/server_builder_option.h>
#include <grpcpp/impl/server_builder_plugin.h>
+#include <grpcpp/security/authorization_policy_provider.h>
#include <grpcpp/server.h>
#include <grpcpp/support/config.h>
@@ -55,13 +56,7 @@ namespace internal {
class ExternalConnectionAcceptorImpl;
} // namespace internal
-#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
-namespace experimental {
-#endif
class CallbackGenericService;
-#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
-} // namespace experimental
-#endif
namespace experimental {
// EXPERIMENTAL API:
@@ -121,8 +116,8 @@ class ServerBuilder {
/// \param addr_uri The address to try to bind to the server in URI form. If
/// the scheme name is omitted, "dns:///" is assumed. To bind to any address,
/// please use IPv6 any, i.e., [::]:<port>, which also accepts IPv4
- /// connections. Valid values include dns:///localhost:1234, /
- /// 192.168.1.1:31416, dns:///[::1]:27182, etc.).
+ /// connections. Valid values include dns:///localhost:1234,
+ /// 192.168.1.1:31416, dns:///[::1]:27182, etc.
/// \param creds The credentials associated with the server.
/// \param[out] selected_port If not `nullptr`, gets populated with the port
/// number bound to the \a grpc::Server for the corresponding endpoint after
@@ -269,20 +264,6 @@ class ServerBuilder {
builder_->interceptor_creators_ = std::move(interceptor_creators);
}
- /// Set the allocator for creating and releasing callback server context.
- /// Takes the owndership of the allocator.
- ServerBuilder& SetContextAllocator(
- std::unique_ptr<grpc::ContextAllocator> context_allocator);
-
-#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
- /// Register a generic service that uses the callback API.
- /// Matches requests with any :authority
- /// This is mostly useful for writing generic gRPC Proxies where the exact
- /// serialization format is unknown
- ServerBuilder& RegisterCallbackGenericService(
- grpc::experimental::CallbackGenericService* service);
-#endif
-
enum class ExternalConnectionType {
FROM_FD = 0 // in the form of a file descriptor
};
@@ -295,18 +276,27 @@ class ServerBuilder {
AddExternalConnectionAcceptor(ExternalConnectionType type,
std::shared_ptr<ServerCredentials> creds);
+ /// Sets server authorization policy provider in
+ /// GRPC_ARG_AUTHORIZATION_POLICY_PROVIDER channel argument.
+ void SetAuthorizationPolicyProvider(
+ std::shared_ptr<experimental::AuthorizationPolicyProviderInterface>
+ provider);
+
private:
ServerBuilder* builder_;
};
-#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+ /// Set the allocator for creating and releasing callback server context.
+ /// Takes the owndership of the allocator.
+ ServerBuilder& SetContextAllocator(
+ std::unique_ptr<grpc::ContextAllocator> context_allocator);
+
/// Register a generic service that uses the callback API.
/// Matches requests with any :authority
/// This is mostly useful for writing generic gRPC Proxies where the exact
/// serialization format is unknown
ServerBuilder& RegisterCallbackGenericService(
grpc::CallbackGenericService* service);
-#endif
/// NOTE: The function experimental() is not stable public API. It is a view
/// to the experimental components of this class. It may be changed or removed
@@ -357,6 +347,9 @@ class ServerBuilder {
server_config_fetcher_ = server_config_fetcher;
}
+ /// Experimental API, subject to change.
+ virtual ChannelArguments BuildChannelArgs();
+
private:
friend class ::grpc::testing::ServerBuilderPluginTest;
@@ -395,12 +388,7 @@ class ServerBuilder {
grpc_resource_quota* resource_quota_;
grpc::AsyncGenericService* generic_service_{nullptr};
std::unique_ptr<ContextAllocator> context_allocator_;
-#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
grpc::CallbackGenericService* callback_generic_service_{nullptr};
-#else
- grpc::experimental::CallbackGenericService* callback_generic_service_{
- nullptr};
-#endif
struct {
bool is_set;
@@ -417,6 +405,8 @@ class ServerBuilder {
std::vector<std::shared_ptr<grpc::internal::ExternalConnectionAcceptorImpl>>
acceptors_;
grpc_server_config_fetcher* server_config_fetcher_ = nullptr;
+ std::shared_ptr<experimental::AuthorizationPolicyProviderInterface>
+ authorization_provider_;
};
} // namespace grpc
diff --git a/contrib/libs/grpc/include/grpcpp/server_context.h b/contrib/libs/grpc/include/grpcpp/server_context.h
index 45f2614994..ed6bd66d06 100644
--- a/contrib/libs/grpc/include/grpcpp/server_context.h
+++ b/contrib/libs/grpc/include/grpcpp/server_context.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SERVER_CONTEXT_H
#define GRPCPP_SERVER_CONTEXT_H
-#include <grpcpp/impl/codegen/server_context.h>
+#include <grpcpp/impl/codegen/server_context.h> // IWYU pragma: export
#endif // GRPCPP_SERVER_CONTEXT_H
diff --git a/contrib/libs/grpc/include/grpcpp/server_posix.h b/contrib/libs/grpc/include/grpcpp/server_posix.h
index ef3ee01a5c..2e938624d2 100644
--- a/contrib/libs/grpc/include/grpcpp/server_posix.h
+++ b/contrib/libs/grpc/include/grpcpp/server_posix.h
@@ -19,9 +19,10 @@
#ifndef GRPCPP_SERVER_POSIX_H
#define GRPCPP_SERVER_POSIX_H
+#include <grpc/support/port_platform.h>
+
#include <memory>
-#include <grpc/support/port_platform.h>
#include <grpcpp/server.h>
namespace grpc {
diff --git a/contrib/libs/grpc/include/grpcpp/support/async_stream.h b/contrib/libs/grpc/include/grpcpp/support/async_stream.h
index ff9e455679..5f71701417 100644
--- a/contrib/libs/grpc/include/grpcpp/support/async_stream.h
+++ b/contrib/libs/grpc/include/grpcpp/support/async_stream.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_ASYNC_STREAM_H
#define GRPCPP_SUPPORT_ASYNC_STREAM_H
-#include <grpcpp/impl/codegen/async_stream.h>
+#include <grpcpp/impl/codegen/async_stream.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_ASYNC_STREAM_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/async_unary_call.h b/contrib/libs/grpc/include/grpcpp/support/async_unary_call.h
index 2e5181c557..02071e48c5 100644
--- a/contrib/libs/grpc/include/grpcpp/support/async_unary_call.h
+++ b/contrib/libs/grpc/include/grpcpp/support/async_unary_call.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H
#define GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H
-#include <grpcpp/impl/codegen/async_unary_call.h>
+#include <grpcpp/impl/codegen/async_unary_call.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/byte_buffer.h b/contrib/libs/grpc/include/grpcpp/support/byte_buffer.h
index 53aeff19f7..6f566e76da 100644
--- a/contrib/libs/grpc/include/grpcpp/support/byte_buffer.h
+++ b/contrib/libs/grpc/include/grpcpp/support/byte_buffer.h
@@ -22,7 +22,7 @@
#include <grpc/byte_buffer.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
-#include <grpcpp/impl/codegen/byte_buffer.h>
+#include <grpcpp/impl/codegen/byte_buffer.h> // IWYU pragma: export
#include <grpcpp/impl/serialization_traits.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/slice.h>
diff --git a/contrib/libs/grpc/include/grpcpp/support/channel_arguments.h b/contrib/libs/grpc/include/grpcpp/support/channel_arguments.h
index 0ddc463ceb..a09180de45 100644
--- a/contrib/libs/grpc/include/grpcpp/support/channel_arguments.h
+++ b/contrib/libs/grpc/include/grpcpp/support/channel_arguments.h
@@ -74,13 +74,7 @@ class ChannelArguments {
/// the resolver.
void SetGrpclbFallbackTimeout(int fallback_timeout);
- /// For client channel's, the socket mutator operates on
- /// "channel" sockets. For server's, the socket mutator operates
- /// only on "listen" sockets.
- /// TODO(apolcyn): allow socket mutators to also operate
- /// on server "channel" sockets, and adjust the socket mutator
- /// object to be more speficic about which type of socket
- /// it should operate on.
+ /// Set a mutator for the underlying socket.
void SetSocketMutator(grpc_socket_mutator* mutator);
/// Set the string to prepend to the user agent.
diff --git a/contrib/libs/grpc/include/grpcpp/support/client_callback.h b/contrib/libs/grpc/include/grpcpp/support/client_callback.h
index 063fdc4f85..c15bca0dbe 100644
--- a/contrib/libs/grpc/include/grpcpp/support/client_callback.h
+++ b/contrib/libs/grpc/include/grpcpp/support/client_callback.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_CLIENT_CALLBACK_H
#define GRPCPP_SUPPORT_CLIENT_CALLBACK_H
-#include <grpcpp/impl/codegen/client_callback.h>
+#include <grpcpp/impl/codegen/client_callback.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_CLIENT_CALLBACK_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/client_interceptor.h b/contrib/libs/grpc/include/grpcpp/support/client_interceptor.h
index 50810e3fe3..552cab4c70 100644
--- a/contrib/libs/grpc/include/grpcpp/support/client_interceptor.h
+++ b/contrib/libs/grpc/include/grpcpp/support/client_interceptor.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_CLIENT_INTERCEPTOR_H
#define GRPCPP_SUPPORT_CLIENT_INTERCEPTOR_H
-#include <grpcpp/impl/codegen/client_interceptor.h>
+#include <grpcpp/impl/codegen/client_interceptor.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_CLIENT_INTERCEPTOR_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/config.h b/contrib/libs/grpc/include/grpcpp/support/config.h
index 16bdab6427..f2632f2640 100644
--- a/contrib/libs/grpc/include/grpcpp/support/config.h
+++ b/contrib/libs/grpc/include/grpcpp/support/config.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_CONFIG_H
#define GRPCPP_SUPPORT_CONFIG_H
-#include <grpcpp/impl/codegen/config.h>
+#include <grpcpp/impl/codegen/config.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_CONFIG_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/interceptor.h b/contrib/libs/grpc/include/grpcpp/support/interceptor.h
index 7ff79516ba..d4f2ea180e 100644
--- a/contrib/libs/grpc/include/grpcpp/support/interceptor.h
+++ b/contrib/libs/grpc/include/grpcpp/support/interceptor.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_INTERCEPTOR_H
#define GRPCPP_SUPPORT_INTERCEPTOR_H
-#include <grpcpp/impl/codegen/interceptor.h>
+#include <grpcpp/impl/codegen/interceptor.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_INTERCEPTOR_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/message_allocator.h b/contrib/libs/grpc/include/grpcpp/support/message_allocator.h
index 20ce072b90..22a963f3af 100644
--- a/contrib/libs/grpc/include/grpcpp/support/message_allocator.h
+++ b/contrib/libs/grpc/include/grpcpp/support/message_allocator.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_MESSAGE_ALLOCATOR_H
#define GRPCPP_SUPPORT_MESSAGE_ALLOCATOR_H
-#include <grpcpp/impl/codegen/message_allocator.h>
+#include <grpcpp/impl/codegen/message_allocator.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_MESSAGE_ALLOCATOR_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/method_handler.h b/contrib/libs/grpc/include/grpcpp/support/method_handler.h
index 038e76c8af..0b97a7af03 100644
--- a/contrib/libs/grpc/include/grpcpp/support/method_handler.h
+++ b/contrib/libs/grpc/include/grpcpp/support/method_handler.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_METHOD_HANDLER_H
#define GRPCPP_SUPPORT_METHOD_HANDLER_H
-#include <grpcpp/impl/codegen/method_handler.h>
+#include <grpcpp/impl/codegen/method_handler.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_METHOD_HANDLER_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/proto_buffer_reader.h b/contrib/libs/grpc/include/grpcpp/support/proto_buffer_reader.h
index 4cdb65d531..07e523ed74 100644
--- a/contrib/libs/grpc/include/grpcpp/support/proto_buffer_reader.h
+++ b/contrib/libs/grpc/include/grpcpp/support/proto_buffer_reader.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_PROTO_BUFFER_READER_H
#define GRPCPP_SUPPORT_PROTO_BUFFER_READER_H
-#include <grpcpp/impl/codegen/proto_buffer_reader.h>
+#include <grpcpp/impl/codegen/proto_buffer_reader.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_PROTO_BUFFER_READER_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/proto_buffer_writer.h b/contrib/libs/grpc/include/grpcpp/support/proto_buffer_writer.h
index 01cf29c457..589deb82e3 100644
--- a/contrib/libs/grpc/include/grpcpp/support/proto_buffer_writer.h
+++ b/contrib/libs/grpc/include/grpcpp/support/proto_buffer_writer.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_PROTO_BUFFER_WRITER_H
#define GRPCPP_SUPPORT_PROTO_BUFFER_WRITER_H
-#include <grpcpp/impl/codegen/proto_buffer_writer.h>
+#include <grpcpp/impl/codegen/proto_buffer_writer.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_PROTO_BUFFER_WRITER_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/server_callback.h b/contrib/libs/grpc/include/grpcpp/support/server_callback.h
index b0aeeb53c5..1ffdce53d9 100644
--- a/contrib/libs/grpc/include/grpcpp/support/server_callback.h
+++ b/contrib/libs/grpc/include/grpcpp/support/server_callback.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_SERVER_CALLBACK_H
#define GRPCPP_SUPPORT_SERVER_CALLBACK_H
-#include <grpcpp/impl/codegen/server_callback.h>
+#include <grpcpp/impl/codegen/server_callback.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_SERVER_CALLBACK_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/server_interceptor.h b/contrib/libs/grpc/include/grpcpp/support/server_interceptor.h
index b0a6229b66..ad9c7a1869 100644
--- a/contrib/libs/grpc/include/grpcpp/support/server_interceptor.h
+++ b/contrib/libs/grpc/include/grpcpp/support/server_interceptor.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_SERVER_INTERCEPTOR_H
#define GRPCPP_SUPPORT_SERVER_INTERCEPTOR_H
-#include <grpcpp/impl/codegen/server_interceptor.h>
+#include <grpcpp/impl/codegen/server_interceptor.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_SERVER_INTERCEPTOR_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/slice.h b/contrib/libs/grpc/include/grpcpp/support/slice.h
index eaeb29a40b..2434983f59 100644
--- a/contrib/libs/grpc/include/grpcpp/support/slice.h
+++ b/contrib/libs/grpc/include/grpcpp/support/slice.h
@@ -20,7 +20,7 @@
#define GRPCPP_SUPPORT_SLICE_H
#include <grpc/slice.h>
-#include <grpcpp/impl/codegen/slice.h>
+#include <grpcpp/impl/codegen/slice.h> // IWYU pragma: export
#include <grpcpp/support/config.h>
#endif // GRPCPP_SUPPORT_SLICE_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/status.h b/contrib/libs/grpc/include/grpcpp/support/status.h
index 91b629f167..e46b46d16f 100644
--- a/contrib/libs/grpc/include/grpcpp/support/status.h
+++ b/contrib/libs/grpc/include/grpcpp/support/status.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_STATUS_H
#define GRPCPP_SUPPORT_STATUS_H
-#include <grpcpp/impl/codegen/status.h>
+#include <grpcpp/impl/codegen/status.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_STATUS_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/status_code_enum.h b/contrib/libs/grpc/include/grpcpp/support/status_code_enum.h
index bfb47f39c0..eac697f45a 100644
--- a/contrib/libs/grpc/include/grpcpp/support/status_code_enum.h
+++ b/contrib/libs/grpc/include/grpcpp/support/status_code_enum.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_STATUS_CODE_ENUM_H
#define GRPCPP_SUPPORT_STATUS_CODE_ENUM_H
-#include <grpcpp/impl/codegen/status_code_enum.h>
+#include <grpcpp/impl/codegen/status_code_enum.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_STATUS_CODE_ENUM_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/string_ref.h b/contrib/libs/grpc/include/grpcpp/support/string_ref.h
index 0e0d3d4389..6cf82bedf6 100644
--- a/contrib/libs/grpc/include/grpcpp/support/string_ref.h
+++ b/contrib/libs/grpc/include/grpcpp/support/string_ref.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_STRING_REF_H
#define GRPCPP_SUPPORT_STRING_REF_H
-#include <grpcpp/impl/codegen/string_ref.h>
+#include <grpcpp/impl/codegen/string_ref.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_STRING_REF_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/stub_options.h b/contrib/libs/grpc/include/grpcpp/support/stub_options.h
index e9700ea492..ffe1ad77ea 100644
--- a/contrib/libs/grpc/include/grpcpp/support/stub_options.h
+++ b/contrib/libs/grpc/include/grpcpp/support/stub_options.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_STUB_OPTIONS_H
#define GRPCPP_SUPPORT_STUB_OPTIONS_H
-#include <grpcpp/impl/codegen/stub_options.h>
+#include <grpcpp/impl/codegen/stub_options.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_STUB_OPTIONS_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/sync_stream.h b/contrib/libs/grpc/include/grpcpp/support/sync_stream.h
index ea60b6da6b..78a348de75 100644
--- a/contrib/libs/grpc/include/grpcpp/support/sync_stream.h
+++ b/contrib/libs/grpc/include/grpcpp/support/sync_stream.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_SYNC_STREAM_H
#define GRPCPP_SUPPORT_SYNC_STREAM_H
-#include <grpcpp/impl/codegen/sync_stream.h>
+#include <grpcpp/impl/codegen/sync_stream.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_SYNC_STREAM_H
diff --git a/contrib/libs/grpc/include/grpcpp/support/time.h b/contrib/libs/grpc/include/grpcpp/support/time.h
index c7408ff27d..b5e07b68f2 100644
--- a/contrib/libs/grpc/include/grpcpp/support/time.h
+++ b/contrib/libs/grpc/include/grpcpp/support/time.h
@@ -19,6 +19,6 @@
#ifndef GRPCPP_SUPPORT_TIME_H
#define GRPCPP_SUPPORT_TIME_H
-#include <grpcpp/impl/codegen/time.h>
+#include <grpcpp/impl/codegen/time.h> // IWYU pragma: export
#endif // GRPCPP_SUPPORT_TIME_H
diff --git a/contrib/libs/grpc/include/grpcpp/test/client_context_test_peer.h b/contrib/libs/grpc/include/grpcpp/test/client_context_test_peer.h
new file mode 100644
index 0000000000..0afc32c0e8
--- /dev/null
+++ b/contrib/libs/grpc/include/grpcpp/test/client_context_test_peer.h
@@ -0,0 +1,62 @@
+/*
+ *
+ * Copyright 2021 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_TEST_CLIENT_CONTEXT_TEST_PEER_H
+#define GRPCPP_TEST_CLIENT_CONTEXT_TEST_PEER_H
+
+#include <map>
+
+#include <grpcpp/client_context.h>
+
+namespace grpc {
+namespace testing {
+
+/// A test-only class to access private members and methods of ClientContext.
+class ClientContextTestPeer {
+ public:
+ explicit ClientContextTestPeer(ClientContext* const ctx) : ctx_(ctx) {}
+
+ /// Inject metadata to the ClientContext for the test. The test peer
+ /// must be alive when a ClientContext::GetServerInitialMetadata is called.
+ void AddServerInitialMetadata(const TString& key,
+ const TString& value) {
+ server_initial_metadata_storage_.insert(
+ std::pair<TString, TString>(key, value));
+ ctx_->initial_metadata_received_ = true;
+ ctx_->recv_initial_metadata_.map()->clear();
+ for (const auto& item : server_initial_metadata_storage_) {
+ ctx_->recv_initial_metadata_.map()->insert(
+ std::pair<grpc::string_ref, grpc::string_ref>(
+ item.first.c_str(),
+ grpc::string_ref(item.second.data(), item.second.size())));
+ }
+ }
+
+ std::multimap<TString, TString> GetSendInitialMetadata() const {
+ return ctx_->send_initial_metadata_;
+ }
+
+ private:
+ ClientContext* const ctx_; // not owned
+ std::multimap<TString, TString> server_initial_metadata_storage_;
+};
+
+} // namespace testing
+} // namespace grpc
+
+#endif // GRPCPP_TEST_CLIENT_CONTEXT_TEST_PEER_H
diff --git a/contrib/libs/grpc/include/grpcpp/test/default_reactor_test_peer.h b/contrib/libs/grpc/include/grpcpp/test/default_reactor_test_peer.h
index a792e6f94a..4d4ae5c39d 100644
--- a/contrib/libs/grpc/include/grpcpp/test/default_reactor_test_peer.h
+++ b/contrib/libs/grpc/include/grpcpp/test/default_reactor_test_peer.h
@@ -34,22 +34,21 @@ namespace testing {
/// test mode rather than letting it follow the normal paths.
class DefaultReactorTestPeer {
public:
- explicit DefaultReactorTestPeer(experimental::CallbackServerContext* ctx)
- : DefaultReactorTestPeer(ctx, [](::grpc::Status) {}) {}
- DefaultReactorTestPeer(experimental::CallbackServerContext* ctx,
- std::function<void(::grpc::Status)> finish_func)
+ explicit DefaultReactorTestPeer(CallbackServerContext* ctx)
+ : DefaultReactorTestPeer(ctx, [](Status) {}) {}
+ DefaultReactorTestPeer(CallbackServerContext* ctx,
+ std::function<void(Status)> finish_func)
: ctx_(ctx) {
ctx->SetupTestDefaultReactor(std::move(finish_func));
}
- ::grpc::experimental::ServerUnaryReactor* reactor() const {
- return reinterpret_cast<experimental::ServerUnaryReactor*>(
- &ctx_->default_reactor_);
+ ServerUnaryReactor* reactor() const {
+ return reinterpret_cast<ServerUnaryReactor*>(&ctx_->default_reactor_);
}
bool test_status_set() const { return ctx_->test_status_set(); }
Status test_status() const { return ctx_->test_status(); }
private:
- experimental::CallbackServerContext* const ctx_; // not owned
+ CallbackServerContext* const ctx_; // not owned
};
} // namespace testing
diff --git a/contrib/libs/grpc/include/grpcpp/test/mock_stream.h b/contrib/libs/grpc/include/grpcpp/test/mock_stream.h
index e33595d709..f210b41ac6 100644
--- a/contrib/libs/grpc/include/grpcpp/test/mock_stream.h
+++ b/contrib/libs/grpc/include/grpcpp/test/mock_stream.h
@@ -22,6 +22,7 @@
#include <stdint.h>
#include <gmock/gmock.h>
+
#include <grpcpp/impl/codegen/call.h>
#include <grpcpp/support/async_stream.h>
#include <grpcpp/support/async_unary_call.h>
@@ -90,6 +91,8 @@ class MockClientAsyncResponseReader
public:
MockClientAsyncResponseReader() = default;
+ /// ClientAsyncResponseReaderInterface
+ MOCK_METHOD0_T(StartCall, void());
MOCK_METHOD1_T(ReadInitialMetadata, void(void*));
MOCK_METHOD3_T(Finish, void(R*, Status*, void*));
};
@@ -100,6 +103,7 @@ class MockClientAsyncReader : public ClientAsyncReaderInterface<R> {
MockClientAsyncReader() = default;
/// ClientAsyncStreamingInterface
+ MOCK_METHOD1_T(StartCall, void(void*));
MOCK_METHOD1_T(ReadInitialMetadata, void(void*));
MOCK_METHOD2_T(Finish, void(Status*, void*));
@@ -113,11 +117,13 @@ class MockClientAsyncWriter : public ::grpc::ClientAsyncWriterInterface<W> {
MockClientAsyncWriter() = default;
/// ClientAsyncStreamingInterface
+ MOCK_METHOD1_T(StartCall, void(void*));
MOCK_METHOD1_T(ReadInitialMetadata, void(void*));
MOCK_METHOD2_T(Finish, void(Status*, void*));
/// AsyncWriterInterface
MOCK_METHOD2_T(Write, void(const W&, void*));
+ MOCK_METHOD3_T(Write, void(const W&, ::grpc::WriteOptions, void*));
/// ClientAsyncWriterInterface
MOCK_METHOD1_T(WritesDone, void(void*));
@@ -130,11 +136,13 @@ class MockClientAsyncReaderWriter
MockClientAsyncReaderWriter() = default;
/// ClientAsyncStreamingInterface
+ MOCK_METHOD1_T(StartCall, void(void*));
MOCK_METHOD1_T(ReadInitialMetadata, void(void*));
MOCK_METHOD2_T(Finish, void(Status*, void*));
/// AsyncWriterInterface
MOCK_METHOD2_T(Write, void(const W&, void*));
+ MOCK_METHOD3_T(Write, void(const W&, ::grpc::WriteOptions, void*));
/// AsyncReaderInterface
MOCK_METHOD2_T(Read, void(R*, void*));
@@ -143,6 +151,47 @@ class MockClientAsyncReaderWriter
MOCK_METHOD1_T(WritesDone, void(void*));
};
+template <class R>
+class MockServerReader : public ::grpc::ServerReaderInterface<R> {
+ public:
+ MockServerReader() = default;
+
+ /// ServerStreamingInterface
+ MOCK_METHOD0_T(SendInitialMetadata, void());
+
+ /// ReaderInterface
+ MOCK_METHOD1_T(NextMessageSize, bool(uint32_t*));
+ MOCK_METHOD1_T(Read, bool(R*));
+};
+
+template <class W>
+class MockServerWriter : public ::grpc::ServerWriterInterface<W> {
+ public:
+ MockServerWriter() = default;
+
+ /// ServerStreamingInterface
+ MOCK_METHOD0_T(SendInitialMetadata, void());
+
+ /// WriterInterface
+ MOCK_METHOD2_T(Write, bool(const W&, const WriteOptions));
+};
+
+template <class W, class R>
+class MockServerReaderWriter : public grpc::ServerReaderWriterInterface<W, R> {
+ public:
+ MockServerReaderWriter() = default;
+
+ /// ServerStreamingInterface
+ MOCK_METHOD0_T(SendInitialMetadata, void());
+
+ /// ReaderInterface
+ MOCK_METHOD1_T(NextMessageSize, bool(uint32_t*));
+ MOCK_METHOD1_T(Read, bool(R*));
+
+ /// WriterInterface
+ MOCK_METHOD2_T(Write, bool(const W&, const WriteOptions));
+};
+
} // namespace testing
} // namespace grpc
diff --git a/contrib/libs/grpc/include/grpcpp/xds_server_builder.h b/contrib/libs/grpc/include/grpcpp/xds_server_builder.h
index c1549179ba..82bc087754 100644
--- a/contrib/libs/grpc/include/grpcpp/xds_server_builder.h
+++ b/contrib/libs/grpc/include/grpcpp/xds_server_builder.h
@@ -24,17 +24,24 @@
#include <grpcpp/server_builder.h>
namespace grpc {
-namespace experimental {
class XdsServerServingStatusNotifierInterface {
public:
+ struct ServingStatusUpdate {
+ ::grpc::Status status;
+ };
+
virtual ~XdsServerServingStatusNotifierInterface() = default;
// \a uri contains the listening target associated with the notification. Note
// that a single target provided to XdsServerBuilder can get resolved to
- // multiple listening addresses. Status::OK signifies that the server is
- // serving, while a non-OK status signifies that the server is not serving.
- virtual void OnServingStatusChange(TString uri, grpc::Status status) = 0;
+ // multiple listening addresses.
+ // The callback is invoked each time there is an update to the serving status.
+ // The API does not provide any guarantees around duplicate updates.
+ // Status::OK signifies that the server is serving, while a non-OK status
+ // signifies that the server is not serving.
+ virtual void OnServingStatusUpdate(TString uri,
+ ServingStatusUpdate update) = 0;
};
class XdsServerBuilder : public ::grpc::ServerBuilder {
@@ -47,28 +54,41 @@ class XdsServerBuilder : public ::grpc::ServerBuilder {
notifier_ = notifier;
}
- std::unique_ptr<Server> BuildAndStart() override {
+ private:
+ // Called at the beginning of BuildAndStart().
+ ChannelArguments BuildChannelArgs() override {
+ ChannelArguments args = ServerBuilder::BuildChannelArgs();
+ grpc_channel_args c_channel_args = args.c_channel_args();
grpc_server_config_fetcher* fetcher = grpc_server_config_fetcher_xds_create(
- {OnServingStatusChange, notifier_});
- if (fetcher == nullptr) return nullptr;
- set_fetcher(fetcher);
- return ServerBuilder::BuildAndStart();
+ {OnServingStatusUpdate, notifier_}, &c_channel_args);
+ if (fetcher != nullptr) set_fetcher(fetcher);
+ return args;
}
- private:
- static void OnServingStatusChange(void* user_data, const char* uri,
- grpc_status_code code,
- const char* error_message) {
+ static void OnServingStatusUpdate(void* user_data, const char* uri,
+ grpc_serving_status_update update) {
if (user_data == nullptr) return;
XdsServerServingStatusNotifierInterface* notifier =
static_cast<XdsServerServingStatusNotifierInterface*>(user_data);
- notifier->OnServingStatusChange(
- uri, grpc::Status(static_cast<StatusCode>(code), error_message));
+ notifier->OnServingStatusUpdate(
+ uri, {grpc::Status(static_cast<StatusCode>(update.code),
+ update.error_message)});
}
XdsServerServingStatusNotifierInterface* notifier_ = nullptr;
};
+namespace experimental {
+// TODO(yashykt): Delete this after the 1.42 release.
+GRPC_DEPRECATED(
+ "Use grpc::XdsServerServingStatusNotifierInterface instead. The "
+ "experimental version will be deleted after the 1.42 release.")
+typedef grpc::XdsServerServingStatusNotifierInterface
+ XdsServerServingStatusNotifierInterface;
+GRPC_DEPRECATED(
+ "Use grpc::XdsServerBuilder instead. The experimental version will be "
+ "deleted after the 1.42 release.")
+typedef grpc::XdsServerBuilder XdsServerBuilder;
} // namespace experimental
} // namespace grpc