diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/grpc/include/grpcpp | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/grpc/include/grpcpp')
85 files changed, 4588 insertions, 4588 deletions
diff --git a/contrib/libs/grpc/include/grpcpp/alarm.h b/contrib/libs/grpc/include/grpcpp/alarm.h index 96add23e32..88685278bf 100644 --- a/contrib/libs/grpc/include/grpcpp/alarm.h +++ b/contrib/libs/grpc/include/grpcpp/alarm.h @@ -1,28 +1,28 @@ -/* - * +/* + * * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - + * + * 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. + * + */ + /// An Alarm posts the user-provided tag to its associated completion queue or /// invokes the user-provided function on expiry or cancellation. -#ifndef GRPCPP_ALARM_H -#define GRPCPP_ALARM_H - +#ifndef GRPCPP_ALARM_H +#define GRPCPP_ALARM_H + #include <functional> - + #include <grpc/grpc.h> #include <grpcpp/impl/codegen/completion_queue.h> #include <grpcpp/impl/codegen/completion_queue_tag.h> @@ -30,13 +30,13 @@ #include <grpcpp/impl/codegen/time.h> #include <grpcpp/impl/grpc_library.h> -namespace grpc { - +namespace grpc { + class Alarm : private ::grpc::GrpcLibraryCodegen { public: /// Create an unset completion queue alarm Alarm(); - + /// Destroy the given completion queue alarm, cancelling it in the process. ~Alarm(); @@ -122,4 +122,4 @@ class Alarm : private ::grpc::GrpcLibraryCodegen { } // namespace grpc -#endif // GRPCPP_ALARM_H +#endif // GRPCPP_ALARM_H diff --git a/contrib/libs/grpc/include/grpcpp/channel.h b/contrib/libs/grpc/include/grpcpp/channel.h index 6a31ff7aa9..a586998af1 100644 --- a/contrib/libs/grpc/include/grpcpp/channel.h +++ b/contrib/libs/grpc/include/grpcpp/channel.h @@ -1,26 +1,26 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_CHANNEL_H -#define GRPCPP_CHANNEL_H - +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_CHANNEL_H +#define GRPCPP_CHANNEL_H + #include <memory> - + #include <grpc/grpc.h> #include <grpcpp/impl/call.h> #include <grpcpp/impl/codegen/channel_interface.h> @@ -36,13 +36,13 @@ namespace grpc { namespace testing { class ChannelTestPeer; } // namespace testing - + std::shared_ptr<Channel> CreateChannelInternal( const TString& host, grpc_channel* c_channel, std::vector< std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> interceptor_creators); - + namespace experimental { /// Resets the channel's connection backoff. /// TODO(roth): Once we see whether this proves useful, either create a gRFC @@ -121,6 +121,6 @@ class Channel final : public ::grpc::ChannelInterface, interceptor_creators_; }; -} // namespace grpc - -#endif // GRPCPP_CHANNEL_H +} // namespace grpc + +#endif // GRPCPP_CHANNEL_H diff --git a/contrib/libs/grpc/include/grpcpp/client_context.h b/contrib/libs/grpc/include/grpcpp/client_context.h index 1994fcc6bc..d5f88ed037 100644 --- a/contrib/libs/grpc/include/grpcpp/client_context.h +++ b/contrib/libs/grpc/include/grpcpp/client_context.h @@ -1,39 +1,39 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/// A ClientContext allows the person implementing a service client to: -/// -/// - Add custom metadata key-value pairs that will propagated to the server -/// side. -/// - Control call settings such as compression and authentication. -/// - Initial and trailing metadata coming from the server. -/// - Get performance metrics (ie, census). -/// -/// Context settings are only relevant to the call they are invoked with, that -/// is to say, they aren't sticky. Some of these settings, such as the -/// compression options, can be made persistent at channel construction time -/// (see \a grpc::CreateCustomChannel). -/// -/// \warning ClientContext instances should \em not be reused across rpcs. - -#ifndef GRPCPP_CLIENT_CONTEXT_H -#define GRPCPP_CLIENT_CONTEXT_H - -#include <grpcpp/impl/codegen/client_context.h> - -#endif // GRPCPP_CLIENT_CONTEXT_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/// A ClientContext allows the person implementing a service client to: +/// +/// - Add custom metadata key-value pairs that will propagated to the server +/// side. +/// - Control call settings such as compression and authentication. +/// - Initial and trailing metadata coming from the server. +/// - Get performance metrics (ie, census). +/// +/// Context settings are only relevant to the call they are invoked with, that +/// is to say, they aren't sticky. Some of these settings, such as the +/// compression options, can be made persistent at channel construction time +/// (see \a grpc::CreateCustomChannel). +/// +/// \warning ClientContext instances should \em not be reused across rpcs. + +#ifndef GRPCPP_CLIENT_CONTEXT_H +#define GRPCPP_CLIENT_CONTEXT_H + +#include <grpcpp/impl/codegen/client_context.h> + +#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..7659285e71 100644 --- a/contrib/libs/grpc/include/grpcpp/completion_queue.h +++ b/contrib/libs/grpc/include/grpcpp/completion_queue.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_COMPLETION_QUEUE_H -#define GRPCPP_COMPLETION_QUEUE_H - -#include <grpcpp/impl/codegen/completion_queue.h> - -#endif // GRPCPP_COMPLETION_QUEUE_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_COMPLETION_QUEUE_H +#define GRPCPP_COMPLETION_QUEUE_H + +#include <grpcpp/impl/codegen/completion_queue.h> + +#endif // GRPCPP_COMPLETION_QUEUE_H diff --git a/contrib/libs/grpc/include/grpcpp/create_channel.h b/contrib/libs/grpc/include/grpcpp/create_channel.h index 4b94a08e45..1e716a16e5 100644 --- a/contrib/libs/grpc/include/grpcpp/create_channel.h +++ b/contrib/libs/grpc/include/grpcpp/create_channel.h @@ -1,33 +1,33 @@ -/* - * +/* + * * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_CREATE_CHANNEL_H -#define GRPCPP_CREATE_CHANNEL_H - + * + * 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_H +#define GRPCPP_CREATE_CHANNEL_H + #include <memory> #include <grpcpp/channel.h> #include <grpcpp/impl/codegen/client_interceptor.h> #include <grpcpp/security/credentials.h> -#include <grpcpp/support/channel_arguments.h> +#include <grpcpp/support/channel_arguments.h> #include <grpcpp/support/config.h> - -namespace grpc { + +namespace grpc { /// Create a new \a Channel pointing to \a target. /// /// \param target The URI of the endpoint to connect to. @@ -35,9 +35,9 @@ namespace grpc { /// hold an object or is invalid, a lame channel (one on which all operations /// fail) is returned. std::shared_ptr<Channel> CreateChannel( - const grpc::string& target, + const grpc::string& target, const std::shared_ptr<ChannelCredentials>& creds); - + /// Create a new \em custom \a Channel pointing to \a target. /// /// \warning For advanced use and testing ONLY. Override default channel @@ -49,10 +49,10 @@ std::shared_ptr<Channel> CreateChannel( /// fail) is returned. /// \param args Options for channel creation. std::shared_ptr<Channel> CreateCustomChannel( - const grpc::string& target, - const std::shared_ptr<ChannelCredentials>& creds, + const grpc::string& target, + const std::shared_ptr<ChannelCredentials>& creds, const ChannelArguments& args); - + namespace experimental { /// Create a new \em custom \a Channel pointing to \a target with \a /// interceptors being invoked per call. @@ -73,6 +73,6 @@ std::shared_ptr<Channel> CreateCustomChannelWithInterceptors( std::unique_ptr<experimental::ClientInterceptorFactoryInterface>> interceptor_creators); } // namespace experimental -} // namespace grpc - -#endif // GRPCPP_CREATE_CHANNEL_H +} // namespace grpc + +#endif // GRPCPP_CREATE_CHANNEL_H diff --git a/contrib/libs/grpc/include/grpcpp/create_channel_posix.h b/contrib/libs/grpc/include/grpcpp/create_channel_posix.h index c6755b0aa6..87d7dbb981 100644 --- a/contrib/libs/grpc/include/grpcpp/create_channel_posix.h +++ b/contrib/libs/grpc/include/grpcpp/create_channel_posix.h @@ -1,41 +1,41 @@ -/* - * +/* + * * Copyright 2016 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_POSIX_H -#define GRPCPP_CREATE_CHANNEL_POSIX_H - + * + * 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_POSIX_H +#define GRPCPP_CREATE_CHANNEL_POSIX_H + #include <memory> - + #include <grpc/support/port_platform.h> #include <grpcpp/channel.h> #include <grpcpp/support/channel_arguments.h> -namespace grpc { - -#ifdef GPR_SUPPORT_CHANNELS_FROM_FD - +namespace grpc { + +#ifdef GPR_SUPPORT_CHANNELS_FROM_FD + /// Create a new \a Channel communicating over the given file descriptor. /// /// \param target The name of the target. /// \param fd The file descriptor representing a socket. std::shared_ptr<grpc::Channel> CreateInsecureChannelFromFd( const TString& target, int fd); - + /// Create a new \a Channel communicating over given file descriptor with custom /// channel arguments. /// @@ -44,7 +44,7 @@ std::shared_ptr<grpc::Channel> CreateInsecureChannelFromFd( /// \param args Options for channel creation. std::shared_ptr<grpc::Channel> CreateCustomInsecureChannelFromFd( const TString& target, int fd, const grpc::ChannelArguments& args); - + namespace experimental { /// Create a new \a Channel communicating over given file descriptor with custom @@ -63,8 +63,8 @@ CreateCustomInsecureChannelWithInterceptorsFromFd( } // namespace experimental -#endif // GPR_SUPPORT_CHANNELS_FROM_FD - -} // namespace grpc - -#endif // GRPCPP_CREATE_CHANNEL_POSIX_H +#endif // GPR_SUPPORT_CHANNELS_FROM_FD + +} // namespace grpc + +#endif // GRPCPP_CREATE_CHANNEL_POSIX_H diff --git a/contrib/libs/grpc/include/grpcpp/ext/health_check_service_server_builder_option.h b/contrib/libs/grpc/include/grpcpp/ext/health_check_service_server_builder_option.h index dd43b05ef0..89412743cf 100644 --- a/contrib/libs/grpc/include/grpcpp/ext/health_check_service_server_builder_option.h +++ b/contrib/libs/grpc/include/grpcpp/ext/health_check_service_server_builder_option.h @@ -1,47 +1,47 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H -#define GRPCPP_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H - -#include <memory> - -#include <grpcpp/health_check_service_interface.h> -#include <grpcpp/impl/server_builder_option.h> -#include <grpcpp/support/config.h> - -namespace grpc { - -class HealthCheckServiceServerBuilderOption : public ServerBuilderOption { - public: - /// The ownership of \a hc will be taken and transferred to the grpc server. - /// To explicitly disable default service, pass in a nullptr. - explicit HealthCheckServiceServerBuilderOption( - std::unique_ptr<HealthCheckServiceInterface> hc); - ~HealthCheckServiceServerBuilderOption() override {} - void UpdateArguments(ChannelArguments* args) override; - void UpdatePlugins( - std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) override; - - private: - std::unique_ptr<HealthCheckServiceInterface> hc_; -}; - -} // namespace grpc - -#endif // GRPCPP_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H +/* + * + * Copyright 2016 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H +#define GRPCPP_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H + +#include <memory> + +#include <grpcpp/health_check_service_interface.h> +#include <grpcpp/impl/server_builder_option.h> +#include <grpcpp/support/config.h> + +namespace grpc { + +class HealthCheckServiceServerBuilderOption : public ServerBuilderOption { + public: + /// The ownership of \a hc will be taken and transferred to the grpc server. + /// To explicitly disable default service, pass in a nullptr. + explicit HealthCheckServiceServerBuilderOption( + std::unique_ptr<HealthCheckServiceInterface> hc); + ~HealthCheckServiceServerBuilderOption() override {} + void UpdateArguments(ChannelArguments* args) override; + void UpdatePlugins( + std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) override; + + private: + std::unique_ptr<HealthCheckServiceInterface> hc_; +}; + +} // namespace grpc + +#endif // GRPCPP_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H diff --git a/contrib/libs/grpc/include/grpcpp/ext/proto_server_reflection_plugin.h b/contrib/libs/grpc/include/grpcpp/ext/proto_server_reflection_plugin.h index 7df4aa931b..f7fcd3b5b6 100644 --- a/contrib/libs/grpc/include/grpcpp/ext/proto_server_reflection_plugin.h +++ b/contrib/libs/grpc/include/grpcpp/ext/proto_server_reflection_plugin.h @@ -1,33 +1,33 @@ -/* - * +/* + * * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H -#define GRPCPP_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H - + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H +#define GRPCPP_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H + #include <grpcpp/impl/server_builder_plugin.h> #include <grpcpp/support/config.h> - -namespace grpc { + +namespace grpc { class ProtoServerReflection; class ServerInitializer; -namespace reflection { - +namespace reflection { + class ProtoServerReflectionPlugin : public ::grpc::ServerBuilderPlugin { public: ProtoServerReflectionPlugin(); @@ -37,16 +37,16 @@ class ProtoServerReflectionPlugin : public ::grpc::ServerBuilderPlugin { void ChangeArguments(const ::TString& name, void* value) override; bool has_async_methods() const override; bool has_sync_methods() const override; - + private: std::shared_ptr<grpc::ProtoServerReflection> reflection_service_; }; - + /// Add proto reflection plugin to \a ServerBuilder. /// This function should be called at the static initialization time. void InitProtoReflectionServerBuilderPlugin(); -} // namespace reflection -} // namespace grpc - -#endif // GRPCPP_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H +} // namespace reflection +} // namespace grpc + +#endif // GRPCPP_EXT_PROTO_SERVER_REFLECTION_PLUGIN_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..474573263a 100644 --- a/contrib/libs/grpc/include/grpcpp/generic/async_generic_service.h +++ b/contrib/libs/grpc/include/grpcpp/generic/async_generic_service.h @@ -1,24 +1,24 @@ -/* - * +/* + * * Copyright 2018 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_GENERIC_ASYNC_GENERIC_SERVICE_H -#define GRPCPP_GENERIC_ASYNC_GENERIC_SERVICE_H - + * + * 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_GENERIC_ASYNC_GENERIC_SERVICE_H +#define GRPCPP_GENERIC_ASYNC_GENERIC_SERVICE_H + #include <grpcpp/impl/codegen/async_generic_service.h> - -#endif // GRPCPP_GENERIC_ASYNC_GENERIC_SERVICE_H + +#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 102d2591c9..0fd513405e 100644 --- a/contrib/libs/grpc/include/grpcpp/generic/generic_stub.h +++ b/contrib/libs/grpc/include/grpcpp/generic/generic_stub.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_GENERIC_GENERIC_STUB_H -#define GRPCPP_GENERIC_GENERIC_STUB_H - +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_GENERIC_GENERIC_STUB_H +#define GRPCPP_GENERIC_GENERIC_STUB_H + #include <functional> #include <grpcpp/client_context.h> @@ -29,10 +29,10 @@ #include <grpcpp/support/client_callback.h> #include <grpcpp/support/status.h> -namespace grpc { - +namespace grpc { + class CompletionQueue; - + typedef ClientAsyncReaderWriter<ByteBuffer, ByteBuffer> GenericClientAsyncReaderWriter; typedef ClientAsyncResponseReader<ByteBuffer> GenericClientAsyncResponseReader; @@ -209,6 +209,6 @@ class TemplatedGenericStub final { typedef TemplatedGenericStub<grpc::ByteBuffer, grpc::ByteBuffer> GenericStub; -} // namespace grpc - -#endif // GRPCPP_GENERIC_GENERIC_STUB_H +} // namespace grpc + +#endif // GRPCPP_GENERIC_GENERIC_STUB_H diff --git a/contrib/libs/grpc/include/grpcpp/grpcpp.h b/contrib/libs/grpc/include/grpcpp/grpcpp.h index d37258cf3b..f85879c22c 100644 --- a/contrib/libs/grpc/include/grpcpp/grpcpp.h +++ b/contrib/libs/grpc/include/grpcpp/grpcpp.h @@ -1,69 +1,69 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/// \mainpage gRPC C++ API -/// -/// The gRPC C++ API mainly consists of the following classes: -/// <br> -/// - grpc::Channel, which represents the connection to an endpoint. See [the +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/// \mainpage gRPC C++ API +/// +/// The gRPC C++ API mainly consists of the following classes: +/// <br> +/// - grpc::Channel, which represents the connection to an endpoint. See [the /// gRPC Concepts page](https://grpc.io/docs/what-is-grpc/core-concepts) for /// more details. Channels are created by the factory function /// grpc::CreateChannel. -/// -/// - grpc::CompletionQueue, the producer-consumer queue used for all -/// asynchronous communication with the gRPC runtime. -/// -/// - grpc::ClientContext and grpc::ServerContext, where optional configuration -/// for an RPC can be set, such as setting custom metadata to be conveyed to the -/// peer, compression settings, authentication, etc. -/// -/// - grpc::Server, representing a gRPC server, created by grpc::ServerBuilder. -/// -/// Streaming calls are handled with the streaming classes in -/// \ref sync_stream.h and -/// \ref async_stream.h. -/// -/// Refer to the -/// [examples](https://github.com/grpc/grpc/blob/master/examples/cpp) -/// for code putting these pieces into play. - -#ifndef GRPCPP_GRPCPP_H -#define GRPCPP_GRPCPP_H - -// Pragma for http://include-what-you-use.org/ tool, tells that following -// 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> -#include <grpcpp/create_channel.h> -#include <grpcpp/create_channel_posix.h> -#include <grpcpp/server.h> -#include <grpcpp/server_builder.h> -#include <grpcpp/server_context.h> -#include <grpcpp/server_posix.h> -// IWYU pragma: end_exports - -namespace grpc { -/// Return gRPC library version. +/// +/// - grpc::CompletionQueue, the producer-consumer queue used for all +/// asynchronous communication with the gRPC runtime. +/// +/// - grpc::ClientContext and grpc::ServerContext, where optional configuration +/// for an RPC can be set, such as setting custom metadata to be conveyed to the +/// peer, compression settings, authentication, etc. +/// +/// - grpc::Server, representing a gRPC server, created by grpc::ServerBuilder. +/// +/// Streaming calls are handled with the streaming classes in +/// \ref sync_stream.h and +/// \ref async_stream.h. +/// +/// Refer to the +/// [examples](https://github.com/grpc/grpc/blob/master/examples/cpp) +/// for code putting these pieces into play. + +#ifndef GRPCPP_GRPCPP_H +#define GRPCPP_GRPCPP_H + +// Pragma for http://include-what-you-use.org/ tool, tells that following +// 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> +#include <grpcpp/create_channel.h> +#include <grpcpp/create_channel_posix.h> +#include <grpcpp/server.h> +#include <grpcpp/server_builder.h> +#include <grpcpp/server_context.h> +#include <grpcpp/server_posix.h> +// IWYU pragma: end_exports + +namespace grpc { +/// Return gRPC library version. TString Version(); -} // namespace grpc - -#endif // GRPCPP_GRPCPP_H +} // namespace grpc + +#endif // GRPCPP_GRPCPP_H diff --git a/contrib/libs/grpc/include/grpcpp/health_check_service_interface.h b/contrib/libs/grpc/include/grpcpp/health_check_service_interface.h index de055a82ea..4ce77f836d 100644 --- a/contrib/libs/grpc/include/grpcpp/health_check_service_interface.h +++ b/contrib/libs/grpc/include/grpcpp/health_check_service_interface.h @@ -1,37 +1,37 @@ -/* - * +/* + * * Copyright 2016 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_HEALTH_CHECK_SERVICE_INTERFACE_H -#define GRPCPP_HEALTH_CHECK_SERVICE_INTERFACE_H - + * + * 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_HEALTH_CHECK_SERVICE_INTERFACE_H +#define GRPCPP_HEALTH_CHECK_SERVICE_INTERFACE_H + #include <grpcpp/support/config.h> - -namespace grpc { - -const char kHealthCheckServiceInterfaceArg[] = - "grpc.health_check_service_interface"; - + +namespace grpc { + +const char kHealthCheckServiceInterfaceArg[] = + "grpc.health_check_service_interface"; + /// The gRPC server uses this interface to expose the health checking service /// without depending on protobuf. class HealthCheckServiceInterface { public: virtual ~HealthCheckServiceInterface() {} - + /// Set or change the serving status of the given \a service_name. virtual void SetServingStatus(const TString& service_name, bool serving) = 0; @@ -42,7 +42,7 @@ class HealthCheckServiceInterface { /// state changes. virtual void Shutdown() {} }; - + /// Enable/disable the default health checking service. This applies to all C++ /// servers created afterwards. For each server, user can override the default /// with a HealthCheckServiceServerBuilderOption. @@ -53,6 +53,6 @@ void EnableDefaultHealthCheckService(bool enable); /// NOT thread safe. bool DefaultHealthCheckServiceEnabled(); -} // namespace grpc - -#endif // GRPCPP_HEALTH_CHECK_SERVICE_INTERFACE_H +} // namespace grpc + +#endif // GRPCPP_HEALTH_CHECK_SERVICE_INTERFACE_H diff --git a/contrib/libs/grpc/include/grpcpp/impl/README.md b/contrib/libs/grpc/include/grpcpp/impl/README.md index 612150caa0..4770816fae 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/README.md +++ b/contrib/libs/grpc/include/grpcpp/impl/README.md @@ -1,4 +1,4 @@ -**The APIs in this directory are not stable!** - -This directory contains header files that need to be installed but are not part -of the public API. Users should not use these headers directly. +**The APIs in this directory are not stable!** + +This directory contains header files that need to be installed but are not part +of the public API. Users should not use these headers directly. diff --git a/contrib/libs/grpc/include/grpcpp/impl/call.h b/contrib/libs/grpc/include/grpcpp/impl/call.h index a6b1312693..373e02f6d9 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/call.h +++ b/contrib/libs/grpc/include/grpcpp/impl/call.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CALL_H -#define GRPCPP_IMPL_CALL_H - -#include <grpcpp/impl/codegen/call.h> - -#endif // GRPCPP_IMPL_CALL_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CALL_H +#define GRPCPP_IMPL_CALL_H + +#include <grpcpp/impl/codegen/call.h> + +#endif // GRPCPP_IMPL_CALL_H diff --git a/contrib/libs/grpc/include/grpcpp/impl/channel_argument_option.h b/contrib/libs/grpc/include/grpcpp/impl/channel_argument_option.h index 6e93199694..019c6c6c54 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/channel_argument_option.h +++ b/contrib/libs/grpc/include/grpcpp/impl/channel_argument_option.h @@ -1,37 +1,37 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CHANNEL_ARGUMENT_OPTION_H -#define GRPCPP_IMPL_CHANNEL_ARGUMENT_OPTION_H - -#include <map> -#include <memory> - -#include <grpcpp/impl/server_builder_option.h> -#include <grpcpp/support/channel_arguments.h> - -namespace grpc { - -std::unique_ptr<ServerBuilderOption> MakeChannelArgumentOption( +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CHANNEL_ARGUMENT_OPTION_H +#define GRPCPP_IMPL_CHANNEL_ARGUMENT_OPTION_H + +#include <map> +#include <memory> + +#include <grpcpp/impl/server_builder_option.h> +#include <grpcpp/support/channel_arguments.h> + +namespace grpc { + +std::unique_ptr<ServerBuilderOption> MakeChannelArgumentOption( const TString& name, const TString& value); -std::unique_ptr<ServerBuilderOption> MakeChannelArgumentOption( +std::unique_ptr<ServerBuilderOption> MakeChannelArgumentOption( const TString& name, int value); - -} // namespace grpc - -#endif // GRPCPP_IMPL_CHANNEL_ARGUMENT_OPTION_H + +} // namespace grpc + +#endif // GRPCPP_IMPL_CHANNEL_ARGUMENT_OPTION_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..983cab1be2 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/client_unary_call.h +++ b/contrib/libs/grpc/include/grpcpp/impl/client_unary_call.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CLIENT_UNARY_CALL_H -#define GRPCPP_IMPL_CLIENT_UNARY_CALL_H - -#include <grpcpp/impl/codegen/client_unary_call.h> - -#endif // GRPCPP_IMPL_CLIENT_UNARY_CALL_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CLIENT_UNARY_CALL_H +#define GRPCPP_IMPL_CLIENT_UNARY_CALL_H + +#include <grpcpp/impl/codegen/client_unary_call.h> + +#endif // GRPCPP_IMPL_CLIENT_UNARY_CALL_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..6fb27d0268 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/async_stream.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/async_stream.h @@ -1,43 +1,43 @@ -/* - * +/* + * * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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_IMPL_CODEGEN_ASYNC_STREAM_H -#define GRPCPP_IMPL_CODEGEN_ASYNC_STREAM_H - + * + * 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_IMPL_CODEGEN_ASYNC_STREAM_H +#define GRPCPP_IMPL_CODEGEN_ASYNC_STREAM_H + #include <grpcpp/impl/codegen/call.h> #include <grpcpp/impl/codegen/channel_interface.h> #include <grpcpp/impl/codegen/core_codegen_interface.h> #include <grpcpp/impl/codegen/server_context.h> #include <grpcpp/impl/codegen/service_type.h> #include <grpcpp/impl/codegen/status.h> - -namespace grpc { - -namespace internal { + +namespace grpc { + +namespace internal { /// Common interface for all client side asynchronous streaming. class ClientAsyncStreamingInterface { public: virtual ~ClientAsyncStreamingInterface() {} - + /// Start the call that was set up by the constructor, but only if the /// constructor was invoked through the "Prepare" API which doesn't actually /// start the call virtual void StartCall(void* tag) = 0; - + /// Request notification of the reading of the initial metadata. Completion /// will be notified by \a tag on the associated completion queue. /// This call is optional, but if it is used, it cannot be used concurrently @@ -77,11 +77,11 @@ class ClientAsyncStreamingInterface { }; /// An interface that yields a sequence of messages of type \a R. -template <class R> +template <class R> class AsyncReaderInterface { public: virtual ~AsyncReaderInterface() {} - + /// Read a message of type \a R into \a msg. Completion will be notified by \a /// tag on the associated completion queue. /// This is thread-safe with respect to \a Write or \a WritesDone methods. It @@ -99,11 +99,11 @@ class AsyncReaderInterface { }; /// An interface that can be fed a sequence of messages of type \a W. -template <class W> +template <class W> class AsyncWriterInterface { public: virtual ~AsyncWriterInterface() {} - + /// Request the writing of \a msg with identifying tag \a tag. /// /// Only one write may be outstanding at any given time. This means that @@ -158,15 +158,15 @@ class AsyncWriterInterface { } }; -} // namespace internal - -template <class R> +} // namespace internal + +template <class R> class ClientAsyncReaderInterface : public internal::ClientAsyncStreamingInterface, public internal::AsyncReaderInterface<R> {}; - + namespace internal { -template <class R> +template <class R> class ClientAsyncReaderFactory { public: /// Create a stream object. @@ -189,7 +189,7 @@ class ClientAsyncReaderFactory { } }; } // namespace internal - + /// Async client-side API for doing server-streaming RPCs, /// where the incoming message stream coming from the server has /// messages of type \a R. @@ -297,7 +297,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> { }; /// Common interface for client side asynchronous writing. -template <class W> +template <class W> class ClientAsyncWriterInterface : public internal::ClientAsyncStreamingInterface, public internal::AsyncWriterInterface<W> { @@ -308,9 +308,9 @@ class ClientAsyncWriterInterface /// \param[in] tag The tag identifying the operation. virtual void WritesDone(void* tag) = 0; }; - + namespace internal { -template <class W> +template <class W> class ClientAsyncWriterFactory { public: /// Create a stream object. @@ -337,7 +337,7 @@ class ClientAsyncWriterFactory { } }; } // namespace internal - + /// Async API on the client side for doing client-streaming RPCs, /// where the outgoing message stream going to the server contains /// messages of type \a W. @@ -466,7 +466,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> { /// Async client-side interface for bi-directional streaming, /// where the client-to-server message stream has messages of type \a W, /// and the server-to-client message stream has messages of type \a R. -template <class W, class R> +template <class W, class R> class ClientAsyncReaderWriterInterface : public internal::ClientAsyncStreamingInterface, public internal::AsyncWriterInterface<W>, @@ -478,9 +478,9 @@ class ClientAsyncReaderWriterInterface /// \param[in] tag The tag identifying the operation. virtual void WritesDone(void* tag) = 0; }; - + namespace internal { -template <class W, class R> +template <class W, class R> class ClientAsyncReaderWriterFactory { public: /// Create a stream object. @@ -495,7 +495,7 @@ class ClientAsyncReaderWriterFactory { const ::grpc::internal::RpcMethod& method, ::grpc::ClientContext* context, bool start, void* tag) { ::grpc::internal::Call call = channel->CreateCall(method, context, cq); - + return new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc( call.call(), sizeof(ClientAsyncReaderWriter<W, R>))) ClientAsyncReaderWriter<W, R>(call, context, start, tag); @@ -507,7 +507,7 @@ class ClientAsyncReaderWriterFactory { /// where the outgoing message stream going to the server /// has messages of type \a W, and the incoming message stream coming /// from the server has messages of type \a R. -template <class W, class R> +template <class W, class R> class ClientAsyncReaderWriter final : public ClientAsyncReaderWriterInterface<W, R> { public: @@ -515,7 +515,7 @@ class ClientAsyncReaderWriter final static void operator delete(void* /*ptr*/, std::size_t size) { GPR_CODEGEN_ASSERT(size == sizeof(ClientAsyncReaderWriter)); } - + // This operator should never be called as the memory should be freed as part // of the arena destruction. It only exists to provide a matching operator // delete to the operator new so that some compilers will not complain (see @@ -636,7 +636,7 @@ class ClientAsyncReaderWriter final finish_ops_; }; -template <class W, class R> +template <class W, class R> class ServerAsyncReaderInterface : public ::grpc::internal::ServerAsyncStreamingInterface, public internal::AsyncReaderInterface<R> { @@ -665,7 +665,7 @@ class ServerAsyncReaderInterface /// \param[in] msg To be sent to the client as the response for this call. virtual void Finish(const W& msg, const ::grpc::Status& status, void* tag) = 0; - + /// Indicate that the stream is to be finished with a certain /// non-OK status code. /// Request notification for when the server has sent the appropriate @@ -792,7 +792,7 @@ class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> { finish_ops_; }; -template <class W> +template <class W> class ServerAsyncWriterInterface : public ::grpc::internal::ServerAsyncStreamingInterface, public internal::AsyncWriterInterface<W> { @@ -819,7 +819,7 @@ class ServerAsyncWriterInterface /// \param[in] tag Tag identifying this request. /// \param[in] status To be sent to the client as the result of this call. virtual void Finish(const ::grpc::Status& status, void* tag) = 0; - + /// Request the writing of \a msg and coalesce it with trailing metadata which /// contains \a status, using WriteOptions options with /// identifying tag \a tag. @@ -840,12 +840,12 @@ class ServerAsyncWriterInterface /// Async server-side API for doing server streaming RPCs, /// where the outgoing message stream from the server has messages of type \a W. -template <class W> +template <class W> class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> { public: explicit ServerAsyncWriter(::grpc::ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} - + /// See \a ServerAsyncStreamingInterface::SendInitialMetadata for semantics. /// /// Implicit input parameter: @@ -953,7 +953,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> { }; /// Server-side interface for asynchronous bi-directional streaming. -template <class W, class R> +template <class W, class R> class ServerAsyncReaderWriterInterface : public ::grpc::internal::ServerAsyncStreamingInterface, public internal::AsyncWriterInterface<W>, @@ -982,7 +982,7 @@ class ServerAsyncReaderWriterInterface /// \param[in] tag Tag identifying this request. /// \param[in] status To be sent to the client as the result of this call. virtual void Finish(const ::grpc::Status& status, void* tag) = 0; - + /// Request the writing of \a msg and coalesce it with trailing metadata which /// contains \a status, using WriteOptions options with /// identifying tag \a tag. @@ -1005,13 +1005,13 @@ class ServerAsyncReaderWriterInterface /// where the incoming message stream coming from the client has messages of /// type \a R, and the outgoing message stream coming from the server has /// messages of type \a W. -template <class W, class R> +template <class W, class R> class ServerAsyncReaderWriter final : public ServerAsyncReaderWriterInterface<W, R> { public: explicit ServerAsyncReaderWriter(::grpc::ServerContext* ctx) : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} - + /// See \a ServerAsyncStreamingInterface::SendInitialMetadata for semantics. /// /// Implicit input parameter: @@ -1021,7 +1021,7 @@ class ServerAsyncReaderWriter final /// \param[in] tag Tag identifying this request. void SendInitialMetadata(void* tag) override { GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); - + meta_ops_.set_output_tag(tag); meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_, ctx_->initial_metadata_flags()); @@ -1031,13 +1031,13 @@ class ServerAsyncReaderWriter final ctx_->sent_initial_metadata_ = true; call_.PerformOps(&meta_ops_); } - + void Read(R* msg, void* tag) override { read_ops_.set_output_tag(tag); read_ops_.RecvMessage(msg); call_.PerformOps(&read_ops_); } - + void Write(const W& msg, void* tag) override { write_ops_.set_output_tag(tag); EnsureInitialMetadataSent(&write_ops_); @@ -1045,7 +1045,7 @@ class ServerAsyncReaderWriter final GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok()); call_.PerformOps(&write_ops_); } - + void Write(const W& msg, ::grpc::WriteOptions options, void* tag) override { write_ops_.set_output_tag(tag); if (options.is_last_message()) { @@ -1127,5 +1127,5 @@ class ServerAsyncReaderWriter final finish_ops_; }; -} // namespace grpc -#endif // GRPCPP_IMPL_CODEGEN_ASYNC_STREAM_H +} // namespace grpc +#endif // GRPCPP_IMPL_CODEGEN_ASYNC_STREAM_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 3deeda8c7f..82958a8092 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 @@ -1,45 +1,45 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_ASYNC_UNARY_CALL_H -#define GRPCPP_IMPL_CODEGEN_ASYNC_UNARY_CALL_H - +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_ASYNC_UNARY_CALL_H +#define GRPCPP_IMPL_CODEGEN_ASYNC_UNARY_CALL_H + #include <grpcpp/impl/codegen/call.h> #include <grpcpp/impl/codegen/channel_interface.h> #include <grpcpp/impl/codegen/client_context.h> #include <grpcpp/impl/codegen/server_context.h> #include <grpcpp/impl/codegen/service_type.h> #include <grpcpp/impl/codegen/status.h> - -namespace grpc { - + +namespace grpc { + /// An interface relevant for async client side unary RPCs (which send /// one request message to a server and receive one response message). template <class R> class ClientAsyncResponseReaderInterface { public: virtual ~ClientAsyncResponseReaderInterface() {} - + /// Start the call that was set up by the constructor, but only if the /// constructor was invoked through the "Prepare" API which doesn't actually /// start the call virtual void StartCall() = 0; - + /// Request notification of the reading of initial metadata. Completion /// will be notified by \a tag on the associated completion queue. /// This call is optional, but if it is used, it cannot be used concurrently @@ -47,7 +47,7 @@ class ClientAsyncResponseReaderInterface { /// /// \param[in] tag Tag identifying this request. virtual void ReadInitialMetadata(void* tag) = 0; - + /// Request to receive the server's response \a msg and final \a status for /// the call, and to notify \a tag on this call's completion queue when /// finished. @@ -65,7 +65,7 @@ class ClientAsyncResponseReaderInterface { virtual void Finish(R* msg, ::grpc::Status* status, void* tag) = 0; }; -namespace internal { +namespace internal { template <class R> class ClientAsyncResponseReaderFactory { public: @@ -87,10 +87,10 @@ class ClientAsyncResponseReaderFactory { } }; } // namespace internal - + /// Async API for client-side unary RPCs, where the message response /// received from the server is of type \a R. -template <class R> +template <class R> class ClientAsyncResponseReader final : public ClientAsyncResponseReaderInterface<R> { public: @@ -98,14 +98,14 @@ class ClientAsyncResponseReader final static void operator delete(void* /*ptr*/, std::size_t size) { GPR_CODEGEN_ASSERT(size == sizeof(ClientAsyncResponseReader)); } - + // This operator should never be called as the memory should be freed as part // of the arena destruction. It only exists to provide a matching operator // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. static void operator delete(void*, void*) { GPR_CODEGEN_ASSERT(false); } - + void StartCall() override { GPR_CODEGEN_ASSERT(!started_); started_ = true; @@ -296,8 +296,8 @@ class ServerAsyncResponseWriter final finish_buf_; }; -} // namespace grpc - +} // namespace grpc + namespace std { template <class R> class default_delete<::grpc::ClientAsyncResponseReader<R>> { @@ -311,4 +311,4 @@ class default_delete<::grpc::ClientAsyncResponseReaderInterface<R>> { }; } // namespace std -#endif // GRPCPP_IMPL_CODEGEN_ASYNC_UNARY_CALL_H +#endif // GRPCPP_IMPL_CODEGEN_ASYNC_UNARY_CALL_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 6e64ec9981..c0a4c00126 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/byte_buffer.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/byte_buffer.h @@ -1,34 +1,34 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_BYTE_BUFFER_H -#define GRPCPP_IMPL_CODEGEN_BYTE_BUFFER_H - -#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> - +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_BYTE_BUFFER_H +#define GRPCPP_IMPL_CODEGEN_BYTE_BUFFER_H + +#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; @@ -46,60 +46,60 @@ template <class ServiceType, class RequestType, class ResponseType> class ServerStreamingHandler; template <::grpc::StatusCode code> class ErrorMethodHandler; -class CallOpSendMessage; -template <class R> -class CallOpRecvMessage; -class CallOpGenericRecvMessage; +class CallOpSendMessage; +template <class R> +class CallOpRecvMessage; +class CallOpGenericRecvMessage; class ExternalConnectionAcceptorImpl; -template <class R> -class DeserializeFuncType; -class GrpcByteBufferPeer; - -} // namespace internal -/// A sequence of bytes. -class ByteBuffer final { - public: - /// Constuct an empty buffer. - ByteBuffer() : buffer_(nullptr) {} - - /// Construct buffer from \a slices, of which there are \a nslices. - ByteBuffer(const Slice* slices, size_t nslices) { - // The following assertions check that the representation of a grpc::Slice - // is identical to that of a grpc_slice: it has a grpc_slice field, and - // nothing else. - static_assert(std::is_same<decltype(slices[0].slice_), grpc_slice>::value, - "Slice must have same representation as grpc_slice"); - static_assert(sizeof(Slice) == sizeof(grpc_slice), - "Slice must have same representation as grpc_slice"); - // The following assertions check that the representation of a ByteBuffer is - // identical to grpc_byte_buffer*: it has a grpc_byte_buffer* field, - // and nothing else. - static_assert(std::is_same<decltype(buffer_), grpc_byte_buffer*>::value, - "ByteBuffer must have same representation as " - "grpc_byte_buffer*"); - static_assert(sizeof(ByteBuffer) == sizeof(grpc_byte_buffer*), - "ByteBuffer must have same representation as " - "grpc_byte_buffer*"); - // The const_cast is legal if grpc_raw_byte_buffer_create() does no more - // than its advertised side effect of increasing the reference count of the - // slices it processes, and such an increase does not affect the semantics - // seen by the caller of this constructor. - buffer_ = g_core_codegen_interface->grpc_raw_byte_buffer_create( - reinterpret_cast<grpc_slice*>(const_cast<Slice*>(slices)), nslices); - } - - /// Constuct a byte buffer by referencing elements of existing buffer +template <class R> +class DeserializeFuncType; +class GrpcByteBufferPeer; + +} // namespace internal +/// A sequence of bytes. +class ByteBuffer final { + public: + /// Constuct an empty buffer. + ByteBuffer() : buffer_(nullptr) {} + + /// Construct buffer from \a slices, of which there are \a nslices. + ByteBuffer(const Slice* slices, size_t nslices) { + // The following assertions check that the representation of a grpc::Slice + // is identical to that of a grpc_slice: it has a grpc_slice field, and + // nothing else. + static_assert(std::is_same<decltype(slices[0].slice_), grpc_slice>::value, + "Slice must have same representation as grpc_slice"); + static_assert(sizeof(Slice) == sizeof(grpc_slice), + "Slice must have same representation as grpc_slice"); + // The following assertions check that the representation of a ByteBuffer is + // identical to grpc_byte_buffer*: it has a grpc_byte_buffer* field, + // and nothing else. + static_assert(std::is_same<decltype(buffer_), grpc_byte_buffer*>::value, + "ByteBuffer must have same representation as " + "grpc_byte_buffer*"); + static_assert(sizeof(ByteBuffer) == sizeof(grpc_byte_buffer*), + "ByteBuffer must have same representation as " + "grpc_byte_buffer*"); + // The const_cast is legal if grpc_raw_byte_buffer_create() does no more + // than its advertised side effect of increasing the reference count of the + // slices it processes, and such an increase does not affect the semantics + // seen by the caller of this constructor. + buffer_ = g_core_codegen_interface->grpc_raw_byte_buffer_create( + reinterpret_cast<grpc_slice*>(const_cast<Slice*>(slices)), nslices); + } + + /// Constuct a byte buffer by referencing elements of existing buffer /// \a buf. Wrapper of core function grpc_byte_buffer_copy . This is not /// a deep copy; it is just a referencing. As a result, its performance is /// size-independent. ByteBuffer(const ByteBuffer& buf) : buffer_(nullptr) { operator=(buf); } - - ~ByteBuffer() { - if (buffer_) { - g_core_codegen_interface->grpc_byte_buffer_destroy(buffer_); - } - } - + + ~ByteBuffer() { + if (buffer_) { + g_core_codegen_interface->grpc_byte_buffer_destroy(buffer_); + } + } + /// Wrapper of core function grpc_byte_buffer_copy . This is not /// a deep copy; it is just a referencing. As a result, its performance is /// size-independent. @@ -113,56 +113,56 @@ class ByteBuffer final { } return *this; } - - /// Dump (read) the buffer contents into \a slices. - Status Dump(std::vector<Slice>* slices) const; - - /// Remove all data. - void Clear() { - if (buffer_) { - g_core_codegen_interface->grpc_byte_buffer_destroy(buffer_); - buffer_ = nullptr; - } - } - - /// Make a duplicate copy of the internals of this byte - /// buffer so that we have our own owned version of it. + + /// Dump (read) the buffer contents into \a slices. + Status Dump(std::vector<Slice>* slices) const; + + /// Remove all data. + void Clear() { + if (buffer_) { + g_core_codegen_interface->grpc_byte_buffer_destroy(buffer_); + buffer_ = nullptr; + } + } + + /// Make a duplicate copy of the internals of this byte + /// buffer so that we have our own owned version of it. /// bbuf.Duplicate(); is equivalent to bbuf=bbuf; but is actually readable. /// This is not a deep copy; it is a referencing and its performance /// is size-independent. - void Duplicate() { - buffer_ = g_core_codegen_interface->grpc_byte_buffer_copy(buffer_); - } - - /// Forget underlying byte buffer without destroying - /// Use this only for un-owned byte buffers - void Release() { buffer_ = nullptr; } - - /// Buffer size in bytes. - size_t Length() const { - return buffer_ == nullptr - ? 0 - : g_core_codegen_interface->grpc_byte_buffer_length(buffer_); - } - - /// Swap the state of *this and *other. - void Swap(ByteBuffer* other) { - grpc_byte_buffer* tmp = other->buffer_; - other->buffer_ = buffer_; - buffer_ = tmp; - } - - /// Is this ByteBuffer valid? - bool Valid() const { return (buffer_ != nullptr); } - - private: - friend class SerializationTraits<ByteBuffer, void>; - friend class ServerInterface; - friend class internal::CallOpSendMessage; - template <class R> - friend class internal::CallOpRecvMessage; - friend class internal::CallOpGenericRecvMessage; - template <class ServiceType, class RequestType, class ResponseType> + void Duplicate() { + buffer_ = g_core_codegen_interface->grpc_byte_buffer_copy(buffer_); + } + + /// Forget underlying byte buffer without destroying + /// Use this only for un-owned byte buffers + void Release() { buffer_ = nullptr; } + + /// Buffer size in bytes. + size_t Length() const { + return buffer_ == nullptr + ? 0 + : g_core_codegen_interface->grpc_byte_buffer_length(buffer_); + } + + /// Swap the state of *this and *other. + void Swap(ByteBuffer* other) { + grpc_byte_buffer* tmp = other->buffer_; + other->buffer_ = buffer_; + buffer_ = tmp; + } + + /// Is this ByteBuffer valid? + bool Valid() const { return (buffer_ != nullptr); } + + private: + friend class SerializationTraits<ByteBuffer, void>; + friend class ServerInterface; + friend class internal::CallOpSendMessage; + template <class R> + friend class internal::CallOpRecvMessage; + friend class internal::CallOpGenericRecvMessage; + template <class ServiceType, class RequestType, class ResponseType> friend class internal::RpcMethodHandler; template <class ServiceType, class RequestType, class ResponseType> friend class internal::ServerStreamingHandler; @@ -172,55 +172,55 @@ class ByteBuffer final { friend class internal::CallbackServerStreamingHandler; template <StatusCode code> friend class internal::ErrorMethodHandler; - template <class R> - friend class internal::DeserializeFuncType; - friend class ProtoBufferReader; - friend class ProtoBufferWriter; - friend class internal::GrpcByteBufferPeer; + template <class R> + friend class internal::DeserializeFuncType; + friend class ProtoBufferReader; + friend class ProtoBufferWriter; + friend class internal::GrpcByteBufferPeer; friend class internal::ExternalConnectionAcceptorImpl; - - grpc_byte_buffer* buffer_; - - // takes ownership - void set_buffer(grpc_byte_buffer* buf) { - if (buffer_) { - Clear(); - } - buffer_ = buf; - } - - grpc_byte_buffer* c_buffer() { return buffer_; } - grpc_byte_buffer** c_buffer_ptr() { return &buffer_; } - - class ByteBufferPointer { - public: - ByteBufferPointer(const ByteBuffer* b) - : bbuf_(const_cast<ByteBuffer*>(b)) {} - operator ByteBuffer*() { return bbuf_; } - operator grpc_byte_buffer*() { return bbuf_->buffer_; } - operator grpc_byte_buffer**() { return &bbuf_->buffer_; } - - private: - ByteBuffer* bbuf_; - }; - ByteBufferPointer bbuf_ptr() const { return ByteBufferPointer(this); } -}; - -template <> -class SerializationTraits<ByteBuffer, void> { - public: - static Status Deserialize(ByteBuffer* byte_buffer, ByteBuffer* dest) { - dest->set_buffer(byte_buffer->buffer_); - return Status::OK; - } - static Status Serialize(const ByteBuffer& source, ByteBuffer* buffer, - bool* own_buffer) { - *buffer = source; - *own_buffer = true; + + grpc_byte_buffer* buffer_; + + // takes ownership + void set_buffer(grpc_byte_buffer* buf) { + if (buffer_) { + Clear(); + } + buffer_ = buf; + } + + grpc_byte_buffer* c_buffer() { return buffer_; } + grpc_byte_buffer** c_buffer_ptr() { return &buffer_; } + + class ByteBufferPointer { + public: + ByteBufferPointer(const ByteBuffer* b) + : bbuf_(const_cast<ByteBuffer*>(b)) {} + operator ByteBuffer*() { return bbuf_; } + operator grpc_byte_buffer*() { return bbuf_->buffer_; } + operator grpc_byte_buffer**() { return &bbuf_->buffer_; } + + private: + ByteBuffer* bbuf_; + }; + ByteBufferPointer bbuf_ptr() const { return ByteBufferPointer(this); } +}; + +template <> +class SerializationTraits<ByteBuffer, void> { + public: + static Status Deserialize(ByteBuffer* byte_buffer, ByteBuffer* dest) { + dest->set_buffer(byte_buffer->buffer_); + return Status::OK; + } + static Status Serialize(const ByteBuffer& source, ByteBuffer* buffer, + bool* own_buffer) { + *buffer = source; + *own_buffer = true; return g_core_codegen_interface->ok(); - } -}; - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_BYTE_BUFFER_H + } +}; + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_BYTE_BUFFER_H diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/call.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/call.h index b229286215..ade23fec17 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/call.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/call.h @@ -1,59 +1,59 @@ -/* - * +/* + * * Copyright 2018 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#ifndef GRPCPP_IMPL_CODEGEN_CALL_H -#define GRPCPP_IMPL_CODEGEN_CALL_H - + * + * 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_IMPL_CODEGEN_CALL_H +#define GRPCPP_IMPL_CODEGEN_CALL_H + #include <grpc/impl/codegen/grpc_types.h> -#include <grpcpp/impl/codegen/call_hook.h> - +#include <grpcpp/impl/codegen/call_hook.h> + namespace grpc { -class CompletionQueue; +class CompletionQueue; namespace experimental { class ClientRpcInfo; class ServerRpcInfo; } // namespace experimental -namespace internal { -class CallHook; +namespace internal { +class CallHook; class CallOpSetInterface; - -/// Straightforward wrapping of the C call object -class Call final { - public: + +/// Straightforward wrapping of the C call object +class Call final { + public: Call() : call_hook_(nullptr), cq_(nullptr), call_(nullptr), max_receive_message_size_(-1) {} - /** call is owned by the caller */ + /** call is owned by the caller */ Call(grpc_call* call, CallHook* call_hook, ::grpc::CompletionQueue* cq) - : call_hook_(call_hook), - cq_(cq), - call_(call), - max_receive_message_size_(-1) {} - + : call_hook_(call_hook), + cq_(cq), + call_(call), + max_receive_message_size_(-1) {} + Call(grpc_call* call, CallHook* call_hook, ::grpc::CompletionQueue* cq, experimental::ClientRpcInfo* rpc_info) - : call_hook_(call_hook), - cq_(cq), - call_(call), + : call_hook_(call_hook), + cq_(cq), + call_(call), max_receive_message_size_(-1), client_rpc_info_(rpc_info) {} - + Call(grpc_call* call, CallHook* call_hook, ::grpc::CompletionQueue* cq, int max_receive_message_size, experimental::ServerRpcInfo* rpc_info) : call_hook_(call_hook), @@ -62,15 +62,15 @@ class Call final { max_receive_message_size_(max_receive_message_size), server_rpc_info_(rpc_info) {} - void PerformOps(CallOpSetInterface* ops) { - call_hook_->PerformOpsOnCall(ops, this); - } - - grpc_call* call() const { return call_; } + void PerformOps(CallOpSetInterface* ops) { + call_hook_->PerformOpsOnCall(ops, this); + } + + grpc_call* call() const { return call_; } ::grpc::CompletionQueue* cq() const { return cq_; } - - int max_receive_message_size() const { return max_receive_message_size_; } - + + int max_receive_message_size() const { return max_receive_message_size_; } + experimental::ClientRpcInfo* client_rpc_info() const { return client_rpc_info_; } @@ -79,15 +79,15 @@ class Call final { return server_rpc_info_; } - private: - CallHook* call_hook_; + private: + CallHook* call_hook_; ::grpc::CompletionQueue* cq_; - grpc_call* call_; - int max_receive_message_size_; + grpc_call* call_; + int max_receive_message_size_; experimental::ClientRpcInfo* client_rpc_info_ = nullptr; experimental::ServerRpcInfo* server_rpc_info_ = nullptr; -}; -} // namespace internal -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_CALL_H +}; +} // namespace internal +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_CALL_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..9320665257 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/call_hook.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/call_hook.h @@ -1,39 +1,39 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_CALL_HOOK_H -#define GRPCPP_IMPL_CODEGEN_CALL_HOOK_H - -namespace grpc { - -namespace internal { -class CallOpSetInterface; -class Call; - -/// This is an interface that Channel and Server implement to allow them to hook -/// performing ops. -class CallHook { - public: - virtual ~CallHook() {} - virtual void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) = 0; -}; -} // namespace internal - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_CALL_HOOK_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_CALL_HOOK_H +#define GRPCPP_IMPL_CODEGEN_CALL_HOOK_H + +namespace grpc { + +namespace internal { +class CallOpSetInterface; +class Call; + +/// This is an interface that Channel and Server implement to allow them to hook +/// performing ops. +class CallHook { + public: + virtual ~CallHook() {} + virtual void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) = 0; +}; +} // namespace internal + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_CALL_HOOK_H 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 ea0752d90e..93bb8ab38f 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/channel_interface.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/channel_interface.h @@ -1,51 +1,51 @@ -/* - * - * Copyright 2016 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. - * - */ - +/* + * + * Copyright 2016 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. + * + */ + #if defined(__GNUC__) #pragma GCC system_header #endif -#ifndef GRPCPP_IMPL_CODEGEN_CHANNEL_INTERFACE_H -#define GRPCPP_IMPL_CODEGEN_CHANNEL_INTERFACE_H - -#include <grpc/impl/codegen/connectivity_state.h> +#ifndef GRPCPP_IMPL_CODEGEN_CHANNEL_INTERFACE_H +#define GRPCPP_IMPL_CODEGEN_CHANNEL_INTERFACE_H + +#include <grpc/impl/codegen/connectivity_state.h> #include <grpcpp/impl/codegen/call.h> -#include <grpcpp/impl/codegen/status.h> -#include <grpcpp/impl/codegen/time.h> - +#include <grpcpp/impl/codegen/status.h> +#include <grpcpp/impl/codegen/time.h> + namespace grpc { -template <class R> -class ClientReader; -template <class W> -class ClientWriter; -template <class W, class R> -class ClientReaderWriter; -namespace internal { -template <class InputMessage, class OutputMessage> +template <class R> +class ClientReader; +template <class W> +class ClientWriter; +template <class W, class R> +class ClientReaderWriter; +namespace internal { +template <class InputMessage, class OutputMessage> class CallbackUnaryCallImpl; -template <class R> -class ClientAsyncReaderFactory; -template <class W> -class ClientAsyncWriterFactory; -template <class W, class R> -class ClientAsyncReaderWriterFactory; -template <class R> -class ClientAsyncResponseReaderFactory; +template <class R> +class ClientAsyncReaderFactory; +template <class W> +class ClientAsyncWriterFactory; +template <class W, class R> +class ClientAsyncReaderWriterFactory; +template <class R> +class ClientAsyncResponseReaderFactory; template <class W, class R> class ClientCallbackReaderWriterFactory; template <class R> @@ -70,57 +70,57 @@ class RpcMethod; class InterceptedChannel; template <class InputMessage, class OutputMessage> class BlockingUnaryCallImpl; -} // namespace internal - -/// Codegen interface for \a grpc::Channel. -class ChannelInterface { - public: - virtual ~ChannelInterface() {} - /// Get the current channel state. If the channel is in IDLE and - /// \a try_to_connect is set to true, try to connect. - virtual grpc_connectivity_state GetState(bool try_to_connect) = 0; - - /// Return the \a tag on \a cq when the channel state is changed or \a - /// deadline expires. \a GetState needs to called to get the current state. - template <typename T> - void NotifyOnStateChange(grpc_connectivity_state last_observed, T deadline, +} // namespace internal + +/// Codegen interface for \a grpc::Channel. +class ChannelInterface { + public: + virtual ~ChannelInterface() {} + /// Get the current channel state. If the channel is in IDLE and + /// \a try_to_connect is set to true, try to connect. + virtual grpc_connectivity_state GetState(bool try_to_connect) = 0; + + /// Return the \a tag on \a cq when the channel state is changed or \a + /// deadline expires. \a GetState needs to called to get the current state. + template <typename T> + void NotifyOnStateChange(grpc_connectivity_state last_observed, T deadline, ::grpc::CompletionQueue* cq, void* tag) { - TimePoint<T> deadline_tp(deadline); - NotifyOnStateChangeImpl(last_observed, deadline_tp.raw_time(), cq, tag); - } - - /// Blocking wait for channel state change or \a deadline expiration. - /// \a GetState needs to called to get the current state. - template <typename T> - bool WaitForStateChange(grpc_connectivity_state last_observed, T deadline) { - TimePoint<T> deadline_tp(deadline); - return WaitForStateChangeImpl(last_observed, deadline_tp.raw_time()); - } - - /// Wait for this channel to be connected - template <typename T> - bool WaitForConnected(T deadline) { - grpc_connectivity_state state; - while ((state = GetState(true)) != GRPC_CHANNEL_READY) { - if (!WaitForStateChange(state, deadline)) return false; - } - return true; - } - - private: - template <class R> + TimePoint<T> deadline_tp(deadline); + NotifyOnStateChangeImpl(last_observed, deadline_tp.raw_time(), cq, tag); + } + + /// Blocking wait for channel state change or \a deadline expiration. + /// \a GetState needs to called to get the current state. + template <typename T> + bool WaitForStateChange(grpc_connectivity_state last_observed, T deadline) { + TimePoint<T> deadline_tp(deadline); + return WaitForStateChangeImpl(last_observed, deadline_tp.raw_time()); + } + + /// Wait for this channel to be connected + template <typename T> + bool WaitForConnected(T deadline) { + grpc_connectivity_state state; + while ((state = GetState(true)) != GRPC_CHANNEL_READY) { + if (!WaitForStateChange(state, deadline)) return false; + } + return true; + } + + private: + template <class R> friend class ::grpc::ClientReader; - template <class W> + template <class W> friend class ::grpc::ClientWriter; - template <class W, class R> + template <class W, class R> friend class ::grpc::ClientReaderWriter; - template <class R> + template <class R> friend class ::grpc::internal::ClientAsyncReaderFactory; - template <class W> + template <class W> friend class ::grpc::internal::ClientAsyncWriterFactory; - template <class W, class R> + template <class W, class R> friend class ::grpc::internal::ClientAsyncReaderWriterFactory; - template <class R> + template <class R> friend class ::grpc::internal::ClientAsyncResponseReaderFactory; template <class W, class R> friend class ::grpc::internal::ClientCallbackReaderWriterFactory; @@ -129,25 +129,25 @@ class ChannelInterface { template <class W> friend class ::grpc::internal::ClientCallbackWriterFactory; friend class ::grpc::internal::ClientCallbackUnaryFactory; - template <class InputMessage, class OutputMessage> - friend class ::grpc::internal::BlockingUnaryCallImpl; + template <class InputMessage, class OutputMessage> + friend class ::grpc::internal::BlockingUnaryCallImpl; template <class InputMessage, class OutputMessage> friend class ::grpc::internal::CallbackUnaryCallImpl; - friend class ::grpc::internal::RpcMethod; + friend class ::grpc::internal::RpcMethod; friend class ::grpc::experimental::DelegatingChannel; friend class ::grpc::internal::InterceptedChannel; - virtual internal::Call CreateCall(const internal::RpcMethod& method, + virtual internal::Call CreateCall(const internal::RpcMethod& method, ::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) = 0; - virtual void PerformOpsOnCall(internal::CallOpSetInterface* ops, - internal::Call* call) = 0; - virtual void* RegisterMethod(const char* method) = 0; - virtual void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, - gpr_timespec deadline, + virtual void PerformOpsOnCall(internal::CallOpSetInterface* ops, + internal::Call* call) = 0; + virtual void* RegisterMethod(const char* method) = 0; + virtual void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, + gpr_timespec deadline, ::grpc::CompletionQueue* cq, void* tag) = 0; - virtual bool WaitForStateChangeImpl(grpc_connectivity_state last_observed, - gpr_timespec deadline) = 0; + virtual bool WaitForStateChangeImpl(grpc_connectivity_state last_observed, + gpr_timespec deadline) = 0; // EXPERIMENTAL // This is needed to keep codegen_test_minimal happy. InterceptedChannel needs @@ -171,7 +171,7 @@ class ChannelInterface { // and adding a new pure method to an interface would be a breaking change // (even though this is private and non-API) virtual ::grpc::CompletionQueue* CallbackCQ() { return nullptr; } -}; -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_CHANNEL_INTERFACE_H +}; +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_CHANNEL_INTERFACE_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 a4e58f34c5..a0f1d3a35e 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/client_context.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/client_context.h @@ -1,21 +1,21 @@ -/* - * +/* + * * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - + * + * 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. + * + */ + /// A ClientContext allows the person implementing a service client to: /// /// - Add custom metadata key-value pairs that will propagated to the server @@ -31,13 +31,13 @@ /// /// \warning ClientContext instances should \em not be reused across rpcs. -#ifndef GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_H -#define GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_H - +#ifndef GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_H +#define GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_H + #include <map> #include <memory> #include <util/generic/string.h> - + #include <grpc/impl/codegen/compression_types.h> #include <grpc/impl/codegen/propagation_bits.h> #include <grpcpp/impl/codegen/client_interceptor.h> @@ -56,11 +56,11 @@ struct census_context; struct grpc_call; -namespace grpc { +namespace grpc { class ServerContext; class ServerContextBase; class CallbackServerContext; - + namespace internal { template <class InputMessage, class OutputMessage> class CallbackUnaryCallImpl; @@ -73,7 +73,7 @@ class ClientCallbackWriterImpl; class ClientCallbackUnaryImpl; class ClientContextAccessor; } // namespace internal - + template <class R> class ClientReader; template <class W> @@ -519,6 +519,6 @@ class ClientContext { grpc::experimental::ClientRpcInfo rpc_info_; }; -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_H +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_H 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 098bb50ee2..6175126311 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 @@ -1,71 +1,71 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_CLIENT_UNARY_CALL_H -#define GRPCPP_IMPL_CODEGEN_CLIENT_UNARY_CALL_H - -#include <grpcpp/impl/codegen/call.h> -#include <grpcpp/impl/codegen/channel_interface.h> -#include <grpcpp/impl/codegen/config.h> -#include <grpcpp/impl/codegen/core_codegen_interface.h> -#include <grpcpp/impl/codegen/status.h> - +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_CLIENT_UNARY_CALL_H +#define GRPCPP_IMPL_CODEGEN_CLIENT_UNARY_CALL_H + +#include <grpcpp/impl/codegen/call.h> +#include <grpcpp/impl/codegen/channel_interface.h> +#include <grpcpp/impl/codegen/config.h> +#include <grpcpp/impl/codegen/core_codegen_interface.h> +#include <grpcpp/impl/codegen/status.h> + namespace grpc { - -class ClientContext; -namespace internal { -class RpcMethod; -/// Wrapper that performs a blocking unary call -template <class InputMessage, class OutputMessage> -Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method, + +class ClientContext; +namespace internal { +class RpcMethod; +/// Wrapper that performs a blocking unary call +template <class InputMessage, class OutputMessage> +Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method, grpc::ClientContext* context, const InputMessage& request, OutputMessage* result) { - return BlockingUnaryCallImpl<InputMessage, OutputMessage>( - channel, method, context, request, result) - .status(); -} - -template <class InputMessage, class OutputMessage> -class BlockingUnaryCallImpl { - public: - BlockingUnaryCallImpl(ChannelInterface* channel, const RpcMethod& method, + return BlockingUnaryCallImpl<InputMessage, OutputMessage>( + channel, method, context, request, result) + .status(); +} + +template <class InputMessage, class OutputMessage> +class BlockingUnaryCallImpl { + public: + BlockingUnaryCallImpl(ChannelInterface* channel, const RpcMethod& method, grpc::ClientContext* context, const InputMessage& request, OutputMessage* result) { ::grpc::CompletionQueue cq(grpc_completion_queue_attributes{ GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, nullptr}); // Pluckable completion queue ::grpc::internal::Call call(channel->CreateCall(method, context, &cq)); - CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, - CallOpRecvInitialMetadata, CallOpRecvMessage<OutputMessage>, - CallOpClientSendClose, CallOpClientRecvStatus> - ops; + CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, + CallOpRecvInitialMetadata, CallOpRecvMessage<OutputMessage>, + CallOpClientSendClose, CallOpClientRecvStatus> + ops; status_ = ops.SendMessagePtr(&request); - if (!status_.ok()) { - return; - } + if (!status_.ok()) { + return; + } ops.SendInitialMetadata(&context->send_initial_metadata_, - context->initial_metadata_flags()); - ops.RecvInitialMetadata(context); - ops.RecvMessage(result); - ops.AllowNoMessage(); - ops.ClientSendClose(); - ops.ClientRecvStatus(context, &status_); - call.PerformOps(&ops); + context->initial_metadata_flags()); + ops.RecvInitialMetadata(context); + ops.RecvMessage(result); + ops.AllowNoMessage(); + ops.ClientSendClose(); + ops.ClientRecvStatus(context, &status_); + call.PerformOps(&ops); cq.Pluck(&ops); // Some of the ops might fail. If the ops fail in the core layer, status // would reflect the error. But, if the ops fail in the C++ layer, the @@ -77,15 +77,15 @@ class BlockingUnaryCallImpl { if (!ops.got_message && status_.ok()) { status_ = Status(StatusCode::UNIMPLEMENTED, "No message returned for unary request"); - } - } - Status status() { return status_; } - - private: - Status status_; -}; - -} // namespace internal -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_CLIENT_UNARY_CALL_H + } + } + Status status() { return status_; } + + private: + Status status_; +}; + +} // namespace internal +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_CLIENT_UNARY_CALL_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 ca0c77276a..b6a5984ac0 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/completion_queue.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/completion_queue.h @@ -1,21 +1,21 @@ -/* - * - * Copyright 2015-2016 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. - * - */ - +/* + * + * Copyright 2015-2016 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. + * + */ + /// A completion queue implements a concurrent producer-consumer queue, with /// two main API-exposed methods: \a Next and \a AsyncNext. These /// methods are the essential component of the gRPC C++ asynchronous API. @@ -29,11 +29,11 @@ /// elsewhere. /// \remark{All other API calls on completion queue should be completed before /// a completion queue destructor is called.} -#ifndef GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_H -#define GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_H - +#ifndef GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_H +#define GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_H + #include <list> - + #include <grpc/impl/codegen/atm.h> #include <grpcpp/impl/codegen/completion_queue_tag.h> #include <grpcpp/impl/codegen/core_codegen_interface.h> @@ -44,7 +44,7 @@ struct grpc_completion_queue; -namespace grpc { +namespace grpc { template <class R> class ClientReader; template <class W> @@ -58,7 +58,7 @@ class ServerWriter; namespace internal { template <class W, class R> class ServerReaderWriterBody; - + template <class ServiceType, class RequestType, class ResponseType> class RpcMethodHandler; template <class ServiceType, class RequestType, class ResponseType> @@ -70,7 +70,7 @@ class TemplatedBidiStreamingHandler; template <::grpc::StatusCode code> class ErrorMethodHandler; } // namespace internal - + class Channel; class ChannelInterface; class Server; @@ -443,6 +443,6 @@ class ServerCompletionQueue : public CompletionQueue { friend class ::grpc::Server; }; -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_H +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_H 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..e8ae72b0be 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 @@ -1,31 +1,31 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H -#define GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H - -namespace grpc { - -namespace internal { -/// An interface allowing implementors to process and filter event tags. -class CompletionQueueTag { - public: - virtual ~CompletionQueueTag() {} +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H +#define GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H + +namespace grpc { + +namespace internal { +/// An interface allowing implementors to process and filter event tags. +class CompletionQueueTag { + public: + virtual ~CompletionQueueTag() {} /// FinalizeResult must be called before informing user code that the /// operation bound to the underlying core completion queue tag has @@ -45,10 +45,10 @@ class CompletionQueueTag { /// application (e.g., server shutdown, for server unimplemented method /// responses, or for cases where a server-side RPC doesn't have a completion /// notification registered using AsyncNotifyWhenDone) - virtual bool FinalizeResult(void** tag, bool* status) = 0; -}; -} // namespace internal - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H + virtual bool FinalizeResult(void** tag, bool* status) = 0; +}; +} // namespace internal + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_TAG_H diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/config.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/config.h index 87f9914273..24a9632452 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/config.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/config.h @@ -1,43 +1,43 @@ -/* - * - * Copyright 2016 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_IMPL_CODEGEN_CONFIG_H -#define GRPCPP_IMPL_CODEGEN_CONFIG_H - +/* + * + * Copyright 2016 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_IMPL_CODEGEN_CONFIG_H +#define GRPCPP_IMPL_CODEGEN_CONFIG_H + #include <util/generic/string.h> - -/// The following macros are deprecated and appear only for users -/// with PB files generated using gRPC 1.0.x plugins. They should -/// not be used in new code -#define GRPC_OVERRIDE override // deprecated -#define GRPC_FINAL final // deprecated - + +/// The following macros are deprecated and appear only for users +/// with PB files generated using gRPC 1.0.x plugins. They should +/// not be used in new code +#define GRPC_OVERRIDE override // deprecated +#define GRPC_FINAL final // deprecated + #ifdef GRPC_CUSTOM_STRING #warning GRPC_CUSTOM_STRING is no longer supported. Please use TString. #endif -namespace grpc { - +namespace grpc { + // Using grpc::string and grpc::to_string is discouraged in favor of // TString and ToString. This is only for legacy code using // them explictly. typedef TString string; // deprecated - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_CONFIG_H + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_CONFIG_H 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 c4012fb00c..185f6723e7 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/config_protobuf.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/config_protobuf.h @@ -1,104 +1,104 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_CONFIG_PROTOBUF_H -#define GRPCPP_IMPL_CODEGEN_CONFIG_PROTOBUF_H - -#define GRPC_OPEN_SOURCE_PROTO - -#ifndef GRPC_CUSTOM_MESSAGE -#ifdef GRPC_USE_PROTO_LITE +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_CONFIG_PROTOBUF_H +#define GRPCPP_IMPL_CODEGEN_CONFIG_PROTOBUF_H + +#define GRPC_OPEN_SOURCE_PROTO + +#ifndef GRPC_CUSTOM_MESSAGE +#ifdef GRPC_USE_PROTO_LITE #include <google/protobuf/message_lite.h> -#define GRPC_CUSTOM_MESSAGE ::google::protobuf::MessageLite +#define GRPC_CUSTOM_MESSAGE ::google::protobuf::MessageLite #define GRPC_CUSTOM_MESSAGELITE ::google::protobuf::MessageLite -#else +#else #include <google/protobuf/message.h> -#define GRPC_CUSTOM_MESSAGE ::google::protobuf::Message +#define GRPC_CUSTOM_MESSAGE ::google::protobuf::Message #define GRPC_CUSTOM_MESSAGELITE ::google::protobuf::MessageLite -#endif -#endif - -#ifndef GRPC_CUSTOM_DESCRIPTOR +#endif +#endif + +#ifndef GRPC_CUSTOM_DESCRIPTOR #include <google/protobuf/descriptor.h> -#include <google/protobuf/descriptor.pb.h> -#define GRPC_CUSTOM_DESCRIPTOR ::google::protobuf::Descriptor -#define GRPC_CUSTOM_DESCRIPTORPOOL ::google::protobuf::DescriptorPool -#define GRPC_CUSTOM_FIELDDESCRIPTOR ::google::protobuf::FieldDescriptor -#define GRPC_CUSTOM_FILEDESCRIPTOR ::google::protobuf::FileDescriptor -#define GRPC_CUSTOM_FILEDESCRIPTORPROTO ::google::protobuf::FileDescriptorProto -#define GRPC_CUSTOM_METHODDESCRIPTOR ::google::protobuf::MethodDescriptor -#define GRPC_CUSTOM_SERVICEDESCRIPTOR ::google::protobuf::ServiceDescriptor -#define GRPC_CUSTOM_SOURCELOCATION ::google::protobuf::SourceLocation -#endif - -#ifndef GRPC_CUSTOM_DESCRIPTORDATABASE +#include <google/protobuf/descriptor.pb.h> +#define GRPC_CUSTOM_DESCRIPTOR ::google::protobuf::Descriptor +#define GRPC_CUSTOM_DESCRIPTORPOOL ::google::protobuf::DescriptorPool +#define GRPC_CUSTOM_FIELDDESCRIPTOR ::google::protobuf::FieldDescriptor +#define GRPC_CUSTOM_FILEDESCRIPTOR ::google::protobuf::FileDescriptor +#define GRPC_CUSTOM_FILEDESCRIPTORPROTO ::google::protobuf::FileDescriptorProto +#define GRPC_CUSTOM_METHODDESCRIPTOR ::google::protobuf::MethodDescriptor +#define GRPC_CUSTOM_SERVICEDESCRIPTOR ::google::protobuf::ServiceDescriptor +#define GRPC_CUSTOM_SOURCELOCATION ::google::protobuf::SourceLocation +#endif + +#ifndef GRPC_CUSTOM_DESCRIPTORDATABASE #include <google/protobuf/descriptor_database.h> -#define GRPC_CUSTOM_DESCRIPTORDATABASE ::google::protobuf::DescriptorDatabase -#define GRPC_CUSTOM_SIMPLEDESCRIPTORDATABASE \ - ::google::protobuf::SimpleDescriptorDatabase -#endif - -#ifndef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM +#define GRPC_CUSTOM_DESCRIPTORDATABASE ::google::protobuf::DescriptorDatabase +#define GRPC_CUSTOM_SIMPLEDESCRIPTORDATABASE \ + ::google::protobuf::SimpleDescriptorDatabase +#endif + +#ifndef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/io/zero_copy_stream.h> -#define GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM \ - ::google::protobuf::io::ZeroCopyOutputStream -#define GRPC_CUSTOM_ZEROCOPYINPUTSTREAM \ - ::google::protobuf::io::ZeroCopyInputStream -#define GRPC_CUSTOM_CODEDINPUTSTREAM ::google::protobuf::io::CodedInputStream -#endif - +#define GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM \ + ::google::protobuf::io::ZeroCopyOutputStream +#define GRPC_CUSTOM_ZEROCOPYINPUTSTREAM \ + ::google::protobuf::io::ZeroCopyInputStream +#define GRPC_CUSTOM_CODEDINPUTSTREAM ::google::protobuf::io::CodedInputStream +#endif + #ifndef GRPC_CUSTOM_JSONUTIL #include <google/protobuf/util/json_util.h> #define GRPC_CUSTOM_JSONUTIL ::google::protobuf::util #define GRPC_CUSTOM_UTIL_STATUS ::google::protobuf::util::Status #endif -namespace grpc { -namespace protobuf { - -typedef GRPC_CUSTOM_MESSAGE Message; +namespace grpc { +namespace protobuf { + +typedef GRPC_CUSTOM_MESSAGE Message; typedef GRPC_CUSTOM_MESSAGELITE MessageLite; - -typedef GRPC_CUSTOM_DESCRIPTOR Descriptor; -typedef GRPC_CUSTOM_DESCRIPTORPOOL DescriptorPool; -typedef GRPC_CUSTOM_DESCRIPTORDATABASE DescriptorDatabase; -typedef GRPC_CUSTOM_FIELDDESCRIPTOR FieldDescriptor; -typedef GRPC_CUSTOM_FILEDESCRIPTOR FileDescriptor; -typedef GRPC_CUSTOM_FILEDESCRIPTORPROTO FileDescriptorProto; -typedef GRPC_CUSTOM_METHODDESCRIPTOR MethodDescriptor; -typedef GRPC_CUSTOM_SERVICEDESCRIPTOR ServiceDescriptor; -typedef GRPC_CUSTOM_SIMPLEDESCRIPTORDATABASE SimpleDescriptorDatabase; -typedef GRPC_CUSTOM_SOURCELOCATION SourceLocation; - + +typedef GRPC_CUSTOM_DESCRIPTOR Descriptor; +typedef GRPC_CUSTOM_DESCRIPTORPOOL DescriptorPool; +typedef GRPC_CUSTOM_DESCRIPTORDATABASE DescriptorDatabase; +typedef GRPC_CUSTOM_FIELDDESCRIPTOR FieldDescriptor; +typedef GRPC_CUSTOM_FILEDESCRIPTOR FileDescriptor; +typedef GRPC_CUSTOM_FILEDESCRIPTORPROTO FileDescriptorProto; +typedef GRPC_CUSTOM_METHODDESCRIPTOR MethodDescriptor; +typedef GRPC_CUSTOM_SERVICEDESCRIPTOR ServiceDescriptor; +typedef GRPC_CUSTOM_SIMPLEDESCRIPTORDATABASE SimpleDescriptorDatabase; +typedef GRPC_CUSTOM_SOURCELOCATION SourceLocation; + namespace util { typedef GRPC_CUSTOM_UTIL_STATUS Status; } // namespace util namespace json = GRPC_CUSTOM_JSONUTIL; -namespace io { -typedef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ZeroCopyOutputStream; -typedef GRPC_CUSTOM_ZEROCOPYINPUTSTREAM ZeroCopyInputStream; -typedef GRPC_CUSTOM_CODEDINPUTSTREAM CodedInputStream; -} // namespace io - -} // namespace protobuf -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_CONFIG_PROTOBUF_H +namespace io { +typedef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ZeroCopyOutputStream; +typedef GRPC_CUSTOM_ZEROCOPYINPUTSTREAM ZeroCopyInputStream; +typedef GRPC_CUSTOM_CODEDINPUTSTREAM CodedInputStream; +} // namespace io + +} // namespace protobuf +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_CONFIG_PROTOBUF_H 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 50c8da4ffe..e757ad260a 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/core_codegen.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/core_codegen.h @@ -1,127 +1,127 @@ -/* - * - * Copyright 2016 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_IMPL_CODEGEN_CORE_CODEGEN_H -#define GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_H - -// This file should be compiled as part of grpcpp. - -#include <grpc/byte_buffer.h> -#include <grpc/grpc.h> -#include <grpc/impl/codegen/grpc_types.h> -#include <grpcpp/impl/codegen/core_codegen_interface.h> - -namespace grpc { - -/// Implementation of the core codegen interface. -class CoreCodegen final : public CoreCodegenInterface { - private: - virtual const grpc_completion_queue_factory* - grpc_completion_queue_factory_lookup( - const grpc_completion_queue_attributes* attributes) override; - virtual grpc_completion_queue* grpc_completion_queue_create( - const grpc_completion_queue_factory* factory, - const grpc_completion_queue_attributes* attributes, - void* reserved) override; - grpc_completion_queue* grpc_completion_queue_create_for_next( - void* reserved) override; - grpc_completion_queue* grpc_completion_queue_create_for_pluck( - void* reserved) override; +/* + * + * Copyright 2016 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_IMPL_CODEGEN_CORE_CODEGEN_H +#define GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_H + +// This file should be compiled as part of grpcpp. + +#include <grpc/byte_buffer.h> +#include <grpc/grpc.h> +#include <grpc/impl/codegen/grpc_types.h> +#include <grpcpp/impl/codegen/core_codegen_interface.h> + +namespace grpc { + +/// Implementation of the core codegen interface. +class CoreCodegen final : public CoreCodegenInterface { + private: + virtual const grpc_completion_queue_factory* + grpc_completion_queue_factory_lookup( + const grpc_completion_queue_attributes* attributes) override; + virtual grpc_completion_queue* grpc_completion_queue_create( + const grpc_completion_queue_factory* factory, + const grpc_completion_queue_attributes* attributes, + void* reserved) override; + grpc_completion_queue* grpc_completion_queue_create_for_next( + void* reserved) override; + grpc_completion_queue* grpc_completion_queue_create_for_pluck( + void* reserved) override; void grpc_completion_queue_shutdown(grpc_completion_queue* cq) override; - void grpc_completion_queue_destroy(grpc_completion_queue* cq) override; - grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag, - gpr_timespec deadline, - void* reserved) override; - - void* gpr_malloc(size_t size) override; - void gpr_free(void* p) override; - - void grpc_init() override; - void grpc_shutdown() override; - - void gpr_mu_init(gpr_mu* mu) override; - void gpr_mu_destroy(gpr_mu* mu) override; - void gpr_mu_lock(gpr_mu* mu) override; - void gpr_mu_unlock(gpr_mu* mu) override; - void gpr_cv_init(gpr_cv* cv) override; - void gpr_cv_destroy(gpr_cv* cv) override; - int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu, gpr_timespec abs_deadline) override; - void gpr_cv_signal(gpr_cv* cv) override; - void gpr_cv_broadcast(gpr_cv* cv) override; - + void grpc_completion_queue_destroy(grpc_completion_queue* cq) override; + grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag, + gpr_timespec deadline, + void* reserved) override; + + void* gpr_malloc(size_t size) override; + void gpr_free(void* p) override; + + void grpc_init() override; + void grpc_shutdown() override; + + void gpr_mu_init(gpr_mu* mu) override; + void gpr_mu_destroy(gpr_mu* mu) override; + void gpr_mu_lock(gpr_mu* mu) override; + void gpr_mu_unlock(gpr_mu* mu) override; + void gpr_cv_init(gpr_cv* cv) override; + void gpr_cv_destroy(gpr_cv* cv) override; + int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu, gpr_timespec abs_deadline) override; + void gpr_cv_signal(gpr_cv* cv) override; + void gpr_cv_broadcast(gpr_cv* cv) override; + grpc_call_error grpc_call_start_batch(grpc_call* call, const grpc_op* ops, size_t nops, void* tag, void* reserved) override; - grpc_call_error grpc_call_cancel_with_status(grpc_call* call, - grpc_status_code status, - const char* description, - void* reserved) override; - void grpc_call_ref(grpc_call* call) override; - void grpc_call_unref(grpc_call* call) override; + grpc_call_error grpc_call_cancel_with_status(grpc_call* call, + grpc_status_code status, + const char* description, + void* reserved) 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; const char* grpc_call_error_to_string(grpc_call_error error) override; - - grpc_byte_buffer* grpc_byte_buffer_copy(grpc_byte_buffer* bb) override; - void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) override; - size_t grpc_byte_buffer_length(grpc_byte_buffer* bb) override; - - int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, - grpc_byte_buffer* buffer) override; - void grpc_byte_buffer_reader_destroy( - grpc_byte_buffer_reader* reader) override; - int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader, - grpc_slice* slice) override; + + grpc_byte_buffer* grpc_byte_buffer_copy(grpc_byte_buffer* bb) override; + void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) override; + size_t grpc_byte_buffer_length(grpc_byte_buffer* bb) override; + + int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, + grpc_byte_buffer* buffer) override; + void grpc_byte_buffer_reader_destroy( + grpc_byte_buffer_reader* reader) override; + int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader, + grpc_slice* slice) override; int grpc_byte_buffer_reader_peek(grpc_byte_buffer_reader* reader, grpc_slice** slice) override; - - grpc_byte_buffer* grpc_raw_byte_buffer_create(grpc_slice* slice, - size_t nslices) override; - grpc_slice grpc_slice_new_with_user_data(void* p, size_t len, - void (*destroy)(void*), - void* user_data) override; - grpc_slice grpc_slice_new_with_len(void* p, size_t len, - void (*destroy)(void*, size_t)) override; - grpc_slice grpc_empty_slice() override; - grpc_slice grpc_slice_malloc(size_t length) override; - void grpc_slice_unref(grpc_slice slice) override; - grpc_slice grpc_slice_ref(grpc_slice slice) override; - grpc_slice grpc_slice_split_tail(grpc_slice* s, size_t split) override; - grpc_slice grpc_slice_split_head(grpc_slice* s, size_t split) override; - grpc_slice grpc_slice_sub(grpc_slice s, size_t begin, size_t end) override; - void grpc_slice_buffer_add(grpc_slice_buffer* sb, grpc_slice slice) override; - void grpc_slice_buffer_pop(grpc_slice_buffer* sb) override; - grpc_slice grpc_slice_from_static_buffer(const void* buffer, - size_t length) override; - grpc_slice grpc_slice_from_copied_buffer(const void* buffer, - size_t length) override; - void grpc_metadata_array_init(grpc_metadata_array* array) override; - void grpc_metadata_array_destroy(grpc_metadata_array* array) override; - - gpr_timespec gpr_inf_future(gpr_clock_type type) override; - gpr_timespec gpr_time_0(gpr_clock_type type) override; - - virtual const Status& ok() override; - virtual const Status& cancelled() override; - - void assert_fail(const char* failed_assertion, const char* file, - int line) override; -}; - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_H + + grpc_byte_buffer* grpc_raw_byte_buffer_create(grpc_slice* slice, + size_t nslices) override; + grpc_slice grpc_slice_new_with_user_data(void* p, size_t len, + void (*destroy)(void*), + void* user_data) override; + grpc_slice grpc_slice_new_with_len(void* p, size_t len, + void (*destroy)(void*, size_t)) override; + grpc_slice grpc_empty_slice() override; + grpc_slice grpc_slice_malloc(size_t length) override; + void grpc_slice_unref(grpc_slice slice) override; + grpc_slice grpc_slice_ref(grpc_slice slice) override; + grpc_slice grpc_slice_split_tail(grpc_slice* s, size_t split) override; + grpc_slice grpc_slice_split_head(grpc_slice* s, size_t split) override; + grpc_slice grpc_slice_sub(grpc_slice s, size_t begin, size_t end) override; + void grpc_slice_buffer_add(grpc_slice_buffer* sb, grpc_slice slice) override; + void grpc_slice_buffer_pop(grpc_slice_buffer* sb) override; + grpc_slice grpc_slice_from_static_buffer(const void* buffer, + size_t length) override; + grpc_slice grpc_slice_from_copied_buffer(const void* buffer, + size_t length) override; + void grpc_metadata_array_init(grpc_metadata_array* array) override; + void grpc_metadata_array_destroy(grpc_metadata_array* array) override; + + gpr_timespec gpr_inf_future(gpr_clock_type type) override; + gpr_timespec gpr_time_0(gpr_clock_type type) override; + + virtual const Status& ok() override; + virtual const Status& cancelled() override; + + void assert_fail(const char* failed_assertion, const char* file, + int line) override; +}; + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_H 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..d95ac511b7 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 @@ -1,155 +1,155 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H -#define GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H - +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H +#define GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H + #include <grpc/impl/codegen/byte_buffer.h> -#include <grpc/impl/codegen/byte_buffer_reader.h> -#include <grpc/impl/codegen/grpc_types.h> -#include <grpc/impl/codegen/sync.h> -#include <grpcpp/impl/codegen/config.h> -#include <grpcpp/impl/codegen/status.h> - -namespace grpc { - -/// Interface between the codegen library and the minimal subset of core -/// features required by the generated code. -/// -/// All undocumented methods are simply forwarding the call to their namesakes. -/// Please refer to their corresponding documentation for details. -/// -/// \warning This interface should be considered internal and private. -class CoreCodegenInterface { - public: - virtual ~CoreCodegenInterface() = default; - - /// Upon a failed assertion, log the error. - virtual void assert_fail(const char* failed_assertion, const char* file, - int line) = 0; - - virtual const grpc_completion_queue_factory* - grpc_completion_queue_factory_lookup( - const grpc_completion_queue_attributes* attributes) = 0; - virtual grpc_completion_queue* grpc_completion_queue_create( - const grpc_completion_queue_factory* factory, - const grpc_completion_queue_attributes* attributes, void* reserved) = 0; - virtual grpc_completion_queue* grpc_completion_queue_create_for_next( - void* reserved) = 0; - virtual grpc_completion_queue* grpc_completion_queue_create_for_pluck( - void* reserved) = 0; +#include <grpc/impl/codegen/byte_buffer_reader.h> +#include <grpc/impl/codegen/grpc_types.h> +#include <grpc/impl/codegen/sync.h> +#include <grpcpp/impl/codegen/config.h> +#include <grpcpp/impl/codegen/status.h> + +namespace grpc { + +/// Interface between the codegen library and the minimal subset of core +/// features required by the generated code. +/// +/// All undocumented methods are simply forwarding the call to their namesakes. +/// Please refer to their corresponding documentation for details. +/// +/// \warning This interface should be considered internal and private. +class CoreCodegenInterface { + public: + virtual ~CoreCodegenInterface() = default; + + /// Upon a failed assertion, log the error. + virtual void assert_fail(const char* failed_assertion, const char* file, + int line) = 0; + + virtual const grpc_completion_queue_factory* + grpc_completion_queue_factory_lookup( + const grpc_completion_queue_attributes* attributes) = 0; + virtual grpc_completion_queue* grpc_completion_queue_create( + const grpc_completion_queue_factory* factory, + const grpc_completion_queue_attributes* attributes, void* reserved) = 0; + virtual grpc_completion_queue* grpc_completion_queue_create_for_next( + void* reserved) = 0; + virtual grpc_completion_queue* grpc_completion_queue_create_for_pluck( + void* reserved) = 0; virtual void grpc_completion_queue_shutdown(grpc_completion_queue* cq) = 0; - virtual void grpc_completion_queue_destroy(grpc_completion_queue* cq) = 0; - virtual grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, - void* tag, - gpr_timespec deadline, - void* reserved) = 0; - - virtual void* gpr_malloc(size_t size) = 0; - virtual void gpr_free(void* p) = 0; - - // These are only to be used to fix edge cases involving grpc_init and - // grpc_shutdown. Calling grpc_init from the codegen interface before - // the real grpc_init is called will cause a crash, so if you use this - // function, ensure that it is not the first call to grpc_init. - virtual void grpc_init() = 0; - virtual void grpc_shutdown() = 0; - - virtual void gpr_mu_init(gpr_mu* mu) = 0; - virtual void gpr_mu_destroy(gpr_mu* mu) = 0; - virtual void gpr_mu_lock(gpr_mu* mu) = 0; - virtual void gpr_mu_unlock(gpr_mu* mu) = 0; - virtual void gpr_cv_init(gpr_cv* cv) = 0; - virtual void gpr_cv_destroy(gpr_cv* cv) = 0; - virtual int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu, - gpr_timespec abs_deadline) = 0; - virtual void gpr_cv_signal(gpr_cv* cv) = 0; - virtual void gpr_cv_broadcast(gpr_cv* cv) = 0; - - virtual grpc_byte_buffer* grpc_byte_buffer_copy(grpc_byte_buffer* bb) = 0; - virtual void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) = 0; - virtual size_t grpc_byte_buffer_length(grpc_byte_buffer* bb) - GRPC_MUST_USE_RESULT = 0; - - virtual int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, - grpc_byte_buffer* buffer) - GRPC_MUST_USE_RESULT = 0; - virtual void grpc_byte_buffer_reader_destroy( - grpc_byte_buffer_reader* reader) = 0; - virtual int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader, - grpc_slice* slice) = 0; + virtual void grpc_completion_queue_destroy(grpc_completion_queue* cq) = 0; + virtual grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, + void* tag, + gpr_timespec deadline, + void* reserved) = 0; + + virtual void* gpr_malloc(size_t size) = 0; + virtual void gpr_free(void* p) = 0; + + // These are only to be used to fix edge cases involving grpc_init and + // grpc_shutdown. Calling grpc_init from the codegen interface before + // the real grpc_init is called will cause a crash, so if you use this + // function, ensure that it is not the first call to grpc_init. + virtual void grpc_init() = 0; + virtual void grpc_shutdown() = 0; + + virtual void gpr_mu_init(gpr_mu* mu) = 0; + virtual void gpr_mu_destroy(gpr_mu* mu) = 0; + virtual void gpr_mu_lock(gpr_mu* mu) = 0; + virtual void gpr_mu_unlock(gpr_mu* mu) = 0; + virtual void gpr_cv_init(gpr_cv* cv) = 0; + virtual void gpr_cv_destroy(gpr_cv* cv) = 0; + virtual int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu, + gpr_timespec abs_deadline) = 0; + virtual void gpr_cv_signal(gpr_cv* cv) = 0; + virtual void gpr_cv_broadcast(gpr_cv* cv) = 0; + + virtual grpc_byte_buffer* grpc_byte_buffer_copy(grpc_byte_buffer* bb) = 0; + virtual void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) = 0; + virtual size_t grpc_byte_buffer_length(grpc_byte_buffer* bb) + GRPC_MUST_USE_RESULT = 0; + + virtual int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, + grpc_byte_buffer* buffer) + GRPC_MUST_USE_RESULT = 0; + virtual void grpc_byte_buffer_reader_destroy( + grpc_byte_buffer_reader* reader) = 0; + virtual int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader, + grpc_slice* slice) = 0; virtual int grpc_byte_buffer_reader_peek(grpc_byte_buffer_reader* reader, grpc_slice** slice) = 0; - - virtual grpc_byte_buffer* grpc_raw_byte_buffer_create(grpc_slice* slice, - size_t nslices) = 0; - virtual grpc_slice grpc_slice_new_with_user_data(void* p, size_t len, - void (*destroy)(void*), - void* user_data) = 0; - virtual grpc_slice grpc_slice_new_with_len(void* p, size_t len, - void (*destroy)(void*, - size_t)) = 0; + + virtual grpc_byte_buffer* grpc_raw_byte_buffer_create(grpc_slice* slice, + size_t nslices) = 0; + virtual grpc_slice grpc_slice_new_with_user_data(void* p, size_t len, + void (*destroy)(void*), + void* user_data) = 0; + virtual grpc_slice grpc_slice_new_with_len(void* p, size_t len, + void (*destroy)(void*, + size_t)) = 0; virtual grpc_call_error grpc_call_start_batch(grpc_call* call, const grpc_op* ops, size_t nops, void* tag, void* reserved) = 0; - virtual grpc_call_error grpc_call_cancel_with_status(grpc_call* call, - grpc_status_code status, - const char* description, - void* reserved) = 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; + virtual grpc_call_error grpc_call_cancel_with_status(grpc_call* call, + grpc_status_code status, + const char* description, + void* reserved) = 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; virtual const char* grpc_call_error_to_string(grpc_call_error error) = 0; - virtual grpc_slice grpc_empty_slice() = 0; - virtual grpc_slice grpc_slice_malloc(size_t length) = 0; - virtual void grpc_slice_unref(grpc_slice slice) = 0; - virtual grpc_slice grpc_slice_ref(grpc_slice slice) = 0; - virtual grpc_slice grpc_slice_split_tail(grpc_slice* s, size_t split) = 0; - virtual grpc_slice grpc_slice_split_head(grpc_slice* s, size_t split) = 0; - virtual grpc_slice grpc_slice_sub(grpc_slice s, size_t begin, size_t end) = 0; - virtual void grpc_slice_buffer_add(grpc_slice_buffer* sb, - grpc_slice slice) = 0; - virtual void grpc_slice_buffer_pop(grpc_slice_buffer* sb) = 0; - virtual grpc_slice grpc_slice_from_static_buffer(const void* buffer, - size_t length) = 0; - virtual grpc_slice grpc_slice_from_copied_buffer(const void* buffer, - size_t length) = 0; - - virtual void grpc_metadata_array_init(grpc_metadata_array* array) = 0; - virtual void grpc_metadata_array_destroy(grpc_metadata_array* array) = 0; - - virtual const Status& ok() = 0; - virtual const Status& cancelled() = 0; - - virtual gpr_timespec gpr_inf_future(gpr_clock_type type) = 0; - virtual gpr_timespec gpr_time_0(gpr_clock_type type) = 0; -}; - -extern CoreCodegenInterface* g_core_codegen_interface; - -/// Codegen specific version of \a GPR_ASSERT. -#define GPR_CODEGEN_ASSERT(x) \ - do { \ + virtual grpc_slice grpc_empty_slice() = 0; + virtual grpc_slice grpc_slice_malloc(size_t length) = 0; + virtual void grpc_slice_unref(grpc_slice slice) = 0; + virtual grpc_slice grpc_slice_ref(grpc_slice slice) = 0; + virtual grpc_slice grpc_slice_split_tail(grpc_slice* s, size_t split) = 0; + virtual grpc_slice grpc_slice_split_head(grpc_slice* s, size_t split) = 0; + virtual grpc_slice grpc_slice_sub(grpc_slice s, size_t begin, size_t end) = 0; + virtual void grpc_slice_buffer_add(grpc_slice_buffer* sb, + grpc_slice slice) = 0; + virtual void grpc_slice_buffer_pop(grpc_slice_buffer* sb) = 0; + virtual grpc_slice grpc_slice_from_static_buffer(const void* buffer, + size_t length) = 0; + virtual grpc_slice grpc_slice_from_copied_buffer(const void* buffer, + size_t length) = 0; + + virtual void grpc_metadata_array_init(grpc_metadata_array* array) = 0; + virtual void grpc_metadata_array_destroy(grpc_metadata_array* array) = 0; + + virtual const Status& ok() = 0; + virtual const Status& cancelled() = 0; + + virtual gpr_timespec gpr_inf_future(gpr_clock_type type) = 0; + virtual gpr_timespec gpr_time_0(gpr_clock_type type) = 0; +}; + +extern CoreCodegenInterface* g_core_codegen_interface; + +/// Codegen specific version of \a GPR_ASSERT. +#define GPR_CODEGEN_ASSERT(x) \ + do { \ if (GPR_UNLIKELY(!(x))) { \ - grpc::g_core_codegen_interface->assert_fail(#x, __FILE__, __LINE__); \ - } \ - } while (0) - + grpc::g_core_codegen_interface->assert_fail(#x, __FILE__, __LINE__); \ + } \ + } while (0) + /// Codegen specific version of \a GPR_DEBUG_ASSERT. #ifndef NDEBUG #define GPR_CODEGEN_DEBUG_ASSERT(x) GPR_CODEGEN_ASSERT(x) @@ -159,6 +159,6 @@ extern CoreCodegenInterface* g_core_codegen_interface; } while (0) #endif -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H 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..70b110100f 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 @@ -1,33 +1,33 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H -#define GRPCPP_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H - -#include <memory> - -#include <grpc/impl/codegen/grpc_types.h> -#include <grpcpp/impl/codegen/security/auth_context.h> - -namespace grpc { - -std::shared_ptr<const AuthContext> CreateAuthContext(grpc_call* call); - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H +#define GRPCPP_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H + +#include <memory> + +#include <grpc/impl/codegen/grpc_types.h> +#include <grpcpp/impl/codegen/security/auth_context.h> + +namespace grpc { + +std::shared_ptr<const AuthContext> CreateAuthContext(grpc_call* call); + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_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 17c904d71a..ced6e35d94 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/grpc_library.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/grpc_library.h @@ -1,64 +1,64 @@ -/* - * - * Copyright 2016 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_IMPL_CODEGEN_GRPC_LIBRARY_H -#define GRPCPP_IMPL_CODEGEN_GRPC_LIBRARY_H - -#include <grpcpp/impl/codegen/core_codegen_interface.h> - -namespace grpc { - -class GrpcLibraryInterface { - public: - virtual ~GrpcLibraryInterface() = default; - virtual void init() = 0; - virtual void shutdown() = 0; -}; - -/// Initialized by \a grpc::GrpcLibraryInitializer from -/// <grpcpp/impl/grpc_library.h> -extern GrpcLibraryInterface* g_glip; - -/// Classes that require gRPC to be initialized should inherit from this class. -class GrpcLibraryCodegen { - public: - GrpcLibraryCodegen(bool call_grpc_init = true) : grpc_init_called_(false) { - if (call_grpc_init) { - GPR_CODEGEN_ASSERT(g_glip && - "gRPC library not initialized. See " - "grpc::internal::GrpcLibraryInitializer."); - g_glip->init(); - grpc_init_called_ = true; - } - } - virtual ~GrpcLibraryCodegen() { - if (grpc_init_called_) { - GPR_CODEGEN_ASSERT(g_glip && - "gRPC library not initialized. See " - "grpc::internal::GrpcLibraryInitializer."); - g_glip->shutdown(); - } - } - - private: - bool grpc_init_called_; -}; - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_GRPC_LIBRARY_H +/* + * + * Copyright 2016 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_IMPL_CODEGEN_GRPC_LIBRARY_H +#define GRPCPP_IMPL_CODEGEN_GRPC_LIBRARY_H + +#include <grpcpp/impl/codegen/core_codegen_interface.h> + +namespace grpc { + +class GrpcLibraryInterface { + public: + virtual ~GrpcLibraryInterface() = default; + virtual void init() = 0; + virtual void shutdown() = 0; +}; + +/// Initialized by \a grpc::GrpcLibraryInitializer from +/// <grpcpp/impl/grpc_library.h> +extern GrpcLibraryInterface* g_glip; + +/// Classes that require gRPC to be initialized should inherit from this class. +class GrpcLibraryCodegen { + public: + GrpcLibraryCodegen(bool call_grpc_init = true) : grpc_init_called_(false) { + if (call_grpc_init) { + GPR_CODEGEN_ASSERT(g_glip && + "gRPC library not initialized. See " + "grpc::internal::GrpcLibraryInitializer."); + g_glip->init(); + grpc_init_called_ = true; + } + } + virtual ~GrpcLibraryCodegen() { + if (grpc_init_called_) { + GPR_CODEGEN_ASSERT(g_glip && + "gRPC library not initialized. See " + "grpc::internal::GrpcLibraryInitializer."); + g_glip->shutdown(); + } + } + + private: + bool grpc_init_called_; +}; + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_GRPC_LIBRARY_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..b25a29ccf5 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/metadata_map.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/metadata_map.h @@ -1,39 +1,39 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_METADATA_MAP_H -#define GRPCPP_IMPL_CODEGEN_METADATA_MAP_H - +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_METADATA_MAP_H +#define GRPCPP_IMPL_CODEGEN_METADATA_MAP_H + #include <map> #include <grpc/impl/codegen/log.h> -#include <grpcpp/impl/codegen/slice.h> - -namespace grpc { - -namespace internal { +#include <grpcpp/impl/codegen/slice.h> + +namespace grpc { + +namespace internal { const char kBinaryErrorDetailsKey[] = "grpc-status-details-bin"; -class MetadataMap { - public: +class MetadataMap { + public: MetadataMap() { Setup(); } - + ~MetadataMap() { Destroy(); } TString GetBinaryErrorDetails() { @@ -82,24 +82,24 @@ class MetadataMap { std::multimap<grpc::string_ref, grpc::string_ref> map_; void Destroy() { - g_core_codegen_interface->grpc_metadata_array_destroy(&arr_); - } - + g_core_codegen_interface->grpc_metadata_array_destroy(&arr_); + } + void Setup() { memset(&arr_, 0, sizeof(arr_)); } - void FillMap() { + void FillMap() { if (filled_) return; filled_ = true; - for (size_t i = 0; i < arr_.count; i++) { - // TODO(yangg) handle duplicates? - map_.insert(std::pair<grpc::string_ref, grpc::string_ref>( - StringRefFromSlice(&arr_.metadata[i].key), - StringRefFromSlice(&arr_.metadata[i].value))); - } - } -}; -} // namespace internal - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_METADATA_MAP_H + for (size_t i = 0; i < arr_.count; i++) { + // TODO(yangg) handle duplicates? + map_.insert(std::pair<grpc::string_ref, grpc::string_ref>( + StringRefFromSlice(&arr_.metadata[i].key), + StringRefFromSlice(&arr_.metadata[i].value))); + } + } +}; +} // namespace internal + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_METADATA_MAP_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 487471290d..6ee485b94b 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 @@ -1,149 +1,149 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_READER_H -#define GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_READER_H - -#include <type_traits> - -#include <grpc/impl/codegen/byte_buffer_reader.h> -#include <grpc/impl/codegen/grpc_types.h> -#include <grpc/impl/codegen/slice.h> -#include <grpcpp/impl/codegen/byte_buffer.h> -#include <grpcpp/impl/codegen/config_protobuf.h> -#include <grpcpp/impl/codegen/core_codegen_interface.h> -#include <grpcpp/impl/codegen/serialization_traits.h> -#include <grpcpp/impl/codegen/status.h> - -/// This header provides an object that reads bytes directly from a -/// grpc::ByteBuffer, via the ZeroCopyInputStream interface - -namespace grpc { - -extern CoreCodegenInterface* g_core_codegen_interface; - -/// This is a specialization of the protobuf class ZeroCopyInputStream -/// The principle is to get one chunk of data at a time from the proto layer, -/// with options to backup (re-see some bytes) or skip (forward past some bytes) -/// -/// Read more about ZeroCopyInputStream interface here: -/// https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.zero_copy_stream#ZeroCopyInputStream -class ProtoBufferReader : public ::grpc::protobuf::io::ZeroCopyInputStream { - public: - /// Constructs buffer reader from \a buffer. Will set \a status() to non ok - /// if \a buffer is invalid (the internal buffer has not been initialized). - explicit ProtoBufferReader(ByteBuffer* buffer) - : byte_count_(0), backup_count_(0), status_() { - /// Implemented through a grpc_byte_buffer_reader which iterates - /// over the slices that make up a byte buffer - if (!buffer->Valid() || - !g_core_codegen_interface->grpc_byte_buffer_reader_init( - &reader_, buffer->c_buffer())) { - status_ = Status(StatusCode::INTERNAL, - "Couldn't initialize byte buffer reader"); - } - } - - ~ProtoBufferReader() { - if (status_.ok()) { - g_core_codegen_interface->grpc_byte_buffer_reader_destroy(&reader_); - } - } - - /// Give the proto library a chunk of data from the stream. The caller - /// may safely read from data[0, size - 1]. - bool Next(const void** data, int* size) override { - if (!status_.ok()) { - return false; - } - /// If we have backed up previously, we need to return the backed-up slice - if (backup_count_ > 0) { +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_READER_H +#define GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_READER_H + +#include <type_traits> + +#include <grpc/impl/codegen/byte_buffer_reader.h> +#include <grpc/impl/codegen/grpc_types.h> +#include <grpc/impl/codegen/slice.h> +#include <grpcpp/impl/codegen/byte_buffer.h> +#include <grpcpp/impl/codegen/config_protobuf.h> +#include <grpcpp/impl/codegen/core_codegen_interface.h> +#include <grpcpp/impl/codegen/serialization_traits.h> +#include <grpcpp/impl/codegen/status.h> + +/// This header provides an object that reads bytes directly from a +/// grpc::ByteBuffer, via the ZeroCopyInputStream interface + +namespace grpc { + +extern CoreCodegenInterface* g_core_codegen_interface; + +/// This is a specialization of the protobuf class ZeroCopyInputStream +/// The principle is to get one chunk of data at a time from the proto layer, +/// with options to backup (re-see some bytes) or skip (forward past some bytes) +/// +/// Read more about ZeroCopyInputStream interface here: +/// https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.zero_copy_stream#ZeroCopyInputStream +class ProtoBufferReader : public ::grpc::protobuf::io::ZeroCopyInputStream { + public: + /// Constructs buffer reader from \a buffer. Will set \a status() to non ok + /// if \a buffer is invalid (the internal buffer has not been initialized). + explicit ProtoBufferReader(ByteBuffer* buffer) + : byte_count_(0), backup_count_(0), status_() { + /// Implemented through a grpc_byte_buffer_reader which iterates + /// over the slices that make up a byte buffer + if (!buffer->Valid() || + !g_core_codegen_interface->grpc_byte_buffer_reader_init( + &reader_, buffer->c_buffer())) { + status_ = Status(StatusCode::INTERNAL, + "Couldn't initialize byte buffer reader"); + } + } + + ~ProtoBufferReader() { + if (status_.ok()) { + g_core_codegen_interface->grpc_byte_buffer_reader_destroy(&reader_); + } + } + + /// Give the proto library a chunk of data from the stream. The caller + /// may safely read from data[0, size - 1]. + bool Next(const void** data, int* size) override { + if (!status_.ok()) { + return false; + } + /// If we have backed up previously, we need to return the backed-up slice + if (backup_count_ > 0) { *data = GRPC_SLICE_START_PTR(*slice_) + GRPC_SLICE_LENGTH(*slice_) - - backup_count_; - GPR_CODEGEN_ASSERT(backup_count_ <= INT_MAX); - *size = (int)backup_count_; - backup_count_ = 0; - return true; - } - /// Otherwise get the next slice from the byte buffer reader + backup_count_; + GPR_CODEGEN_ASSERT(backup_count_ <= INT_MAX); + *size = (int)backup_count_; + backup_count_ = 0; + return true; + } + /// Otherwise get the next slice from the byte buffer reader if (!g_core_codegen_interface->grpc_byte_buffer_reader_peek(&reader_, - &slice_)) { - return false; - } + &slice_)) { + return false; + } *data = GRPC_SLICE_START_PTR(*slice_); - // On win x64, int is only 32bit + // On win x64, int is only 32bit GPR_CODEGEN_ASSERT(GRPC_SLICE_LENGTH(*slice_) <= INT_MAX); byte_count_ += * size = (int)GRPC_SLICE_LENGTH(*slice_); - return true; - } - - /// Returns the status of the buffer reader. - Status status() const { return status_; } - - /// The proto library calls this to indicate that we should back up \a count - /// bytes that have already been returned by the last call of Next. - /// So do the backup and have that ready for a later Next. - void BackUp(int count) override { + return true; + } + + /// Returns the status of the buffer reader. + Status status() const { return status_; } + + /// The proto library calls this to indicate that we should back up \a count + /// bytes that have already been returned by the last call of Next. + /// So do the backup and have that ready for a later Next. + void BackUp(int count) override { GPR_CODEGEN_ASSERT(count <= static_cast<int>(GRPC_SLICE_LENGTH(*slice_))); - backup_count_ = count; - } - - /// The proto library calls this to skip over \a count bytes. Implement this - /// using Next and BackUp combined. - bool Skip(int count) override { - const void* data; - int size; - while (Next(&data, &size)) { - if (size >= count) { - BackUp(size - count); - return true; - } - // size < count; - count -= size; - } - // error or we have too large count; - return false; - } - - /// Returns the total number of bytes read since this object was created. + backup_count_ = count; + } + + /// The proto library calls this to skip over \a count bytes. Implement this + /// using Next and BackUp combined. + bool Skip(int count) override { + const void* data; + int size; + while (Next(&data, &size)) { + if (size >= count) { + BackUp(size - count); + return true; + } + // size < count; + count -= size; + } + // error or we have too large count; + return false; + } + + /// Returns the total number of bytes read since this object was created. int64_t ByteCount() const override { return byte_count_ - backup_count_; } - - // These protected members are needed to support internal optimizations. - // they expose internal bits of grpc core that are NOT stable. If you have - // a use case needs to use one of these functions, please send an email to - // https://groups.google.com/forum/#!forum/grpc-io. - protected: - void set_byte_count(int64_t byte_count) { byte_count_ = byte_count; } - int64_t backup_count() { return backup_count_; } - void set_backup_count(int64_t backup_count) { backup_count_ = backup_count; } - grpc_byte_buffer_reader* reader() { return &reader_; } + + // These protected members are needed to support internal optimizations. + // they expose internal bits of grpc core that are NOT stable. If you have + // a use case needs to use one of these functions, please send an email to + // https://groups.google.com/forum/#!forum/grpc-io. + protected: + void set_byte_count(int64_t byte_count) { byte_count_ = byte_count; } + int64_t backup_count() { return backup_count_; } + void set_backup_count(int64_t backup_count) { backup_count_ = backup_count; } + grpc_byte_buffer_reader* reader() { return &reader_; } grpc_slice* slice() { return slice_; } grpc_slice** mutable_slice_ptr() { return &slice_; } - - private: - int64_t byte_count_; ///< total bytes read since object creation - int64_t backup_count_; ///< how far backed up in the stream we are - grpc_byte_buffer_reader reader_; ///< internal object to read \a grpc_slice - ///< from the \a grpc_byte_buffer + + private: + int64_t byte_count_; ///< total bytes read since object creation + int64_t backup_count_; ///< how far backed up in the stream we are + grpc_byte_buffer_reader reader_; ///< internal object to read \a grpc_slice + ///< from the \a grpc_byte_buffer grpc_slice* slice_; ///< current slice passed back to the caller - Status status_; ///< status of the entire object -}; - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_READER_H + Status status_; ///< status of the entire object +}; + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_PROTO_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 0af4616e50..ffc8a2ed4f 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 @@ -1,167 +1,167 @@ -/* - * - * Copyright 2018 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_WRITER_H -#define GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_WRITER_H - -#include <type_traits> - -#include <grpc/impl/codegen/grpc_types.h> -#include <grpc/impl/codegen/slice.h> -#include <grpcpp/impl/codegen/byte_buffer.h> -#include <grpcpp/impl/codegen/config_protobuf.h> -#include <grpcpp/impl/codegen/core_codegen_interface.h> -#include <grpcpp/impl/codegen/serialization_traits.h> -#include <grpcpp/impl/codegen/status.h> - -/// This header provides an object that writes bytes directly into a -/// grpc::ByteBuffer, via the ZeroCopyOutputStream interface - -namespace grpc { - -extern CoreCodegenInterface* g_core_codegen_interface; - -// Forward declaration for testing use only -namespace internal { -class ProtoBufferWriterPeer; -} // namespace internal - -const int kProtoBufferWriterMaxBufferLength = 1024 * 1024; - -/// This is a specialization of the protobuf class ZeroCopyOutputStream. -/// The principle is to give the proto layer one buffer of bytes at a time -/// that it can use to serialize the next portion of the message, with the -/// option to "backup" if more buffer is given than required at the last buffer. -/// -/// Read more about ZeroCopyOutputStream interface here: -/// https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.zero_copy_stream#ZeroCopyOutputStream -class ProtoBufferWriter : public ::grpc::protobuf::io::ZeroCopyOutputStream { - public: - /// Constructor for this derived class - /// - /// \param[out] byte_buffer A pointer to the grpc::ByteBuffer created - /// \param block_size How big are the chunks to allocate at a time - /// \param total_size How many total bytes are required for this proto - ProtoBufferWriter(ByteBuffer* byte_buffer, int block_size, int total_size) - : block_size_(block_size), - total_size_(total_size), - byte_count_(0), - have_backup_(false) { - GPR_CODEGEN_ASSERT(!byte_buffer->Valid()); - /// Create an empty raw byte buffer and look at its underlying slice buffer - grpc_byte_buffer* bp = - g_core_codegen_interface->grpc_raw_byte_buffer_create(NULL, 0); - byte_buffer->set_buffer(bp); - slice_buffer_ = &bp->data.raw.slice_buffer; - } - - ~ProtoBufferWriter() { - if (have_backup_) { - g_core_codegen_interface->grpc_slice_unref(backup_slice_); - } - } - - /// Give the proto library the next buffer of bytes and its size. It is - /// safe for the caller to write from data[0, size - 1]. - bool Next(void** data, int* size) override { - // Protobuf should not ask for more memory than total_size_. - GPR_CODEGEN_ASSERT(byte_count_ < total_size_); - // 1. Use the remaining backup slice if we have one - // 2. Otherwise allocate a slice, up to the remaining length needed - // or our maximum allocation size - // 3. Provide the slice start and size available - // 4. Add the slice being returned to the slice buffer +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_WRITER_H +#define GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_WRITER_H + +#include <type_traits> + +#include <grpc/impl/codegen/grpc_types.h> +#include <grpc/impl/codegen/slice.h> +#include <grpcpp/impl/codegen/byte_buffer.h> +#include <grpcpp/impl/codegen/config_protobuf.h> +#include <grpcpp/impl/codegen/core_codegen_interface.h> +#include <grpcpp/impl/codegen/serialization_traits.h> +#include <grpcpp/impl/codegen/status.h> + +/// This header provides an object that writes bytes directly into a +/// grpc::ByteBuffer, via the ZeroCopyOutputStream interface + +namespace grpc { + +extern CoreCodegenInterface* g_core_codegen_interface; + +// Forward declaration for testing use only +namespace internal { +class ProtoBufferWriterPeer; +} // namespace internal + +const int kProtoBufferWriterMaxBufferLength = 1024 * 1024; + +/// This is a specialization of the protobuf class ZeroCopyOutputStream. +/// The principle is to give the proto layer one buffer of bytes at a time +/// that it can use to serialize the next portion of the message, with the +/// option to "backup" if more buffer is given than required at the last buffer. +/// +/// Read more about ZeroCopyOutputStream interface here: +/// https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.zero_copy_stream#ZeroCopyOutputStream +class ProtoBufferWriter : public ::grpc::protobuf::io::ZeroCopyOutputStream { + public: + /// Constructor for this derived class + /// + /// \param[out] byte_buffer A pointer to the grpc::ByteBuffer created + /// \param block_size How big are the chunks to allocate at a time + /// \param total_size How many total bytes are required for this proto + ProtoBufferWriter(ByteBuffer* byte_buffer, int block_size, int total_size) + : block_size_(block_size), + total_size_(total_size), + byte_count_(0), + have_backup_(false) { + GPR_CODEGEN_ASSERT(!byte_buffer->Valid()); + /// Create an empty raw byte buffer and look at its underlying slice buffer + grpc_byte_buffer* bp = + g_core_codegen_interface->grpc_raw_byte_buffer_create(NULL, 0); + byte_buffer->set_buffer(bp); + slice_buffer_ = &bp->data.raw.slice_buffer; + } + + ~ProtoBufferWriter() { + if (have_backup_) { + g_core_codegen_interface->grpc_slice_unref(backup_slice_); + } + } + + /// Give the proto library the next buffer of bytes and its size. It is + /// safe for the caller to write from data[0, size - 1]. + bool Next(void** data, int* size) override { + // Protobuf should not ask for more memory than total_size_. + GPR_CODEGEN_ASSERT(byte_count_ < total_size_); + // 1. Use the remaining backup slice if we have one + // 2. Otherwise allocate a slice, up to the remaining length needed + // or our maximum allocation size + // 3. Provide the slice start and size available + // 4. Add the slice being returned to the slice buffer size_t remain = static_cast<size_t>(total_size_ - byte_count_); - if (have_backup_) { - /// If we have a backup slice, we should use it first - slice_ = backup_slice_; - have_backup_ = false; - if (GRPC_SLICE_LENGTH(slice_) > remain) { - GRPC_SLICE_SET_LENGTH(slice_, remain); - } - } else { - // When less than a whole block is needed, only allocate that much. - // But make sure the allocated slice is not inlined. - size_t allocate_length = - remain > static_cast<size_t>(block_size_) ? block_size_ : remain; - slice_ = g_core_codegen_interface->grpc_slice_malloc( - allocate_length > GRPC_SLICE_INLINED_SIZE - ? allocate_length - : GRPC_SLICE_INLINED_SIZE + 1); - } - *data = GRPC_SLICE_START_PTR(slice_); - // On win x64, int is only 32bit - GPR_CODEGEN_ASSERT(GRPC_SLICE_LENGTH(slice_) <= INT_MAX); - byte_count_ += * size = (int)GRPC_SLICE_LENGTH(slice_); - g_core_codegen_interface->grpc_slice_buffer_add(slice_buffer_, slice_); - return true; - } - - /// Backup by \a count bytes because Next returned more bytes than needed - /// (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 { - /// 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 - /// 4. Mark that we still have the remaining part (for later use/unref) - GPR_CODEGEN_ASSERT(count <= static_cast<int>(GRPC_SLICE_LENGTH(slice_))); - g_core_codegen_interface->grpc_slice_buffer_pop(slice_buffer_); - if ((size_t)count == GRPC_SLICE_LENGTH(slice_)) { - backup_slice_ = slice_; - } else { - backup_slice_ = g_core_codegen_interface->grpc_slice_split_tail( - &slice_, GRPC_SLICE_LENGTH(slice_) - count); - g_core_codegen_interface->grpc_slice_buffer_add(slice_buffer_, slice_); - } - // It's dangerous to keep an inlined grpc_slice as the backup slice, since - // on a following Next() call, a reference will be returned to this slice - // via GRPC_SLICE_START_PTR, which will not be an address held by - // slice_buffer_. - have_backup_ = backup_slice_.refcount != NULL; - byte_count_ -= count; - } - - /// Returns the total number of bytes written since this object was created. + if (have_backup_) { + /// If we have a backup slice, we should use it first + slice_ = backup_slice_; + have_backup_ = false; + if (GRPC_SLICE_LENGTH(slice_) > remain) { + GRPC_SLICE_SET_LENGTH(slice_, remain); + } + } else { + // When less than a whole block is needed, only allocate that much. + // But make sure the allocated slice is not inlined. + size_t allocate_length = + remain > static_cast<size_t>(block_size_) ? block_size_ : remain; + slice_ = g_core_codegen_interface->grpc_slice_malloc( + allocate_length > GRPC_SLICE_INLINED_SIZE + ? allocate_length + : GRPC_SLICE_INLINED_SIZE + 1); + } + *data = GRPC_SLICE_START_PTR(slice_); + // On win x64, int is only 32bit + GPR_CODEGEN_ASSERT(GRPC_SLICE_LENGTH(slice_) <= INT_MAX); + byte_count_ += * size = (int)GRPC_SLICE_LENGTH(slice_); + g_core_codegen_interface->grpc_slice_buffer_add(slice_buffer_, slice_); + return true; + } + + /// Backup by \a count bytes because Next returned more bytes than needed + /// (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 { + /// 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 + /// 4. Mark that we still have the remaining part (for later use/unref) + GPR_CODEGEN_ASSERT(count <= static_cast<int>(GRPC_SLICE_LENGTH(slice_))); + g_core_codegen_interface->grpc_slice_buffer_pop(slice_buffer_); + if ((size_t)count == GRPC_SLICE_LENGTH(slice_)) { + backup_slice_ = slice_; + } else { + backup_slice_ = g_core_codegen_interface->grpc_slice_split_tail( + &slice_, GRPC_SLICE_LENGTH(slice_) - count); + g_core_codegen_interface->grpc_slice_buffer_add(slice_buffer_, slice_); + } + // It's dangerous to keep an inlined grpc_slice as the backup slice, since + // on a following Next() call, a reference will be returned to this slice + // via GRPC_SLICE_START_PTR, which will not be an address held by + // slice_buffer_. + have_backup_ = backup_slice_.refcount != NULL; + byte_count_ -= count; + } + + /// Returns the total number of bytes written since this object was created. int64_t ByteCount() const override { return byte_count_; } - - // These protected members are needed to support internal optimizations. - // they expose internal bits of grpc core that are NOT stable. If you have - // a use case needs to use one of these functions, please send an email to - // https://groups.google.com/forum/#!forum/grpc-io. - protected: - grpc_slice_buffer* slice_buffer() { return slice_buffer_; } - void set_byte_count(int64_t byte_count) { byte_count_ = byte_count; } - - private: - // friend for testing purposes only - friend class internal::ProtoBufferWriterPeer; - const int block_size_; ///< size to alloc for each new \a grpc_slice needed - const int total_size_; ///< byte size of proto being serialized - int64_t byte_count_; ///< bytes written since this object was created - grpc_slice_buffer* - slice_buffer_; ///< internal buffer of slices holding the serialized data - bool have_backup_; ///< if we are holding a backup slice or not - grpc_slice backup_slice_; ///< holds space we can still write to, if the - ///< caller has called BackUp - grpc_slice slice_; ///< current slice passed back to the caller -}; - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_WRITER_H + + // These protected members are needed to support internal optimizations. + // they expose internal bits of grpc core that are NOT stable. If you have + // a use case needs to use one of these functions, please send an email to + // https://groups.google.com/forum/#!forum/grpc-io. + protected: + grpc_slice_buffer* slice_buffer() { return slice_buffer_; } + void set_byte_count(int64_t byte_count) { byte_count_ = byte_count; } + + private: + // friend for testing purposes only + friend class internal::ProtoBufferWriterPeer; + const int block_size_; ///< size to alloc for each new \a grpc_slice needed + const int total_size_; ///< byte size of proto being serialized + int64_t byte_count_; ///< bytes written since this object was created + grpc_slice_buffer* + slice_buffer_; ///< internal buffer of slices holding the serialized data + bool have_backup_; ///< if we are holding a backup slice or not + grpc_slice backup_slice_; ///< holds space we can still write to, if the + ///< caller has called BackUp + grpc_slice slice_; ///< current slice passed back to the caller +}; + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_WRITER_H 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 2e102135a3..cc3359c9eb 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/proto_utils.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/proto_utils.h @@ -1,119 +1,119 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_PROTO_UTILS_H -#define GRPCPP_IMPL_CODEGEN_PROTO_UTILS_H - -#include <type_traits> - -#include <grpc/impl/codegen/byte_buffer_reader.h> -#include <grpc/impl/codegen/grpc_types.h> -#include <grpc/impl/codegen/slice.h> -#include <grpcpp/impl/codegen/byte_buffer.h> -#include <grpcpp/impl/codegen/config_protobuf.h> -#include <grpcpp/impl/codegen/core_codegen_interface.h> -#include <grpcpp/impl/codegen/proto_buffer_reader.h> -#include <grpcpp/impl/codegen/proto_buffer_writer.h> -#include <grpcpp/impl/codegen/serialization_traits.h> -#include <grpcpp/impl/codegen/slice.h> -#include <grpcpp/impl/codegen/status.h> - -/// This header provides serialization and deserialization between gRPC -/// messages serialized using protobuf and the C++ objects they represent. - -namespace grpc { - -extern CoreCodegenInterface* g_core_codegen_interface; - -// ProtoBufferWriter must be a subclass of ::protobuf::io::ZeroCopyOutputStream. -template <class ProtoBufferWriter, class T> +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_PROTO_UTILS_H +#define GRPCPP_IMPL_CODEGEN_PROTO_UTILS_H + +#include <type_traits> + +#include <grpc/impl/codegen/byte_buffer_reader.h> +#include <grpc/impl/codegen/grpc_types.h> +#include <grpc/impl/codegen/slice.h> +#include <grpcpp/impl/codegen/byte_buffer.h> +#include <grpcpp/impl/codegen/config_protobuf.h> +#include <grpcpp/impl/codegen/core_codegen_interface.h> +#include <grpcpp/impl/codegen/proto_buffer_reader.h> +#include <grpcpp/impl/codegen/proto_buffer_writer.h> +#include <grpcpp/impl/codegen/serialization_traits.h> +#include <grpcpp/impl/codegen/slice.h> +#include <grpcpp/impl/codegen/status.h> + +/// This header provides serialization and deserialization between gRPC +/// messages serialized using protobuf and the C++ objects they represent. + +namespace grpc { + +extern CoreCodegenInterface* g_core_codegen_interface; + +// ProtoBufferWriter must be a subclass of ::protobuf::io::ZeroCopyOutputStream. +template <class ProtoBufferWriter, class T> Status GenericSerialize(const grpc::protobuf::MessageLite& msg, ByteBuffer* bb, - bool* own_buffer) { - static_assert(std::is_base_of<protobuf::io::ZeroCopyOutputStream, - ProtoBufferWriter>::value, - "ProtoBufferWriter must be a subclass of " - "::protobuf::io::ZeroCopyOutputStream"); - *own_buffer = true; + bool* own_buffer) { + static_assert(std::is_base_of<protobuf::io::ZeroCopyOutputStream, + ProtoBufferWriter>::value, + "ProtoBufferWriter must be a subclass of " + "::protobuf::io::ZeroCopyOutputStream"); + *own_buffer = true; int byte_size = msg.ByteSizeLong(); - if ((size_t)byte_size <= GRPC_SLICE_INLINED_SIZE) { - Slice slice(byte_size); - // We serialize directly into the allocated slices memory - GPR_CODEGEN_ASSERT(slice.end() == msg.SerializeWithCachedSizesToArray( - const_cast<uint8_t*>(slice.begin()))); - ByteBuffer tmp(&slice, 1); - bb->Swap(&tmp); - - return g_core_codegen_interface->ok(); - } - ProtoBufferWriter writer(bb, kProtoBufferWriterMaxBufferLength, byte_size); - return msg.SerializeToZeroCopyStream(&writer) - ? g_core_codegen_interface->ok() - : Status(StatusCode::INTERNAL, "Failed to serialize message"); -} - -// BufferReader must be a subclass of ::protobuf::io::ZeroCopyInputStream. -template <class ProtoBufferReader, class T> + if ((size_t)byte_size <= GRPC_SLICE_INLINED_SIZE) { + Slice slice(byte_size); + // We serialize directly into the allocated slices memory + GPR_CODEGEN_ASSERT(slice.end() == msg.SerializeWithCachedSizesToArray( + const_cast<uint8_t*>(slice.begin()))); + ByteBuffer tmp(&slice, 1); + bb->Swap(&tmp); + + return g_core_codegen_interface->ok(); + } + ProtoBufferWriter writer(bb, kProtoBufferWriterMaxBufferLength, byte_size); + return msg.SerializeToZeroCopyStream(&writer) + ? g_core_codegen_interface->ok() + : Status(StatusCode::INTERNAL, "Failed to serialize message"); +} + +// BufferReader must be a subclass of ::protobuf::io::ZeroCopyInputStream. +template <class ProtoBufferReader, class T> Status GenericDeserialize(ByteBuffer* buffer, grpc::protobuf::MessageLite* msg) { - static_assert(std::is_base_of<protobuf::io::ZeroCopyInputStream, - ProtoBufferReader>::value, - "ProtoBufferReader must be a subclass of " - "::protobuf::io::ZeroCopyInputStream"); - if (buffer == nullptr) { - return Status(StatusCode::INTERNAL, "No payload"); - } - Status result = g_core_codegen_interface->ok(); - { - ProtoBufferReader reader(buffer); - if (!reader.status().ok()) { - return reader.status(); - } + static_assert(std::is_base_of<protobuf::io::ZeroCopyInputStream, + ProtoBufferReader>::value, + "ProtoBufferReader must be a subclass of " + "::protobuf::io::ZeroCopyInputStream"); + if (buffer == nullptr) { + return Status(StatusCode::INTERNAL, "No payload"); + } + Status result = g_core_codegen_interface->ok(); + { + ProtoBufferReader reader(buffer); + if (!reader.status().ok()) { + return reader.status(); + } if (!msg->ParseFromZeroCopyStream(&reader)) { - result = Status(StatusCode::INTERNAL, msg->InitializationErrorString()); - } - } - buffer->Clear(); - return result; -} - -// this is needed so the following class does not conflict with protobuf -// serializers that utilize internal-only tools. -#ifdef GRPC_OPEN_SOURCE_PROTO -// This class provides a protobuf serializer. It translates between protobuf -// objects and grpc_byte_buffers. More information about SerializationTraits can -// be found in include/grpcpp/impl/codegen/serialization_traits.h. -template <class T> + result = Status(StatusCode::INTERNAL, msg->InitializationErrorString()); + } + } + buffer->Clear(); + return result; +} + +// this is needed so the following class does not conflict with protobuf +// serializers that utilize internal-only tools. +#ifdef GRPC_OPEN_SOURCE_PROTO +// This class provides a protobuf serializer. It translates between protobuf +// objects and grpc_byte_buffers. More information about SerializationTraits can +// be found in include/grpcpp/impl/codegen/serialization_traits.h. +template <class T> class SerializationTraits< T, typename std::enable_if< std::is_base_of<grpc::protobuf::MessageLite, T>::value>::type> { - public: + public: static Status Serialize(const grpc::protobuf::MessageLite& msg, ByteBuffer* bb, bool* own_buffer) { - return GenericSerialize<ProtoBufferWriter, T>(msg, bb, own_buffer); - } - + return GenericSerialize<ProtoBufferWriter, T>(msg, bb, own_buffer); + } + static Status Deserialize(ByteBuffer* buffer, grpc::protobuf::MessageLite* msg) { - return GenericDeserialize<ProtoBufferReader, T>(buffer, msg); - } -}; -#endif - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_PROTO_UTILS_H + return GenericDeserialize<ProtoBufferReader, T>(buffer, msg); + } +}; +#endif + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_PROTO_UTILS_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 9dcde954f1..22e67582ec 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/rpc_method.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/rpc_method.h @@ -1,61 +1,61 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_RPC_METHOD_H -#define GRPCPP_IMPL_CODEGEN_RPC_METHOD_H - -#include <memory> - -#include <grpcpp/impl/codegen/channel_interface.h> - -namespace grpc { -namespace internal { -/// Descriptor of an RPC method -class RpcMethod { - public: - enum RpcType { - NORMAL_RPC = 0, - CLIENT_STREAMING, // request streaming - SERVER_STREAMING, // response streaming - BIDI_STREAMING - }; - - RpcMethod(const char* name, RpcType type) - : name_(name), method_type_(type), channel_tag_(NULL) {} - - RpcMethod(const char* name, RpcType type, - const std::shared_ptr<ChannelInterface>& channel) - : name_(name), - method_type_(type), - channel_tag_(channel->RegisterMethod(name)) {} - - const char* name() const { return name_; } - 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_; - RpcType method_type_; - void* const channel_tag_; -}; - -} // namespace internal -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_RPC_METHOD_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_RPC_METHOD_H +#define GRPCPP_IMPL_CODEGEN_RPC_METHOD_H + +#include <memory> + +#include <grpcpp/impl/codegen/channel_interface.h> + +namespace grpc { +namespace internal { +/// Descriptor of an RPC method +class RpcMethod { + public: + enum RpcType { + NORMAL_RPC = 0, + CLIENT_STREAMING, // request streaming + SERVER_STREAMING, // response streaming + BIDI_STREAMING + }; + + RpcMethod(const char* name, RpcType type) + : name_(name), method_type_(type), channel_tag_(NULL) {} + + RpcMethod(const char* name, RpcType type, + const std::shared_ptr<ChannelInterface>& channel) + : name_(name), + method_type_(type), + channel_tag_(channel->RegisterMethod(name)) {} + + const char* name() const { return name_; } + 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_; + RpcType method_type_; + void* const channel_tag_; +}; + +} // namespace internal +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_RPC_METHOD_H 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..529e45b0ff 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 @@ -1,44 +1,44 @@ -/* - * - * Copyright 2016 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_IMPL_CODEGEN_RPC_SERVICE_METHOD_H -#define GRPCPP_IMPL_CODEGEN_RPC_SERVICE_METHOD_H - -#include <climits> -#include <functional> -#include <map> -#include <memory> -#include <vector> - +/* + * + * Copyright 2016 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_IMPL_CODEGEN_RPC_SERVICE_METHOD_H +#define GRPCPP_IMPL_CODEGEN_RPC_SERVICE_METHOD_H + +#include <climits> +#include <functional> +#include <map> +#include <memory> +#include <vector> + #include <grpc/impl/codegen/log.h> -#include <grpcpp/impl/codegen/byte_buffer.h> -#include <grpcpp/impl/codegen/config.h> -#include <grpcpp/impl/codegen/rpc_method.h> -#include <grpcpp/impl/codegen/status.h> - +#include <grpcpp/impl/codegen/byte_buffer.h> +#include <grpcpp/impl/codegen/config.h> +#include <grpcpp/impl/codegen/rpc_method.h> +#include <grpcpp/impl/codegen/status.h> + namespace grpc { class ServerContextBase; -namespace internal { -/// Base class for running an RPC handler. -class MethodHandler { - public: - virtual ~MethodHandler() {} - struct HandlerParameter { +namespace internal { +/// Base class for running an RPC handler. +class MethodHandler { + public: + virtual ~MethodHandler() {} + struct HandlerParameter { /// Constructor for HandlerParameter /// /// \param c : the gRPC Call structure for this server call @@ -65,8 +65,8 @@ class MethodHandler { const Status status; void* const internal_data; const std::function<void()> call_requester; - }; - virtual void RunHandler(const HandlerParameter& param) = 0; + }; + virtual void RunHandler(const HandlerParameter& param) = 0; /* Returns a pointer to the deserialized request. \a status reflects the result of deserialization. This pointer and the status should be filled in @@ -78,19 +78,19 @@ class MethodHandler { GPR_CODEGEN_ASSERT(req == nullptr); return nullptr; } -}; - -/// Server side rpc method class -class RpcServiceMethod : public RpcMethod { - public: - /// Takes ownership of the handler - RpcServiceMethod(const char* name, RpcMethod::RpcType type, - MethodHandler* handler) +}; + +/// Server side rpc method class +class RpcServiceMethod : public RpcMethod { + public: + /// Takes ownership of the handler + RpcServiceMethod(const char* name, RpcMethod::RpcType type, + MethodHandler* handler) : RpcMethod(name, type), server_tag_(nullptr), api_type_(ApiType::SYNC), handler_(handler) {} - + enum class ApiType { SYNC, ASYNC, @@ -99,12 +99,12 @@ class RpcServiceMethod : public RpcMethod { RAW_CALL_BACK, }; - void set_server_tag(void* tag) { server_tag_ = tag; } - void* server_tag() const { return server_tag_; } - /// if MethodHandler is nullptr, then this is an async method - MethodHandler* handler() const { return handler_.get(); } + void set_server_tag(void* tag) { server_tag_ = tag; } + void* server_tag() const { return server_tag_; } + /// if MethodHandler is nullptr, then this is an async method + MethodHandler* handler() const { return handler_.get(); } ApiType api_type() const { return api_type_; } - void SetHandler(MethodHandler* handler) { handler_.reset(handler); } + void SetHandler(MethodHandler* handler) { handler_.reset(handler); } void SetServerApiType(RpcServiceMethod::ApiType type) { if ((api_type_ == ApiType::SYNC) && (type == ApiType::ASYNC || type == ApiType::RAW)) { @@ -123,11 +123,11 @@ class RpcServiceMethod : public RpcMethod { } api_type_ = type; } - - private: - void* server_tag_; + + private: + void* server_tag_; ApiType api_type_; - std::unique_ptr<MethodHandler> handler_; + std::unique_ptr<MethodHandler> handler_; const char* TypeToString(RpcServiceMethod::ApiType type) { switch (type) { @@ -145,9 +145,9 @@ class RpcServiceMethod : public RpcMethod { GPR_UNREACHABLE_CODE(return "unknown"); } } -}; -} // namespace internal - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_RPC_SERVICE_METHOD_H +}; +} // namespace internal + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_RPC_SERVICE_METHOD_H 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 220b78f2eb..ccb02b05f5 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 @@ -1,94 +1,94 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H -#define GRPCPP_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H - -#include <iterator> -#include <vector> - -#include <grpcpp/impl/codegen/config.h> -#include <grpcpp/impl/codegen/string_ref.h> - -struct grpc_auth_context; -struct grpc_auth_property; -struct grpc_auth_property_iterator; - -namespace grpc { -class SecureAuthContext; - +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H +#define GRPCPP_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H + +#include <iterator> +#include <vector> + +#include <grpcpp/impl/codegen/config.h> +#include <grpcpp/impl/codegen/string_ref.h> + +struct grpc_auth_context; +struct grpc_auth_property; +struct grpc_auth_property_iterator; + +namespace grpc { +class SecureAuthContext; + typedef std::pair<string_ref, string_ref> AuthProperty; - -class AuthPropertyIterator - : public std::iterator<std::input_iterator_tag, const AuthProperty> { - public: - ~AuthPropertyIterator(); - AuthPropertyIterator& operator++(); - AuthPropertyIterator operator++(int); - bool operator==(const AuthPropertyIterator& rhs) const; - bool operator!=(const AuthPropertyIterator& rhs) const; - const AuthProperty operator*(); - - protected: - AuthPropertyIterator(); - AuthPropertyIterator(const grpc_auth_property* property, - const grpc_auth_property_iterator* iter); - - private: - friend class SecureAuthContext; - const grpc_auth_property* property_; - // The following items form a grpc_auth_property_iterator. - const grpc_auth_context* ctx_; - size_t index_; - const char* name_; -}; - -/// Class encapsulating the Authentication Information. -/// -/// It includes the secure identity of the peer, the type of secure transport -/// used as well as any other properties required by the authorization layer. -class AuthContext { - public: - virtual ~AuthContext() {} - - /// Returns true if the peer is authenticated. - virtual bool IsPeerAuthenticated() const = 0; - - /// A peer identity. - /// - /// It is, in general, comprised of one or more properties (in which case they - /// have the same name). - virtual std::vector<grpc::string_ref> GetPeerIdentity() const = 0; + +class AuthPropertyIterator + : public std::iterator<std::input_iterator_tag, const AuthProperty> { + public: + ~AuthPropertyIterator(); + AuthPropertyIterator& operator++(); + AuthPropertyIterator operator++(int); + bool operator==(const AuthPropertyIterator& rhs) const; + bool operator!=(const AuthPropertyIterator& rhs) const; + const AuthProperty operator*(); + + protected: + AuthPropertyIterator(); + AuthPropertyIterator(const grpc_auth_property* property, + const grpc_auth_property_iterator* iter); + + private: + friend class SecureAuthContext; + const grpc_auth_property* property_; + // The following items form a grpc_auth_property_iterator. + const grpc_auth_context* ctx_; + size_t index_; + const char* name_; +}; + +/// Class encapsulating the Authentication Information. +/// +/// It includes the secure identity of the peer, the type of secure transport +/// used as well as any other properties required by the authorization layer. +class AuthContext { + public: + virtual ~AuthContext() {} + + /// Returns true if the peer is authenticated. + virtual bool IsPeerAuthenticated() const = 0; + + /// A peer identity. + /// + /// It is, in general, comprised of one or more properties (in which case they + /// have the same name). + virtual std::vector<grpc::string_ref> GetPeerIdentity() const = 0; virtual TString GetPeerIdentityPropertyName() const = 0; - - /// Returns all the property values with the given name. - virtual std::vector<grpc::string_ref> FindPropertyValues( + + /// Returns all the property values with the given name. + virtual std::vector<grpc::string_ref> FindPropertyValues( const TString& name) const = 0; - - /// Iteration over all the properties. - virtual AuthPropertyIterator begin() const = 0; - virtual AuthPropertyIterator end() const = 0; - - /// Mutation functions: should only be used by an AuthMetadataProcessor. + + /// Iteration over all the properties. + virtual AuthPropertyIterator begin() const = 0; + virtual AuthPropertyIterator end() const = 0; + + /// Mutation functions: should only be used by an AuthMetadataProcessor. virtual void AddProperty(const TString& key, const string_ref& value) = 0; virtual bool SetPeerIdentityPropertyName(const string& name) = 0; -}; - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H +}; + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H 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..e9d1d7d00e 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/serialization_traits.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/serialization_traits.h @@ -1,62 +1,62 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_SERIALIZATION_TRAITS_H -#define GRPCPP_IMPL_CODEGEN_SERIALIZATION_TRAITS_H - -namespace grpc { - -/// Defines how to serialize and deserialize some type. -/// -/// Used for hooking different message serialization API's into GRPC. -/// Each SerializationTraits<Message> implementation must provide the -/// following functions: -/// 1. static Status Serialize(const Message& msg, -/// ByteBuffer* buffer, -/// bool* own_buffer); -/// OR -/// static Status Serialize(const Message& msg, -/// grpc_byte_buffer** buffer, -/// bool* own_buffer); -/// The former is preferred; the latter is deprecated -/// -/// 2. static Status Deserialize(ByteBuffer* buffer, -/// Message* msg); -/// OR -/// static Status Deserialize(grpc_byte_buffer* buffer, -/// Message* msg); -/// The former is preferred; the latter is deprecated -/// -/// Serialize is required to convert message to a ByteBuffer, and -/// return that byte buffer through *buffer. *own_buffer should -/// be set to true if the caller owns said byte buffer, or false if -/// ownership is retained elsewhere. -/// -/// Deserialize is required to convert buffer into the message stored at -/// msg. max_receive_message_size is passed in as a bound on the maximum -/// number of message bytes Deserialize should accept. -/// -/// Both functions return a Status, allowing them to explain what went -/// wrong if required. -template <class Message, - class UnusedButHereForPartialTemplateSpecialization = void> -class SerializationTraits; - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_SERIALIZATION_TRAITS_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_SERIALIZATION_TRAITS_H +#define GRPCPP_IMPL_CODEGEN_SERIALIZATION_TRAITS_H + +namespace grpc { + +/// Defines how to serialize and deserialize some type. +/// +/// Used for hooking different message serialization API's into GRPC. +/// Each SerializationTraits<Message> implementation must provide the +/// following functions: +/// 1. static Status Serialize(const Message& msg, +/// ByteBuffer* buffer, +/// bool* own_buffer); +/// OR +/// static Status Serialize(const Message& msg, +/// grpc_byte_buffer** buffer, +/// bool* own_buffer); +/// The former is preferred; the latter is deprecated +/// +/// 2. static Status Deserialize(ByteBuffer* buffer, +/// Message* msg); +/// OR +/// static Status Deserialize(grpc_byte_buffer* buffer, +/// Message* msg); +/// The former is preferred; the latter is deprecated +/// +/// Serialize is required to convert message to a ByteBuffer, and +/// return that byte buffer through *buffer. *own_buffer should +/// be set to true if the caller owns said byte buffer, or false if +/// ownership is retained elsewhere. +/// +/// Deserialize is required to convert buffer into the message stored at +/// msg. max_receive_message_size is passed in as a bound on the maximum +/// number of message bytes Deserialize should accept. +/// +/// Both functions return a Status, allowing them to explain what went +/// wrong if required. +template <class Message, + class UnusedButHereForPartialTemplateSpecialization = void> +class SerializationTraits; + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_SERIALIZATION_TRAITS_H 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 685f006cda..73706eea07 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/server_context.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/server_context.h @@ -1,31 +1,31 @@ -/* - * +/* + * * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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_IMPL_CODEGEN_SERVER_CONTEXT_H -#define GRPCPP_IMPL_CODEGEN_SERVER_CONTEXT_H - + * + * 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_IMPL_CODEGEN_SERVER_CONTEXT_H +#define GRPCPP_IMPL_CODEGEN_SERVER_CONTEXT_H + #include <atomic> #include <cassert> #include <map> #include <memory> #include <type_traits> #include <vector> - + #include <grpc/impl/codegen/port_platform.h> #include <grpc/impl/codegen/compression_types.h> @@ -48,7 +48,7 @@ struct grpc_metadata; struct grpc_call; struct census_context; -namespace grpc { +namespace grpc { template <class W, class R> class ServerAsyncReader; template <class W> @@ -61,7 +61,7 @@ template <class R> class ServerReader; template <class W> class ServerWriter; - + namespace internal { template <class ServiceType, class RequestType, class ResponseType> class BidiStreamingHandler; @@ -89,7 +89,7 @@ class TemplatedBidiStreamingHandler; template <::grpc::StatusCode code> class ErrorMethodHandler; } // namespace internal - + class ClientContext; class CompletionQueue; class GenericServerContext; @@ -98,10 +98,10 @@ class ServerInterface; // 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 @@ -601,8 +601,8 @@ class CallbackServerContext : public ServerContextBase { CallbackServerContext& operator=(const CallbackServerContext&) = delete; }; -} // namespace grpc - +} // namespace grpc + static_assert( std::is_base_of<::grpc::ServerContextBase, ::grpc::ServerContext>::value, "improper base class"); @@ -616,4 +616,4 @@ static_assert(sizeof(::grpc::ServerContextBase) == sizeof(::grpc::CallbackServerContext), "wrong size"); -#endif // GRPCPP_IMPL_CODEGEN_SERVER_CONTEXT_H +#endif // GRPCPP_IMPL_CODEGEN_SERVER_CONTEXT_H 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 d97b725025..309ea37a48 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/server_interface.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/server_interface.h @@ -1,36 +1,36 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_SERVER_INTERFACE_H -#define GRPCPP_IMPL_CODEGEN_SERVER_INTERFACE_H - +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_SERVER_INTERFACE_H +#define GRPCPP_IMPL_CODEGEN_SERVER_INTERFACE_H + #include <grpc/impl/codegen/port_platform.h> -#include <grpc/impl/codegen/grpc_types.h> -#include <grpcpp/impl/codegen/byte_buffer.h> +#include <grpc/impl/codegen/grpc_types.h> +#include <grpcpp/impl/codegen/byte_buffer.h> #include <grpcpp/impl/codegen/call.h> -#include <grpcpp/impl/codegen/call_hook.h> -#include <grpcpp/impl/codegen/completion_queue_tag.h> -#include <grpcpp/impl/codegen/core_codegen_interface.h> +#include <grpcpp/impl/codegen/call_hook.h> +#include <grpcpp/impl/codegen/completion_queue_tag.h> +#include <grpcpp/impl/codegen/core_codegen_interface.h> #include <grpcpp/impl/codegen/interceptor_common.h> -#include <grpcpp/impl/codegen/rpc_service_method.h> +#include <grpcpp/impl/codegen/rpc_service_method.h> #include <grpcpp/impl/codegen/server_context.h> - + namespace grpc { class AsyncGenericService; @@ -39,17 +39,17 @@ class CompletionQueue; class GenericServerContext; class ServerCompletionQueue; class ServerCredentials; -class Service; - -extern CoreCodegenInterface* g_core_codegen_interface; - -/// Models a gRPC server. -/// -/// Servers are configured and started via \a grpc::ServerBuilder. -namespace internal { -class ServerAsyncStreamingInterface; -} // namespace internal - +class Service; + +extern CoreCodegenInterface* g_core_codegen_interface; + +/// Models a gRPC server. +/// +/// Servers are configured and started via \a grpc::ServerBuilder. +namespace internal { +class ServerAsyncStreamingInterface; +} // namespace internal + #ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL namespace experimental { #endif @@ -62,12 +62,12 @@ namespace experimental { class ServerInterceptorFactoryInterface; } // namespace experimental -class ServerInterface : public internal::CallHook { - public: - virtual ~ServerInterface() {} - +class ServerInterface : public internal::CallHook { + public: + virtual ~ServerInterface() {} + /// \a Shutdown does the following things: - /// + /// /// 1. Shutdown the server: deactivate all listening ports, mark it in /// "shutdown mode" so that further call Request's or incoming RPC matches /// are no longer allowed. Also return all Request'ed-but-not-yet-active @@ -91,45 +91,45 @@ class ServerInterface : public internal::CallHook { /// server from completing the "join" operation that it needs to do at /// shutdown time). /// - /// All completion queue associated with the server (for example, for async - /// serving) must be shutdown *after* this method has returned: - /// See \a ServerBuilder::AddCompletionQueue for details. + /// All completion queue associated with the server (for example, for async + /// serving) must be shutdown *after* this method has returned: + /// See \a ServerBuilder::AddCompletionQueue for details. /// They must also be drained (by repeated Next) after being shutdown. - /// - /// \param deadline How long to wait until pending rpcs are forcefully - /// terminated. - template <class T> - void Shutdown(const T& deadline) { - ShutdownInternal(TimePoint<T>(deadline).raw_time()); - } - + /// + /// \param deadline How long to wait until pending rpcs are forcefully + /// terminated. + template <class T> + void Shutdown(const T& deadline) { + ShutdownInternal(TimePoint<T>(deadline).raw_time()); + } + /// Shutdown the server without a deadline and forced cancellation. - /// - /// All completion queue associated with the server (for example, for async - /// serving) must be shutdown *after* this method has returned: - /// See \a ServerBuilder::AddCompletionQueue for details. - void Shutdown() { - ShutdownInternal( - g_core_codegen_interface->gpr_inf_future(GPR_CLOCK_MONOTONIC)); - } - - /// Block waiting for all work to complete. - /// - /// \warning The server must be either shutting down or some other thread must - /// call \a Shutdown for this function to ever return. - virtual void Wait() = 0; - - protected: - friend class ::grpc::Service; - - /// Register a service. This call does not take ownership of the service. - /// The service must exist for the lifetime of the Server instance. + /// + /// All completion queue associated with the server (for example, for async + /// serving) must be shutdown *after* this method has returned: + /// See \a ServerBuilder::AddCompletionQueue for details. + void Shutdown() { + ShutdownInternal( + g_core_codegen_interface->gpr_inf_future(GPR_CLOCK_MONOTONIC)); + } + + /// Block waiting for all work to complete. + /// + /// \warning The server must be either shutting down or some other thread must + /// call \a Shutdown for this function to ever return. + virtual void Wait() = 0; + + protected: + friend class ::grpc::Service; + + /// Register a service. This call does not take ownership of the service. + /// The service must exist for the lifetime of the Server instance. virtual bool RegisterService(const TString* host, Service* service) = 0; - - /// Register a generic service. This call does not take ownership of the - /// service. The service must exist for the lifetime of the Server instance. - virtual void RegisterAsyncGenericService(AsyncGenericService* service) = 0; - + + /// Register a generic service. This call does not take ownership of the + /// 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 @@ -158,76 +158,76 @@ class ServerInterface : public internal::CallHook { } #endif - /// Tries to bind \a server to the given \a addr. - /// - /// It can be invoked multiple times. - /// - /// \param addr The address to try to bind to the server (eg, localhost:1234, - /// 192.168.1.1:31416, [::1]:27182, etc.). - /// \params creds The credentials associated with the server. - /// + /// Tries to bind \a server to the given \a addr. + /// + /// It can be invoked multiple times. + /// + /// \param addr The address to try to bind to the server (eg, localhost:1234, + /// 192.168.1.1:31416, [::1]:27182, etc.). + /// \params creds The credentials associated with the server. + /// /// \return bound port number on success, 0 on failure. - /// - /// \warning It's an error to call this method on an already started server. + /// + /// \warning It's an error to call this method on an already started server. virtual int AddListeningPort(const TString& addr, ServerCredentials* creds) = 0; - - /// Start the server. - /// - /// \param cqs Completion queues for handling asynchronous services. The - /// caller is required to keep all completion queues live until the server is - /// destroyed. - /// \param num_cqs How many completion queues does \a cqs hold. + + /// Start the server. + /// + /// \param cqs Completion queues for handling asynchronous services. The + /// caller is required to keep all completion queues live until the server is + /// destroyed. + /// \param num_cqs How many completion queues does \a cqs hold. virtual void Start(::grpc::ServerCompletionQueue** cqs, size_t num_cqs) = 0; - - virtual void ShutdownInternal(gpr_timespec deadline) = 0; - - virtual int max_receive_message_size() const = 0; - - virtual grpc_server* server() = 0; - - virtual void PerformOpsOnCall(internal::CallOpSetInterface* ops, - internal::Call* call) = 0; - - class BaseAsyncRequest : public internal::CompletionQueueTag { - public: + + virtual void ShutdownInternal(gpr_timespec deadline) = 0; + + virtual int max_receive_message_size() const = 0; + + virtual grpc_server* server() = 0; + + virtual void PerformOpsOnCall(internal::CallOpSetInterface* ops, + internal::Call* call) = 0; + + class BaseAsyncRequest : public internal::CompletionQueueTag { + public: BaseAsyncRequest(ServerInterface* server, ::grpc::ServerContext* context, - internal::ServerAsyncStreamingInterface* stream, + internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag, bool delete_on_finalize); - virtual ~BaseAsyncRequest(); - - bool FinalizeResult(void** tag, bool* status) override; - + virtual ~BaseAsyncRequest(); + + bool FinalizeResult(void** tag, bool* status) override; + private: void ContinueFinalizeResultAfterInterception(); - protected: - ServerInterface* const server_; + protected: + ServerInterface* const server_; ::grpc::ServerContext* const context_; - internal::ServerAsyncStreamingInterface* const stream_; + internal::ServerAsyncStreamingInterface* const stream_; ::grpc::CompletionQueue* const call_cq_; ::grpc::ServerCompletionQueue* const notification_cq_; - void* const tag_; - const bool delete_on_finalize_; - grpc_call* call_; + void* const tag_; + const bool delete_on_finalize_; + grpc_call* call_; internal::Call call_wrapper_; internal::InterceptorBatchMethodsImpl interceptor_methods_; bool done_intercepting_; - }; - + }; + /// RegisteredAsyncRequest is not part of the C++ API - class RegisteredAsyncRequest : public BaseAsyncRequest { - public: + class RegisteredAsyncRequest : public BaseAsyncRequest { + public: RegisteredAsyncRequest(ServerInterface* server, ::grpc::ServerContext* context, - internal::ServerAsyncStreamingInterface* stream, + internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag, const char* name, internal::RpcMethod::RpcType type); - + virtual bool FinalizeResult(void** tag, bool* status) override { /* If we are done intercepting, then there is nothing more for us to do */ if (done_intercepting_) { @@ -239,20 +239,20 @@ class ServerInterface : public internal::CallHook { *server_->interceptor_creators())); return BaseAsyncRequest::FinalizeResult(tag, status); } - - protected: - void IssueRequest(void* registered_method, grpc_byte_buffer** payload, + + protected: + void IssueRequest(void* registered_method, grpc_byte_buffer** payload, ::grpc::ServerCompletionQueue* notification_cq); const char* name_; const internal::RpcMethod::RpcType type_; - }; - - class NoPayloadAsyncRequest final : public RegisteredAsyncRequest { - public: + }; + + class NoPayloadAsyncRequest final : public RegisteredAsyncRequest { + public: NoPayloadAsyncRequest(internal::RpcServiceMethod* registered_method, ServerInterface* server, ::grpc::ServerContext* context, - internal::ServerAsyncStreamingInterface* stream, + internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) @@ -260,114 +260,114 @@ class ServerInterface : public internal::CallHook { server, context, stream, call_cq, notification_cq, tag, registered_method->name(), registered_method->method_type()) { IssueRequest(registered_method->server_tag(), nullptr, notification_cq); - } - - // uses RegisteredAsyncRequest::FinalizeResult - }; - - template <class Message> - class PayloadAsyncRequest final : public RegisteredAsyncRequest { - public: + } + + // uses RegisteredAsyncRequest::FinalizeResult + }; + + template <class Message> + class PayloadAsyncRequest final : public RegisteredAsyncRequest { + public: PayloadAsyncRequest(internal::RpcServiceMethod* registered_method, ServerInterface* server, ::grpc::ServerContext* context, - internal::ServerAsyncStreamingInterface* stream, + internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag, Message* request) : RegisteredAsyncRequest( server, context, stream, call_cq, notification_cq, tag, registered_method->name(), registered_method->method_type()), - registered_method_(registered_method), - request_(request) { + registered_method_(registered_method), + request_(request) { IssueRequest(registered_method->server_tag(), payload_.bbuf_ptr(), notification_cq); - } - - ~PayloadAsyncRequest() { - payload_.Release(); // We do not own the payload_ - } - - bool FinalizeResult(void** tag, bool* status) override { + } + + ~PayloadAsyncRequest() { + payload_.Release(); // We do not own the payload_ + } + + bool FinalizeResult(void** tag, bool* status) override { /* If we are done intercepting, then there is nothing more for us to do */ if (done_intercepting_) { return RegisteredAsyncRequest::FinalizeResult(tag, status); } - if (*status) { - if (!payload_.Valid() || !SerializationTraits<Message>::Deserialize( - payload_.bbuf_ptr(), request_) - .ok()) { - // If deserialization fails, we cancel the call and instantiate - // a new instance of ourselves to request another call. We then - // return false, which prevents the call from being returned to - // the application. - g_core_codegen_interface->grpc_call_cancel_with_status( - call_, GRPC_STATUS_INTERNAL, "Unable to parse request", nullptr); - g_core_codegen_interface->grpc_call_unref(call_); - new PayloadAsyncRequest(registered_method_, server_, context_, - stream_, call_cq_, notification_cq_, tag_, - request_); - delete this; - return false; - } - } + if (*status) { + if (!payload_.Valid() || !SerializationTraits<Message>::Deserialize( + payload_.bbuf_ptr(), request_) + .ok()) { + // If deserialization fails, we cancel the call and instantiate + // a new instance of ourselves to request another call. We then + // return false, which prevents the call from being returned to + // the application. + g_core_codegen_interface->grpc_call_cancel_with_status( + call_, GRPC_STATUS_INTERNAL, "Unable to parse request", nullptr); + g_core_codegen_interface->grpc_call_unref(call_); + new PayloadAsyncRequest(registered_method_, server_, context_, + stream_, call_cq_, notification_cq_, tag_, + request_); + delete this; + return false; + } + } /* Set interception point for recv message */ interceptor_methods_.AddInterceptionHookPoint( experimental::InterceptionHookPoints::POST_RECV_MESSAGE); interceptor_methods_.SetRecvMessage(request_, nullptr); - return RegisteredAsyncRequest::FinalizeResult(tag, status); - } - - private: + return RegisteredAsyncRequest::FinalizeResult(tag, status); + } + + private: internal::RpcServiceMethod* const registered_method_; - Message* const request_; - ByteBuffer payload_; - }; - - class GenericAsyncRequest : public BaseAsyncRequest { - public: - GenericAsyncRequest(ServerInterface* server, GenericServerContext* context, - internal::ServerAsyncStreamingInterface* stream, + Message* const request_; + ByteBuffer payload_; + }; + + class GenericAsyncRequest : public BaseAsyncRequest { + public: + GenericAsyncRequest(ServerInterface* server, GenericServerContext* context, + internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag, bool delete_on_finalize); - - bool FinalizeResult(void** tag, bool* status) override; - - private: - grpc_call_details call_details_; - }; - - template <class Message> - void RequestAsyncCall(internal::RpcServiceMethod* method, + + bool FinalizeResult(void** tag, bool* status) override; + + private: + grpc_call_details call_details_; + }; + + template <class Message> + void RequestAsyncCall(internal::RpcServiceMethod* method, ::grpc::ServerContext* context, - internal::ServerAsyncStreamingInterface* stream, + internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag, Message* message) { - GPR_CODEGEN_ASSERT(method); + GPR_CODEGEN_ASSERT(method); new PayloadAsyncRequest<Message>(method, this, context, stream, call_cq, notification_cq, tag, message); - } - - void RequestAsyncCall(internal::RpcServiceMethod* method, + } + + void RequestAsyncCall(internal::RpcServiceMethod* method, ::grpc::ServerContext* context, - internal::ServerAsyncStreamingInterface* stream, + internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - GPR_CODEGEN_ASSERT(method); + GPR_CODEGEN_ASSERT(method); new NoPayloadAsyncRequest(method, this, context, stream, call_cq, notification_cq, tag); - } - + } + void RequestAsyncGenericCall(GenericServerContext* context, internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { - new GenericAsyncRequest(this, context, stream, call_cq, notification_cq, - tag, true); - } + new GenericAsyncRequest(this, context, stream, call_cq, notification_cq, + tag, true); + } private: // EXPERIMENTAL @@ -390,8 +390,8 @@ class ServerInterface : public internal::CallHook { // and adding a new pure method to an interface would be a breaking change // (even though this is private and non-API) virtual ::grpc::CompletionQueue* CallbackCQ() { return nullptr; } -}; - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_SERVER_INTERFACE_H +}; + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_SERVER_INTERFACE_H 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 30be904a3c..dc17404d12 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/service_type.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/service_type.h @@ -1,82 +1,82 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_SERVICE_TYPE_H -#define GRPCPP_IMPL_CODEGEN_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> -#include <grpcpp/impl/codegen/serialization_traits.h> -#include <grpcpp/impl/codegen/server_interface.h> -#include <grpcpp/impl/codegen/status.h> - +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_SERVICE_TYPE_H +#define GRPCPP_IMPL_CODEGEN_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> +#include <grpcpp/impl/codegen/serialization_traits.h> +#include <grpcpp/impl/codegen/server_interface.h> +#include <grpcpp/impl/codegen/status.h> + namespace grpc { - -class CompletionQueue; -class ServerContext; + +class CompletionQueue; +class ServerContext; class ServerInterface; -namespace internal { -class Call; -class ServerAsyncStreamingInterface { - public: - virtual ~ServerAsyncStreamingInterface() {} - - /// Request notification of the sending of initial metadata to the client. - /// Completion will be notified by \a tag on the associated completion - /// queue. This call is optional, but if it is used, it cannot be used - /// concurrently with or after the \a Finish method. - /// - /// \param[in] tag Tag identifying this request. - virtual void SendInitialMetadata(void* tag) = 0; - - private: - friend class ::grpc::ServerInterface; - virtual void BindCall(Call* call) = 0; -}; -} // namespace internal - -/// Desriptor of an RPC service and its various RPC methods -class Service { - public: - Service() : server_(nullptr) {} - virtual ~Service() {} - - bool has_async_methods() const { +namespace internal { +class Call; +class ServerAsyncStreamingInterface { + public: + virtual ~ServerAsyncStreamingInterface() {} + + /// Request notification of the sending of initial metadata to the client. + /// Completion will be notified by \a tag on the associated completion + /// queue. This call is optional, but if it is used, it cannot be used + /// concurrently with or after the \a Finish method. + /// + /// \param[in] tag Tag identifying this request. + virtual void SendInitialMetadata(void* tag) = 0; + + private: + friend class ::grpc::ServerInterface; + virtual void BindCall(Call* call) = 0; +}; +} // namespace internal + +/// Desriptor of an RPC service and its various RPC methods +class Service { + public: + Service() : server_(nullptr) {} + virtual ~Service() {} + + bool has_async_methods() const { for (const auto& method : methods_) { if (method && method->handler() == nullptr) { - return true; - } - } - return false; - } - - bool has_synchronous_methods() const { + return true; + } + } + return false; + } + + bool has_synchronous_methods() const { for (const auto& method : methods_) { if (method && method->api_type() == internal::RpcServiceMethod::ApiType::SYNC) { - return true; - } - } - return false; - } - + return true; + } + } + return false; + } + bool has_callback_methods() const { for (const auto& method : methods_) { if (method && (method->api_type() == @@ -89,16 +89,16 @@ class Service { return false; } - bool has_generic_methods() const { + bool has_generic_methods() const { for (const auto& method : methods_) { if (method.get() == nullptr) { - return true; - } - } - return false; - } - - protected: + return true; + } + } + return false; + } + + protected: // TODO(vjpai): Promote experimental contents once callback API is accepted class experimental_type { public: @@ -122,10 +122,10 @@ class Service { experimental_type experimental() { return experimental_type(this); } - template <class Message> + template <class Message> void RequestAsyncUnary(int index, ::grpc::ServerContext* context, Message* request, - internal::ServerAsyncStreamingInterface* stream, + internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { @@ -134,52 +134,52 @@ class Service { // warning was first seen (grpc/grpc#11664) size_t idx = static_cast<size_t>(index); server_->RequestAsyncCall(methods_[idx].get(), context, stream, call_cq, - notification_cq, tag, request); - } - void RequestAsyncClientStreaming( + notification_cq, tag, request); + } + void RequestAsyncClientStreaming( int index, ::grpc::ServerContext* context, internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { size_t idx = static_cast<size_t>(index); server_->RequestAsyncCall(methods_[idx].get(), context, stream, call_cq, - notification_cq, tag); - } - template <class Message> - void RequestAsyncServerStreaming( + notification_cq, tag); + } + template <class Message> + void RequestAsyncServerStreaming( int index, ::grpc::ServerContext* context, Message* request, internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { size_t idx = static_cast<size_t>(index); server_->RequestAsyncCall(methods_[idx].get(), context, stream, call_cq, - notification_cq, tag, request); - } - void RequestAsyncBidiStreaming( + notification_cq, tag, request); + } + void RequestAsyncBidiStreaming( int index, ::grpc::ServerContext* context, internal::ServerAsyncStreamingInterface* stream, ::grpc::CompletionQueue* call_cq, ::grpc::ServerCompletionQueue* notification_cq, void* tag) { size_t idx = static_cast<size_t>(index); server_->RequestAsyncCall(methods_[idx].get(), context, stream, call_cq, - notification_cq, tag); - } - - void AddMethod(internal::RpcServiceMethod* method) { - methods_.emplace_back(method); - } - - void MarkMethodAsync(int index) { + notification_cq, tag); + } + + void AddMethod(internal::RpcServiceMethod* method) { + methods_.emplace_back(method); + } + + void MarkMethodAsync(int index) { // 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); - GPR_CODEGEN_ASSERT( + GPR_CODEGEN_ASSERT( methods_[idx].get() != nullptr && - "Cannot mark the method as 'async' because it has already been " - "marked as 'generic'."); + "Cannot mark the method as 'async' because it has already been " + "marked as 'generic'."); methods_[idx]->SetServerApiType(internal::RpcServiceMethod::ApiType::ASYNC); - } - + } + void MarkMethodRaw(int index) { // 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. @@ -190,32 +190,32 @@ class Service { methods_[idx]->SetServerApiType(internal::RpcServiceMethod::ApiType::RAW); } - void MarkMethodGeneric(int index) { + void MarkMethodGeneric(int index) { // 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); - GPR_CODEGEN_ASSERT( + GPR_CODEGEN_ASSERT( methods_[idx]->handler() != nullptr && - "Cannot mark the method as 'generic' because it has already been " + "Cannot mark the method as 'generic' because it has already been " "marked as 'async' or 'raw'."); methods_[idx].reset(); - } - - void MarkMethodStreamed(int index, internal::MethodHandler* streamed_method) { + } + + void MarkMethodStreamed(int index, internal::MethodHandler* streamed_method) { // 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); GPR_CODEGEN_ASSERT(methods_[idx] && methods_[idx]->handler() && - "Cannot mark an async or generic method Streamed"); + "Cannot mark an async or generic method Streamed"); methods_[idx]->SetHandler(streamed_method); - - // From the server's point of view, streamed unary is a special - // case of BIDI_STREAMING that has 1 read and 1 write, in that order, - // and split server-side streaming is BIDI_STREAMING with 1 read and - // any number of writes, in that order. + + // From the server's point of view, streamed unary is a special + // case of BIDI_STREAMING that has 1 read and 1 write, in that order, + // and split server-side streaming is BIDI_STREAMING with 1 read and + // any number of writes, in that order. methods_[idx]->SetMethodType(internal::RpcMethod::BIDI_STREAMING); - } - + } + #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL void MarkMethodCallback(int index, internal::MethodHandler* handler) { MarkMethodCallbackInternal(index, handler); @@ -229,7 +229,7 @@ class Service { return GetHandlerInternal(index); } #endif - private: + private: // TODO(vjpai): migrate the Internal functions to mainline functions once // callback API is fully de-experimental void MarkMethodCallbackInternal(int index, internal::MethodHandler* handler) { @@ -265,11 +265,11 @@ class Service { } friend class Server; - friend class ServerInterface; - ServerInterface* server_; - std::vector<std::unique_ptr<internal::RpcServiceMethod>> methods_; -}; - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_SERVICE_TYPE_H + friend class ServerInterface; + ServerInterface* server_; + std::vector<std::unique_ptr<internal::RpcServiceMethod>> methods_; +}; + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_SERVICE_TYPE_H diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/slice.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/slice.h index b1a24dcef8..c1ab4bbd7b 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/slice.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/slice.h @@ -1,143 +1,143 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_SLICE_H -#define GRPCPP_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. -/// -/// A slice represents a contiguous reference counted array of bytes. -/// It is cheap to take references to a slice, and it is cheap to create a -/// slice pointing to a subset of another slice. -class Slice final { - public: - /// Construct an empty slice. - Slice() : slice_(g_core_codegen_interface->grpc_empty_slice()) {} - /// Destructor - drops one reference. - ~Slice() { g_core_codegen_interface->grpc_slice_unref(slice_); } - - enum AddRef { ADD_REF }; - /// Construct a slice from \a slice, adding a reference. - Slice(grpc_slice slice, AddRef) - : slice_(g_core_codegen_interface->grpc_slice_ref(slice)) {} - - enum StealRef { STEAL_REF }; - /// Construct a slice from \a slice, stealing a reference. - Slice(grpc_slice slice, StealRef) : slice_(slice) {} - - /// Allocate a slice of specified size - Slice(size_t len) - : slice_(g_core_codegen_interface->grpc_slice_malloc(len)) {} - - /// Construct a slice from a copied buffer - Slice(const void* buf, size_t len) - : slice_(g_core_codegen_interface->grpc_slice_from_copied_buffer( - reinterpret_cast<const char*>(buf), len)) {} - - /// Construct a slice from a copied string +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_SLICE_H +#define GRPCPP_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. +/// +/// A slice represents a contiguous reference counted array of bytes. +/// It is cheap to take references to a slice, and it is cheap to create a +/// slice pointing to a subset of another slice. +class Slice final { + public: + /// Construct an empty slice. + Slice() : slice_(g_core_codegen_interface->grpc_empty_slice()) {} + /// Destructor - drops one reference. + ~Slice() { g_core_codegen_interface->grpc_slice_unref(slice_); } + + enum AddRef { ADD_REF }; + /// Construct a slice from \a slice, adding a reference. + Slice(grpc_slice slice, AddRef) + : slice_(g_core_codegen_interface->grpc_slice_ref(slice)) {} + + enum StealRef { STEAL_REF }; + /// Construct a slice from \a slice, stealing a reference. + Slice(grpc_slice slice, StealRef) : slice_(slice) {} + + /// Allocate a slice of specified size + Slice(size_t len) + : slice_(g_core_codegen_interface->grpc_slice_malloc(len)) {} + + /// Construct a slice from a copied buffer + Slice(const void* buf, size_t len) + : slice_(g_core_codegen_interface->grpc_slice_from_copied_buffer( + reinterpret_cast<const char*>(buf), len)) {} + + /// Construct a slice from a copied string Slice(const TString& str) - : slice_(g_core_codegen_interface->grpc_slice_from_copied_buffer( - str.c_str(), str.length())) {} - - enum StaticSlice { STATIC_SLICE }; - - /// Construct a slice from a static buffer - Slice(const void* buf, size_t len, StaticSlice) - : slice_(g_core_codegen_interface->grpc_slice_from_static_buffer( - reinterpret_cast<const char*>(buf), len)) {} - - /// Copy constructor, adds a reference. - Slice(const Slice& other) - : slice_(g_core_codegen_interface->grpc_slice_ref(other.slice_)) {} - - /// Assignment, reference count is unchanged. - Slice& operator=(Slice other) { - std::swap(slice_, other.slice_); - return *this; - } - - /// Create a slice pointing at some data. Calls malloc to allocate a refcount - /// for the object, and arranges that destroy will be called with the - /// user data pointer passed in at destruction. Can be the same as buf or - /// different (e.g., if data is part of a larger structure that must be - /// destroyed when the data is no longer needed) - Slice(void* buf, size_t len, void (*destroy)(void*), void* user_data) - : slice_(g_core_codegen_interface->grpc_slice_new_with_user_data( - buf, len, destroy, user_data)) {} - - /// Specialization of above for common case where buf == user_data - Slice(void* buf, size_t len, void (*destroy)(void*)) - : Slice(buf, len, destroy, buf) {} - - /// Similar to the above but has a destroy that also takes slice length - Slice(void* buf, size_t len, void (*destroy)(void*, size_t)) - : slice_(g_core_codegen_interface->grpc_slice_new_with_len(buf, len, - destroy)) {} - - /// Byte size. - size_t size() const { return GRPC_SLICE_LENGTH(slice_); } - - /// Raw pointer to the beginning (first element) of the slice. - const uint8_t* begin() const { return GRPC_SLICE_START_PTR(slice_); } - - /// 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_); } - - /// 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_); - } - - private: - friend class ByteBuffer; - - grpc_slice slice_; -}; - -inline grpc::string_ref StringRefFromSlice(const grpc_slice* slice) { - return grpc::string_ref( - reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(*slice)), - GRPC_SLICE_LENGTH(*slice)); -} - + : slice_(g_core_codegen_interface->grpc_slice_from_copied_buffer( + str.c_str(), str.length())) {} + + enum StaticSlice { STATIC_SLICE }; + + /// Construct a slice from a static buffer + Slice(const void* buf, size_t len, StaticSlice) + : slice_(g_core_codegen_interface->grpc_slice_from_static_buffer( + reinterpret_cast<const char*>(buf), len)) {} + + /// Copy constructor, adds a reference. + Slice(const Slice& other) + : slice_(g_core_codegen_interface->grpc_slice_ref(other.slice_)) {} + + /// Assignment, reference count is unchanged. + Slice& operator=(Slice other) { + std::swap(slice_, other.slice_); + return *this; + } + + /// Create a slice pointing at some data. Calls malloc to allocate a refcount + /// for the object, and arranges that destroy will be called with the + /// user data pointer passed in at destruction. Can be the same as buf or + /// different (e.g., if data is part of a larger structure that must be + /// destroyed when the data is no longer needed) + Slice(void* buf, size_t len, void (*destroy)(void*), void* user_data) + : slice_(g_core_codegen_interface->grpc_slice_new_with_user_data( + buf, len, destroy, user_data)) {} + + /// Specialization of above for common case where buf == user_data + Slice(void* buf, size_t len, void (*destroy)(void*)) + : Slice(buf, len, destroy, buf) {} + + /// Similar to the above but has a destroy that also takes slice length + Slice(void* buf, size_t len, void (*destroy)(void*, size_t)) + : slice_(g_core_codegen_interface->grpc_slice_new_with_len(buf, len, + destroy)) {} + + /// Byte size. + size_t size() const { return GRPC_SLICE_LENGTH(slice_); } + + /// Raw pointer to the beginning (first element) of the slice. + const uint8_t* begin() const { return GRPC_SLICE_START_PTR(slice_); } + + /// 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_); } + + /// 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_); + } + + private: + friend class ByteBuffer; + + grpc_slice slice_; +}; + +inline grpc::string_ref StringRefFromSlice(const grpc_slice* slice) { + return grpc::string_ref( + reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(*slice)), + GRPC_SLICE_LENGTH(*slice)); +} + inline TString StringFromCopiedSlice(grpc_slice slice) { return TString(reinterpret_cast<char*>(GRPC_SLICE_START_PTR(slice)), GRPC_SLICE_LENGTH(slice)); -} - +} + inline grpc_slice SliceReferencingString(const TString& str) { - return g_core_codegen_interface->grpc_slice_from_static_buffer(str.data(), - str.length()); -} - + return g_core_codegen_interface->grpc_slice_from_static_buffer(str.data(), + str.length()); +} + inline grpc_slice SliceFromCopiedString(const TString& str) { - return g_core_codegen_interface->grpc_slice_from_copied_buffer(str.data(), - str.length()); -} - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_SLICE_H + return g_core_codegen_interface->grpc_slice_from_copied_buffer(str.data(), + str.length()); +} + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_SLICE_H diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/status.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/status.h index a5ad6f32fe..3dbf6f234a 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/status.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/status.h @@ -1,133 +1,133 @@ -/* - * - * Copyright 2016 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_IMPL_CODEGEN_STATUS_H -#define GRPCPP_IMPL_CODEGEN_STATUS_H - -#include <grpc/impl/codegen/status.h> -#include <grpcpp/impl/codegen/config.h> -#include <grpcpp/impl/codegen/status_code_enum.h> - -namespace grpc { - -/// Did it work? If it didn't, why? -/// -/// See \a grpc::StatusCode for details on the available code and their meaning. -class Status { - public: - /// Construct an OK instance. - Status() : code_(StatusCode::OK) { - // Static assertions to make sure that the C++ API value correctly - // maps to the core surface API value - static_assert(StatusCode::OK == static_cast<StatusCode>(GRPC_STATUS_OK), - "Mismatched status code"); - static_assert( - StatusCode::CANCELLED == static_cast<StatusCode>(GRPC_STATUS_CANCELLED), - "Mismatched status code"); - static_assert( - StatusCode::UNKNOWN == static_cast<StatusCode>(GRPC_STATUS_UNKNOWN), - "Mismatched status code"); - static_assert(StatusCode::INVALID_ARGUMENT == - static_cast<StatusCode>(GRPC_STATUS_INVALID_ARGUMENT), - "Mismatched status code"); - static_assert(StatusCode::DEADLINE_EXCEEDED == - static_cast<StatusCode>(GRPC_STATUS_DEADLINE_EXCEEDED), - "Mismatched status code"); - static_assert( - StatusCode::NOT_FOUND == static_cast<StatusCode>(GRPC_STATUS_NOT_FOUND), - "Mismatched status code"); - static_assert(StatusCode::ALREADY_EXISTS == - static_cast<StatusCode>(GRPC_STATUS_ALREADY_EXISTS), - "Mismatched status code"); - static_assert(StatusCode::PERMISSION_DENIED == - static_cast<StatusCode>(GRPC_STATUS_PERMISSION_DENIED), - "Mismatched status code"); - static_assert(StatusCode::UNAUTHENTICATED == - static_cast<StatusCode>(GRPC_STATUS_UNAUTHENTICATED), - "Mismatched status code"); - static_assert(StatusCode::RESOURCE_EXHAUSTED == - static_cast<StatusCode>(GRPC_STATUS_RESOURCE_EXHAUSTED), - "Mismatched status code"); - static_assert(StatusCode::FAILED_PRECONDITION == - static_cast<StatusCode>(GRPC_STATUS_FAILED_PRECONDITION), - "Mismatched status code"); - static_assert( - StatusCode::ABORTED == static_cast<StatusCode>(GRPC_STATUS_ABORTED), - "Mismatched status code"); - static_assert(StatusCode::OUT_OF_RANGE == - static_cast<StatusCode>(GRPC_STATUS_OUT_OF_RANGE), - "Mismatched status code"); - static_assert(StatusCode::UNIMPLEMENTED == - static_cast<StatusCode>(GRPC_STATUS_UNIMPLEMENTED), - "Mismatched status code"); - static_assert( - StatusCode::INTERNAL == static_cast<StatusCode>(GRPC_STATUS_INTERNAL), - "Mismatched status code"); - static_assert(StatusCode::UNAVAILABLE == - static_cast<StatusCode>(GRPC_STATUS_UNAVAILABLE), - "Mismatched status code"); - static_assert( - StatusCode::DATA_LOSS == static_cast<StatusCode>(GRPC_STATUS_DATA_LOSS), - "Mismatched status code"); - } - - /// Construct an instance with associated \a code and \a error_message. - /// It is an error to construct an OK status with non-empty \a error_message. +/* + * + * Copyright 2016 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_IMPL_CODEGEN_STATUS_H +#define GRPCPP_IMPL_CODEGEN_STATUS_H + +#include <grpc/impl/codegen/status.h> +#include <grpcpp/impl/codegen/config.h> +#include <grpcpp/impl/codegen/status_code_enum.h> + +namespace grpc { + +/// Did it work? If it didn't, why? +/// +/// See \a grpc::StatusCode for details on the available code and their meaning. +class Status { + public: + /// Construct an OK instance. + Status() : code_(StatusCode::OK) { + // Static assertions to make sure that the C++ API value correctly + // maps to the core surface API value + static_assert(StatusCode::OK == static_cast<StatusCode>(GRPC_STATUS_OK), + "Mismatched status code"); + static_assert( + StatusCode::CANCELLED == static_cast<StatusCode>(GRPC_STATUS_CANCELLED), + "Mismatched status code"); + static_assert( + StatusCode::UNKNOWN == static_cast<StatusCode>(GRPC_STATUS_UNKNOWN), + "Mismatched status code"); + static_assert(StatusCode::INVALID_ARGUMENT == + static_cast<StatusCode>(GRPC_STATUS_INVALID_ARGUMENT), + "Mismatched status code"); + static_assert(StatusCode::DEADLINE_EXCEEDED == + static_cast<StatusCode>(GRPC_STATUS_DEADLINE_EXCEEDED), + "Mismatched status code"); + static_assert( + StatusCode::NOT_FOUND == static_cast<StatusCode>(GRPC_STATUS_NOT_FOUND), + "Mismatched status code"); + static_assert(StatusCode::ALREADY_EXISTS == + static_cast<StatusCode>(GRPC_STATUS_ALREADY_EXISTS), + "Mismatched status code"); + static_assert(StatusCode::PERMISSION_DENIED == + static_cast<StatusCode>(GRPC_STATUS_PERMISSION_DENIED), + "Mismatched status code"); + static_assert(StatusCode::UNAUTHENTICATED == + static_cast<StatusCode>(GRPC_STATUS_UNAUTHENTICATED), + "Mismatched status code"); + static_assert(StatusCode::RESOURCE_EXHAUSTED == + static_cast<StatusCode>(GRPC_STATUS_RESOURCE_EXHAUSTED), + "Mismatched status code"); + static_assert(StatusCode::FAILED_PRECONDITION == + static_cast<StatusCode>(GRPC_STATUS_FAILED_PRECONDITION), + "Mismatched status code"); + static_assert( + StatusCode::ABORTED == static_cast<StatusCode>(GRPC_STATUS_ABORTED), + "Mismatched status code"); + static_assert(StatusCode::OUT_OF_RANGE == + static_cast<StatusCode>(GRPC_STATUS_OUT_OF_RANGE), + "Mismatched status code"); + static_assert(StatusCode::UNIMPLEMENTED == + static_cast<StatusCode>(GRPC_STATUS_UNIMPLEMENTED), + "Mismatched status code"); + static_assert( + StatusCode::INTERNAL == static_cast<StatusCode>(GRPC_STATUS_INTERNAL), + "Mismatched status code"); + static_assert(StatusCode::UNAVAILABLE == + static_cast<StatusCode>(GRPC_STATUS_UNAVAILABLE), + "Mismatched status code"); + static_assert( + StatusCode::DATA_LOSS == static_cast<StatusCode>(GRPC_STATUS_DATA_LOSS), + "Mismatched status code"); + } + + /// Construct an instance with associated \a code and \a error_message. + /// It is an error to construct an OK status with non-empty \a error_message. Status(StatusCode code, const TString& error_message) - : code_(code), error_message_(error_message) {} - - /// Construct an instance with \a code, \a error_message and - /// \a error_details. It is an error to construct an OK status with non-empty - /// \a error_message and/or \a error_details. + : code_(code), error_message_(error_message) {} + + /// Construct an instance with \a code, \a error_message and + /// \a error_details. It is an error to construct an OK status with non-empty + /// \a error_message and/or \a error_details. Status(StatusCode code, const TString& error_message, const TString& error_details) - : code_(code), - error_message_(error_message), - binary_error_details_(error_details) {} - - // Pre-defined special status objects. - /// An OK pre-defined instance. - static const Status& OK; - /// A CANCELLED pre-defined instance. - static const Status& CANCELLED; - - /// Return the instance's error code. - StatusCode error_code() const { return code_; } - /// Return the instance's error message. + : code_(code), + error_message_(error_message), + binary_error_details_(error_details) {} + + // Pre-defined special status objects. + /// An OK pre-defined instance. + static const Status& OK; + /// A CANCELLED pre-defined instance. + static const Status& CANCELLED; + + /// Return the instance's error code. + StatusCode error_code() const { return code_; } + /// Return the instance's error message. TString error_message() const { return error_message_; } - /// Return the (binary) error details. - // Usually it contains a serialized google.rpc.Status proto. + /// Return the (binary) error details. + // Usually it contains a serialized google.rpc.Status proto. TString error_details() const { return binary_error_details_; } - - /// Is the status OK? - bool ok() const { return code_ == StatusCode::OK; } - - // Ignores any errors. This method does nothing except potentially suppress - // complaints from any tools that are checking that errors are not dropped on - // the floor. - void IgnoreError() const {} - - private: - StatusCode code_; + + /// Is the status OK? + bool ok() const { return code_ == StatusCode::OK; } + + // Ignores any errors. This method does nothing except potentially suppress + // complaints from any tools that are checking that errors are not dropped on + // the floor. + void IgnoreError() const {} + + private: + StatusCode code_; TString error_message_; TString binary_error_details_; -}; - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_STATUS_H +}; + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_STATUS_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..ef5bdfdad1 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 @@ -1,143 +1,143 @@ -/* - * - * Copyright 2016 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_IMPL_CODEGEN_STATUS_CODE_ENUM_H -#define GRPCPP_IMPL_CODEGEN_STATUS_CODE_ENUM_H - -namespace grpc { - -enum StatusCode { - /// Not an error; returned on success. - OK = 0, - - /// The operation was cancelled (typically by the caller). - CANCELLED = 1, - - /// Unknown error. An example of where this error may be returned is if a - /// Status value received from another address space belongs to an error-space - /// that is not known in this address space. Also errors raised by APIs that - /// do not return enough error information may be converted to this error. - UNKNOWN = 2, - - /// Client specified an invalid argument. Note that this differs from - /// FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are - /// problematic regardless of the state of the system (e.g., a malformed file - /// name). - INVALID_ARGUMENT = 3, - - /// Deadline expired before operation could complete. For operations that - /// change the state of the system, this error may be returned even if the - /// operation has completed successfully. For example, a successful response - /// from a server could have been delayed long enough for the deadline to - /// expire. - DEADLINE_EXCEEDED = 4, - - /// Some requested entity (e.g., file or directory) was not found. - NOT_FOUND = 5, - - /// Some entity that we attempted to create (e.g., file or directory) already - /// exists. - ALREADY_EXISTS = 6, - - /// The caller does not have permission to execute the specified operation. - /// PERMISSION_DENIED must not be used for rejections caused by exhausting - /// some resource (use RESOURCE_EXHAUSTED instead for those errors). - /// PERMISSION_DENIED must not be used if the caller can not be identified - /// (use UNAUTHENTICATED instead for those errors). - PERMISSION_DENIED = 7, - - /// The request does not have valid authentication credentials for the - /// operation. - UNAUTHENTICATED = 16, - - /// Some resource has been exhausted, perhaps a per-user quota, or perhaps the - /// entire file system is out of space. - RESOURCE_EXHAUSTED = 8, - - /// Operation was rejected because the system is not in a state required for - /// the operation's execution. For example, directory to be deleted may be - /// non-empty, an rmdir operation is applied to a non-directory, etc. - /// - /// A litmus test that may help a service implementor in deciding - /// between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: - /// (a) Use UNAVAILABLE if the client can retry just the failing call. - /// (b) Use ABORTED if the client should retry at a higher-level - /// (e.g., restarting a read-modify-write sequence). - /// (c) Use FAILED_PRECONDITION if the client should not retry until - /// the system state has been explicitly fixed. E.g., if an "rmdir" - /// fails because the directory is non-empty, FAILED_PRECONDITION - /// should be returned since the client should not retry unless - /// they have first fixed up the directory by deleting files from it. - /// (d) Use FAILED_PRECONDITION if the client performs conditional - /// REST Get/Update/Delete on a resource and the resource on the - /// server does not match the condition. E.g., conflicting - /// read-modify-write on the same resource. - FAILED_PRECONDITION = 9, - - /// The operation was aborted, typically due to a concurrency issue like - /// sequencer check failures, transaction aborts, etc. - /// - /// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, - /// and UNAVAILABLE. - ABORTED = 10, - - /// Operation was attempted past the valid range. E.g., seeking or reading - /// past end of file. - /// - /// Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed - /// if the system state changes. For example, a 32-bit file system will - /// generate INVALID_ARGUMENT if asked to read at an offset that is not in the - /// range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from - /// an offset past the current file size. - /// - /// There is a fair bit of overlap between FAILED_PRECONDITION and - /// OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error) - /// when it applies so that callers who are iterating through a space can - /// easily look for an OUT_OF_RANGE error to detect when they are done. - OUT_OF_RANGE = 11, - - /// Operation is not implemented or not supported/enabled in this service. - UNIMPLEMENTED = 12, - - /// Internal errors. Means some invariants expected by underlying System has - /// been broken. If you see one of these errors, Something is very broken. - INTERNAL = 13, - - /// The service is currently unavailable. This is a most likely a transient +/* + * + * Copyright 2016 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_IMPL_CODEGEN_STATUS_CODE_ENUM_H +#define GRPCPP_IMPL_CODEGEN_STATUS_CODE_ENUM_H + +namespace grpc { + +enum StatusCode { + /// Not an error; returned on success. + OK = 0, + + /// The operation was cancelled (typically by the caller). + CANCELLED = 1, + + /// Unknown error. An example of where this error may be returned is if a + /// Status value received from another address space belongs to an error-space + /// that is not known in this address space. Also errors raised by APIs that + /// do not return enough error information may be converted to this error. + UNKNOWN = 2, + + /// Client specified an invalid argument. Note that this differs from + /// FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are + /// problematic regardless of the state of the system (e.g., a malformed file + /// name). + INVALID_ARGUMENT = 3, + + /// Deadline expired before operation could complete. For operations that + /// change the state of the system, this error may be returned even if the + /// operation has completed successfully. For example, a successful response + /// from a server could have been delayed long enough for the deadline to + /// expire. + DEADLINE_EXCEEDED = 4, + + /// Some requested entity (e.g., file or directory) was not found. + NOT_FOUND = 5, + + /// Some entity that we attempted to create (e.g., file or directory) already + /// exists. + ALREADY_EXISTS = 6, + + /// The caller does not have permission to execute the specified operation. + /// PERMISSION_DENIED must not be used for rejections caused by exhausting + /// some resource (use RESOURCE_EXHAUSTED instead for those errors). + /// PERMISSION_DENIED must not be used if the caller can not be identified + /// (use UNAUTHENTICATED instead for those errors). + PERMISSION_DENIED = 7, + + /// The request does not have valid authentication credentials for the + /// operation. + UNAUTHENTICATED = 16, + + /// Some resource has been exhausted, perhaps a per-user quota, or perhaps the + /// entire file system is out of space. + RESOURCE_EXHAUSTED = 8, + + /// Operation was rejected because the system is not in a state required for + /// the operation's execution. For example, directory to be deleted may be + /// non-empty, an rmdir operation is applied to a non-directory, etc. + /// + /// A litmus test that may help a service implementor in deciding + /// between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: + /// (a) Use UNAVAILABLE if the client can retry just the failing call. + /// (b) Use ABORTED if the client should retry at a higher-level + /// (e.g., restarting a read-modify-write sequence). + /// (c) Use FAILED_PRECONDITION if the client should not retry until + /// the system state has been explicitly fixed. E.g., if an "rmdir" + /// fails because the directory is non-empty, FAILED_PRECONDITION + /// should be returned since the client should not retry unless + /// they have first fixed up the directory by deleting files from it. + /// (d) Use FAILED_PRECONDITION if the client performs conditional + /// REST Get/Update/Delete on a resource and the resource on the + /// server does not match the condition. E.g., conflicting + /// read-modify-write on the same resource. + FAILED_PRECONDITION = 9, + + /// The operation was aborted, typically due to a concurrency issue like + /// sequencer check failures, transaction aborts, etc. + /// + /// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, + /// and UNAVAILABLE. + ABORTED = 10, + + /// Operation was attempted past the valid range. E.g., seeking or reading + /// past end of file. + /// + /// Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed + /// if the system state changes. For example, a 32-bit file system will + /// generate INVALID_ARGUMENT if asked to read at an offset that is not in the + /// range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from + /// an offset past the current file size. + /// + /// There is a fair bit of overlap between FAILED_PRECONDITION and + /// OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error) + /// when it applies so that callers who are iterating through a space can + /// easily look for an OUT_OF_RANGE error to detect when they are done. + OUT_OF_RANGE = 11, + + /// Operation is not implemented or not supported/enabled in this service. + UNIMPLEMENTED = 12, + + /// Internal errors. Means some invariants expected by underlying System has + /// been broken. If you see one of these errors, Something is very broken. + INTERNAL = 13, + + /// The service is currently unavailable. This is a most likely a transient /// condition and may be corrected by retrying with a backoff. Note that it is /// not always safe to retry non-idempotent operations. - /// - /// \warning Although data MIGHT not have been transmitted when this - /// status occurs, there is NOT A GUARANTEE that the server has not seen - /// anything. So in general it is unsafe to retry on this status code - /// if the call is non-idempotent. - /// - /// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, - /// and UNAVAILABLE. - UNAVAILABLE = 14, - - /// Unrecoverable data loss or corruption. - DATA_LOSS = 15, - - /// Force users to include a default branch: - DO_NOT_USE = -1 -}; - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_STATUS_CODE_ENUM_H + /// + /// \warning Although data MIGHT not have been transmitted when this + /// status occurs, there is NOT A GUARANTEE that the server has not seen + /// anything. So in general it is unsafe to retry on this status code + /// if the call is non-idempotent. + /// + /// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, + /// and UNAVAILABLE. + UNAVAILABLE = 14, + + /// Unrecoverable data loss or corruption. + DATA_LOSS = 15, + + /// Force users to include a default branch: + DO_NOT_USE = -1 +}; + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_STATUS_CODE_ENUM_H 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 c5dcd31c1d..b7aa9d8935 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/string_ref.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/string_ref.h @@ -1,149 +1,149 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_STRING_REF_H -#define GRPCPP_IMPL_CODEGEN_STRING_REF_H - -#include <string.h> - -#include <algorithm> -#include <iosfwd> -#include <iostream> -#include <iterator> - -#include <grpcpp/impl/codegen/config.h> - +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_STRING_REF_H +#define GRPCPP_IMPL_CODEGEN_STRING_REF_H + +#include <string.h> + +#include <algorithm> +#include <iosfwd> +#include <iostream> +#include <iterator> + +#include <grpcpp/impl/codegen/config.h> + #include <util/stream/output.h> -namespace grpc { - -/// This class is a non owning reference to a string. -/// -/// It should be a strict subset of the upcoming std::string_ref. -/// -/// \see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3442.html -/// -/// The constexpr is dropped or replaced with const for legacy compiler -/// compatibility. -class string_ref { - public: - /// types - typedef const char* const_iterator; - typedef std::reverse_iterator<const_iterator> const_reverse_iterator; - - /// constants - const static size_t npos; - - /// construct/copy. - string_ref() : data_(nullptr), length_(0) {} - string_ref(const string_ref& other) - : data_(other.data_), length_(other.length_) {} - string_ref& operator=(const string_ref& rhs) { - data_ = rhs.data_; - length_ = rhs.length_; - return *this; - } - - string_ref(const char* s) : data_(s), length_(strlen(s)) {} - string_ref(const char* s, size_t l) : data_(s), length_(l) {} +namespace grpc { + +/// This class is a non owning reference to a string. +/// +/// It should be a strict subset of the upcoming std::string_ref. +/// +/// \see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3442.html +/// +/// The constexpr is dropped or replaced with const for legacy compiler +/// compatibility. +class string_ref { + public: + /// types + typedef const char* const_iterator; + typedef std::reverse_iterator<const_iterator> const_reverse_iterator; + + /// constants + const static size_t npos; + + /// construct/copy. + string_ref() : data_(nullptr), length_(0) {} + string_ref(const string_ref& other) + : data_(other.data_), length_(other.length_) {} + string_ref& operator=(const string_ref& rhs) { + data_ = rhs.data_; + length_ = rhs.length_; + return *this; + } + + string_ref(const char* s) : data_(s), length_(strlen(s)) {} + string_ref(const char* s, size_t l) : data_(s), length_(l) {} string_ref(const TString& s) : data_(s.data()), length_(s.length()) {} - - /// iterators - const_iterator begin() const { return data_; } - const_iterator end() const { return data_ + length_; } - const_iterator cbegin() const { return data_; } - const_iterator cend() const { return data_ + length_; } - const_reverse_iterator rbegin() const { - return const_reverse_iterator(end()); - } - const_reverse_iterator rend() const { - return const_reverse_iterator(begin()); - } - const_reverse_iterator crbegin() const { - return const_reverse_iterator(end()); - } - const_reverse_iterator crend() const { - return const_reverse_iterator(begin()); - } - - /// capacity - size_t size() const { return length_; } - size_t length() const { return length_; } - size_t max_size() const { return length_; } - bool empty() const { return length_ == 0; } - - /// element access - const char* data() const { return data_; } - - /// string operations - int compare(string_ref x) const { - size_t min_size = length_ < x.length_ ? length_ : x.length_; - int r = memcmp(data_, x.data_, min_size); - if (r < 0) return -1; - if (r > 0) return 1; - if (length_ < x.length_) return -1; - if (length_ > x.length_) return 1; - return 0; - } - - bool starts_with(string_ref x) const { - return length_ >= x.length_ && (memcmp(data_, x.data_, x.length_) == 0); - } - - bool ends_with(string_ref x) const { - return length_ >= x.length_ && - (memcmp(data_ + (length_ - x.length_), x.data_, x.length_) == 0); - } - - size_t find(string_ref s) const { - auto it = std::search(cbegin(), cend(), s.cbegin(), s.cend()); - return it == cend() ? npos : std::distance(cbegin(), it); - } - - size_t find(char c) const { - auto it = std::find(cbegin(), cend(), c); - return it == cend() ? npos : std::distance(cbegin(), it); - } - - string_ref substr(size_t pos, size_t n = npos) const { - if (pos > length_) pos = length_; - if (n > (length_ - pos)) n = length_ - pos; - return string_ref(data_ + pos, n); - } - - private: - const char* data_; - size_t length_; -}; - -/// Comparison operators -inline bool operator==(string_ref x, string_ref y) { return x.compare(y) == 0; } -inline bool operator!=(string_ref x, string_ref y) { return x.compare(y) != 0; } -inline bool operator<(string_ref x, string_ref y) { return x.compare(y) < 0; } -inline bool operator<=(string_ref x, string_ref y) { return x.compare(y) <= 0; } -inline bool operator>(string_ref x, string_ref y) { return x.compare(y) > 0; } -inline bool operator>=(string_ref x, string_ref y) { return x.compare(y) >= 0; } - + + /// iterators + const_iterator begin() const { return data_; } + const_iterator end() const { return data_ + length_; } + const_iterator cbegin() const { return data_; } + const_iterator cend() const { return data_ + length_; } + const_reverse_iterator rbegin() const { + return const_reverse_iterator(end()); + } + const_reverse_iterator rend() const { + return const_reverse_iterator(begin()); + } + const_reverse_iterator crbegin() const { + return const_reverse_iterator(end()); + } + const_reverse_iterator crend() const { + return const_reverse_iterator(begin()); + } + + /// capacity + size_t size() const { return length_; } + size_t length() const { return length_; } + size_t max_size() const { return length_; } + bool empty() const { return length_ == 0; } + + /// element access + const char* data() const { return data_; } + + /// string operations + int compare(string_ref x) const { + size_t min_size = length_ < x.length_ ? length_ : x.length_; + int r = memcmp(data_, x.data_, min_size); + if (r < 0) return -1; + if (r > 0) return 1; + if (length_ < x.length_) return -1; + if (length_ > x.length_) return 1; + return 0; + } + + bool starts_with(string_ref x) const { + return length_ >= x.length_ && (memcmp(data_, x.data_, x.length_) == 0); + } + + bool ends_with(string_ref x) const { + return length_ >= x.length_ && + (memcmp(data_ + (length_ - x.length_), x.data_, x.length_) == 0); + } + + size_t find(string_ref s) const { + auto it = std::search(cbegin(), cend(), s.cbegin(), s.cend()); + return it == cend() ? npos : std::distance(cbegin(), it); + } + + size_t find(char c) const { + auto it = std::find(cbegin(), cend(), c); + return it == cend() ? npos : std::distance(cbegin(), it); + } + + string_ref substr(size_t pos, size_t n = npos) const { + if (pos > length_) pos = length_; + if (n > (length_ - pos)) n = length_ - pos; + return string_ref(data_ + pos, n); + } + + private: + const char* data_; + size_t length_; +}; + +/// Comparison operators +inline bool operator==(string_ref x, string_ref y) { return x.compare(y) == 0; } +inline bool operator!=(string_ref x, string_ref y) { return x.compare(y) != 0; } +inline bool operator<(string_ref x, string_ref y) { return x.compare(y) < 0; } +inline bool operator<=(string_ref x, string_ref y) { return x.compare(y) <= 0; } +inline bool operator>(string_ref x, string_ref y) { return x.compare(y) > 0; } +inline bool operator>=(string_ref x, string_ref y) { return x.compare(y) >= 0; } + inline IOutputStream& operator<<(IOutputStream& out, const string_ref& string) { TString t(string.begin(), string.end()); return out << t; -} - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_STRING_REF_H +} + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_STRING_REF_H 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..c1ab474a61 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/stub_options.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/stub_options.h @@ -1,29 +1,29 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_STUB_OPTIONS_H -#define GRPCPP_IMPL_CODEGEN_STUB_OPTIONS_H - -namespace grpc { - -/// Useful interface for generated stubs -class StubOptions {}; - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_STUB_OPTIONS_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_STUB_OPTIONS_H +#define GRPCPP_IMPL_CODEGEN_STUB_OPTIONS_H + +namespace grpc { + +/// Useful interface for generated stubs +class StubOptions {}; + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_STUB_OPTIONS_H 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..befb42e003 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/sync_stream.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/sync_stream.h @@ -1,23 +1,23 @@ -/* - * +/* + * * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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_IMPL_CODEGEN_SYNC_STREAM_H -#define GRPCPP_IMPL_CODEGEN_SYNC_STREAM_H - + * + * 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_IMPL_CODEGEN_SYNC_STREAM_H +#define GRPCPP_IMPL_CODEGEN_SYNC_STREAM_H + #include <grpcpp/impl/codegen/call.h> #include <grpcpp/impl/codegen/channel_interface.h> #include <grpcpp/impl/codegen/client_context.h> @@ -26,15 +26,15 @@ #include <grpcpp/impl/codegen/server_context.h> #include <grpcpp/impl/codegen/service_type.h> #include <grpcpp/impl/codegen/status.h> - -namespace grpc { - -namespace internal { + +namespace grpc { + +namespace internal { /// Common interface for all synchronous client side streaming. class ClientStreamingInterface { public: virtual ~ClientStreamingInterface() {} - + /// Block waiting until the stream finishes and a final status of the call is /// available. /// @@ -61,12 +61,12 @@ class ClientStreamingInterface { /// possible trailing metadata sent from the server. virtual ::grpc::Status Finish() = 0; }; - + /// Common interface for all synchronous server side streaming. class ServerStreamingInterface { public: virtual ~ServerStreamingInterface() {} - + /// Block to send initial metadata to client. /// This call is optional, but if it is used, it cannot be used concurrently /// with or after the \a Finish method. @@ -77,15 +77,15 @@ class ServerStreamingInterface { }; /// An interface that yields a sequence of messages of type \a R. -template <class R> +template <class R> class ReaderInterface { public: virtual ~ReaderInterface() {} - + /// Get an upper bound on the next message size available for reading on this /// stream. virtual bool NextMessageSize(uint32_t* sz) = 0; - + /// Block to read a message and parse to \a msg. Returns \a true on success. /// This is thread-safe with respect to \a Write or \WritesDone methods on /// the same stream. It should not be called concurrently with another \a @@ -98,13 +98,13 @@ class ReaderInterface { /// (or been cancelled). virtual bool Read(R* msg) = 0; }; - + /// An interface that can be fed a sequence of messages of type \a W. -template <class W> +template <class W> class WriterInterface { public: virtual ~WriterInterface() {} - + /// Block to write \a msg to the stream with WriteOptions \a options. /// This is thread-safe with respect to \a ReaderInterface::Read /// @@ -113,7 +113,7 @@ class WriterInterface { /// /// \return \a true on success, \a false when the stream has been closed. virtual bool Write(const W& msg, ::grpc::WriteOptions options) = 0; - + /// Block to write \a msg to the stream with default write options. /// This is thread-safe with respect to \a ReaderInterface::Read /// @@ -141,10 +141,10 @@ class WriterInterface { } }; -} // namespace internal - +} // namespace internal + /// Client-side interface for streaming reads of message of type \a R. -template <class R> +template <class R> class ClientReaderInterface : public internal::ClientStreamingInterface, public internal::ReaderInterface<R> { public: @@ -154,9 +154,9 @@ class ClientReaderInterface : public internal::ClientStreamingInterface, /// the metadata will be available in ClientContext after the first read. virtual void WaitForInitialMetadata() = 0; }; - + namespace internal { -template <class R> +template <class R> class ClientReaderFactory { public: template <class W> @@ -168,7 +168,7 @@ class ClientReaderFactory { } }; } // namespace internal - + /// Synchronous (blocking) client-side API for doing server-streaming RPCs, /// where the stream of messages coming from the server has messages /// of type \a R. @@ -262,7 +262,7 @@ class ClientReader final : public ClientReaderInterface<R> { }; /// Client-side interface for streaming writes of message type \a W. -template <class W> +template <class W> class ClientWriterInterface : public internal::ClientStreamingInterface, public internal::WriterInterface<W> { public: @@ -274,9 +274,9 @@ class ClientWriterInterface : public internal::ClientStreamingInterface, /// \return Whether the writes were successful. virtual bool WritesDone() = 0; }; - + namespace internal { -template <class W> +template <class W> class ClientWriterFactory { public: template <class R> @@ -287,7 +287,7 @@ class ClientWriterFactory { } }; } // namespace internal - + /// Synchronous (blocking) client-side API for doing client-streaming RPCs, /// where the outgoing message stream coming from the client has messages of /// type \a W. @@ -406,7 +406,7 @@ class ClientWriter : public ClientWriterInterface<W> { /// Client-side interface for bi-directional streaming with /// client-to-server stream messages of type \a W and /// server-to-client stream messages of type \a R. -template <class W, class R> +template <class W, class R> class ClientReaderWriterInterface : public internal::ClientStreamingInterface, public internal::WriterInterface<W>, public internal::ReaderInterface<R> { @@ -416,7 +416,7 @@ class ClientReaderWriterInterface : public internal::ClientStreamingInterface, /// the first read. Calling this method is optional, and if it is not called /// the metadata will be available in ClientContext after the first read. virtual void WaitForInitialMetadata() = 0; - + /// Half close writing from the client. (signal that the stream of messages /// coming from the client is complete). /// Blocks until currently-pending writes are completed. @@ -427,7 +427,7 @@ class ClientReaderWriterInterface : public internal::ClientStreamingInterface, }; namespace internal { -template <class W, class R> +template <class W, class R> class ClientReaderWriterFactory { public: static ClientReaderWriter<W, R>* Create( @@ -438,7 +438,7 @@ class ClientReaderWriterFactory { } }; } // namespace internal - + /// Synchronous (blocking) client-side API for bi-directional streaming RPCs, /// where the outgoing message stream coming from the client has messages of /// type \a W, and the incoming messages stream coming from the server has @@ -569,14 +569,14 @@ class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> { }; /// Server-side interface for streaming reads of message of type \a R. -template <class R> +template <class R> class ServerReaderInterface : public internal::ServerStreamingInterface, public internal::ReaderInterface<R> {}; - + /// Synchronous (blocking) server-side API for doing client-streaming RPCs, /// where the incoming message stream coming from the client has messages of /// type \a R. -template <class R> +template <class R> class ServerReader final : public ServerReaderInterface<R> { public: /// See the \a ServerStreamingInterface.SendInitialMetadata method @@ -584,7 +584,7 @@ class ServerReader final : public ServerReaderInterface<R> { /// \a ServerContext associated with this call. void SendInitialMetadata() override { GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); - + ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata> ops; ops.SendInitialMetadata(&ctx_->initial_metadata_, @@ -622,14 +622,14 @@ class ServerReader final : public ServerReaderInterface<R> { }; /// Server-side interface for streaming writes of message of type \a W. -template <class W> +template <class W> class ServerWriterInterface : public internal::ServerStreamingInterface, public internal::WriterInterface<W> {}; - + /// Synchronous (blocking) server-side API for doing for doing a /// server-streaming RPCs, where the outgoing message stream coming from the /// server has messages of type \a W. -template <class W> +template <class W> class ServerWriter final : public ServerWriterInterface<W> { public: /// See the \a ServerStreamingInterface.SendInitialMetadata method @@ -638,7 +638,7 @@ class ServerWriter final : public ServerWriterInterface<W> { /// \a ServerContext associated with this call. void SendInitialMetadata() override { GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); - + ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata> ops; ops.SendInitialMetadata(&ctx_->initial_metadata_, @@ -697,19 +697,19 @@ class ServerWriter final : public ServerWriterInterface<W> { }; /// Server-side interface for bi-directional streaming. -template <class W, class R> +template <class W, class R> class ServerReaderWriterInterface : public internal::ServerStreamingInterface, public internal::WriterInterface<W>, public internal::ReaderInterface<R> {}; - + /// Actual implementation of bi-directional streaming namespace internal { -template <class W, class R> +template <class W, class R> class ServerReaderWriterBody final { public: ServerReaderWriterBody(grpc::internal::Call* call, ::grpc::ServerContext* ctx) : call_(call), ctx_(ctx) {} - + void SendInitialMetadata() { GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); @@ -816,7 +816,7 @@ class ServerReaderWriter final : public ServerReaderWriterInterface<W, R> { /// the message. A key difference relative to streaming: ServerUnaryStreamer /// must have exactly 1 Read and exactly 1 Write, in that order, to function /// correctly. Otherwise, the RPC is in error. -template <class RequestType, class ResponseType> +template <class RequestType, class ResponseType> class ServerUnaryStreamer final : public ServerReaderWriterInterface<ResponseType, RequestType> { public: @@ -825,7 +825,7 @@ class ServerUnaryStreamer final /// - the \a ServerContext associated with this call will be used for /// sending initial metadata. void SendInitialMetadata() override { body_.SendInitialMetadata(); } - + /// Get an upper bound on the request message size from the client. bool NextMessageSize(uint32_t* sz) override { return body_.NextMessageSize(sz); @@ -882,7 +882,7 @@ class ServerUnaryStreamer final /// This is invoked through a server-side streaming call on the client side, /// but the server responds to it as though it were a bidi streaming call that /// must first have exactly 1 Read and then any number of Writes. -template <class RequestType, class ResponseType> +template <class RequestType, class ResponseType> class ServerSplitStreamer final : public ServerReaderWriterInterface<ResponseType, RequestType> { public: @@ -891,7 +891,7 @@ class ServerSplitStreamer final /// - the \a ServerContext associated with this call will be used for /// sending initial metadata. void SendInitialMetadata() override { body_.SendInitialMetadata(); } - + /// Get an upper bound on the request message size from the client. bool NextMessageSize(uint32_t* sz) override { return body_.NextMessageSize(sz); @@ -938,6 +938,6 @@ class ServerSplitStreamer final : body_(call, ctx), read_done_(false) {} }; -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_SYNC_STREAM_H +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_SYNC_STREAM_H diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/time.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/time.h index 3a54db45bf..fdad72ece1 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/time.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/time.h @@ -1,91 +1,91 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_CODEGEN_TIME_H -#define GRPCPP_IMPL_CODEGEN_TIME_H - -#if defined(__GNUC__) -#pragma GCC system_header -#endif - -#include <chrono> - -#include <grpc/impl/codegen/grpc_types.h> -#include <grpcpp/impl/codegen/config.h> - -namespace grpc { - -/** If you are trying to use CompletionQueue::AsyncNext with a time class that - isn't either gpr_timespec or std::chrono::system_clock::time_point, you - will most likely be looking at this comment as your compiler will have - fired an error below. In order to fix this issue, you have two potential - solutions: - - 1. Use gpr_timespec or std::chrono::system_clock::time_point instead - 2. Specialize the TimePoint class with whichever time class that you - want to use here. See below for two examples of how to do this. - */ -template <typename T> -class TimePoint { - public: +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_CODEGEN_TIME_H +#define GRPCPP_IMPL_CODEGEN_TIME_H + +#if defined(__GNUC__) +#pragma GCC system_header +#endif + +#include <chrono> + +#include <grpc/impl/codegen/grpc_types.h> +#include <grpcpp/impl/codegen/config.h> + +namespace grpc { + +/** If you are trying to use CompletionQueue::AsyncNext with a time class that + isn't either gpr_timespec or std::chrono::system_clock::time_point, you + will most likely be looking at this comment as your compiler will have + fired an error below. In order to fix this issue, you have two potential + solutions: + + 1. Use gpr_timespec or std::chrono::system_clock::time_point instead + 2. Specialize the TimePoint class with whichever time class that you + want to use here. See below for two examples of how to do this. + */ +template <typename T> +class TimePoint { + public: // If you see the error with methods below, you may need either // i) using the existing types having a conversion class such as // gpr_timespec and std::chrono::system_clock::time_point or // ii) writing a new TimePoint<YourType> to address your case. TimePoint(const T& /*time*/) = delete; gpr_timespec raw_time() = delete; -}; - -template <> -class TimePoint<gpr_timespec> { - public: - TimePoint(const gpr_timespec& time) : time_(time) {} - gpr_timespec raw_time() { return time_; } - - private: - gpr_timespec time_; -}; - -} // namespace grpc - -namespace grpc { - -// from and to should be absolute time. -void Timepoint2Timespec(const std::chrono::system_clock::time_point& from, - gpr_timespec* to); -void TimepointHR2Timespec( - const std::chrono::high_resolution_clock::time_point& from, - gpr_timespec* to); - -std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t); - -template <> -class TimePoint<std::chrono::system_clock::time_point> { - public: - TimePoint(const std::chrono::system_clock::time_point& time) { - Timepoint2Timespec(time, &time_); - } - gpr_timespec raw_time() const { return time_; } - - private: - gpr_timespec time_; -}; - -} // namespace grpc - -#endif // GRPCPP_IMPL_CODEGEN_TIME_H +}; + +template <> +class TimePoint<gpr_timespec> { + public: + TimePoint(const gpr_timespec& time) : time_(time) {} + gpr_timespec raw_time() { return time_; } + + private: + gpr_timespec time_; +}; + +} // namespace grpc + +namespace grpc { + +// from and to should be absolute time. +void Timepoint2Timespec(const std::chrono::system_clock::time_point& from, + gpr_timespec* to); +void TimepointHR2Timespec( + const std::chrono::high_resolution_clock::time_point& from, + gpr_timespec* to); + +std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t); + +template <> +class TimePoint<std::chrono::system_clock::time_point> { + public: + TimePoint(const std::chrono::system_clock::time_point& time) { + Timepoint2Timespec(time, &time_); + } + gpr_timespec raw_time() const { return time_; } + + private: + gpr_timespec time_; +}; + +} // namespace grpc + +#endif // GRPCPP_IMPL_CODEGEN_TIME_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..a84048edfa 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/grpc_library.h +++ b/contrib/libs/grpc/include/grpcpp/impl/grpc_library.h @@ -1,60 +1,60 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_GRPC_LIBRARY_H -#define GRPCPP_IMPL_GRPC_LIBRARY_H - -#include <iostream> - -#include <grpc/grpc.h> -#include <grpcpp/impl/codegen/config.h> -#include <grpcpp/impl/codegen/core_codegen.h> -#include <grpcpp/impl/codegen/grpc_library.h> - -namespace grpc { - -namespace internal { -class GrpcLibrary final : public GrpcLibraryInterface { - public: - void init() override { grpc_init(); } - void shutdown() override { grpc_shutdown(); } -}; - -/// Instantiating this class ensures the proper initialization of gRPC. -class GrpcLibraryInitializer final { - public: - GrpcLibraryInitializer() { - if (grpc::g_glip == nullptr) { +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_GRPC_LIBRARY_H +#define GRPCPP_IMPL_GRPC_LIBRARY_H + +#include <iostream> + +#include <grpc/grpc.h> +#include <grpcpp/impl/codegen/config.h> +#include <grpcpp/impl/codegen/core_codegen.h> +#include <grpcpp/impl/codegen/grpc_library.h> + +namespace grpc { + +namespace internal { +class GrpcLibrary final : public GrpcLibraryInterface { + public: + void init() override { grpc_init(); } + void shutdown() override { grpc_shutdown(); } +}; + +/// Instantiating this class ensures the proper initialization of gRPC. +class GrpcLibraryInitializer final { + public: + GrpcLibraryInitializer() { + if (grpc::g_glip == nullptr) { static auto* const g_gli = new GrpcLibrary(); grpc::g_glip = g_gli; - } - if (grpc::g_core_codegen_interface == nullptr) { + } + if (grpc::g_core_codegen_interface == nullptr) { static auto* const g_core_codegen = new CoreCodegen(); grpc::g_core_codegen_interface = g_core_codegen; - } - } - - /// A no-op method to force the linker to reference this class, which will - /// take care of initializing and shutting down the gRPC runtime. - int summon() { return 0; } -}; - -} // namespace internal -} // namespace grpc - -#endif // GRPCPP_IMPL_GRPC_LIBRARY_H + } + } + + /// A no-op method to force the linker to reference this class, which will + /// take care of initializing and shutting down the gRPC runtime. + int summon() { return 0; } +}; + +} // namespace internal +} // namespace grpc + +#endif // GRPCPP_IMPL_GRPC_LIBRARY_H diff --git a/contrib/libs/grpc/include/grpcpp/impl/method_handler_impl.h b/contrib/libs/grpc/include/grpcpp/impl/method_handler_impl.h index 5eceb5ff91..66d6135490 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/method_handler_impl.h +++ b/contrib/libs/grpc/include/grpcpp/impl/method_handler_impl.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_METHOD_HANDLER_IMPL_H -#define GRPCPP_IMPL_METHOD_HANDLER_IMPL_H - +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_METHOD_HANDLER_IMPL_H +#define GRPCPP_IMPL_METHOD_HANDLER_IMPL_H + #include <grpcpp/impl/codegen/method_handler.h> - -#endif // GRPCPP_IMPL_METHOD_HANDLER_IMPL_H + +#endif // GRPCPP_IMPL_METHOD_HANDLER_IMPL_H diff --git a/contrib/libs/grpc/include/grpcpp/impl/rpc_method.h b/contrib/libs/grpc/include/grpcpp/impl/rpc_method.h index 5da7041671..eac0548db0 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/rpc_method.h +++ b/contrib/libs/grpc/include/grpcpp/impl/rpc_method.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_RPC_METHOD_H -#define GRPCPP_IMPL_RPC_METHOD_H - -#include <grpcpp/impl/codegen/rpc_method.h> - -#endif // GRPCPP_IMPL_RPC_METHOD_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_RPC_METHOD_H +#define GRPCPP_IMPL_RPC_METHOD_H + +#include <grpcpp/impl/codegen/rpc_method.h> + +#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..90309dd46e 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/rpc_service_method.h +++ b/contrib/libs/grpc/include/grpcpp/impl/rpc_service_method.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2016 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_IMPL_RPC_SERVICE_METHOD_H -#define GRPCPP_IMPL_RPC_SERVICE_METHOD_H - -#include <grpcpp/impl/codegen/rpc_service_method.h> - -#endif // GRPCPP_IMPL_RPC_SERVICE_METHOD_H +/* + * + * Copyright 2016 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_IMPL_RPC_SERVICE_METHOD_H +#define GRPCPP_IMPL_RPC_SERVICE_METHOD_H + +#include <grpcpp/impl/codegen/rpc_service_method.h> + +#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..ff585d2c8f 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/serialization_traits.h +++ b/contrib/libs/grpc/include/grpcpp/impl/serialization_traits.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_SERIALIZATION_TRAITS_H -#define GRPCPP_IMPL_SERIALIZATION_TRAITS_H - -#include <grpcpp/impl/codegen/serialization_traits.h> - -#endif // GRPCPP_IMPL_SERIALIZATION_TRAITS_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_SERIALIZATION_TRAITS_H +#define GRPCPP_IMPL_SERIALIZATION_TRAITS_H + +#include <grpcpp/impl/codegen/serialization_traits.h> + +#endif // GRPCPP_IMPL_SERIALIZATION_TRAITS_H diff --git a/contrib/libs/grpc/include/grpcpp/impl/server_builder_option.h b/contrib/libs/grpc/include/grpcpp/impl/server_builder_option.h index c8f047b90e..f37af0edc3 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/server_builder_option.h +++ b/contrib/libs/grpc/include/grpcpp/impl/server_builder_option.h @@ -1,32 +1,32 @@ -/* - * +/* + * * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_SERVER_BUILDER_OPTION_H -#define GRPCPP_IMPL_SERVER_BUILDER_OPTION_H - + * + * 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_IMPL_SERVER_BUILDER_OPTION_H +#define GRPCPP_IMPL_SERVER_BUILDER_OPTION_H + #include <map> #include <memory> - + #include <grpcpp/impl/server_builder_plugin.h> #include <grpcpp/support/channel_arguments.h> -namespace grpc { - +namespace grpc { + /// Interface to pass an option to a \a ServerBuilder. class ServerBuilderOption { public: @@ -37,7 +37,7 @@ class ServerBuilderOption { virtual void UpdatePlugins( std::vector<std::unique_ptr<grpc::ServerBuilderPlugin>>* plugins) = 0; }; - -} // namespace grpc - -#endif // GRPCPP_IMPL_SERVER_BUILDER_OPTION_H + +} // namespace grpc + +#endif // GRPCPP_IMPL_SERVER_BUILDER_OPTION_H diff --git a/contrib/libs/grpc/include/grpcpp/impl/server_builder_plugin.h b/contrib/libs/grpc/include/grpcpp/impl/server_builder_plugin.h index 8fedca2b14..0aa3ff0710 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/server_builder_plugin.h +++ b/contrib/libs/grpc/include/grpcpp/impl/server_builder_plugin.h @@ -1,70 +1,70 @@ -/* - * - * Copyright 2016 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_IMPL_SERVER_BUILDER_PLUGIN_H -#define GRPCPP_IMPL_SERVER_BUILDER_PLUGIN_H - -#if defined(__GNUC__) -#pragma GCC system_header -#endif - -#include <memory> - +/* + * + * Copyright 2016 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_IMPL_SERVER_BUILDER_PLUGIN_H +#define GRPCPP_IMPL_SERVER_BUILDER_PLUGIN_H + +#if defined(__GNUC__) +#pragma GCC system_header +#endif + +#include <memory> + #include <grpcpp/support/channel_arguments.h> -#include <grpcpp/support/config.h> - +#include <grpcpp/support/config.h> + namespace grpc { - -class ServerBuilder; -class ServerInitializer; - -/// This interface is meant for internal usage only. Implementations of this -/// interface should add themselves to a \a ServerBuilder instance through the -/// \a InternalAddPluginFactory method. -class ServerBuilderPlugin { - public: - virtual ~ServerBuilderPlugin() {} + +class ServerBuilder; +class ServerInitializer; + +/// This interface is meant for internal usage only. Implementations of this +/// interface should add themselves to a \a ServerBuilder instance through the +/// \a InternalAddPluginFactory method. +class ServerBuilderPlugin { + public: + virtual ~ServerBuilderPlugin() {} virtual TString name() = 0; - + /// UpdateServerBuilder will be called at an early stage in /// ServerBuilder::BuildAndStart(), right after the ServerBuilderOptions have /// done their updates. virtual void UpdateServerBuilder(ServerBuilder* /*builder*/) {} - - /// InitServer will be called in ServerBuilder::BuildAndStart(), after the - /// Server instance is created. + + /// InitServer will be called in ServerBuilder::BuildAndStart(), after the + /// Server instance is created. virtual void InitServer(ServerInitializer* si) = 0; - - /// Finish will be called at the end of ServerBuilder::BuildAndStart(). + + /// Finish will be called at the end of ServerBuilder::BuildAndStart(). virtual void Finish(ServerInitializer* si) = 0; - - /// ChangeArguments is an interface that can be used in - /// ServerBuilderOption::UpdatePlugins + + /// ChangeArguments is an interface that can be used in + /// ServerBuilderOption::UpdatePlugins virtual void ChangeArguments(const TString& name, void* value) = 0; - - /// UpdateChannelArguments will be called in ServerBuilder::BuildAndStart(), - /// before the Server instance is created. + + /// UpdateChannelArguments will be called in ServerBuilder::BuildAndStart(), + /// before the Server instance is created. virtual void UpdateChannelArguments(ChannelArguments* /*args*/) {} - - virtual bool has_sync_methods() const { return false; } - virtual bool has_async_methods() const { return false; } -}; - -} // namespace grpc - -#endif // GRPCPP_IMPL_SERVER_BUILDER_PLUGIN_H + + virtual bool has_sync_methods() const { return false; } + virtual bool has_async_methods() const { return false; } +}; + +} // namespace grpc + +#endif // GRPCPP_IMPL_SERVER_BUILDER_PLUGIN_H diff --git a/contrib/libs/grpc/include/grpcpp/impl/server_initializer.h b/contrib/libs/grpc/include/grpcpp/impl/server_initializer.h index 38b17edacd..505dda763d 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/server_initializer.h +++ b/contrib/libs/grpc/include/grpcpp/impl/server_initializer.h @@ -1,37 +1,37 @@ -/* - * +/* + * * Copyright 2016 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_IMPL_SERVER_INITIALIZER_H -#define GRPCPP_IMPL_SERVER_INITIALIZER_H - + * + * 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_IMPL_SERVER_INITIALIZER_H +#define GRPCPP_IMPL_SERVER_INITIALIZER_H + #include <memory> #include <vector> - + #include <grpcpp/server.h> -namespace grpc { +namespace grpc { class Server; class Service; - + class ServerInitializer { public: ServerInitializer(grpc::Server* server) : server_(server) {} - + bool RegisterService(std::shared_ptr<grpc::Service> service) { if (!server_->RegisterService(nullptr, service.get())) { return false; @@ -49,6 +49,6 @@ class ServerInitializer { std::vector<std::shared_ptr<grpc::Service> > default_services_; }; -} // namespace grpc - -#endif // GRPCPP_IMPL_SERVER_INITIALIZER_H +} // namespace grpc + +#endif // GRPCPP_IMPL_SERVER_INITIALIZER_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..76542d6050 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/service_type.h +++ b/contrib/libs/grpc/include/grpcpp/impl/service_type.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_IMPL_SERVICE_TYPE_H -#define GRPCPP_IMPL_SERVICE_TYPE_H - -#include <grpcpp/impl/codegen/service_type.h> - -#endif // GRPCPP_IMPL_SERVICE_TYPE_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_IMPL_SERVICE_TYPE_H +#define GRPCPP_IMPL_SERVICE_TYPE_H + +#include <grpcpp/impl/codegen/service_type.h> + +#endif // GRPCPP_IMPL_SERVICE_TYPE_H diff --git a/contrib/libs/grpc/include/grpcpp/resource_quota.h b/contrib/libs/grpc/include/grpcpp/resource_quota.h index eb2b7e73af..0d205e5020 100644 --- a/contrib/libs/grpc/include/grpcpp/resource_quota.h +++ b/contrib/libs/grpc/include/grpcpp/resource_quota.h @@ -1,31 +1,31 @@ -/* - * +/* + * * Copyright 2016 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_RESOURCE_QUOTA_H -#define GRPCPP_RESOURCE_QUOTA_H - + * + * 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_RESOURCE_QUOTA_H +#define GRPCPP_RESOURCE_QUOTA_H + struct grpc_resource_quota; - + #include <grpcpp/impl/codegen/config.h> #include <grpcpp/impl/codegen/grpc_library.h> -namespace grpc { - +namespace grpc { + /// ResourceQuota represents a bound on memory and thread usage by the gRPC /// library. A ResourceQuota can be attached to a server (via \a ServerBuilder), /// or a client channel (via \a ChannelArguments). @@ -63,6 +63,6 @@ class ResourceQuota final : private ::grpc::GrpcLibraryCodegen { grpc_resource_quota* const impl_; }; -} // namespace grpc - -#endif // GRPCPP_RESOURCE_QUOTA_H +} // namespace grpc + +#endif // GRPCPP_RESOURCE_QUOTA_H diff --git a/contrib/libs/grpc/include/grpcpp/security/auth_context.h b/contrib/libs/grpc/include/grpcpp/security/auth_context.h index 7a6f2cb718..a35fb47d98 100644 --- a/contrib/libs/grpc/include/grpcpp/security/auth_context.h +++ b/contrib/libs/grpc/include/grpcpp/security/auth_context.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SECURITY_AUTH_CONTEXT_H -#define GRPCPP_SECURITY_AUTH_CONTEXT_H - -#include <grpcpp/impl/codegen/security/auth_context.h> - -#endif // GRPCPP_SECURITY_AUTH_CONTEXT_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SECURITY_AUTH_CONTEXT_H +#define GRPCPP_SECURITY_AUTH_CONTEXT_H + +#include <grpcpp/impl/codegen/security/auth_context.h> + +#endif // GRPCPP_SECURITY_AUTH_CONTEXT_H diff --git a/contrib/libs/grpc/include/grpcpp/security/auth_metadata_processor.h b/contrib/libs/grpc/include/grpcpp/security/auth_metadata_processor.h index f5321e877c..92898584e9 100644 --- a/contrib/libs/grpc/include/grpcpp/security/auth_metadata_processor.h +++ b/contrib/libs/grpc/include/grpcpp/security/auth_metadata_processor.h @@ -1,32 +1,32 @@ -/* - * +/* + * * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_H -#define GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_H - + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_H +#define GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_H + #include <map> - + #include <grpcpp/security/auth_context.h> #include <grpcpp/support/status.h> #include <grpcpp/support/string_ref.h> -namespace grpc { - +namespace grpc { + /// Interface allowing custom server-side authorization based on credentials /// encoded in metadata. Objects of this type can be passed to /// \a ServerCredentials::SetAuthMetadataProcessor(). @@ -34,7 +34,7 @@ class AuthMetadataProcessor { public: typedef std::multimap<grpc::string_ref, grpc::string_ref> InputMetadata; typedef std::multimap<TString, TString> OutputMetadata; - + virtual ~AuthMetadataProcessor() {} /// If this method returns true, the \a Process function will be scheduled in @@ -56,6 +56,6 @@ class AuthMetadataProcessor { OutputMetadata* response_metadata) = 0; }; -} // namespace grpc - -#endif // GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_H +} // namespace grpc + +#endif // GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_H diff --git a/contrib/libs/grpc/include/grpcpp/security/credentials.h b/contrib/libs/grpc/include/grpcpp/security/credentials.h index 339e9d4c27..735f3e0c2a 100644 --- a/contrib/libs/grpc/include/grpcpp/security/credentials.h +++ b/contrib/libs/grpc/include/grpcpp/security/credentials.h @@ -1,21 +1,21 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + #ifndef GRPCPP_SECURITY_CREDENTIALS_H #define GRPCPP_SECURITY_CREDENTIALS_H @@ -26,7 +26,7 @@ #include <map> #include <memory> #include <vector> - + #include <grpc/grpc_security_constants.h> #include <grpcpp/channel.h> #include <grpcpp/impl/codegen/client_interceptor.h> @@ -36,15 +36,15 @@ #include <grpcpp/support/channel_arguments.h> #include <grpcpp/support/status.h> #include <grpcpp/support/string_ref.h> - + struct grpc_call; -namespace grpc { +namespace grpc { class CallCredentials; class SecureCallCredentials; class SecureChannelCredentials; class ChannelCredentials; - + std::shared_ptr<Channel> CreateCustomChannel( const grpc::string& target, const std::shared_ptr<grpc::ChannelCredentials>& creds, @@ -70,14 +70,14 @@ class ChannelCredentials : private grpc::GrpcLibraryCodegen { public: ChannelCredentials(); ~ChannelCredentials(); - + protected: friend std::shared_ptr<ChannelCredentials> CompositeChannelCredentials( const std::shared_ptr<ChannelCredentials>& channel_creds, const std::shared_ptr<CallCredentials>& call_creds); - + virtual SecureChannelCredentials* AsSecureCredentials() = 0; - + private: friend std::shared_ptr<grpc::Channel> CreateCustomChannel( const grpc::string& target, @@ -186,9 +186,9 @@ constexpr long kMaxAuthTokenLifetimeSecs = 3600; /// (JWT) created with this credentials. It should not exceed /// \a kMaxAuthTokenLifetimeSecs or will be cropped to this value. std::shared_ptr<CallCredentials> ServiceAccountJWTAccessCredentials( - const grpc::string& json_key, + const grpc::string& json_key, long token_lifetime_seconds = kMaxAuthTokenLifetimeSecs); - + /// Builds refresh token credentials. /// json_refresh_token is the JSON string containing the refresh token along /// with a client_id and client_secret. @@ -199,7 +199,7 @@ std::shared_ptr<CallCredentials> ServiceAccountJWTAccessCredentials( /// services. std::shared_ptr<CallCredentials> GoogleRefreshTokenCredentials( const grpc::string& json_refresh_token); - + /// Builds access token credentials. /// access_token is an oauth2 access token that was fetched using an out of band /// mechanism. @@ -210,7 +210,7 @@ std::shared_ptr<CallCredentials> GoogleRefreshTokenCredentials( /// services. std::shared_ptr<CallCredentials> AccessTokenCredentials( const grpc::string& access_token); - + /// Builds IAM credentials. /// /// \warning Only use these credentials when connecting to a Google endpoint. @@ -218,32 +218,32 @@ std::shared_ptr<CallCredentials> AccessTokenCredentials( /// service being able to impersonate your client for requests to Google /// services. std::shared_ptr<CallCredentials> GoogleIAMCredentials( - const grpc::string& authorization_token, + const grpc::string& authorization_token, const grpc::string& authority_selector); - + /// Combines a channel credentials and a call credentials into a composite /// channel credentials. std::shared_ptr<ChannelCredentials> CompositeChannelCredentials( - const std::shared_ptr<ChannelCredentials>& channel_creds, + const std::shared_ptr<ChannelCredentials>& channel_creds, const std::shared_ptr<CallCredentials>& call_creds); - + /// Combines two call credentials objects into a composite call credentials. std::shared_ptr<CallCredentials> CompositeCallCredentials( const std::shared_ptr<CallCredentials>& creds1, const std::shared_ptr<CallCredentials>& creds2); - + /// Credentials for an unencrypted, unauthenticated channel std::shared_ptr<ChannelCredentials> InsecureChannelCredentials(); - + /// User defined metadata credentials. class MetadataCredentialsPlugin { public: virtual ~MetadataCredentialsPlugin() {} - + /// If this method returns true, the Process function will be scheduled in /// a different thread from the one processing the call. virtual bool IsBlocking() const { return true; } - + /// Type of credentials this plugin is implementing. virtual const char* GetType() const { return ""; } @@ -266,7 +266,7 @@ std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin( std::unique_ptr<MetadataCredentialsPlugin> plugin); namespace experimental { - + /// Options for creating STS Oauth Token Exchange credentials following the IETF /// draft https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-16. /// Optional fields may be set to empty string. It is the responsibility of the @@ -283,22 +283,22 @@ struct StsCredentialsOptions { grpc::string actor_token_path; // Optional. grpc::string actor_token_type; // Optional. }; - + grpc::Status StsCredentialsOptionsFromJson(const TString& json_string, StsCredentialsOptions* options); - + /// Creates STS credentials options from the $STS_CREDENTIALS environment /// variable. This environment variable points to the path of a JSON file /// comforming to the schema described above. grpc::Status StsCredentialsOptionsFromEnv(StsCredentialsOptions* options); - + std::shared_ptr<CallCredentials> StsCredentials( const StsCredentialsOptions& options); - + std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin( std::unique_ptr<MetadataCredentialsPlugin> plugin, grpc_security_level min_security_level); - + /// Options used to build AltsCredentials. struct AltsCredentialsOptions { /// service accounts of target endpoint that will be acceptable @@ -306,7 +306,7 @@ struct AltsCredentialsOptions { /// that of the server, authentication will fail. std::vector<grpc::string> target_service_accounts; }; - + /// Builds ALTS Credentials given ALTS specific options std::shared_ptr<ChannelCredentials> AltsCredentials( const AltsCredentialsOptions& options); @@ -319,7 +319,7 @@ std::shared_ptr<ChannelCredentials> LocalCredentials( std::shared_ptr<ChannelCredentials> TlsCredentials( const TlsCredentialsOptions& options); -} // namespace experimental -} // namespace grpc - -#endif // GRPCPP_SECURITY_CREDENTIALS_H +} // namespace experimental +} // namespace grpc + +#endif // GRPCPP_SECURITY_CREDENTIALS_H diff --git a/contrib/libs/grpc/include/grpcpp/security/server_credentials.h b/contrib/libs/grpc/include/grpcpp/security/server_credentials.h index d0a532360a..40977bffaa 100644 --- a/contrib/libs/grpc/include/grpcpp/security/server_credentials.h +++ b/contrib/libs/grpc/include/grpcpp/security/server_credentials.h @@ -1,73 +1,73 @@ -/* - * +/* + * * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SECURITY_SERVER_CREDENTIALS_H -#define GRPCPP_SECURITY_SERVER_CREDENTIALS_H - + * + * 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_SERVER_CREDENTIALS_H +#define GRPCPP_SECURITY_SERVER_CREDENTIALS_H + #include <memory> #include <vector> - + #include <grpc/grpc_security_constants.h> #include <grpcpp/security/auth_metadata_processor.h> #include <grpcpp/security/tls_credentials_options.h> #include <grpcpp/support/config.h> - + struct grpc_server; -namespace grpc { - +namespace grpc { + class Server; -/// Options to create ServerCredentials with SSL -struct SslServerCredentialsOptions { - /// \warning Deprecated - SslServerCredentialsOptions() - : force_client_auth(false), - client_certificate_request(GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE) {} - SslServerCredentialsOptions( - grpc_ssl_client_certificate_request_type request_type) - : force_client_auth(false), client_certificate_request(request_type) {} - - struct PemKeyCertPair { +/// Options to create ServerCredentials with SSL +struct SslServerCredentialsOptions { + /// \warning Deprecated + SslServerCredentialsOptions() + : force_client_auth(false), + client_certificate_request(GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE) {} + SslServerCredentialsOptions( + grpc_ssl_client_certificate_request_type request_type) + : force_client_auth(false), client_certificate_request(request_type) {} + + struct PemKeyCertPair { TString private_key; TString cert_chain; - }; + }; TString pem_root_certs; - std::vector<PemKeyCertPair> pem_key_cert_pairs; - /// \warning Deprecated - bool force_client_auth; - - /// If both \a force_client_auth and \a client_certificate_request - /// fields are set, \a force_client_auth takes effect, i.e. - /// \a REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY - /// will be enforced. - grpc_ssl_client_certificate_request_type client_certificate_request; -}; - + std::vector<PemKeyCertPair> pem_key_cert_pairs; + /// \warning Deprecated + bool force_client_auth; + + /// If both \a force_client_auth and \a client_certificate_request + /// fields are set, \a force_client_auth takes effect, i.e. + /// \a REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY + /// will be enforced. + grpc_ssl_client_certificate_request_type client_certificate_request; +}; + /// Wrapper around \a grpc_server_credentials, a way to authenticate a server. class ServerCredentials { public: virtual ~ServerCredentials(); - + /// This method is not thread-safe and has to be called before the server is /// started. The last call to this function wins. virtual void SetAuthMetadataProcessor( const std::shared_ptr<grpc::AuthMetadataProcessor>& processor) = 0; - + private: friend class Server; @@ -85,17 +85,17 @@ std::shared_ptr<ServerCredentials> SslServerCredentials( std::shared_ptr<ServerCredentials> InsecureServerCredentials(); -namespace experimental { - +namespace experimental { + /// Options to create ServerCredentials with ALTS struct AltsServerCredentialsOptions { /// Add fields if needed. }; - + /// Builds ALTS ServerCredentials given ALTS specific options std::shared_ptr<ServerCredentials> AltsServerCredentials( const AltsServerCredentialsOptions& options); - + /// Builds Local ServerCredentials. std::shared_ptr<ServerCredentials> AltsServerCredentials( const AltsServerCredentialsOptions& options); @@ -107,7 +107,7 @@ std::shared_ptr<ServerCredentials> LocalServerCredentials( std::shared_ptr<ServerCredentials> TlsServerCredentials( const experimental::TlsCredentialsOptions& options); -} // namespace experimental -} // namespace grpc - -#endif // GRPCPP_SECURITY_SERVER_CREDENTIALS_H +} // namespace experimental +} // namespace grpc + +#endif // GRPCPP_SECURITY_SERVER_CREDENTIALS_H diff --git a/contrib/libs/grpc/include/grpcpp/server.h b/contrib/libs/grpc/include/grpcpp/server.h index ff04746347..92690e51a6 100644 --- a/contrib/libs/grpc/include/grpcpp/server.h +++ b/contrib/libs/grpc/include/grpcpp/server.h @@ -1,32 +1,32 @@ -/* - * +/* + * * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SERVER_H -#define GRPCPP_SERVER_H - -#if defined(__GNUC__) -#pragma GCC system_header -#endif - + * + * 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_SERVER_H +#define GRPCPP_SERVER_H + +#if defined(__GNUC__) +#pragma GCC system_header +#endif + #include <list> #include <memory> #include <vector> - + #include <grpc/impl/codegen/port_platform.h> #include <grpc/compression.h> @@ -47,15 +47,15 @@ struct grpc_server; -namespace grpc { +namespace grpc { class AsyncGenericService; class ServerContext; class ServerInitializer; - + namespace internal { class ExternalConnectionAcceptorImpl; } // namespace internal - + /// Represents a gRPC server. /// /// Use a \a grpc::ServerBuilder to create, configure, and start @@ -374,6 +374,6 @@ class Server : public ServerInterface, private GrpcLibraryCodegen { std::vector<CompletionQueue*> cq_list_; }; -} // namespace grpc - -#endif // GRPCPP_SERVER_H +} // namespace grpc + +#endif // GRPCPP_SERVER_H diff --git a/contrib/libs/grpc/include/grpcpp/server_builder.h b/contrib/libs/grpc/include/grpcpp/server_builder.h index de48b83807..eb6e14d4bb 100644 --- a/contrib/libs/grpc/include/grpcpp/server_builder.h +++ b/contrib/libs/grpc/include/grpcpp/server_builder.h @@ -1,29 +1,29 @@ -/* - * +/* + * * Copyright 2015-2016 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_SERVER_BUILDER_H -#define GRPCPP_SERVER_BUILDER_H - + * + * 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_SERVER_BUILDER_H +#define GRPCPP_SERVER_BUILDER_H + #include <climits> #include <map> #include <memory> #include <vector> - + #include <grpc/impl/codegen/port_platform.h> #include <grpc/compression.h> @@ -38,8 +38,8 @@ struct grpc_resource_quota; -namespace grpc { - +namespace grpc { + class CompletionQueue; class Server; class ServerCompletionQueue; @@ -50,7 +50,7 @@ class Service; namespace testing { class ServerBuilderPluginTest; } // namespace testing - + namespace internal { class ExternalConnectionAcceptorImpl; } // namespace internal @@ -82,8 +82,8 @@ class ExternalConnectionAcceptor { }; } // namespace experimental -} // namespace grpc - +} // namespace grpc + namespace grpc { /// A builder class for the creation and startup of \a grpc::Server instances. @@ -409,4 +409,4 @@ class ServerBuilder { } // namespace grpc -#endif // GRPCPP_SERVER_BUILDER_H +#endif // GRPCPP_SERVER_BUILDER_H diff --git a/contrib/libs/grpc/include/grpcpp/server_context.h b/contrib/libs/grpc/include/grpcpp/server_context.h index 45f2614994..1e8c6bed88 100644 --- a/contrib/libs/grpc/include/grpcpp/server_context.h +++ b/contrib/libs/grpc/include/grpcpp/server_context.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SERVER_CONTEXT_H -#define GRPCPP_SERVER_CONTEXT_H - -#include <grpcpp/impl/codegen/server_context.h> - -#endif // GRPCPP_SERVER_CONTEXT_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SERVER_CONTEXT_H +#define GRPCPP_SERVER_CONTEXT_H + +#include <grpcpp/impl/codegen/server_context.h> + +#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..5d35cd9f91 100644 --- a/contrib/libs/grpc/include/grpcpp/server_posix.h +++ b/contrib/libs/grpc/include/grpcpp/server_posix.h @@ -1,42 +1,42 @@ -/* - * - * Copyright 2016 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_SERVER_POSIX_H -#define GRPCPP_SERVER_POSIX_H - +/* + * + * Copyright 2016 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_SERVER_POSIX_H +#define GRPCPP_SERVER_POSIX_H + #include <memory> - + #include <grpc/support/port_platform.h> #include <grpcpp/server.h> -namespace grpc { - -#ifdef GPR_SUPPORT_CHANNELS_FROM_FD - +namespace grpc { + +#ifdef GPR_SUPPORT_CHANNELS_FROM_FD + /// Add a new client to a \a Server communicating over the given /// file descriptor. /// /// \param server The server to add the client to. /// \param fd The file descriptor representing a socket. void AddInsecureChannelFromFd(Server* server, int fd); - -#endif // GPR_SUPPORT_CHANNELS_FROM_FD - -} // namespace grpc - -#endif // GRPCPP_SERVER_POSIX_H + +#endif // GPR_SUPPORT_CHANNELS_FROM_FD + +} // namespace grpc + +#endif // GRPCPP_SERVER_POSIX_H diff --git a/contrib/libs/grpc/include/grpcpp/support/async_stream.h b/contrib/libs/grpc/include/grpcpp/support/async_stream.h index ff9e455679..3fa169f5a0 100644 --- a/contrib/libs/grpc/include/grpcpp/support/async_stream.h +++ b/contrib/libs/grpc/include/grpcpp/support/async_stream.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SUPPORT_ASYNC_STREAM_H -#define GRPCPP_SUPPORT_ASYNC_STREAM_H - -#include <grpcpp/impl/codegen/async_stream.h> - -#endif // GRPCPP_SUPPORT_ASYNC_STREAM_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SUPPORT_ASYNC_STREAM_H +#define GRPCPP_SUPPORT_ASYNC_STREAM_H + +#include <grpcpp/impl/codegen/async_stream.h> + +#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..648954b2e8 100644 --- a/contrib/libs/grpc/include/grpcpp/support/async_unary_call.h +++ b/contrib/libs/grpc/include/grpcpp/support/async_unary_call.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H -#define GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H - -#include <grpcpp/impl/codegen/async_unary_call.h> - -#endif // GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H +#define GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H + +#include <grpcpp/impl/codegen/async_unary_call.h> + +#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..e3043422e8 100644 --- a/contrib/libs/grpc/include/grpcpp/support/byte_buffer.h +++ b/contrib/libs/grpc/include/grpcpp/support/byte_buffer.h @@ -1,31 +1,31 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SUPPORT_BYTE_BUFFER_H -#define GRPCPP_SUPPORT_BYTE_BUFFER_H - -#include <grpc/byte_buffer.h> -#include <grpc/grpc.h> -#include <grpc/support/log.h> -#include <grpcpp/impl/codegen/byte_buffer.h> -#include <grpcpp/impl/serialization_traits.h> -#include <grpcpp/support/config.h> -#include <grpcpp/support/slice.h> -#include <grpcpp/support/status.h> - -#endif // GRPCPP_SUPPORT_BYTE_BUFFER_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SUPPORT_BYTE_BUFFER_H +#define GRPCPP_SUPPORT_BYTE_BUFFER_H + +#include <grpc/byte_buffer.h> +#include <grpc/grpc.h> +#include <grpc/support/log.h> +#include <grpcpp/impl/codegen/byte_buffer.h> +#include <grpcpp/impl/serialization_traits.h> +#include <grpcpp/support/config.h> +#include <grpcpp/support/slice.h> +#include <grpcpp/support/status.h> + +#endif // GRPCPP_SUPPORT_BYTE_BUFFER_H diff --git a/contrib/libs/grpc/include/grpcpp/support/channel_arguments.h b/contrib/libs/grpc/include/grpcpp/support/channel_arguments.h index 85b6ee7dcc..e699cab917 100644 --- a/contrib/libs/grpc/include/grpcpp/support/channel_arguments.h +++ b/contrib/libs/grpc/include/grpcpp/support/channel_arguments.h @@ -1,42 +1,42 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SUPPORT_CHANNEL_ARGUMENTS_H -#define GRPCPP_SUPPORT_CHANNEL_ARGUMENTS_H - -#if defined(__GNUC__) -#pragma GCC system_header -#endif - +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SUPPORT_CHANNEL_ARGUMENTS_H +#define GRPCPP_SUPPORT_CHANNEL_ARGUMENTS_H + +#if defined(__GNUC__) +#pragma GCC system_header +#endif + #include <list> #include <vector> - + #include <grpc/compression.h> #include <grpc/grpc.h> #include <grpcpp/resource_quota.h> #include <grpcpp/support/config.h> - + namespace grpc { class SecureChannelCredentials; namespace testing { class ChannelArgumentsTest; } // namespace testing - + /// Options for channel creation. The user can use generic setters to pass /// key value pairs down to C channel creation code. For gRPC related options, /// concrete setters are provided. @@ -44,13 +44,13 @@ class ChannelArguments { public: ChannelArguments(); ~ChannelArguments(); - + ChannelArguments(const ChannelArguments& other); ChannelArguments& operator=(ChannelArguments other) { Swap(other); return *this; } - + void Swap(ChannelArguments& other); /// Dump arguments in this instance to \a channel_args. Does not take @@ -147,6 +147,6 @@ class ChannelArguments { std::list<TString> strings_; }; -} // namespace grpc - -#endif // GRPCPP_SUPPORT_CHANNEL_ARGUMENTS_H +} // namespace grpc + +#endif // GRPCPP_SUPPORT_CHANNEL_ARGUMENTS_H diff --git a/contrib/libs/grpc/include/grpcpp/support/config.h b/contrib/libs/grpc/include/grpcpp/support/config.h index 16bdab6427..8d05034765 100644 --- a/contrib/libs/grpc/include/grpcpp/support/config.h +++ b/contrib/libs/grpc/include/grpcpp/support/config.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SUPPORT_CONFIG_H -#define GRPCPP_SUPPORT_CONFIG_H - -#include <grpcpp/impl/codegen/config.h> - -#endif // GRPCPP_SUPPORT_CONFIG_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SUPPORT_CONFIG_H +#define GRPCPP_SUPPORT_CONFIG_H + +#include <grpcpp/impl/codegen/config.h> + +#endif // GRPCPP_SUPPORT_CONFIG_H diff --git a/contrib/libs/grpc/include/grpcpp/support/error_details.h b/contrib/libs/grpc/include/grpcpp/support/error_details.h index 15b917f6c5..b252070423 100644 --- a/contrib/libs/grpc/include/grpcpp/support/error_details.h +++ b/contrib/libs/grpc/include/grpcpp/support/error_details.h @@ -1,34 +1,34 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SUPPORT_ERROR_DETAILS_H -#define GRPCPP_SUPPORT_ERROR_DETAILS_H - +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SUPPORT_ERROR_DETAILS_H +#define GRPCPP_SUPPORT_ERROR_DETAILS_H + #include <grpcpp/support/status.h> - -namespace google { -namespace rpc { -class Status; -} // namespace rpc -} // namespace google - -namespace grpc { - + +namespace google { +namespace rpc { +class Status; +} // namespace rpc +} // namespace google + +namespace grpc { + /// Map a \a grpc::Status to a \a google::rpc::Status. /// The given \a to object will be cleared. /// On success, returns status with OK. @@ -36,13 +36,13 @@ namespace grpc { /// Returns status with \a FAILED_PRECONDITION, if \a to is nullptr. grpc::Status ExtractErrorDetails(const grpc::Status& from, ::google::rpc::Status* to); - + /// Map \a google::rpc::Status to a \a grpc::Status. /// Returns OK on success. /// Returns status with \a FAILED_PRECONDITION if \a to is nullptr. grpc::Status SetErrorDetails(const ::google::rpc::Status& from, grpc::Status* to); - -} // namespace grpc - -#endif // GRPCPP_SUPPORT_ERROR_DETAILS_H + +} // namespace grpc + +#endif // GRPCPP_SUPPORT_ERROR_DETAILS_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..ed9811aa4e 100644 --- a/contrib/libs/grpc/include/grpcpp/support/proto_buffer_reader.h +++ b/contrib/libs/grpc/include/grpcpp/support/proto_buffer_reader.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2018 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SUPPORT_PROTO_BUFFER_READER_H -#define GRPCPP_SUPPORT_PROTO_BUFFER_READER_H - -#include <grpcpp/impl/codegen/proto_buffer_reader.h> - -#endif // GRPCPP_SUPPORT_PROTO_BUFFER_READER_H +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SUPPORT_PROTO_BUFFER_READER_H +#define GRPCPP_SUPPORT_PROTO_BUFFER_READER_H + +#include <grpcpp/impl/codegen/proto_buffer_reader.h> + +#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..e5d89fc028 100644 --- a/contrib/libs/grpc/include/grpcpp/support/proto_buffer_writer.h +++ b/contrib/libs/grpc/include/grpcpp/support/proto_buffer_writer.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2018 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SUPPORT_PROTO_BUFFER_WRITER_H -#define GRPCPP_SUPPORT_PROTO_BUFFER_WRITER_H - -#include <grpcpp/impl/codegen/proto_buffer_writer.h> - -#endif // GRPCPP_SUPPORT_PROTO_BUFFER_WRITER_H +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SUPPORT_PROTO_BUFFER_WRITER_H +#define GRPCPP_SUPPORT_PROTO_BUFFER_WRITER_H + +#include <grpcpp/impl/codegen/proto_buffer_writer.h> + +#endif // GRPCPP_SUPPORT_PROTO_BUFFER_WRITER_H diff --git a/contrib/libs/grpc/include/grpcpp/support/slice.h b/contrib/libs/grpc/include/grpcpp/support/slice.h index eaeb29a40b..ffdfe9baf8 100644 --- a/contrib/libs/grpc/include/grpcpp/support/slice.h +++ b/contrib/libs/grpc/include/grpcpp/support/slice.h @@ -1,26 +1,26 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SUPPORT_SLICE_H -#define GRPCPP_SUPPORT_SLICE_H - -#include <grpc/slice.h> -#include <grpcpp/impl/codegen/slice.h> -#include <grpcpp/support/config.h> - -#endif // GRPCPP_SUPPORT_SLICE_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SUPPORT_SLICE_H +#define GRPCPP_SUPPORT_SLICE_H + +#include <grpc/slice.h> +#include <grpcpp/impl/codegen/slice.h> +#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..9be8afd31c 100644 --- a/contrib/libs/grpc/include/grpcpp/support/status.h +++ b/contrib/libs/grpc/include/grpcpp/support/status.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SUPPORT_STATUS_H -#define GRPCPP_SUPPORT_STATUS_H - -#include <grpcpp/impl/codegen/status.h> - -#endif // GRPCPP_SUPPORT_STATUS_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SUPPORT_STATUS_H +#define GRPCPP_SUPPORT_STATUS_H + +#include <grpcpp/impl/codegen/status.h> + +#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..ab3751c135 100644 --- a/contrib/libs/grpc/include/grpcpp/support/status_code_enum.h +++ b/contrib/libs/grpc/include/grpcpp/support/status_code_enum.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SUPPORT_STATUS_CODE_ENUM_H -#define GRPCPP_SUPPORT_STATUS_CODE_ENUM_H - -#include <grpcpp/impl/codegen/status_code_enum.h> - -#endif // GRPCPP_SUPPORT_STATUS_CODE_ENUM_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SUPPORT_STATUS_CODE_ENUM_H +#define GRPCPP_SUPPORT_STATUS_CODE_ENUM_H + +#include <grpcpp/impl/codegen/status_code_enum.h> + +#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..f7505f6b24 100644 --- a/contrib/libs/grpc/include/grpcpp/support/string_ref.h +++ b/contrib/libs/grpc/include/grpcpp/support/string_ref.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SUPPORT_STRING_REF_H -#define GRPCPP_SUPPORT_STRING_REF_H - -#include <grpcpp/impl/codegen/string_ref.h> - -#endif // GRPCPP_SUPPORT_STRING_REF_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SUPPORT_STRING_REF_H +#define GRPCPP_SUPPORT_STRING_REF_H + +#include <grpcpp/impl/codegen/string_ref.h> + +#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..ed5165dc0c 100644 --- a/contrib/libs/grpc/include/grpcpp/support/stub_options.h +++ b/contrib/libs/grpc/include/grpcpp/support/stub_options.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SUPPORT_STUB_OPTIONS_H -#define GRPCPP_SUPPORT_STUB_OPTIONS_H - -#include <grpcpp/impl/codegen/stub_options.h> - -#endif // GRPCPP_SUPPORT_STUB_OPTIONS_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SUPPORT_STUB_OPTIONS_H +#define GRPCPP_SUPPORT_STUB_OPTIONS_H + +#include <grpcpp/impl/codegen/stub_options.h> + +#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..2b310694e8 100644 --- a/contrib/libs/grpc/include/grpcpp/support/sync_stream.h +++ b/contrib/libs/grpc/include/grpcpp/support/sync_stream.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SUPPORT_SYNC_STREAM_H -#define GRPCPP_SUPPORT_SYNC_STREAM_H - -#include <grpcpp/impl/codegen/sync_stream.h> - -#endif // GRPCPP_SUPPORT_SYNC_STREAM_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SUPPORT_SYNC_STREAM_H +#define GRPCPP_SUPPORT_SYNC_STREAM_H + +#include <grpcpp/impl/codegen/sync_stream.h> + +#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..41ee85ba66 100644 --- a/contrib/libs/grpc/include/grpcpp/support/time.h +++ b/contrib/libs/grpc/include/grpcpp/support/time.h @@ -1,24 +1,24 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_SUPPORT_TIME_H -#define GRPCPP_SUPPORT_TIME_H - -#include <grpcpp/impl/codegen/time.h> - -#endif // GRPCPP_SUPPORT_TIME_H +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SUPPORT_TIME_H +#define GRPCPP_SUPPORT_TIME_H + +#include <grpcpp/impl/codegen/time.h> + +#endif // GRPCPP_SUPPORT_TIME_H diff --git a/contrib/libs/grpc/include/grpcpp/test/mock_stream.h b/contrib/libs/grpc/include/grpcpp/test/mock_stream.h index e33595d709..b60d3c02cc 100644 --- a/contrib/libs/grpc/include/grpcpp/test/mock_stream.h +++ b/contrib/libs/grpc/include/grpcpp/test/mock_stream.h @@ -1,149 +1,149 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPCPP_TEST_MOCK_STREAM_H -#define GRPCPP_TEST_MOCK_STREAM_H - -#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> -#include <grpcpp/support/sync_stream.h> - -namespace grpc { -namespace testing { - -template <class R> +/* + * + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_TEST_MOCK_STREAM_H +#define GRPCPP_TEST_MOCK_STREAM_H + +#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> +#include <grpcpp/support/sync_stream.h> + +namespace grpc { +namespace testing { + +template <class R> class MockClientReader : public ::grpc::ClientReaderInterface<R> { - public: - MockClientReader() = default; - - /// ClientStreamingInterface - MOCK_METHOD0_T(Finish, Status()); - - /// ReaderInterface - MOCK_METHOD1_T(NextMessageSize, bool(uint32_t*)); - MOCK_METHOD1_T(Read, bool(R*)); - - /// ClientReaderInterface - MOCK_METHOD0_T(WaitForInitialMetadata, void()); -}; - -template <class W> + public: + MockClientReader() = default; + + /// ClientStreamingInterface + MOCK_METHOD0_T(Finish, Status()); + + /// ReaderInterface + MOCK_METHOD1_T(NextMessageSize, bool(uint32_t*)); + MOCK_METHOD1_T(Read, bool(R*)); + + /// ClientReaderInterface + MOCK_METHOD0_T(WaitForInitialMetadata, void()); +}; + +template <class W> class MockClientWriter : public ::grpc::ClientWriterInterface<W> { - public: - MockClientWriter() = default; - - /// ClientStreamingInterface - MOCK_METHOD0_T(Finish, Status()); - - /// WriterInterface - MOCK_METHOD2_T(Write, bool(const W&, const WriteOptions)); - - /// ClientWriterInterface - MOCK_METHOD0_T(WritesDone, bool()); -}; - -template <class W, class R> + public: + MockClientWriter() = default; + + /// ClientStreamingInterface + MOCK_METHOD0_T(Finish, Status()); + + /// WriterInterface + MOCK_METHOD2_T(Write, bool(const W&, const WriteOptions)); + + /// ClientWriterInterface + MOCK_METHOD0_T(WritesDone, bool()); +}; + +template <class W, class R> class MockClientReaderWriter : public ::grpc::ClientReaderWriterInterface<W, R> { - public: - MockClientReaderWriter() = default; - - /// ClientStreamingInterface - MOCK_METHOD0_T(Finish, Status()); - - /// ReaderInterface - MOCK_METHOD1_T(NextMessageSize, bool(uint32_t*)); - MOCK_METHOD1_T(Read, bool(R*)); - - /// WriterInterface - MOCK_METHOD2_T(Write, bool(const W&, const WriteOptions)); - - /// ClientReaderWriterInterface - MOCK_METHOD0_T(WaitForInitialMetadata, void()); - MOCK_METHOD0_T(WritesDone, bool()); -}; - -/// TODO: We do not support mocking an async RPC for now. - -template <class R> -class MockClientAsyncResponseReader + public: + MockClientReaderWriter() = default; + + /// ClientStreamingInterface + MOCK_METHOD0_T(Finish, Status()); + + /// ReaderInterface + MOCK_METHOD1_T(NextMessageSize, bool(uint32_t*)); + MOCK_METHOD1_T(Read, bool(R*)); + + /// WriterInterface + MOCK_METHOD2_T(Write, bool(const W&, const WriteOptions)); + + /// ClientReaderWriterInterface + MOCK_METHOD0_T(WaitForInitialMetadata, void()); + MOCK_METHOD0_T(WritesDone, bool()); +}; + +/// TODO: We do not support mocking an async RPC for now. + +template <class R> +class MockClientAsyncResponseReader : public ::grpc::ClientAsyncResponseReaderInterface<R> { - public: - MockClientAsyncResponseReader() = default; - - MOCK_METHOD1_T(ReadInitialMetadata, void(void*)); - MOCK_METHOD3_T(Finish, void(R*, Status*, void*)); -}; - -template <class R> -class MockClientAsyncReader : public ClientAsyncReaderInterface<R> { - public: - MockClientAsyncReader() = default; - - /// ClientAsyncStreamingInterface - MOCK_METHOD1_T(ReadInitialMetadata, void(void*)); - MOCK_METHOD2_T(Finish, void(Status*, void*)); - - /// AsyncReaderInterface - MOCK_METHOD2_T(Read, void(R*, void*)); -}; - -template <class W> + public: + MockClientAsyncResponseReader() = default; + + MOCK_METHOD1_T(ReadInitialMetadata, void(void*)); + MOCK_METHOD3_T(Finish, void(R*, Status*, void*)); +}; + +template <class R> +class MockClientAsyncReader : public ClientAsyncReaderInterface<R> { + public: + MockClientAsyncReader() = default; + + /// ClientAsyncStreamingInterface + MOCK_METHOD1_T(ReadInitialMetadata, void(void*)); + MOCK_METHOD2_T(Finish, void(Status*, void*)); + + /// AsyncReaderInterface + MOCK_METHOD2_T(Read, void(R*, void*)); +}; + +template <class W> class MockClientAsyncWriter : public ::grpc::ClientAsyncWriterInterface<W> { - public: - MockClientAsyncWriter() = default; - - /// ClientAsyncStreamingInterface - MOCK_METHOD1_T(ReadInitialMetadata, void(void*)); - MOCK_METHOD2_T(Finish, void(Status*, void*)); - - /// AsyncWriterInterface - MOCK_METHOD2_T(Write, void(const W&, void*)); - - /// ClientAsyncWriterInterface - MOCK_METHOD1_T(WritesDone, void(void*)); -}; - -template <class W, class R> -class MockClientAsyncReaderWriter - : public ClientAsyncReaderWriterInterface<W, R> { - public: - MockClientAsyncReaderWriter() = default; - - /// ClientAsyncStreamingInterface - MOCK_METHOD1_T(ReadInitialMetadata, void(void*)); - MOCK_METHOD2_T(Finish, void(Status*, void*)); - - /// AsyncWriterInterface - MOCK_METHOD2_T(Write, void(const W&, void*)); - - /// AsyncReaderInterface - MOCK_METHOD2_T(Read, void(R*, void*)); - - /// ClientAsyncReaderWriterInterface - MOCK_METHOD1_T(WritesDone, void(void*)); -}; - -} // namespace testing -} // namespace grpc - -#endif // GRPCPP_TEST_MOCK_STREAM_H + public: + MockClientAsyncWriter() = default; + + /// ClientAsyncStreamingInterface + MOCK_METHOD1_T(ReadInitialMetadata, void(void*)); + MOCK_METHOD2_T(Finish, void(Status*, void*)); + + /// AsyncWriterInterface + MOCK_METHOD2_T(Write, void(const W&, void*)); + + /// ClientAsyncWriterInterface + MOCK_METHOD1_T(WritesDone, void(void*)); +}; + +template <class W, class R> +class MockClientAsyncReaderWriter + : public ClientAsyncReaderWriterInterface<W, R> { + public: + MockClientAsyncReaderWriter() = default; + + /// ClientAsyncStreamingInterface + MOCK_METHOD1_T(ReadInitialMetadata, void(void*)); + MOCK_METHOD2_T(Finish, void(Status*, void*)); + + /// AsyncWriterInterface + MOCK_METHOD2_T(Write, void(const W&, void*)); + + /// AsyncReaderInterface + MOCK_METHOD2_T(Read, void(R*, void*)); + + /// ClientAsyncReaderWriterInterface + MOCK_METHOD1_T(WritesDone, void(void*)); +}; + +} // namespace testing +} // namespace grpc + +#endif // GRPCPP_TEST_MOCK_STREAM_H diff --git a/contrib/libs/grpc/include/grpcpp/test/server_context_test_spouse.h b/contrib/libs/grpc/include/grpcpp/test/server_context_test_spouse.h index 00c19dc4b8..cccea7dbbc 100644 --- a/contrib/libs/grpc/include/grpcpp/test/server_context_test_spouse.h +++ b/contrib/libs/grpc/include/grpcpp/test/server_context_test_spouse.h @@ -1,64 +1,64 @@ -/* - * - * Copyright 2016 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_SERVER_CONTEXT_TEST_SPOUSE_H -#define GRPCPP_TEST_SERVER_CONTEXT_TEST_SPOUSE_H - -#include <map> - -#include <grpcpp/server_context.h> - -namespace grpc { -namespace testing { - -/// A test-only class to access private members and methods of ServerContext. -class ServerContextTestSpouse { - public: - explicit ServerContextTestSpouse(ServerContext* ctx) : ctx_(ctx) {} - - /// Inject client metadata to the ServerContext for the test. The test spouse - /// must be alive when \a ServerContext::client_metadata is called. +/* + * + * Copyright 2016 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_SERVER_CONTEXT_TEST_SPOUSE_H +#define GRPCPP_TEST_SERVER_CONTEXT_TEST_SPOUSE_H + +#include <map> + +#include <grpcpp/server_context.h> + +namespace grpc { +namespace testing { + +/// A test-only class to access private members and methods of ServerContext. +class ServerContextTestSpouse { + public: + explicit ServerContextTestSpouse(ServerContext* ctx) : ctx_(ctx) {} + + /// Inject client metadata to the ServerContext for the test. The test spouse + /// must be alive when \a ServerContext::client_metadata is called. void AddClientMetadata(const TString& key, const TString& value) { - client_metadata_storage_.insert( + client_metadata_storage_.insert( std::pair<TString, TString>(key, value)); - ctx_->client_metadata_.map()->clear(); + ctx_->client_metadata_.map()->clear(); for (const auto& item : client_metadata_storage_) { - ctx_->client_metadata_.map()->insert( - std::pair<grpc::string_ref, grpc::string_ref>( + ctx_->client_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> GetInitialMetadata() const { - return ctx_->initial_metadata_; - } - + return ctx_->initial_metadata_; + } + std::multimap<TString, TString> GetTrailingMetadata() const { - return ctx_->trailing_metadata_; - } - - private: - ServerContext* ctx_; // not owned + return ctx_->trailing_metadata_; + } + + private: + ServerContext* ctx_; // not owned std::multimap<TString, TString> client_metadata_storage_; -}; - -} // namespace testing -} // namespace grpc - -#endif // GRPCPP_TEST_SERVER_CONTEXT_TEST_SPOUSE_H +}; + +} // namespace testing +} // namespace grpc + +#endif // GRPCPP_TEST_SERVER_CONTEXT_TEST_SPOUSE_H |