diff options
| author | heretic <[email protected]> | 2022-03-25 12:34:53 +0300 | 
|---|---|---|
| committer | heretic <[email protected]> | 2022-03-25 12:34:53 +0300 | 
| commit | a41f3739eed6fceb6f62056a7620d220958a47e7 (patch) | |
| tree | 278103258b510cb4a96761ea79d6ccd397ca05a0 /contrib/libs/grpc/include/grpcpp/impl/codegen | |
| parent | 73d3613a82e5c217fcbe0ab8bbf8120c1ed1af55 (diff) | |
Update grpc to 1.43.2 DTCC-864
ref:50a492c335cda70f458797cf945e49fe739c2715
Diffstat (limited to 'contrib/libs/grpc/include/grpcpp/impl/codegen')
51 files changed, 302 insertions, 250 deletions
| 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 a812b086a2a..6499f63f683 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 aaee93df933..db5b3747a26 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 7cb7cc6f16e..d7a3b57314a 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 2c015f2266f..d94ac3bc7ba 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 b2292862157..96d0de53e3b 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 4f7d370c4f7..8c4278e7dc1 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 6df16a1125c..5ad0a74d83b 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 3b74566a6d3..a8eed9f6193 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 612b820066b..f0ce27ae8fe 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 7f03fb0345b..09e67ae45d8 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 a73d525003e..ca65f6f4140 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 82b93587a87..d8204fafde7 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 78be1f7597e..f3560b5ad21 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 d41ea1ad2d4..bad60a23bc9 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 d23e0e2bb3c..ef0c7f14985 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 304386a9ecc..9af470b7502 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 d1776685516..85350b6776e 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 49db4c5dc31..da874c58eb6 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 df2a03cd259..e0440ffe3b1 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 c08cf6c683d..0b23bf46e63 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 cb6095c3a5a..817988f3aa2 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 0479567b864..f4f6794b420 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 660d6d0abdc..9f83a7f938c 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 e3a4c8e7680..d3df6caa045 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 d0afa03a178..0818d5c5343 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 72d8009ded4..46a5d1ac6ba 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 4048ea11974..440c7f1d232 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 03afc0781a2..430d6b67444 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 756f4aae751..090d672ae2d 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 cc88a135ca2..3f1d573ba5f 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 d25b79a4027..d3baa2cd29d 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 cd9d70c5a56..204620bb014 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 7f5c6e9a99d..4f6d87415a1 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 394a29b8374..83dedda42cb 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 4fcc2112435..f34cc8b17c4 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 e2b04356526..3079fecbc4f 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 8f792232909..3148dffc806 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 701ef561a34..fb6bdbccac7 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 76e655a9b3a..8713d3eb30a 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 a73155e59fd..b92bf178649 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 7598e72a40e..3a8fd52acba 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 7fb50388268..e23b95c224b 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 57ca9f09447..182570ef2f8 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 0b9752ccff8..3de44c8f90f 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 a5ad6f32fef..358f2bb7f98 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 bdd7ead6add..36ea24fdfdf 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 a13533eca5a..f0bb76ea5ce 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 a56695a8f82..efa1e38ee02 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 bf89a0e39a2..e3954cc731b 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 408f42f280d..1ce3acdaf74 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 88cf12fd829..41bf69f3764 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> | 
