aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/grpc/src/cpp
diff options
context:
space:
mode:
authorleonidlazarev <leonidlazarev@yandex-team.com>2023-07-17 19:35:29 +0300
committerleonidlazarev <leonidlazarev@yandex-team.com>2023-07-17 19:35:29 +0300
commitcb8e9a6330e4e5d9a0e2f8506e7469bbd641ec63 (patch)
treeeddb7b81e7d1f5a7ac8078591799509e95572f4e /contrib/libs/grpc/src/cpp
parent029cf29f3669091012394221f00dfa0f3631d91b (diff)
downloadydb-cb8e9a6330e4e5d9a0e2f8506e7469bbd641ec63.tar.gz
feat grpc: update to grpc 1.53.1
update grpc to 1.53.1 update grpcio/py3 to 1.53.1 Added patches: 22-grpc-code-output.patch - allow translation of grpc code to internal string type. 23-max-thread-limitation.patch - to provide interface for settings of thread number limit, as grpc::DynamicThreadPool doesn't provide interface to limit thread number anymore. 24-support_for-non-abort-grpc.patch - generate exception instead of application crash 25-forkable-destruction-order.patch - correct forkable logic for TimerManager 27-skip-child-post-fork-operations.patch - allow to skip child post fork operations to exclude UB (used for unified agent only) pr33495_fox_nested_fork.patch - fix issues with nested forks pr33582_fork_handler.patch - disable fork handler support if it is not requested intentionally
Diffstat (limited to 'contrib/libs/grpc/src/cpp')
-rwxr-xr-xcontrib/libs/grpc/src/cpp/README.md2
-rw-r--r--contrib/libs/grpc/src/cpp/client/channel_cc.cc50
-rw-r--r--contrib/libs/grpc/src/cpp/client/client_callback.cc38
-rw-r--r--contrib/libs/grpc/src/cpp/client/client_context.cc56
-rw-r--r--contrib/libs/grpc/src/cpp/client/client_interceptor.cc43
-rw-r--r--contrib/libs/grpc/src/cpp/client/create_channel.cc38
-rw-r--r--contrib/libs/grpc/src/cpp/client/create_channel_internal.cc34
-rw-r--r--contrib/libs/grpc/src/cpp/client/create_channel_internal.h43
-rw-r--r--contrib/libs/grpc/src/cpp/client/create_channel_posix.cc44
-rw-r--r--contrib/libs/grpc/src/cpp/client/credentials_cc.cc33
-rw-r--r--contrib/libs/grpc/src/cpp/client/insecure_credentials.cc36
-rw-r--r--contrib/libs/grpc/src/cpp/client/secure_credentials.cc106
-rw-r--r--contrib/libs/grpc/src/cpp/client/secure_credentials.h46
-rw-r--r--contrib/libs/grpc/src/cpp/codegen/codegen_init.cc30
-rw-r--r--contrib/libs/grpc/src/cpp/common/alarm.cc63
-rw-r--r--contrib/libs/grpc/src/cpp/common/auth_property_iterator.cc34
-rw-r--r--contrib/libs/grpc/src/cpp/common/channel_arguments.cc39
-rw-r--r--contrib/libs/grpc/src/cpp/common/channel_filter.cc41
-rw-r--r--contrib/libs/grpc/src/cpp/common/channel_filter.h55
-rw-r--r--contrib/libs/grpc/src/cpp/common/completion_queue_cc.cc41
-rw-r--r--contrib/libs/grpc/src/cpp/common/core_codegen.cc248
-rw-r--r--contrib/libs/grpc/src/cpp/common/resource_quota_cc.cc35
-rw-r--r--contrib/libs/grpc/src/cpp/common/rpc_method.cc34
-rw-r--r--contrib/libs/grpc/src/cpp/common/secure_auth_context.cc34
-rw-r--r--contrib/libs/grpc/src/cpp/common/secure_auth_context.h43
-rw-r--r--contrib/libs/grpc/src/cpp/common/secure_channel_arguments.cc38
-rw-r--r--contrib/libs/grpc/src/cpp/common/secure_create_auth_context.cc36
-rw-r--r--contrib/libs/grpc/src/cpp/common/tls_certificate_provider.cc1
-rw-r--r--contrib/libs/grpc/src/cpp/common/tls_certificate_verifier.cc11
-rw-r--r--contrib/libs/grpc/src/cpp/common/tls_credentials_options.cc35
-rw-r--r--contrib/libs/grpc/src/cpp/common/validate_service_config.cc37
-rw-r--r--contrib/libs/grpc/src/cpp/common/version_cc.cc40
-rw-r--r--contrib/libs/grpc/src/cpp/ext/proto_server_reflection.cc36
-rw-r--r--contrib/libs/grpc/src/cpp/ext/proto_server_reflection.h42
-rw-r--r--contrib/libs/grpc/src/cpp/ext/proto_server_reflection_plugin.cc34
-rw-r--r--contrib/libs/grpc/src/cpp/server/async_generic_service.cc34
-rw-r--r--contrib/libs/grpc/src/cpp/server/backend_metric_recorder.cc312
-rw-r--r--contrib/libs/grpc/src/cpp/server/backend_metric_recorder.h81
-rw-r--r--contrib/libs/grpc/src/cpp/server/channel_argument_option.cc56
-rw-r--r--contrib/libs/grpc/src/cpp/server/channelz/channelz_service.cc34
-rw-r--r--contrib/libs/grpc/src/cpp/server/channelz/channelz_service.h40
-rw-r--r--contrib/libs/grpc/src/cpp/server/channelz/channelz_service_plugin.cc35
-rw-r--r--contrib/libs/grpc/src/cpp/server/create_default_thread_pool.cc40
-rw-r--r--contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.cc122
-rw-r--r--contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h81
-rw-r--r--contrib/libs/grpc/src/cpp/server/external_connection_acceptor_impl.cc36
-rw-r--r--contrib/libs/grpc/src/cpp/server/external_connection_acceptor_impl.h41
-rw-r--r--contrib/libs/grpc/src/cpp/server/health/default_health_check_service.cc39
-rw-r--r--contrib/libs/grpc/src/cpp/server/health/default_health_check_service.h45
-rw-r--r--contrib/libs/grpc/src/cpp/server/health/health_check_service.cc34
-rw-r--r--contrib/libs/grpc/src/cpp/server/health/health_check_service_server_builder_option.cc34
-rw-r--r--contrib/libs/grpc/src/cpp/server/insecure_server_credentials.cc36
-rw-r--r--contrib/libs/grpc/src/cpp/server/orca/call_metric_recorder.cc117
-rw-r--r--contrib/libs/grpc/src/cpp/server/secure_server_credentials.cc34
-rw-r--r--contrib/libs/grpc/src/cpp/server/secure_server_credentials.h44
-rw-r--r--contrib/libs/grpc/src/cpp/server/server_builder.cc57
-rw-r--r--contrib/libs/grpc/src/cpp/server/server_callback.cc39
-rw-r--r--contrib/libs/grpc/src/cpp/server/server_cc.cc94
-rw-r--r--contrib/libs/grpc/src/cpp/server/server_context.cc93
-rw-r--r--contrib/libs/grpc/src/cpp/server/server_credentials.cc29
-rw-r--r--contrib/libs/grpc/src/cpp/server/server_posix.cc34
-rw-r--r--contrib/libs/grpc/src/cpp/server/thread_pool_interface.h42
-rw-r--r--contrib/libs/grpc/src/cpp/thread_manager/thread_manager.cc49
-rw-r--r--contrib/libs/grpc/src/cpp/thread_manager/thread_manager.h42
-rw-r--r--contrib/libs/grpc/src/cpp/util/byte_buffer_cc.cc41
-rw-r--r--contrib/libs/grpc/src/cpp/util/status.cc34
-rw-r--r--contrib/libs/grpc/src/cpp/util/string_ref.cc36
-rw-r--r--contrib/libs/grpc/src/cpp/util/time_cc.cc35
68 files changed, 1618 insertions, 1878 deletions
diff --git a/contrib/libs/grpc/src/cpp/README.md b/contrib/libs/grpc/src/cpp/README.md
index b7f04bc200..003807a44a 100755
--- a/contrib/libs/grpc/src/cpp/README.md
+++ b/contrib/libs/grpc/src/cpp/README.md
@@ -31,7 +31,7 @@ Therefore, gRPC supports several major build systems, which should satisfy most
| Operating System | Architectures | Versions | Support Level |
|------------------|---------------|----------|---------------|
| Linux - Debian, Ubuntu, CentOS | x86, x64 | clang 6+, GCC 7.3+ | Officially Supported |
-| Windows 10+ | x86, x64 | Visual Studio 2017+ | Officially Supported |
+| Windows 10+ | x86, x64 | Visual Studio 2019+ | Officially Supported |
| MacOS | x86, x64 | XCode 12+ | Officially Supported |
| Linux - Others | x86, x64 | clang 6+, GCC 7.3+ | Best Effort |
| Linux | ARM | | Best Effort |
diff --git a/contrib/libs/grpc/src/cpp/client/channel_cc.cc b/contrib/libs/grpc/src/cpp/client/channel_cc.cc
index 0732b43e9f..c3d7523b2c 100644
--- a/contrib/libs/grpc/src/cpp/client/channel_cc.cc
+++ b/contrib/libs/grpc/src/cpp/client/channel_cc.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include <atomic>
#include <cstring>
@@ -25,31 +25,26 @@
#include <vector>
#include <grpc/grpc.h>
-#include <grpc/impl/codegen/connectivity_state.h>
-#include <grpc/impl/codegen/gpr_types.h>
-#include <grpc/impl/codegen/grpc_types.h>
+#include <grpc/impl/connectivity_state.h>
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include <grpc/support/time.h>
#include <grpcpp/channel.h>
#include <grpcpp/client_context.h>
#include <grpcpp/completion_queue.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/call_op_set_interface.h>
-#include <grpcpp/impl/codegen/completion_queue_tag.h>
-#include <grpcpp/impl/codegen/core_codegen_interface.h>
-#include <grpcpp/impl/codegen/sync.h>
-#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/impl/completion_queue_tag.h>
#include <grpcpp/impl/rpc_method.h>
+#include <grpcpp/impl/sync.h>
#include <grpcpp/support/client_interceptor.h>
-#include <grpcpp/support/config.h>
#include <grpcpp/support/slice.h>
#include "src/core/lib/iomgr/iomgr.h"
namespace grpc {
-static grpc::internal::GrpcLibraryInitializer g_gli_initializer;
Channel::Channel(
const TString& host, grpc_channel* channel,
std::vector<
@@ -57,7 +52,6 @@ Channel::Channel(
interceptor_creators)
: host_(host), c_channel_(channel) {
interceptor_creators_ = std::move(interceptor_creators);
- g_gli_initializer.summon();
}
Channel::~Channel() {
@@ -76,7 +70,7 @@ Channel::~Channel() {
namespace {
inline grpc_slice SliceFromArray(const char* arr, size_t len) {
- return g_core_codegen_interface->grpc_slice_from_copied_buffer(arr, len);
+ return grpc_slice_from_copied_buffer(arr, len);
}
TString GetChannelInfoField(grpc_channel* channel,
diff --git a/contrib/libs/grpc/src/cpp/client/client_callback.cc b/contrib/libs/grpc/src/cpp/client/client_callback.cc
index 7c4d9f4240..64c80c6b97 100644
--- a/contrib/libs/grpc/src/cpp/client/client_callback.cc
+++ b/contrib/libs/grpc/src/cpp/client/client_callback.cc
@@ -1,23 +1,25 @@
-/*
- * 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.
- *
- */
+//
+// 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.
+//
+//
#include <utility>
-#include <grpc/impl/codegen/grpc_types.h>
+#include "y_absl/status/status.h"
+
+#include <grpc/grpc.h>
#include <grpcpp/support/client_callback.h>
#include <grpcpp/support/status.h>
@@ -51,7 +53,7 @@ void ClientReactor::InternalScheduleOnDone(grpc::Status s) {
}
};
ClosureWithArg* arg = new ClosureWithArg(this, std::move(s));
- grpc_core::Executor::Run(&arg->closure, GRPC_ERROR_NONE);
+ grpc_core::Executor::Run(&arg->closure, y_absl::OkStatus());
}
bool ClientReactor::InternalTrailersOnly(const grpc_call* call) const {
diff --git a/contrib/libs/grpc/src/cpp/client/client_context.cc b/contrib/libs/grpc/src/cpp/client/client_context.cc
index 19e20d9c1f..bfdfc4d945 100644
--- a/contrib/libs/grpc/src/cpp/client/client_context.cc
+++ b/contrib/libs/grpc/src/cpp/client/client_context.cc
@@ -1,23 +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.
- *
- */
+//
+//
+// 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.
+//
+//
#include <stdlib.h>
+#include <initializer_list>
#include <map>
#include <memory>
#include <util/generic/string.h>
@@ -25,24 +26,24 @@
#include <utility>
#include <vector>
+#include "y_absl/strings/str_format.h"
+
#include <grpc/compression.h>
#include <grpc/grpc.h>
-#include <grpc/impl/codegen/compression_types.h>
-#include <grpc/impl/codegen/gpr_types.h>
-#include <grpc/impl/codegen/grpc_types.h>
+#include <grpc/impl/compression_types.h>
#include <grpc/status.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include <grpcpp/channel.h>
#include <grpcpp/client_context.h>
-#include <grpcpp/impl/codegen/interceptor_common.h>
-#include <grpcpp/impl/codegen/sync.h>
-#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/impl/interceptor_common.h>
+#include <grpcpp/impl/sync.h>
#include <grpcpp/security/credentials.h>
#include <grpcpp/server_context.h>
#include <grpcpp/support/client_interceptor.h>
-#include <grpcpp/support/config.h>
+
+#include "src/core/lib/gprpp/crash.h"
namespace grpc {
@@ -56,7 +57,6 @@ class DefaultGlobalClientCallbacks final
void Destructor(ClientContext* /*context*/) override {}
};
-static internal::GrpcLibraryInitializer g_gli_initializer;
static DefaultGlobalClientCallbacks* g_default_client_callbacks =
new DefaultGlobalClientCallbacks();
static ClientContext::GlobalCallbacks* g_client_callbacks =
@@ -73,7 +73,6 @@ ClientContext::ClientContext()
propagate_from_call_(nullptr),
compression_algorithm_(GRPC_COMPRESS_NONE),
initial_metadata_corked_(false) {
- g_gli_initializer.summon();
g_client_callbacks->DefaultConstructor(this);
}
@@ -148,9 +147,8 @@ void ClientContext::set_compression_algorithm(
compression_algorithm_ = algorithm;
const char* algorithm_name = nullptr;
if (!grpc_compression_algorithm_name(algorithm, &algorithm_name)) {
- gpr_log(GPR_ERROR, "Name for compression algorithm '%d' unknown.",
- algorithm);
- abort();
+ grpc_core::Crash(y_absl::StrFormat(
+ "Name for compression algorithm '%d' unknown.", algorithm));
}
GPR_ASSERT(algorithm_name != nullptr);
AddMetadata(GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY, algorithm_name);
diff --git a/contrib/libs/grpc/src/cpp/client/client_interceptor.cc b/contrib/libs/grpc/src/cpp/client/client_interceptor.cc
index f4e4acbed1..93181b825c 100644
--- a/contrib/libs/grpc/src/cpp/client/client_interceptor.cc
+++ b/contrib/libs/grpc/src/cpp/client/client_interceptor.cc
@@ -1,24 +1,25 @@
-/*
- *
- * 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.
- *
- */
+//
+//
+// 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.
+//
+//
-#include <grpc/support/log.h>
#include <grpcpp/support/client_interceptor.h>
+#include "src/core/lib/gprpp/crash.h"
+
namespace grpc {
namespace internal {
@@ -30,9 +31,9 @@ namespace experimental {
void RegisterGlobalClientInterceptorFactory(
ClientInterceptorFactoryInterface* factory) {
if (internal::g_global_client_interceptor_factory != nullptr) {
- GPR_ASSERT(false &&
- "It is illegal to call RegisterGlobalClientInterceptorFactory "
- "multiple times.");
+ grpc_core::Crash(
+ "It is illegal to call RegisterGlobalClientInterceptorFactory "
+ "multiple times.");
}
internal::g_global_client_interceptor_factory = factory;
}
diff --git a/contrib/libs/grpc/src/cpp/client/create_channel.cc b/contrib/libs/grpc/src/cpp/client/create_channel.cc
index 9dc50c12f5..3a0496667d 100644
--- a/contrib/libs/grpc/src/cpp/client/create_channel.cc
+++ b/contrib/libs/grpc/src/cpp/client/create_channel.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include <memory>
#include <util/generic/string.h>
@@ -45,7 +45,7 @@ std::shared_ptr<grpc::Channel> CreateCustomChannel(
const grpc::string& target,
const std::shared_ptr<grpc::ChannelCredentials>& creds,
const grpc::ChannelArguments& args) {
- grpc::GrpcLibraryCodegen
+ grpc::internal::GrpcLibrary
init_lib; // We need to call init in case of bad creds.
return creds ? creds->CreateChannelImpl(target, args)
: grpc::CreateChannelInternal(
@@ -77,7 +77,7 @@ std::shared_ptr<grpc::Channel> CreateCustomChannelWithInterceptors(
std::vector<
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators) {
- grpc::GrpcLibraryCodegen
+ grpc::internal::GrpcLibrary
init_lib; // We need to call init in case of bad creds.
return creds ? creds->CreateChannelWithInterceptors(
target, args, std::move(interceptor_creators))
diff --git a/contrib/libs/grpc/src/cpp/client/create_channel_internal.cc b/contrib/libs/grpc/src/cpp/client/create_channel_internal.cc
index 53023eff6a..50e98c2046 100644
--- a/contrib/libs/grpc/src/cpp/client/create_channel_internal.cc
+++ b/contrib/libs/grpc/src/cpp/client/create_channel_internal.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include "src/cpp/client/create_channel_internal.h"
diff --git a/contrib/libs/grpc/src/cpp/client/create_channel_internal.h b/contrib/libs/grpc/src/cpp/client/create_channel_internal.h
index 470c624075..7953f748ff 100644
--- a/contrib/libs/grpc/src/cpp/client/create_channel_internal.h
+++ b/contrib/libs/grpc/src/cpp/client/create_channel_internal.h
@@ -1,33 +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.
- *
- */
+//
+//
+// 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 GRPC_INTERNAL_CPP_CLIENT_CREATE_CHANNEL_INTERNAL_H
-#define GRPC_INTERNAL_CPP_CLIENT_CREATE_CHANNEL_INTERNAL_H
+#ifndef GRPC_SRC_CPP_CLIENT_CREATE_CHANNEL_INTERNAL_H
+#define GRPC_SRC_CPP_CLIENT_CREATE_CHANNEL_INTERNAL_H
#include <memory>
#include <util/generic/string.h>
#include <util/string/cast.h>
#include <vector>
-#include <grpc/impl/codegen/grpc_types.h>
+#include <grpc/grpc.h>
#include <grpcpp/channel.h>
#include <grpcpp/support/client_interceptor.h>
-#include <grpcpp/support/config.h>
namespace grpc {
@@ -39,4 +38,4 @@ std::shared_ptr<Channel> CreateChannelInternal(
} // namespace grpc
-#endif // GRPC_INTERNAL_CPP_CLIENT_CREATE_CHANNEL_INTERNAL_H
+#endif // GRPC_SRC_CPP_CLIENT_CREATE_CHANNEL_INTERNAL_H
diff --git a/contrib/libs/grpc/src/cpp/client/create_channel_posix.cc b/contrib/libs/grpc/src/cpp/client/create_channel_posix.cc
index d3b2ee56d3..b6d9072348 100644
--- a/contrib/libs/grpc/src/cpp/client/create_channel_posix.cc
+++ b/contrib/libs/grpc/src/cpp/client/create_channel_posix.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include <memory>
#include <util/generic/string.h>
@@ -25,12 +25,10 @@
#include <grpc/grpc.h>
#include <grpc/grpc_posix.h>
#include <grpc/grpc_security.h>
-#include <grpc/impl/codegen/grpc_types.h>
#include <grpcpp/channel.h>
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/support/channel_arguments.h>
#include <grpcpp/support/client_interceptor.h>
-#include <grpcpp/support/config.h>
#include "src/cpp/client/create_channel_internal.h"
@@ -43,22 +41,18 @@ class ChannelArguments;
std::shared_ptr<Channel> CreateInsecureChannelFromFd(const TString& target,
int fd) {
internal::GrpcLibrary init_lib;
- init_lib.init();
grpc_channel_credentials* creds = grpc_insecure_credentials_create();
auto channel = CreateChannelInternal(
"", grpc_channel_create_from_fd(target.c_str(), fd, creds, nullptr),
std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>());
grpc_channel_credentials_release(creds);
- // Channel also initializes gRPC, so we can decrement the init ref count here.
- init_lib.shutdown();
return channel;
}
std::shared_ptr<Channel> CreateCustomInsecureChannelFromFd(
const TString& target, int fd, const grpc::ChannelArguments& args) {
internal::GrpcLibrary init_lib;
- init_lib.init();
grpc_channel_args channel_args;
args.SetChannelArgs(&channel_args);
grpc_channel_credentials* creds = grpc_insecure_credentials_create();
@@ -68,7 +62,6 @@ std::shared_ptr<Channel> CreateCustomInsecureChannelFromFd(
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>());
grpc_channel_credentials_release(creds);
// Channel also initializes gRPC, so we can decrement the init ref count here.
- init_lib.shutdown();
return channel;
}
@@ -80,7 +73,6 @@ std::shared_ptr<Channel> CreateCustomInsecureChannelWithInterceptorsFromFd(
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators) {
internal::GrpcLibrary init_lib;
- init_lib.init();
grpc_channel_args channel_args;
args.SetChannelArgs(&channel_args);
grpc_channel_credentials* creds = grpc_insecure_credentials_create();
@@ -88,8 +80,6 @@ std::shared_ptr<Channel> CreateCustomInsecureChannelWithInterceptorsFromFd(
"", grpc_channel_create_from_fd(target.c_str(), fd, creds, &channel_args),
std::move(interceptor_creators));
grpc_channel_credentials_release(creds);
- // Channel also initializes gRPC, so we can decrement the init ref count here.
- init_lib.shutdown();
return channel;
}
diff --git a/contrib/libs/grpc/src/cpp/client/credentials_cc.cc b/contrib/libs/grpc/src/cpp/client/credentials_cc.cc
deleted file mode 100644
index 9dfb2f491c..0000000000
--- a/contrib/libs/grpc/src/cpp/client/credentials_cc.cc
+++ /dev/null
@@ -1,33 +0,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.
- *
- */
-
-#include <grpcpp/impl/grpc_library.h>
-#include <grpcpp/security/credentials.h>
-
-namespace grpc {
-
-static grpc::internal::GrpcLibraryInitializer g_gli_initializer;
-ChannelCredentials::ChannelCredentials() { g_gli_initializer.summon(); }
-
-ChannelCredentials::~ChannelCredentials() {}
-
-CallCredentials::CallCredentials() { g_gli_initializer.summon(); }
-
-CallCredentials::~CallCredentials() {}
-
-} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/client/insecure_credentials.cc b/contrib/libs/grpc/src/cpp/client/insecure_credentials.cc
index 195a9aa809..0aa867ecfd 100644
--- a/contrib/libs/grpc/src/cpp/client/insecure_credentials.cc
+++ b/contrib/libs/grpc/src/cpp/client/insecure_credentials.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include <memory>
#include <util/generic/string.h>
#include <util/string/cast.h>
@@ -23,12 +23,10 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
-#include <grpc/impl/codegen/grpc_types.h>
#include <grpcpp/channel.h>
#include <grpcpp/security/credentials.h>
#include <grpcpp/support/channel_arguments.h>
#include <grpcpp/support/client_interceptor.h>
-#include <grpcpp/support/config.h>
#include "src/cpp/client/create_channel_internal.h"
diff --git a/contrib/libs/grpc/src/cpp/client/secure_credentials.cc b/contrib/libs/grpc/src/cpp/client/secure_credentials.cc
index efe73392f2..bf05ef74f7 100644
--- a/contrib/libs/grpc/src/cpp/client/secure_credentials.cc
+++ b/contrib/libs/grpc/src/cpp/client/secure_credentials.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include "src/cpp/client/secure_credentials.h"
@@ -29,8 +29,8 @@
#include "y_absl/strings/str_join.h"
#include "y_absl/types/optional.h"
+#include <grpc/event_engine/event_engine.h>
#include <grpc/grpc_security_constants.h>
-#include <grpc/impl/codegen/gpr_types.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
@@ -39,28 +39,25 @@
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/security/tls_credentials_options.h>
#include <grpcpp/support/channel_arguments.h>
+#include <grpcpp/support/config.h>
#include <grpcpp/support/slice.h>
#include <grpcpp/support/status.h>
+#include "src/core/lib/event_engine/default_event_engine.h"
#include "src/core/lib/gprpp/env.h"
-#include "src/core/lib/iomgr/closure.h"
+#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/error.h"
-#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/load_file.h"
#include "src/core/lib/json/json.h"
#include "src/core/lib/security/util/json_util.h"
-#include "src/core/lib/slice/slice_refcount.h"
#include "src/cpp/client/create_channel_internal.h"
#include "src/cpp/common/secure_auth_context.h"
namespace grpc {
-static grpc::internal::GrpcLibraryInitializer g_gli_initializer;
SecureChannelCredentials::SecureChannelCredentials(
grpc_channel_credentials* c_creds)
- : c_creds_(c_creds) {
- g_gli_initializer.summon();
-}
+ : c_creds_(c_creds) {}
std::shared_ptr<Channel> SecureChannelCredentials::CreateChannelImpl(
const TString& target, const ChannelArguments& args) {
@@ -85,9 +82,7 @@ SecureChannelCredentials::CreateChannelWithInterceptors(
}
SecureCallCredentials::SecureCallCredentials(grpc_call_credentials* c_creds)
- : c_creds_(c_creds) {
- g_gli_initializer.summon();
-}
+ : c_creds_(c_creds) {}
bool SecureCallCredentials::ApplyToCall(grpc_call* call) {
return grpc_call_set_credentials(call, c_creds_) == GRPC_CALL_OK;
@@ -115,14 +110,14 @@ std::shared_ptr<CallCredentials> WrapCallCredentials(
} // namespace
std::shared_ptr<ChannelCredentials> GoogleDefaultCredentials() {
- grpc::GrpcLibraryCodegen init; // To call grpc_init().
+ grpc::internal::GrpcLibrary init; // To call grpc_init().
return internal::WrapChannelCredentials(
grpc_google_default_credentials_create(nullptr));
}
std::shared_ptr<CallCredentials> ExternalAccountCredentials(
const grpc::string& json_string, const std::vector<grpc::string>& scopes) {
- grpc::GrpcLibraryCodegen init; // To call grpc_init().
+ grpc::internal::GrpcLibrary init; // To call grpc_init().
return WrapCallCredentials(grpc_external_account_credentials_create(
json_string.c_str(), y_absl::StrJoin(scopes, ",").c_str()));
}
@@ -130,7 +125,7 @@ std::shared_ptr<CallCredentials> ExternalAccountCredentials(
// Builds SSL Credentials given SSL specific options
std::shared_ptr<ChannelCredentials> SslCredentials(
const SslCredentialsOptions& options) {
- grpc::GrpcLibraryCodegen init; // To call grpc_init().
+ grpc::internal::GrpcLibrary init; // To call grpc_init().
grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {
options.pem_private_key.c_str(), options.pem_cert_chain.c_str()};
@@ -225,24 +220,22 @@ grpc::Status StsCredentialsOptionsFromEnv(StsCredentialsOptions* options) {
ClearStsCredentialsOptions(options);
grpc_slice json_string = grpc_empty_slice();
auto sts_creds_path = grpc_core::GetEnv("STS_CREDENTIALS");
- grpc_error_handle error = GRPC_ERROR_NONE;
+ grpc_error_handle error;
grpc::Status status;
// NOLINTNEXTLINE(clang-diagnostic-unused-lambda-capture)
- auto cleanup = [&json_string, &error, &status]() {
- grpc_slice_unref_internal(json_string);
- GRPC_ERROR_UNREF(error);
+ auto cleanup = [&json_string, &status]() {
+ grpc_slice_unref(json_string);
return status;
};
-
if (!sts_creds_path.has_value()) {
status = grpc::Status(grpc::StatusCode::NOT_FOUND,
"STS_CREDENTIALS environment variable not set.");
return cleanup();
}
error = grpc_load_file(sts_creds_path->c_str(), 1, &json_string);
- if (!GRPC_ERROR_IS_NONE(error)) {
- status =
- grpc::Status(grpc::StatusCode::NOT_FOUND, grpc_error_std_string(error));
+ if (!error.ok()) {
+ status = grpc::Status(grpc::StatusCode::NOT_FOUND,
+ grpc_core::StatusToString(error));
return cleanup();
}
status = StsCredentialsOptionsFromJson(
@@ -278,7 +271,7 @@ std::shared_ptr<CallCredentials> StsCredentials(
std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
std::unique_ptr<MetadataCredentialsPlugin> plugin,
grpc_security_level min_security_level) {
- grpc::GrpcLibraryCodegen init; // To call grpc_init().
+ grpc::internal::GrpcLibrary init; // To call grpc_init().
const char* type = plugin->GetType();
grpc::MetadataCredentialsPluginWrapper* wrapper =
new grpc::MetadataCredentialsPluginWrapper(std::move(plugin));
@@ -293,7 +286,7 @@ std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
// Builds ALTS Credentials given ALTS specific options
std::shared_ptr<ChannelCredentials> AltsCredentials(
const AltsCredentialsOptions& options) {
- grpc::GrpcLibraryCodegen init; // To call grpc_init().
+ grpc::internal::GrpcLibrary init; // To call grpc_init().
grpc_alts_credentials_options* c_options =
grpc_alts_credentials_client_options_create();
for (const auto& service_account : options.target_service_accounts) {
@@ -308,7 +301,7 @@ std::shared_ptr<ChannelCredentials> AltsCredentials(
// Builds Local Credentials
std::shared_ptr<ChannelCredentials> LocalCredentials(
grpc_local_connect_type type) {
- grpc::GrpcLibraryCodegen init; // To call grpc_init().
+ grpc::internal::GrpcLibrary init; // To call grpc_init().
return internal::WrapChannelCredentials(grpc_local_credentials_create(type));
}
@@ -323,7 +316,7 @@ std::shared_ptr<ChannelCredentials> TlsCredentials(
// Builds credentials for use when running in GCE
std::shared_ptr<CallCredentials> GoogleComputeEngineCredentials() {
- grpc::GrpcLibraryCodegen init; // To call grpc_init().
+ grpc::internal::GrpcLibrary init; // To call grpc_init().
return WrapCallCredentials(
grpc_google_compute_engine_credentials_create(nullptr));
}
@@ -331,7 +324,7 @@ std::shared_ptr<CallCredentials> GoogleComputeEngineCredentials() {
// Builds JWT credentials.
std::shared_ptr<CallCredentials> ServiceAccountJWTAccessCredentials(
const TString& json_key, long token_lifetime_seconds) {
- grpc::GrpcLibraryCodegen init; // To call grpc_init().
+ grpc::internal::GrpcLibrary init; // To call grpc_init().
if (token_lifetime_seconds <= 0) {
gpr_log(GPR_ERROR,
"Trying to create JWTCredentials with non-positive lifetime");
@@ -346,7 +339,7 @@ std::shared_ptr<CallCredentials> ServiceAccountJWTAccessCredentials(
// Builds refresh token credentials.
std::shared_ptr<CallCredentials> GoogleRefreshTokenCredentials(
const TString& json_refresh_token) {
- grpc::GrpcLibraryCodegen init; // To call grpc_init().
+ grpc::internal::GrpcLibrary init; // To call grpc_init().
return WrapCallCredentials(grpc_google_refresh_token_credentials_create(
json_refresh_token.c_str(), nullptr));
}
@@ -354,7 +347,7 @@ std::shared_ptr<CallCredentials> GoogleRefreshTokenCredentials(
// Builds access token credentials.
std::shared_ptr<CallCredentials> AccessTokenCredentials(
const TString& access_token) {
- grpc::GrpcLibraryCodegen init; // To call grpc_init().
+ grpc::internal::GrpcLibrary init; // To call grpc_init().
return WrapCallCredentials(
grpc_access_token_credentials_create(access_token.c_str(), nullptr));
}
@@ -363,7 +356,7 @@ std::shared_ptr<CallCredentials> AccessTokenCredentials(
std::shared_ptr<CallCredentials> GoogleIAMCredentials(
const TString& authorization_token,
const TString& authority_selector) {
- grpc::GrpcLibraryCodegen init; // To call grpc_init().
+ grpc::internal::GrpcLibrary init; // To call grpc_init().
return WrapCallCredentials(grpc_google_iam_credentials_create(
authorization_token.c_str(), authority_selector.c_str(), nullptr));
}
@@ -403,7 +396,7 @@ std::shared_ptr<CallCredentials> CompositeCallCredentials(
std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
std::unique_ptr<MetadataCredentialsPlugin> plugin) {
- grpc::GrpcLibraryCodegen init; // To call grpc_init().
+ grpc::internal::GrpcLibrary init; // To call grpc_init().
const char* type = plugin->GetType();
grpc::MetadataCredentialsPluginWrapper* wrapper =
new grpc::MetadataCredentialsPluginWrapper(std::move(plugin));
@@ -415,14 +408,6 @@ std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
c_plugin, GRPC_PRIVACY_AND_INTEGRITY, nullptr));
}
-namespace {
-void DeleteWrapper(void* wrapper, grpc_error_handle /*ignored*/) {
- MetadataCredentialsPluginWrapper* w =
- static_cast<MetadataCredentialsPluginWrapper*>(wrapper);
- delete w;
-}
-} // namespace
-
char* MetadataCredentialsPluginWrapper::DebugString(void* wrapper) {
GPR_ASSERT(wrapper);
MetadataCredentialsPluginWrapper* w =
@@ -432,10 +417,11 @@ char* MetadataCredentialsPluginWrapper::DebugString(void* wrapper) {
void MetadataCredentialsPluginWrapper::Destroy(void* wrapper) {
if (wrapper == nullptr) return;
- grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
- grpc_core::ExecCtx exec_ctx;
- grpc_core::Executor::Run(GRPC_CLOSURE_CREATE(DeleteWrapper, wrapper, nullptr),
- GRPC_ERROR_NONE);
+ grpc_event_engine::experimental::GetDefaultEventEngine()->Run([wrapper] {
+ grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
+ grpc_core::ExecCtx exec_ctx;
+ delete static_cast<MetadataCredentialsPluginWrapper*>(wrapper);
+ });
}
int MetadataCredentialsPluginWrapper::GetMetadata(
diff --git a/contrib/libs/grpc/src/cpp/client/secure_credentials.h b/contrib/libs/grpc/src/cpp/client/secure_credentials.h
index 63f3e928a5..d5638e4f30 100644
--- a/contrib/libs/grpc/src/cpp/client/secure_credentials.h
+++ b/contrib/libs/grpc/src/cpp/client/secure_credentials.h
@@ -1,23 +1,23 @@
-/*
- *
- * 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 GRPC_INTERNAL_CPP_CLIENT_SECURE_CREDENTIALS_H
-#define GRPC_INTERNAL_CPP_CLIENT_SECURE_CREDENTIALS_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 GRPC_SRC_CPP_CLIENT_SECURE_CREDENTIALS_H
+#define GRPC_SRC_CPP_CLIENT_SECURE_CREDENTIALS_H
#include <stddef.h>
@@ -30,14 +30,12 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
-#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/status.h>
#include <grpcpp/channel.h>
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/security/credentials.h>
#include <grpcpp/support/channel_arguments.h>
#include <grpcpp/support/client_interceptor.h>
-#include <grpcpp/support/config.h>
// TODO(yashykt): We shouldn't be including "src/core" headers.
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/security/credentials/credentials.h"
@@ -107,7 +105,7 @@ grpc_sts_credentials_options StsCredentialsCppToCoreOptions(
} // namespace experimental
-class MetadataCredentialsPluginWrapper final : private GrpcLibraryCodegen {
+class MetadataCredentialsPluginWrapper final : private internal::GrpcLibrary {
public:
static void Destroy(void* wrapper);
static int GetMetadata(
@@ -134,4 +132,4 @@ class MetadataCredentialsPluginWrapper final : private GrpcLibraryCodegen {
} // namespace grpc
-#endif // GRPC_INTERNAL_CPP_CLIENT_SECURE_CREDENTIALS_H
+#endif // GRPC_SRC_CPP_CLIENT_SECURE_CREDENTIALS_H
diff --git a/contrib/libs/grpc/src/cpp/codegen/codegen_init.cc b/contrib/libs/grpc/src/cpp/codegen/codegen_init.cc
deleted file mode 100644
index 4e1176f1f0..0000000000
--- a/contrib/libs/grpc/src/cpp/codegen/codegen_init.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#include <grpcpp/impl/codegen/core_codegen_interface.h>
-#include <grpcpp/impl/grpc_library.h>
-
-/// Null-initializes the global gRPC variables for the codegen library. These
-/// stay null in the absence of grpc++ library. In this case, no gRPC
-/// features such as the ability to perform calls will be available. Trying to
-/// perform them would result in a segmentation fault when trying to deference
-/// the following nulled globals. These should be associated with actual
-/// as part of the instantiation of a \a grpc::GrpcLibraryInitializer variable.
-
-grpc::CoreCodegenInterface* grpc::g_core_codegen_interface;
-grpc::GrpcLibraryInterface* grpc::g_glip;
diff --git a/contrib/libs/grpc/src/cpp/common/alarm.cc b/contrib/libs/grpc/src/cpp/common/alarm.cc
index 2770c11bd1..c119d7eb90 100644
--- a/contrib/libs/grpc/src/cpp/common/alarm.cc
+++ b/contrib/libs/grpc/src/cpp/common/alarm.cc
@@ -1,33 +1,32 @@
-/*
- * 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.
- *
- */
+//
+// 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.
+//
+//
#include <grpc/support/port_platform.h>
#include <functional>
#include <utility>
-#include <grpc/impl/codegen/gpr_types.h>
-#include <grpc/impl/codegen/grpc_types.h>
+#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
+#include <grpc/support/time.h>
#include <grpcpp/alarm.h>
#include <grpcpp/completion_queue.h>
-#include <grpcpp/impl/codegen/completion_queue_tag.h>
-#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/impl/completion_queue_tag.h>
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/iomgr/closure.h"
@@ -89,15 +88,15 @@ class AlarmImpl : public grpc::internal::CompletionQueueTag {
GRPC_CLOSURE_INIT(
&on_alarm_,
[](void* arg, grpc_error_handle error) {
- grpc_core::Executor::Run(
- GRPC_CLOSURE_CREATE(
- [](void* arg, grpc_error_handle error) {
- AlarmImpl* alarm = static_cast<AlarmImpl*>(arg);
- alarm->callback_(GRPC_ERROR_IS_NONE(error));
- alarm->Unref();
- },
- arg, nullptr),
- error);
+ grpc_core::Executor::Run(GRPC_CLOSURE_CREATE(
+ [](void* arg, grpc_error_handle error) {
+ AlarmImpl* alarm =
+ static_cast<AlarmImpl*>(arg);
+ alarm->callback_(error.ok());
+ alarm->Unref();
+ },
+ arg, nullptr),
+ error);
},
this, grpc_schedule_on_exec_ctx);
grpc_timer_init(&timer_,
@@ -133,11 +132,7 @@ class AlarmImpl : public grpc::internal::CompletionQueueTag {
};
} // namespace internal
-static grpc::internal::GrpcLibraryInitializer g_gli_initializer;
-
-Alarm::Alarm() : alarm_(new internal::AlarmImpl()) {
- g_gli_initializer.summon();
-}
+Alarm::Alarm() : alarm_(new internal::AlarmImpl()) {}
void Alarm::SetInternal(grpc::CompletionQueue* cq, gpr_timespec deadline,
void* tag) {
diff --git a/contrib/libs/grpc/src/cpp/common/auth_property_iterator.cc b/contrib/libs/grpc/src/cpp/common/auth_property_iterator.cc
index 45d6db9c3c..10e71d3a17 100644
--- a/contrib/libs/grpc/src/cpp/common/auth_property_iterator.cc
+++ b/contrib/libs/grpc/src/cpp/common/auth_property_iterator.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include <utility>
diff --git a/contrib/libs/grpc/src/cpp/common/channel_arguments.cc b/contrib/libs/grpc/src/cpp/common/channel_arguments.cc
index e92fd131b6..d9420b518a 100644
--- a/contrib/libs/grpc/src/cpp/common/channel_arguments.cc
+++ b/contrib/libs/grpc/src/cpp/common/channel_arguments.cc
@@ -1,34 +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.
- *
- */
+//
+//
+// 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.
+//
+//
#include <algorithm>
#include <list>
-#include <memory>
#include <util/generic/string.h>
#include <util/string/cast.h>
#include <vector>
-#include <grpc/impl/codegen/compression_types.h>
-#include <grpc/impl/codegen/grpc_types.h>
+#include <grpc/impl/compression_types.h>
#include <grpc/support/log.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/resource_quota.h>
#include <grpcpp/support/channel_arguments.h>
-#include <grpcpp/support/config.h>
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/socket_mutator.h"
diff --git a/contrib/libs/grpc/src/cpp/common/channel_filter.cc b/contrib/libs/grpc/src/cpp/common/channel_filter.cc
index 64d9656dc3..d15ae0669d 100644
--- a/contrib/libs/grpc/src/cpp/common/channel_filter.cc
+++ b/contrib/libs/grpc/src/cpp/common/channel_filter.cc
@@ -1,25 +1,23 @@
-/*
- *
- * 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.
+//
+//
#include "src/cpp/common/channel_filter.h"
-#include <memory>
-
#include "y_absl/strings/str_cat.h"
#include "y_absl/strings/string_view.h"
@@ -30,7 +28,6 @@
#include "src/core/lib/channel/channel_stack_builder.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/slice/slice.h"
-#include "src/core/lib/surface/channel_init.h"
namespace grpc {
@@ -74,12 +71,12 @@ namespace internal {
void RegisterChannelFilter(
grpc_channel_stack_type stack_type, int priority,
- std::function<bool(const grpc_channel_args&)> include_filter,
+ std::function<bool(const grpc_core::ChannelArgs&)> include_filter,
const grpc_channel_filter* filter) {
auto maybe_add_filter = [include_filter,
filter](grpc_core::ChannelStackBuilder* builder) {
if (include_filter != nullptr) {
- if (!include_filter(*builder->channel_args().ToC())) {
+ if (!include_filter(builder->channel_args())) {
return true;
}
}
diff --git a/contrib/libs/grpc/src/cpp/common/channel_filter.h b/contrib/libs/grpc/src/cpp/common/channel_filter.h
index bbfeb75207..9a5eb7dc94 100644
--- a/contrib/libs/grpc/src/cpp/common/channel_filter.h
+++ b/contrib/libs/grpc/src/cpp/common/channel_filter.h
@@ -1,23 +1,23 @@
-/*
- *
- * 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 GRPCXX_CHANNEL_FILTER_H
-#define GRPCXX_CHANNEL_FILTER_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 GRPC_SRC_CPP_COMMON_CHANNEL_FILTER_H
+#define GRPC_SRC_CPP_COMMON_CHANNEL_FILTER_H
#include <stddef.h>
@@ -27,13 +27,14 @@
#include <util/string/cast.h>
#include <utility>
+#include "y_absl/status/status.h"
#include "y_absl/types/optional.h"
#include <grpc/grpc.h>
-#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/support/atm.h>
#include <grpcpp/support/config.h>
+#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_fwd.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/context.h"
@@ -87,7 +88,7 @@ class TransportOp {
grpc_error_handle disconnect_with_error() const {
return op_->disconnect_with_error;
}
- bool send_goaway() const { return !GRPC_ERROR_IS_NONE(op_->goaway_error); }
+ bool send_goaway() const { return !op_->goaway_error.ok(); }
// TODO(roth): Add methods for additional fields as needed.
@@ -202,7 +203,7 @@ class ChannelData {
/// Initializes the channel data.
virtual grpc_error_handle Init(grpc_channel_element* /*elem*/,
grpc_channel_element_args* /*args*/) {
- return GRPC_ERROR_NONE;
+ return y_absl::OkStatus();
}
// Called before destruction.
@@ -225,7 +226,7 @@ class CallData {
/// Initializes the call data.
virtual grpc_error_handle Init(grpc_call_element* /*elem*/,
const grpc_call_element_args* /*args*/) {
- return GRPC_ERROR_NONE;
+ return y_absl::OkStatus();
}
// Called before destruction.
@@ -314,7 +315,7 @@ class ChannelFilter final {
void RegisterChannelFilter(
grpc_channel_stack_type stack_type, int priority,
- std::function<bool(const grpc_channel_args&)> include_filter,
+ std::function<bool(const grpc_core::ChannelArgs&)> include_filter,
const grpc_channel_filter* filter);
} // namespace internal
@@ -332,7 +333,7 @@ void RegisterChannelFilter(
template <typename ChannelDataType, typename CallDataType>
void RegisterChannelFilter(
const char* name, grpc_channel_stack_type stack_type, int priority,
- std::function<bool(const grpc_channel_args&)> include_filter) {
+ std::function<bool(const grpc_core::ChannelArgs&)> include_filter) {
using FilterType = internal::ChannelFilter<ChannelDataType, CallDataType>;
static const grpc_channel_filter filter = {
FilterType::StartTransportStreamOpBatch,
@@ -354,4 +355,4 @@ void RegisterChannelFilter(
} // namespace grpc
-#endif // GRPCXX_CHANNEL_FILTER_H
+#endif // GRPC_SRC_CPP_COMMON_CHANNEL_FILTER_H
diff --git a/contrib/libs/grpc/src/cpp/common/completion_queue_cc.cc b/contrib/libs/grpc/src/cpp/common/completion_queue_cc.cc
index b4414a3bb0..abb20e245d 100644
--- a/contrib/libs/grpc/src/cpp/common/completion_queue_cc.cc
+++ b/contrib/libs/grpc/src/cpp/common/completion_queue_cc.cc
@@ -1,33 +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.
- *
- */
+//
+// 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.
+//
+//
#include <vector>
#include "y_absl/base/thread_annotations.h"
#include <grpc/grpc.h>
-#include <grpc/impl/codegen/gpr_types.h>
-#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/support/cpu.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
#include <grpcpp/completion_queue.h>
-#include <grpcpp/impl/codegen/completion_queue_tag.h>
+#include <grpcpp/impl/completion_queue_tag.h>
#include <grpcpp/impl/grpc_library.h>
#include "src/core/lib/gpr/useful.h"
@@ -37,8 +35,6 @@
namespace grpc {
namespace {
-internal::GrpcLibraryInitializer g_gli_initializer;
-
gpr_once g_once_init_callback_alternative = GPR_ONCE_INIT;
grpc_core::Mutex* g_callback_alternative_mu;
@@ -130,12 +126,11 @@ CallbackAlternativeCQ g_callback_alternative_cq;
// a 'grpc_completion_queue' instance (which is being passed as the input to
// this constructor), one must have already called grpc_init().
CompletionQueue::CompletionQueue(grpc_completion_queue* take)
- : GrpcLibraryCodegen(false), cq_(take) {
+ : GrpcLibrary(false), cq_(take) {
InitialAvalanching();
}
void CompletionQueue::Shutdown() {
- g_gli_initializer.summon();
#ifndef NDEBUG
if (!ServerListEmpty()) {
gpr_log(GPR_ERROR,
diff --git a/contrib/libs/grpc/src/cpp/common/core_codegen.cc b/contrib/libs/grpc/src/cpp/common/core_codegen.cc
deleted file mode 100644
index cf5dc084b5..0000000000
--- a/contrib/libs/grpc/src/cpp/common/core_codegen.cc
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#include <grpc/support/port_platform.h>
-
-#include <stdlib.h>
-
-#include <grpc/byte_buffer.h>
-#include <grpc/grpc.h>
-#include <grpc/impl/codegen/gpr_types.h>
-#include <grpc/impl/codegen/grpc_types.h>
-#include <grpc/slice.h>
-#include <grpc/slice_buffer.h>
-#include <grpc/status.h>
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
-#include <grpc/support/sync.h>
-#include <grpc/support/time.h>
-#include <grpcpp/impl/codegen/core_codegen.h>
-#include <grpcpp/support/status.h>
-
-namespace grpc {
-
-const grpc_completion_queue_factory*
-CoreCodegen::grpc_completion_queue_factory_lookup(
- const grpc_completion_queue_attributes* attributes) {
- return ::grpc_completion_queue_factory_lookup(attributes);
-}
-
-grpc_completion_queue* CoreCodegen::grpc_completion_queue_create(
- const grpc_completion_queue_factory* factory,
- const grpc_completion_queue_attributes* attributes, void* reserved) {
- return ::grpc_completion_queue_create(factory, attributes, reserved);
-}
-
-grpc_completion_queue* CoreCodegen::grpc_completion_queue_create_for_next(
- void* reserved) {
- return ::grpc_completion_queue_create_for_next(reserved);
-}
-
-grpc_completion_queue* CoreCodegen::grpc_completion_queue_create_for_pluck(
- void* reserved) {
- return ::grpc_completion_queue_create_for_pluck(reserved);
-}
-
-void CoreCodegen::grpc_completion_queue_shutdown(grpc_completion_queue* cq) {
- ::grpc_completion_queue_shutdown(cq);
-}
-
-void CoreCodegen::grpc_completion_queue_destroy(grpc_completion_queue* cq) {
- ::grpc_completion_queue_destroy(cq);
-}
-
-grpc_event CoreCodegen::grpc_completion_queue_pluck(grpc_completion_queue* cq,
- void* tag,
- gpr_timespec deadline,
- void* reserved) {
- return ::grpc_completion_queue_pluck(cq, tag, deadline, reserved);
-}
-
-void* CoreCodegen::gpr_malloc(size_t size) { return ::gpr_malloc(size); }
-
-void CoreCodegen::gpr_free(void* p) { return ::gpr_free(p); }
-
-void CoreCodegen::grpc_init() { ::grpc_init(); }
-void CoreCodegen::grpc_shutdown() { ::grpc_shutdown(); }
-
-void CoreCodegen::gpr_mu_init(gpr_mu* mu) { ::gpr_mu_init(mu); }
-void CoreCodegen::gpr_mu_destroy(gpr_mu* mu) { ::gpr_mu_destroy(mu); }
-void CoreCodegen::gpr_mu_lock(gpr_mu* mu) { ::gpr_mu_lock(mu); }
-void CoreCodegen::gpr_mu_unlock(gpr_mu* mu) { ::gpr_mu_unlock(mu); }
-void CoreCodegen::gpr_cv_init(gpr_cv* cv) { ::gpr_cv_init(cv); }
-void CoreCodegen::gpr_cv_destroy(gpr_cv* cv) { ::gpr_cv_destroy(cv); }
-int CoreCodegen::gpr_cv_wait(gpr_cv* cv, gpr_mu* mu,
- gpr_timespec abs_deadline) {
- return ::gpr_cv_wait(cv, mu, abs_deadline);
-}
-void CoreCodegen::gpr_cv_signal(gpr_cv* cv) { ::gpr_cv_signal(cv); }
-void CoreCodegen::gpr_cv_broadcast(gpr_cv* cv) { ::gpr_cv_broadcast(cv); }
-
-grpc_byte_buffer* CoreCodegen::grpc_byte_buffer_copy(grpc_byte_buffer* bb) {
- return ::grpc_byte_buffer_copy(bb);
-}
-
-void CoreCodegen::grpc_byte_buffer_destroy(grpc_byte_buffer* bb) {
- ::grpc_byte_buffer_destroy(bb);
-}
-
-size_t CoreCodegen::grpc_byte_buffer_length(grpc_byte_buffer* bb) {
- return ::grpc_byte_buffer_length(bb);
-}
-
-grpc_call_error CoreCodegen::grpc_call_start_batch(grpc_call* call,
- const grpc_op* ops,
- size_t nops, void* tag,
- void* reserved) {
- return ::grpc_call_start_batch(call, ops, nops, tag, reserved);
-}
-
-grpc_call_error CoreCodegen::grpc_call_cancel_with_status(
- grpc_call* call, grpc_status_code status, const char* description,
- void* reserved) {
- return ::grpc_call_cancel_with_status(call, status, description, reserved);
-}
-
-int CoreCodegen::grpc_call_failed_before_recv_message(const grpc_call* c) {
- return ::grpc_call_failed_before_recv_message(c);
-}
-void CoreCodegen::grpc_call_ref(grpc_call* call) { ::grpc_call_ref(call); }
-void CoreCodegen::grpc_call_unref(grpc_call* call) { ::grpc_call_unref(call); }
-void* CoreCodegen::grpc_call_arena_alloc(grpc_call* call, size_t length) {
- return ::grpc_call_arena_alloc(call, length);
-}
-const char* CoreCodegen::grpc_call_error_to_string(grpc_call_error error) {
- return ::grpc_call_error_to_string(error);
-}
-
-int CoreCodegen::grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader,
- grpc_byte_buffer* buffer) {
- return ::grpc_byte_buffer_reader_init(reader, buffer);
-}
-
-void CoreCodegen::grpc_byte_buffer_reader_destroy(
- grpc_byte_buffer_reader* reader) {
- ::grpc_byte_buffer_reader_destroy(reader);
-}
-
-int CoreCodegen::grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader,
- grpc_slice* slice) {
- return ::grpc_byte_buffer_reader_next(reader, slice);
-}
-
-int CoreCodegen::grpc_byte_buffer_reader_peek(grpc_byte_buffer_reader* reader,
- grpc_slice** slice) {
- return ::grpc_byte_buffer_reader_peek(reader, slice);
-}
-
-grpc_byte_buffer* CoreCodegen::grpc_raw_byte_buffer_create(grpc_slice* slice,
- size_t nslices) {
- return ::grpc_raw_byte_buffer_create(slice, nslices);
-}
-
-grpc_slice CoreCodegen::grpc_slice_new_with_user_data(void* p, size_t len,
- void (*destroy)(void*),
- void* user_data) {
- return ::grpc_slice_new_with_user_data(p, len, destroy, user_data);
-}
-
-grpc_slice CoreCodegen::grpc_slice_new_with_len(void* p, size_t len,
- void (*destroy)(void*,
- size_t)) {
- return ::grpc_slice_new_with_len(p, len, destroy);
-}
-
-grpc_slice CoreCodegen::grpc_empty_slice() { return ::grpc_empty_slice(); }
-
-grpc_slice CoreCodegen::grpc_slice_malloc(size_t length) {
- return ::grpc_slice_malloc(length);
-}
-
-void CoreCodegen::grpc_slice_unref(grpc_slice slice) {
- ::grpc_slice_unref(slice);
-}
-
-grpc_slice CoreCodegen::grpc_slice_ref(grpc_slice slice) {
- return ::grpc_slice_ref(slice);
-}
-
-grpc_slice CoreCodegen::grpc_slice_split_tail(grpc_slice* s, size_t split) {
- return ::grpc_slice_split_tail(s, split);
-}
-
-grpc_slice CoreCodegen::grpc_slice_split_head(grpc_slice* s, size_t split) {
- return ::grpc_slice_split_head(s, split);
-}
-
-grpc_slice CoreCodegen::grpc_slice_sub(grpc_slice s, size_t begin, size_t end) {
- return ::grpc_slice_sub(s, begin, end);
-}
-
-grpc_slice CoreCodegen::grpc_slice_from_static_buffer(const void* buffer,
- size_t length) {
- return ::grpc_slice_from_static_buffer(buffer, length);
-}
-
-grpc_slice CoreCodegen::grpc_slice_from_copied_buffer(const void* buffer,
- size_t length) {
- return ::grpc_slice_from_copied_buffer(static_cast<const char*>(buffer),
- length);
-}
-
-void CoreCodegen::grpc_slice_buffer_add(grpc_slice_buffer* sb,
- grpc_slice slice) {
- ::grpc_slice_buffer_add(sb, slice);
-}
-
-void CoreCodegen::grpc_slice_buffer_add_indexed(grpc_slice_buffer* sb,
- grpc_slice slice) {
- ::grpc_slice_buffer_add_indexed(sb, slice);
-}
-
-void CoreCodegen::grpc_slice_buffer_pop(grpc_slice_buffer* sb) {
- ::grpc_slice_buffer_pop(sb);
-}
-
-void CoreCodegen::grpc_metadata_array_init(grpc_metadata_array* array) {
- ::grpc_metadata_array_init(array);
-}
-
-void CoreCodegen::grpc_metadata_array_destroy(grpc_metadata_array* array) {
- ::grpc_metadata_array_destroy(array);
-}
-
-const Status& CoreCodegen::ok() { return grpc::Status::OK; }
-
-const Status& CoreCodegen::cancelled() { return grpc::Status::CANCELLED; }
-
-gpr_timespec CoreCodegen::gpr_inf_future(gpr_clock_type type) {
- return ::gpr_inf_future(type);
-}
-
-gpr_timespec CoreCodegen::gpr_time_0(gpr_clock_type type) {
- return ::gpr_time_0(type);
-}
-
-void CoreCodegen::assert_fail(const char* failed_assertion, const char* file,
- int line) {
- gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, "assertion failed: %s",
- failed_assertion);
- abort();
-}
-
-} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/common/resource_quota_cc.cc b/contrib/libs/grpc/src/cpp/common/resource_quota_cc.cc
index f2af1fb525..179660377c 100644
--- a/contrib/libs/grpc/src/cpp/common/resource_quota_cc.cc
+++ b/contrib/libs/grpc/src/cpp/common/resource_quota_cc.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include <stddef.h>
@@ -23,7 +23,6 @@
#include <grpc/grpc.h>
#include <grpcpp/resource_quota.h>
-#include <grpcpp/support/config.h>
namespace grpc {
diff --git a/contrib/libs/grpc/src/cpp/common/rpc_method.cc b/contrib/libs/grpc/src/cpp/common/rpc_method.cc
index a47dd3e444..f12978dfc3 100644
--- a/contrib/libs/grpc/src/cpp/common/rpc_method.cc
+++ b/contrib/libs/grpc/src/cpp/common/rpc_method.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include <grpcpp/impl/rpc_method.h>
diff --git a/contrib/libs/grpc/src/cpp/common/secure_auth_context.cc b/contrib/libs/grpc/src/cpp/common/secure_auth_context.cc
index cb584e59fe..b29759725b 100644
--- a/contrib/libs/grpc/src/cpp/common/secure_auth_context.cc
+++ b/contrib/libs/grpc/src/cpp/common/secure_auth_context.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include "src/cpp/common/secure_auth_context.h"
diff --git a/contrib/libs/grpc/src/cpp/common/secure_auth_context.h b/contrib/libs/grpc/src/cpp/common/secure_auth_context.h
index cd7fcc4dda..4bb2cd049d 100644
--- a/contrib/libs/grpc/src/cpp/common/secure_auth_context.h
+++ b/contrib/libs/grpc/src/cpp/common/secure_auth_context.h
@@ -1,23 +1,23 @@
-/*
- *
- * 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 GRPC_INTERNAL_CPP_COMMON_SECURE_AUTH_CONTEXT_H
-#define GRPC_INTERNAL_CPP_COMMON_SECURE_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 GRPC_SRC_CPP_COMMON_SECURE_AUTH_CONTEXT_H
+#define GRPC_SRC_CPP_COMMON_SECURE_AUTH_CONTEXT_H
#include <util/generic/string.h>
#include <util/string/cast.h>
@@ -25,7 +25,6 @@
#include <grpc/grpc_security.h>
#include <grpcpp/security/auth_context.h>
-#include <grpcpp/support/config.h>
#include <grpcpp/support/string_ref.h>
#include "src/core/lib/gprpp/ref_counted_ptr.h"
@@ -64,4 +63,4 @@ class SecureAuthContext final : public AuthContext {
} // namespace grpc
-#endif // GRPC_INTERNAL_CPP_COMMON_SECURE_AUTH_CONTEXT_H
+#endif // GRPC_SRC_CPP_COMMON_SECURE_AUTH_CONTEXT_H
diff --git a/contrib/libs/grpc/src/cpp/common/secure_channel_arguments.cc b/contrib/libs/grpc/src/cpp/common/secure_channel_arguments.cc
index 36e19d8477..3d79c9eba2 100644
--- a/contrib/libs/grpc/src/cpp/common/secure_channel_arguments.cc
+++ b/contrib/libs/grpc/src/cpp/common/secure_channel_arguments.cc
@@ -1,29 +1,27 @@
-/*
- *
- * 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.
+//
+//
-#include <memory>
#include <util/generic/string.h>
#include <util/string/cast.h>
#include <vector>
-#include <grpc/impl/codegen/grpc_types.h>
+#include <grpc/grpc.h>
#include <grpcpp/support/channel_arguments.h>
-#include <grpcpp/support/config.h>
namespace grpc {
diff --git a/contrib/libs/grpc/src/cpp/common/secure_create_auth_context.cc b/contrib/libs/grpc/src/cpp/common/secure_create_auth_context.cc
index feb3885d52..4658321520 100644
--- a/contrib/libs/grpc/src/cpp/common/secure_create_auth_context.cc
+++ b/contrib/libs/grpc/src/cpp/common/secure_create_auth_context.cc
@@ -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.
- *
- */
+//
+//
+// 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.
+//
+//
#include <memory>
+#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
-#include <grpc/impl/codegen/grpc_types.h>
#include <grpcpp/security/auth_context.h>
#include "src/core/lib/gprpp/ref_counted_ptr.h"
diff --git a/contrib/libs/grpc/src/cpp/common/tls_certificate_provider.cc b/contrib/libs/grpc/src/cpp/common/tls_certificate_provider.cc
index e78e68decb..f1a2faf0e7 100644
--- a/contrib/libs/grpc/src/cpp/common/tls_certificate_provider.cc
+++ b/contrib/libs/grpc/src/cpp/common/tls_certificate_provider.cc
@@ -21,7 +21,6 @@
#include <grpc/grpc_security.h>
#include <grpc/support/log.h>
#include <grpcpp/security/tls_certificate_provider.h>
-#include <grpcpp/support/config.h>
namespace grpc {
namespace experimental {
diff --git a/contrib/libs/grpc/src/cpp/common/tls_certificate_verifier.cc b/contrib/libs/grpc/src/cpp/common/tls_certificate_verifier.cc
index 5dd9bc13e7..313116de6d 100644
--- a/contrib/libs/grpc/src/cpp/common/tls_certificate_verifier.cc
+++ b/contrib/libs/grpc/src/cpp/common/tls_certificate_verifier.cc
@@ -16,6 +16,7 @@
#include <stddef.h>
+#include <algorithm>
#include <functional>
#include <map>
#include <util/generic/string.h>
@@ -28,18 +29,14 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
-#include <grpcpp/impl/codegen/sync.h>
-#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/impl/sync.h>
#include <grpcpp/security/tls_certificate_verifier.h>
-#include <grpcpp/support/config.h>
#include <grpcpp/support/status.h>
#include <grpcpp/support/string_ref.h>
namespace grpc {
namespace experimental {
-static internal::GrpcLibraryInitializer g_gli_initializer;
-
TlsCustomVerificationCheckRequest::TlsCustomVerificationCheckRequest(
grpc_tls_custom_verification_check_request* request)
: c_request_(request) {
@@ -107,9 +104,7 @@ std::vector<grpc::string_ref> TlsCustomVerificationCheckRequest::ip_names()
}
CertificateVerifier::CertificateVerifier(grpc_tls_certificate_verifier* v)
- : verifier_(v) {
- g_gli_initializer.summon();
-}
+ : verifier_(v) {}
CertificateVerifier::~CertificateVerifier() {
grpc_tls_certificate_verifier_release(verifier_);
diff --git a/contrib/libs/grpc/src/cpp/common/tls_credentials_options.cc b/contrib/libs/grpc/src/cpp/common/tls_credentials_options.cc
index f3d1a1f9e3..1f150d0d6b 100644
--- a/contrib/libs/grpc/src/cpp/common/tls_credentials_options.cc
+++ b/contrib/libs/grpc/src/cpp/common/tls_credentials_options.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
- *
- */
+//
+//
+// 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.
+//
+//
#include <memory>
#include <util/generic/string.h>
@@ -27,7 +27,6 @@
#include <grpcpp/security/tls_certificate_provider.h>
#include <grpcpp/security/tls_certificate_verifier.h>
#include <grpcpp/security/tls_credentials_options.h>
-#include <grpcpp/support/config.h>
namespace grpc {
namespace experimental {
diff --git a/contrib/libs/grpc/src/cpp/common/validate_service_config.cc b/contrib/libs/grpc/src/cpp/common/validate_service_config.cc
index 66a92a86d9..98ddb3f9a4 100644
--- a/contrib/libs/grpc/src/cpp/common/validate_service_config.cc
+++ b/contrib/libs/grpc/src/cpp/common/validate_service_config.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
- *
- */
+//
+//
+// 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.
+//
+//
#include <util/generic/string.h>
#include <util/string/cast.h>
@@ -23,10 +23,11 @@
#include "y_absl/status/statusor.h"
#include <grpc/grpc.h>
-#include <grpcpp/support/config.h>
#include <grpcpp/support/validate_service_config.h>
#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gprpp/ref_counted_ptr.h"
+#include "src/core/lib/service_config/service_config.h"
#include "src/core/lib/service_config/service_config_impl.h"
namespace grpc {
diff --git a/contrib/libs/grpc/src/cpp/common/version_cc.cc b/contrib/libs/grpc/src/cpp/common/version_cc.cc
index cdd0cc0668..b14d7705d3 100644
--- a/contrib/libs/grpc/src/cpp/common/version_cc.cc
+++ b/contrib/libs/grpc/src/cpp/common/version_cc.cc
@@ -1,30 +1,26 @@
-/*
- *
- * 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.
- *
- */
-
-/* This file is autogenerated from:
- templates/src/cpp/common/version_cc.cc.template */
+//
+//
+// 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.
+//
+//
#include <util/generic/string.h>
#include <util/string/cast.h>
#include <grpcpp/grpcpp.h>
-#include <grpcpp/support/config.h>
namespace grpc {
-TString Version() { return "1.50.2"; }
+TString Version() { return GRPC_CPP_VERSION_STRING; }
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.cc b/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.cc
index 324c07f7f8..0e008fcb6b 100644
--- a/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.cc
+++ b/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include "src/cpp/ext/proto_server_reflection.h"
@@ -26,8 +26,6 @@
// IWYU pragma: no_include <google/protobuf/descriptor.h>
-using grpc::Status;
-using grpc::StatusCode;
using grpc::reflection::v1alpha::ErrorResponse;
using grpc::reflection::v1alpha::ExtensionNumberResponse;
using grpc::reflection::v1alpha::ExtensionRequest;
diff --git a/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.h b/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.h
index 95d1cce2f4..d743c4621d 100644
--- a/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.h
+++ b/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.h
@@ -1,23 +1,23 @@
-/*
- *
- * 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 GRPC_INTERNAL_CPP_EXT_PROTO_SERVER_REFLECTION_H
-#define GRPC_INTERNAL_CPP_EXT_PROTO_SERVER_REFLECTION_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 GRPC_SRC_CPP_EXT_PROTO_SERVER_REFLECTION_H
+#define GRPC_SRC_CPP_EXT_PROTO_SERVER_REFLECTION_H
#include <util/generic/string.h>
#include <util/string/cast.h>
@@ -85,4 +85,4 @@ class ProtoServerReflection final
} // namespace grpc
-#endif // GRPC_INTERNAL_CPP_EXT_PROTO_SERVER_REFLECTION_H
+#endif // GRPC_SRC_CPP_EXT_PROTO_SERVER_REFLECTION_H
diff --git a/contrib/libs/grpc/src/cpp/ext/proto_server_reflection_plugin.cc b/contrib/libs/grpc/src/cpp/ext/proto_server_reflection_plugin.cc
index da76bb7964..08c30186a9 100644
--- a/contrib/libs/grpc/src/cpp/ext/proto_server_reflection_plugin.cc
+++ b/contrib/libs/grpc/src/cpp/ext/proto_server_reflection_plugin.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include <grpcpp/ext/proto_server_reflection_plugin.h>
#include <grpcpp/impl/server_builder_plugin.h>
diff --git a/contrib/libs/grpc/src/cpp/server/async_generic_service.cc b/contrib/libs/grpc/src/cpp/server/async_generic_service.cc
index 15381fafef..e5a5c7480d 100644
--- a/contrib/libs/grpc/src/cpp/server/async_generic_service.cc
+++ b/contrib/libs/grpc/src/cpp/server/async_generic_service.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include <grpcpp/completion_queue.h>
#include <grpcpp/generic/async_generic_service.h>
diff --git a/contrib/libs/grpc/src/cpp/server/backend_metric_recorder.cc b/contrib/libs/grpc/src/cpp/server/backend_metric_recorder.cc
new file mode 100644
index 0000000000..f45ef4b6b8
--- /dev/null
+++ b/contrib/libs/grpc/src/cpp/server/backend_metric_recorder.cc
@@ -0,0 +1,312 @@
+//
+// Copyright 2023 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.
+//
+
+#include "src/cpp/server/backend_metric_recorder.h"
+
+#include <inttypes.h>
+
+#include <functional>
+#include <memory>
+#include <util/generic/string.h>
+#include <util/string/cast.h>
+#include <type_traits>
+#include <utility>
+
+#include <grpc/support/log.h>
+#include <grpcpp/ext/call_metric_recorder.h>
+#include <grpcpp/ext/server_metric_recorder.h>
+
+#include "src/core/ext/filters/client_channel/lb_policy/backend_metric_data.h"
+#include "src/core/lib/debug/trace.h"
+
+using grpc_core::BackendMetricData;
+
+namespace {
+// All utilization values must be in [0, 1].
+bool IsUtilizationValid(double utilization) {
+ return utilization >= 0.0 && utilization <= 1.0;
+}
+
+// QPS must be in [0, infy).
+bool IsQpsValid(double qps) { return qps >= 0.0; }
+
+grpc_core::TraceFlag grpc_backend_metric_trace(false, "backend_metric");
+} // namespace
+
+namespace grpc {
+namespace experimental {
+
+std::unique_ptr<ServerMetricRecorder> ServerMetricRecorder::Create() {
+ return std::unique_ptr<ServerMetricRecorder>(new ServerMetricRecorder());
+}
+
+ServerMetricRecorder::ServerMetricRecorder()
+ : metric_state_(std::make_shared<const BackendMetricDataState>()) {}
+
+void ServerMetricRecorder::UpdateBackendMetricDataState(
+ std::function<void(BackendMetricData*)> updater) {
+ internal::MutexLock lock(&mu_);
+ auto new_state = std::make_shared<BackendMetricDataState>(*metric_state_);
+ updater(&new_state->data);
+ ++new_state->sequence_number;
+ metric_state_ = std::move(new_state);
+}
+
+void ServerMetricRecorder::SetCpuUtilization(double value) {
+ if (!IsUtilizationValid(value)) {
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] CPU utilization rejected: %f", this, value);
+ }
+ return;
+ }
+ UpdateBackendMetricDataState(
+ [value](BackendMetricData* data) { data->cpu_utilization = value; });
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] CPU utilization set: %f", this, value);
+ }
+}
+
+void ServerMetricRecorder::SetMemoryUtilization(double value) {
+ if (!IsUtilizationValid(value)) {
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] Mem utilization rejected: %f", this, value);
+ }
+ return;
+ }
+ UpdateBackendMetricDataState(
+ [value](BackendMetricData* data) { data->mem_utilization = value; });
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] Mem utilization set: %f", this, value);
+ }
+}
+
+void ServerMetricRecorder::SetQps(double value) {
+ if (!IsQpsValid(value)) {
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] QPS rejected: %f", this, value);
+ }
+ return;
+ }
+ UpdateBackendMetricDataState(
+ [value](BackendMetricData* data) { data->qps = value; });
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] QPS set: %f", this, value);
+ }
+}
+
+void ServerMetricRecorder::SetNamedUtilization(string_ref name, double value) {
+ if (!IsUtilizationValid(value)) {
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] Named utilization rejected: %f name: %s", this,
+ value, TString(name.data(), name.size()).c_str());
+ }
+ return;
+ }
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] Named utilization set: %f name: %s", this, value,
+ TString(name.data(), name.size()).c_str());
+ }
+ UpdateBackendMetricDataState([name, value](BackendMetricData* data) {
+ data->utilization[y_absl::string_view(name.data(), name.size())] = value;
+ });
+}
+
+void ServerMetricRecorder::SetAllNamedUtilization(
+ std::map<string_ref, double> named_utilization) {
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] All named utilization updated. size: %" PRIuPTR,
+ this, named_utilization.size());
+ }
+ UpdateBackendMetricDataState(
+ [utilization = std::move(named_utilization)](BackendMetricData* data) {
+ data->utilization.clear();
+ for (const auto& u : utilization) {
+ data->utilization[y_absl::string_view(u.first.data(), u.first.size())] =
+ u.second;
+ }
+ });
+}
+
+void ServerMetricRecorder::ClearCpuUtilization() {
+ UpdateBackendMetricDataState(
+ [](BackendMetricData* data) { data->cpu_utilization = -1; });
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] CPU utilization cleared.", this);
+ }
+}
+
+void ServerMetricRecorder::ClearMemoryUtilization() {
+ UpdateBackendMetricDataState(
+ [](BackendMetricData* data) { data->mem_utilization = -1; });
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] Mem utilization cleared.", this);
+ }
+}
+
+void ServerMetricRecorder::ClearQps() {
+ UpdateBackendMetricDataState([](BackendMetricData* data) { data->qps = -1; });
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] QPS utilization cleared.", this);
+ }
+}
+
+void ServerMetricRecorder::ClearNamedUtilization(string_ref name) {
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] Named utilization cleared. name: %s", this,
+ TString(name.data(), name.size()).c_str());
+ }
+ UpdateBackendMetricDataState([name](BackendMetricData* data) {
+ data->utilization.erase(y_absl::string_view(name.data(), name.size()));
+ });
+}
+
+grpc_core::BackendMetricData ServerMetricRecorder::GetMetrics() const {
+ auto result = GetMetricsIfChanged();
+ return result->data;
+}
+
+std::shared_ptr<const ServerMetricRecorder::BackendMetricDataState>
+ServerMetricRecorder::GetMetricsIfChanged() const {
+ std::shared_ptr<const BackendMetricDataState> result;
+ {
+ internal::MutexLock lock(&mu_);
+ result = metric_state_;
+ }
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ const auto& data = result->data;
+ gpr_log(GPR_INFO,
+ "[%p] GetMetrics() returned: seq:%" PRIu64
+ " cpu:%f mem:%f qps:%f utilization size: %" PRIuPTR,
+ this, result->sequence_number, data.cpu_utilization,
+ data.mem_utilization, data.qps, data.utilization.size());
+ }
+ return result;
+}
+
+} // namespace experimental
+
+experimental::CallMetricRecorder&
+BackendMetricState::RecordCpuUtilizationMetric(double value) {
+ if (!IsUtilizationValid(value)) {
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] CPU utilization value rejected: %f", this, value);
+ }
+ return *this;
+ }
+ cpu_utilization_.store(value, std::memory_order_relaxed);
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] CPU utilization recorded: %f", this, value);
+ }
+ return *this;
+}
+
+experimental::CallMetricRecorder&
+BackendMetricState::RecordMemoryUtilizationMetric(double value) {
+ if (!IsUtilizationValid(value)) {
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] Mem utilization value rejected: %f", this, value);
+ }
+ return *this;
+ }
+ mem_utilization_.store(value, std::memory_order_relaxed);
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] Mem utilization recorded: %f", this, value);
+ }
+ return *this;
+}
+
+experimental::CallMetricRecorder& BackendMetricState::RecordQpsMetric(
+ double value) {
+ if (!IsQpsValid(value)) {
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] QPS value rejected: %f", this, value);
+ }
+ return *this;
+ }
+ qps_.store(value, std::memory_order_relaxed);
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] QPS recorded: %f", this, value);
+ }
+ return *this;
+}
+
+experimental::CallMetricRecorder& BackendMetricState::RecordUtilizationMetric(
+ string_ref name, double value) {
+ if (!IsUtilizationValid(value)) {
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] Utilization value rejected: %s %f", this,
+ TString(name.data(), name.length()).c_str(), value);
+ }
+ return *this;
+ }
+ internal::MutexLock lock(&mu_);
+ y_absl::string_view name_sv(name.data(), name.length());
+ utilization_[name_sv] = value;
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] Utilization recorded: %s %f", this,
+ TString(name_sv).c_str(), value);
+ }
+ return *this;
+}
+
+experimental::CallMetricRecorder& BackendMetricState::RecordRequestCostMetric(
+ string_ref name, double value) {
+ internal::MutexLock lock(&mu_);
+ y_absl::string_view name_sv(name.data(), name.length());
+ request_cost_[name_sv] = value;
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO, "[%p] Request cost recorded: %s %f", this,
+ TString(name_sv).c_str(), value);
+ }
+ return *this;
+}
+
+BackendMetricData BackendMetricState::GetBackendMetricData() {
+ // Merge metrics from the ServerMetricRecorder first since metrics recorded
+ // to CallMetricRecorder takes a higher precedence.
+ BackendMetricData data;
+ if (server_metric_recorder_ != nullptr) {
+ data = server_metric_recorder_->GetMetrics();
+ }
+ // Only overwrite if the value is set i.e. in the valid range.
+ const double cpu = cpu_utilization_.load(std::memory_order_relaxed);
+ if (IsUtilizationValid(cpu)) {
+ data.cpu_utilization = cpu;
+ }
+ const double mem = mem_utilization_.load(std::memory_order_relaxed);
+ if (IsUtilizationValid(mem)) {
+ data.mem_utilization = mem;
+ }
+ const double qps = qps_.load(std::memory_order_relaxed);
+ if (IsQpsValid(qps)) {
+ data.qps = qps;
+ }
+ {
+ internal::MutexLock lock(&mu_);
+ data.utilization = std::move(utilization_);
+ data.request_cost = std::move(request_cost_);
+ }
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_backend_metric_trace)) {
+ gpr_log(GPR_INFO,
+ "[%p] Backend metric data returned: cpu:%f mem:%f qps:%f "
+ "utilization size:%" PRIuPTR " request_cost size:%" PRIuPTR,
+ this, data.cpu_utilization, data.mem_utilization, data.qps,
+ data.utilization.size(), data.request_cost.size());
+ }
+ return data;
+}
+
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/server/backend_metric_recorder.h b/contrib/libs/grpc/src/cpp/server/backend_metric_recorder.h
new file mode 100644
index 0000000000..7634b61ad8
--- /dev/null
+++ b/contrib/libs/grpc/src/cpp/server/backend_metric_recorder.h
@@ -0,0 +1,81 @@
+//
+//
+// Copyright 2023 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 GRPC_SRC_CPP_SERVER_BACKEND_METRIC_RECORDER_H
+#define GRPC_SRC_CPP_SERVER_BACKEND_METRIC_RECORDER_H
+
+#include <stdint.h>
+
+#include <atomic>
+#include <map>
+
+#include "y_absl/base/thread_annotations.h"
+#include "y_absl/strings/string_view.h"
+
+#include <grpcpp/ext/call_metric_recorder.h>
+#include <grpcpp/ext/server_metric_recorder.h>
+#include <grpcpp/impl/sync.h>
+#include <grpcpp/support/string_ref.h>
+
+#include "src/core/ext/filters/backend_metrics/backend_metric_provider.h"
+#include "src/core/ext/filters/client_channel/lb_policy/backend_metric_data.h"
+
+namespace grpc {
+namespace experimental {
+
+// Backend metrics and an associated update sequence number.
+struct ServerMetricRecorder::BackendMetricDataState {
+ grpc_core::BackendMetricData data;
+ uint64_t sequence_number = 0;
+};
+
+} // namespace experimental
+
+class BackendMetricState : public grpc_core::BackendMetricProvider,
+ public experimental::CallMetricRecorder {
+ public:
+ // `server_metric_recorder` is optional. When set, GetBackendMetricData()
+ // merges metrics from `server_metric_recorder` with metrics recorded to this.
+ explicit BackendMetricState(
+ experimental::ServerMetricRecorder* server_metric_recorder)
+ : server_metric_recorder_(server_metric_recorder) {}
+ experimental::CallMetricRecorder& RecordCpuUtilizationMetric(
+ double value) override;
+ experimental::CallMetricRecorder& RecordMemoryUtilizationMetric(
+ double value) override;
+ experimental::CallMetricRecorder& RecordQpsMetric(double value) override;
+ experimental::CallMetricRecorder& RecordUtilizationMetric(
+ string_ref name, double value) override;
+ experimental::CallMetricRecorder& RecordRequestCostMetric(
+ string_ref name, double value) override;
+ // This clears metrics currently recorded. Don't call twice.
+ grpc_core::BackendMetricData GetBackendMetricData() override;
+
+ private:
+ experimental::ServerMetricRecorder* server_metric_recorder_;
+ std::atomic<double> cpu_utilization_{-1.0};
+ std::atomic<double> mem_utilization_{-1.0};
+ std::atomic<double> qps_{-1.0};
+ internal::Mutex mu_;
+ std::map<y_absl::string_view, double> utilization_ Y_ABSL_GUARDED_BY(mu_);
+ std::map<y_absl::string_view, double> request_cost_ Y_ABSL_GUARDED_BY(mu_);
+};
+
+} // namespace grpc
+
+#endif // GRPC_SRC_CPP_SERVER_BACKEND_METRIC_RECORDER_H
diff --git a/contrib/libs/grpc/src/cpp/server/channel_argument_option.cc b/contrib/libs/grpc/src/cpp/server/channel_argument_option.cc
index dcdc08b145..c79da7ccc7 100644
--- a/contrib/libs/grpc/src/cpp/server/channel_argument_option.cc
+++ b/contrib/libs/grpc/src/cpp/server/channel_argument_option.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
- *
- */
+//
+//
+// 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.
+//
+//
#include <memory>
#include <util/generic/string.h>
@@ -25,7 +25,6 @@
#include <grpcpp/impl/server_builder_option.h>
#include <grpcpp/impl/server_builder_plugin.h>
#include <grpcpp/support/channel_arguments.h>
-#include <grpcpp/support/config.h>
namespace grpc {
@@ -71,4 +70,25 @@ std::unique_ptr<ServerBuilderOption> MakeChannelArgumentOption(
return std::unique_ptr<ServerBuilderOption>(new IntOption(name, value));
}
+std::unique_ptr<ServerBuilderOption> MakeChannelArgumentOption(
+ const TString& name, void* value) {
+ class PointerOption final : public ServerBuilderOption {
+ public:
+ PointerOption(const TString& name, void* value)
+ : name_(name), value_(value) {}
+
+ void UpdateArguments(ChannelArguments* args) override {
+ args->SetPointer(name_, value_);
+ }
+ void UpdatePlugins(
+ std::vector<std::unique_ptr<ServerBuilderPlugin>>* /*plugins*/)
+ override {}
+
+ private:
+ const TString name_;
+ void* value_;
+ };
+ return std::unique_ptr<ServerBuilderOption>(new PointerOption(name, value));
+}
+
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/server/channelz/channelz_service.cc b/contrib/libs/grpc/src/cpp/server/channelz/channelz_service.cc
index fae8f2b9fb..8ae823054e 100644
--- a/contrib/libs/grpc/src/cpp/server/channelz/channelz_service.cc
+++ b/contrib/libs/grpc/src/cpp/server/channelz/channelz_service.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
- *
- */
+//
+//
+// 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.
+//
+//
#include <grpc/support/port_platform.h>
diff --git a/contrib/libs/grpc/src/cpp/server/channelz/channelz_service.h b/contrib/libs/grpc/src/cpp/server/channelz/channelz_service.h
index 91936da959..a61a706402 100644
--- a/contrib/libs/grpc/src/cpp/server/channelz/channelz_service.h
+++ b/contrib/libs/grpc/src/cpp/server/channelz/channelz_service.h
@@ -1,23 +1,23 @@
-/*
- *
- * 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.
- *
- */
+//
+//
+// 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 GRPC_INTERNAL_CPP_SERVER_CHANNELZ_SERVICE_H
-#define GRPC_INTERNAL_CPP_SERVER_CHANNELZ_SERVICE_H
+#ifndef GRPC_SRC_CPP_SERVER_CHANNELZ_CHANNELZ_SERVICE_H
+#define GRPC_SRC_CPP_SERVER_CHANNELZ_CHANNELZ_SERVICE_H
#include <grpc/support/port_platform.h>
@@ -64,4 +64,4 @@ class ChannelzService final : public channelz::v1::Channelz::Service {
} // namespace grpc
-#endif // GRPC_INTERNAL_CPP_SERVER_CHANNELZ_SERVICE_H
+#endif // GRPC_SRC_CPP_SERVER_CHANNELZ_CHANNELZ_SERVICE_H
diff --git a/contrib/libs/grpc/src/cpp/server/channelz/channelz_service_plugin.cc b/contrib/libs/grpc/src/cpp/server/channelz/channelz_service_plugin.cc
index 07c74b6cdf..8ba040c5b9 100644
--- a/contrib/libs/grpc/src/cpp/server/channelz/channelz_service_plugin.cc
+++ b/contrib/libs/grpc/src/cpp/server/channelz/channelz_service_plugin.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
- *
- */
+//
+//
+// 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.
+//
+//
#include <grpc/support/port_platform.h>
@@ -26,7 +26,6 @@
#include <grpcpp/impl/server_builder_plugin.h>
#include <grpcpp/impl/server_initializer.h>
#include <grpcpp/server_builder.h>
-#include <grpcpp/support/config.h>
#include "src/cpp/server/channelz/channelz_service.h"
diff --git a/contrib/libs/grpc/src/cpp/server/create_default_thread_pool.cc b/contrib/libs/grpc/src/cpp/server/create_default_thread_pool.cc
index 89d5914d09..6d906955c7 100644
--- a/contrib/libs/grpc/src/cpp/server/create_default_thread_pool.cc
+++ b/contrib/libs/grpc/src/cpp/server/create_default_thread_pool.cc
@@ -1,22 +1,20 @@
-/*
- *
- * 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.
- *
- */
-
-#include <grpc/support/cpu.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.
+//
+//
#include "src/cpp/server/dynamic_thread_pool.h"
#include "src/cpp/server/thread_pool_interface.h"
@@ -27,9 +25,7 @@ namespace grpc {
namespace {
ThreadPoolInterface* CreateDefaultThreadPoolImpl() {
- int cores = gpr_cpu_num_cores();
- if (!cores) cores = 4;
- return new DynamicThreadPool(cores);
+ return new DynamicThreadPool();
}
CreateThreadPoolFunc g_ctp_impl = CreateDefaultThreadPoolImpl;
diff --git a/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.cc b/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.cc
deleted file mode 100644
index 2a3d5bc576..0000000000
--- a/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.cc
+++ /dev/null
@@ -1,122 +0,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.
- *
- */
-
-#include "src/cpp/server/dynamic_thread_pool.h"
-
-#include "src/core/lib/gprpp/thd.h"
-
-namespace grpc {
-
-DynamicThreadPool::DynamicThread::DynamicThread(DynamicThreadPool* pool)
- : pool_(pool),
- thd_(
- "grpcpp_dynamic_pool",
- [](void* th) {
- static_cast<DynamicThreadPool::DynamicThread*>(th)->ThreadFunc();
- },
- this) {
- thd_.Start();
-}
-DynamicThreadPool::DynamicThread::~DynamicThread() { thd_.Join(); }
-
-void DynamicThreadPool::DynamicThread::ThreadFunc() {
- pool_->ThreadFunc();
- // Now that we have killed ourselves, we should reduce the thread count
- grpc_core::MutexLock lock(&pool_->mu_);
- pool_->nthreads_--;
- // Move ourselves to dead list
- pool_->dead_threads_.push_back(this);
-
- if ((pool_->shutdown_) && (pool_->nthreads_ == 0)) {
- pool_->shutdown_cv_.Signal();
- }
-}
-
-void DynamicThreadPool::ThreadFunc() {
- for (;;) {
- // Wait until work is available or we are shutting down.
- grpc_core::ReleasableMutexLock lock(&mu_);
- if (!shutdown_ && callbacks_.empty()) {
- // If there are too many threads waiting, then quit this thread
- if (threads_waiting_ >= reserve_threads_) {
- break;
- }
- threads_waiting_++;
- cv_.Wait(&mu_);
- threads_waiting_--;
- }
- // Drain callbacks before considering shutdown to ensure all work
- // gets completed.
- if (!callbacks_.empty()) {
- auto cb = callbacks_.front();
- callbacks_.pop();
- lock.Release();
- cb();
- } else if (shutdown_) {
- break;
- }
- }
-}
-
-DynamicThreadPool::DynamicThreadPool(int reserve_threads)
- : shutdown_(false),
- reserve_threads_(reserve_threads),
- nthreads_(0),
- threads_waiting_(0) {
- for (int i = 0; i < reserve_threads_; i++) {
- grpc_core::MutexLock lock(&mu_);
- nthreads_++;
- new DynamicThread(this);
- }
-}
-
-void DynamicThreadPool::ReapThreads(std::list<DynamicThread*>* tlist) {
- for (auto t = tlist->begin(); t != tlist->end(); t = tlist->erase(t)) {
- delete *t;
- }
-}
-
-DynamicThreadPool::~DynamicThreadPool() {
- grpc_core::MutexLock lock(&mu_);
- shutdown_ = true;
- cv_.SignalAll();
- while (nthreads_ != 0) {
- shutdown_cv_.Wait(&mu_);
- }
- ReapThreads(&dead_threads_);
-}
-
-void DynamicThreadPool::Add(const std::function<void()>& callback) {
- grpc_core::MutexLock lock(&mu_);
- // Add works to the callbacks list
- callbacks_.push(callback);
- // Increase pool size or notify as needed
- if (threads_waiting_ == 0) {
- // Kick off a new thread
- nthreads_++;
- new DynamicThread(this);
- } else {
- cv_.Signal();
- }
- // Also use this chance to harvest dead threads
- if (!dead_threads_.empty()) {
- ReapThreads(&dead_threads_);
- }
-}
-
-} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h b/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h
index 34de51a59c..30da5d1de5 100644
--- a/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h
+++ b/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h
@@ -1,66 +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 GRPC_INTERNAL_CPP_DYNAMIC_THREAD_POOL_H
-#define GRPC_INTERNAL_CPP_DYNAMIC_THREAD_POOL_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 GRPC_SRC_CPP_SERVER_DYNAMIC_THREAD_POOL_H
+#define GRPC_SRC_CPP_SERVER_DYNAMIC_THREAD_POOL_H
#include <functional>
-#include <list>
-#include <queue>
+#include <memory>
+
+#include <grpc/event_engine/event_engine.h>
-#include "src/core/lib/gprpp/sync.h"
-#include "src/core/lib/gprpp/thd.h"
+#include "src/core/lib/event_engine/default_event_engine.h"
#include "src/cpp/server/thread_pool_interface.h"
namespace grpc {
class DynamicThreadPool final : public ThreadPoolInterface {
public:
- explicit DynamicThreadPool(int reserve_threads);
- ~DynamicThreadPool() override;
-
- void Add(const std::function<void()>& callback) override;
+ void Add(const std::function<void()>& callback) override {
+ event_engine_->Run(callback);
+ }
private:
- class DynamicThread {
- public:
- explicit DynamicThread(DynamicThreadPool* pool);
- ~DynamicThread();
-
- private:
- DynamicThreadPool* pool_;
- grpc_core::Thread thd_;
- void ThreadFunc();
- };
- grpc_core::Mutex mu_;
- grpc_core::CondVar cv_;
- grpc_core::CondVar shutdown_cv_;
- bool shutdown_;
- std::queue<std::function<void()>> callbacks_;
- int reserve_threads_;
- int nthreads_;
- int threads_waiting_;
- std::list<DynamicThread*> dead_threads_;
-
- void ThreadFunc();
- static void ReapThreads(std::list<DynamicThread*>* tlist);
+ std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine_ =
+ grpc_event_engine::experimental::GetDefaultEventEngine();
};
} // namespace grpc
-#endif // GRPC_INTERNAL_CPP_DYNAMIC_THREAD_POOL_H
+#endif // GRPC_SRC_CPP_SERVER_DYNAMIC_THREAD_POOL_H
diff --git a/contrib/libs/grpc/src/cpp/server/external_connection_acceptor_impl.cc b/contrib/libs/grpc/src/cpp/server/external_connection_acceptor_impl.cc
index 9f9acda7fa..e2cc8ea0f5 100644
--- a/contrib/libs/grpc/src/cpp/server/external_connection_acceptor_impl.cc
+++ b/contrib/libs/grpc/src/cpp/server/external_connection_acceptor_impl.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
- *
- */
+//
+//
+// 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.
+//
+//
#include "src/cpp/server/external_connection_acceptor_impl.h"
@@ -92,7 +92,7 @@ void ExternalConnectionAcceptorImpl::Start() {
}
void ExternalConnectionAcceptorImpl::SetToChannelArgs(ChannelArguments* args) {
- args->SetPointer(name_.c_str(), &handler_);
+ args->SetPointer(name_, &handler_);
}
} // namespace internal
diff --git a/contrib/libs/grpc/src/cpp/server/external_connection_acceptor_impl.h b/contrib/libs/grpc/src/cpp/server/external_connection_acceptor_impl.h
index 9e3723a206..7a53044950 100644
--- a/contrib/libs/grpc/src/cpp/server/external_connection_acceptor_impl.h
+++ b/contrib/libs/grpc/src/cpp/server/external_connection_acceptor_impl.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.
- *
- */
+//
+//
+// 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 SRC_CPP_SERVER_EXTERNAL_CONNECTION_ACCEPTOR_IMPL_H_
-#define SRC_CPP_SERVER_EXTERNAL_CONNECTION_ACCEPTOR_IMPL_H_
+#ifndef GRPC_SRC_CPP_SERVER_EXTERNAL_CONNECTION_ACCEPTOR_IMPL_H
+#define GRPC_SRC_CPP_SERVER_EXTERNAL_CONNECTION_ACCEPTOR_IMPL_H
#include <memory>
#include <util/generic/string.h>
@@ -26,7 +26,6 @@
#include <grpcpp/security/server_credentials.h>
#include <grpcpp/server_builder.h>
#include <grpcpp/support/channel_arguments.h>
-#include <grpcpp/support/config.h>
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/tcp_server.h"
@@ -70,4 +69,4 @@ class ExternalConnectionAcceptorImpl
} // namespace internal
} // namespace grpc
-#endif // SRC_CPP_SERVER_EXTERNAL_CONNECTION_ACCEPTOR_IMPL_H_
+#endif // GRPC_SRC_CPP_SERVER_EXTERNAL_CONNECTION_ACCEPTOR_IMPL_H
diff --git a/contrib/libs/grpc/src/cpp/server/health/default_health_check_service.cc b/contrib/libs/grpc/src/cpp/server/health/default_health_check_service.cc
index 4b0065234f..4c918cc3f3 100644
--- a/contrib/libs/grpc/src/cpp/server/health/default_health_check_service.cc
+++ b/contrib/libs/grpc/src/cpp/server/health/default_health_check_service.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include "src/cpp/server/health/default_health_check_service.h"
@@ -23,15 +23,14 @@
#include <memory>
#include <utility>
-#include "y_absl/memory/memory.h"
#include "upb/upb.h"
#include "upb/upb.hpp"
#include <grpc/slice.h>
#include <grpc/support/log.h>
-#include <grpcpp/impl/codegen/server_callback_handlers.h>
#include <grpcpp/impl/rpc_method.h>
#include <grpcpp/impl/rpc_service_method.h>
+#include <grpcpp/impl/server_callback_handlers.h>
#include <grpcpp/support/slice.h>
#include "src/proto/grpc/health/v1/health.upb.h"
@@ -111,7 +110,7 @@ void DefaultHealthCheckService::UnregisterWatch(
DefaultHealthCheckService::HealthCheckServiceImpl*
DefaultHealthCheckService::GetHealthCheckService() {
GPR_ASSERT(impl_ == nullptr);
- impl_ = y_absl::make_unique<HealthCheckServiceImpl>(this);
+ impl_ = std::make_unique<HealthCheckServiceImpl>(this);
return impl_.get();
}
diff --git a/contrib/libs/grpc/src/cpp/server/health/default_health_check_service.h b/contrib/libs/grpc/src/cpp/server/health/default_health_check_service.h
index 37efa5f0cc..7ed57636a2 100644
--- a/contrib/libs/grpc/src/cpp/server/health/default_health_check_service.h
+++ b/contrib/libs/grpc/src/cpp/server/health/default_health_check_service.h
@@ -1,23 +1,23 @@
-/*
- *
- * 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 GRPC_INTERNAL_CPP_SERVER_DEFAULT_HEALTH_CHECK_SERVICE_H
-#define GRPC_INTERNAL_CPP_SERVER_DEFAULT_HEALTH_CHECK_SERVICE_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 GRPC_SRC_CPP_SERVER_HEALTH_DEFAULT_HEALTH_CHECK_SERVICE_H
+#define GRPC_SRC_CPP_SERVER_HEALTH_DEFAULT_HEALTH_CHECK_SERVICE_H
#include <stddef.h>
@@ -30,10 +30,9 @@
#include <grpcpp/grpcpp.h>
#include <grpcpp/health_check_service_interface.h>
-#include <grpcpp/impl/codegen/sync.h>
#include <grpcpp/impl/service_type.h>
+#include <grpcpp/impl/sync.h>
#include <grpcpp/support/byte_buffer.h>
-#include <grpcpp/support/config.h>
#include <grpcpp/support/server_callback.h>
#include <grpcpp/support/status.h>
@@ -147,4 +146,4 @@ class DefaultHealthCheckService final : public HealthCheckServiceInterface {
} // namespace grpc
-#endif // GRPC_INTERNAL_CPP_SERVER_DEFAULT_HEALTH_CHECK_SERVICE_H
+#endif // GRPC_SRC_CPP_SERVER_HEALTH_DEFAULT_HEALTH_CHECK_SERVICE_H
diff --git a/contrib/libs/grpc/src/cpp/server/health/health_check_service.cc b/contrib/libs/grpc/src/cpp/server/health/health_check_service.cc
index a0fa2d62f5..8be791d6bf 100644
--- a/contrib/libs/grpc/src/cpp/server/health/health_check_service.cc
+++ b/contrib/libs/grpc/src/cpp/server/health/health_check_service.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include <grpcpp/health_check_service_interface.h>
diff --git a/contrib/libs/grpc/src/cpp/server/health/health_check_service_server_builder_option.cc b/contrib/libs/grpc/src/cpp/server/health/health_check_service_server_builder_option.cc
index bd32c32790..c4eac98b47 100644
--- a/contrib/libs/grpc/src/cpp/server/health/health_check_service_server_builder_option.cc
+++ b/contrib/libs/grpc/src/cpp/server/health/health_check_service_server_builder_option.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include <memory>
#include <utility>
diff --git a/contrib/libs/grpc/src/cpp/server/insecure_server_credentials.cc b/contrib/libs/grpc/src/cpp/server/insecure_server_credentials.cc
index 7720d53a3e..77412a2c8c 100644
--- a/contrib/libs/grpc/src/cpp/server/insecure_server_credentials.cc
+++ b/contrib/libs/grpc/src/cpp/server/insecure_server_credentials.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include <memory>
#include <util/generic/string.h>
@@ -22,11 +22,9 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
-#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/support/log.h>
#include <grpcpp/security/auth_metadata_processor.h>
#include <grpcpp/security/server_credentials.h>
-#include <grpcpp/support/config.h>
namespace grpc {
namespace {
diff --git a/contrib/libs/grpc/src/cpp/server/orca/call_metric_recorder.cc b/contrib/libs/grpc/src/cpp/server/orca/call_metric_recorder.cc
deleted file mode 100644
index 6284064a6a..0000000000
--- a/contrib/libs/grpc/src/cpp/server/orca/call_metric_recorder.cc
+++ /dev/null
@@ -1,117 +0,0 @@
-//
-// Copyright 2022 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.
-//
-
-#include <stddef.h>
-
-#include <map>
-#include <util/generic/string.h>
-#include <util/string/cast.h>
-#include <utility>
-
-#include "y_absl/strings/string_view.h"
-#include "y_absl/types/optional.h"
-#include "upb/upb.h"
-#include "upb/upb.hpp"
-#include "xds/data/orca/v3/orca_load_report.upb.h"
-
-#include <grpcpp/ext/call_metric_recorder.h>
-#include <grpcpp/impl/codegen/sync.h>
-#include <grpcpp/support/config.h>
-#include <grpcpp/support/string_ref.h>
-
-#include "src/core/ext/filters/client_channel/lb_policy/backend_metric_data.h"
-#include "src/core/lib/resource_quota/arena.h"
-
-namespace grpc {
-namespace experimental {
-
-CallMetricRecorder::CallMetricRecorder(grpc_core::Arena* arena)
- : backend_metric_data_(arena->New<grpc_core::BackendMetricData>()) {}
-
-CallMetricRecorder::~CallMetricRecorder() {
- backend_metric_data_->~BackendMetricData();
-}
-
-CallMetricRecorder& CallMetricRecorder::RecordCpuUtilizationMetric(
- double value) {
- internal::MutexLock lock(&mu_);
- backend_metric_data_->cpu_utilization = value;
- return *this;
-}
-
-CallMetricRecorder& CallMetricRecorder::RecordMemoryUtilizationMetric(
- double value) {
- internal::MutexLock lock(&mu_);
- backend_metric_data_->mem_utilization = value;
- return *this;
-}
-
-CallMetricRecorder& CallMetricRecorder::RecordUtilizationMetric(
- grpc::string_ref name, double value) {
- internal::MutexLock lock(&mu_);
- y_absl::string_view name_sv(name.data(), name.length());
- backend_metric_data_->utilization[name_sv] = value;
- return *this;
-}
-
-CallMetricRecorder& CallMetricRecorder::RecordRequestCostMetric(
- grpc::string_ref name, double value) {
- internal::MutexLock lock(&mu_);
- y_absl::string_view name_sv(name.data(), name.length());
- backend_metric_data_->request_cost[name_sv] = value;
- return *this;
-}
-
-y_absl::optional<TString> CallMetricRecorder::CreateSerializedReport() {
- upb::Arena arena;
- internal::MutexLock lock(&mu_);
- bool has_data = backend_metric_data_->cpu_utilization != -1 ||
- backend_metric_data_->mem_utilization != -1 ||
- !backend_metric_data_->utilization.empty() ||
- !backend_metric_data_->request_cost.empty();
- if (!has_data) {
- return y_absl::nullopt;
- }
- xds_data_orca_v3_OrcaLoadReport* response =
- xds_data_orca_v3_OrcaLoadReport_new(arena.ptr());
- if (backend_metric_data_->cpu_utilization != -1) {
- xds_data_orca_v3_OrcaLoadReport_set_cpu_utilization(
- response, backend_metric_data_->cpu_utilization);
- }
- if (backend_metric_data_->mem_utilization != -1) {
- xds_data_orca_v3_OrcaLoadReport_set_mem_utilization(
- response, backend_metric_data_->mem_utilization);
- }
- for (const auto& p : backend_metric_data_->request_cost) {
- xds_data_orca_v3_OrcaLoadReport_request_cost_set(
- response,
- upb_StringView_FromDataAndSize(p.first.data(), p.first.size()),
- p.second, arena.ptr());
- }
- for (const auto& p : backend_metric_data_->utilization) {
- xds_data_orca_v3_OrcaLoadReport_utilization_set(
- response,
- upb_StringView_FromDataAndSize(p.first.data(), p.first.size()),
- p.second, arena.ptr());
- }
- size_t buf_length;
- char* buf = xds_data_orca_v3_OrcaLoadReport_serialize(response, arena.ptr(),
- &buf_length);
- return TString(buf, buf_length);
-}
-
-} // namespace experimental
-} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/server/secure_server_credentials.cc b/contrib/libs/grpc/src/cpp/server/secure_server_credentials.cc
index 018b04d38d..8f862835a6 100644
--- a/contrib/libs/grpc/src/cpp/server/secure_server_credentials.cc
+++ b/contrib/libs/grpc/src/cpp/server/secure_server_credentials.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include "src/cpp/server/secure_server_credentials.h"
diff --git a/contrib/libs/grpc/src/cpp/server/secure_server_credentials.h b/contrib/libs/grpc/src/cpp/server/secure_server_credentials.h
index 20d3c470fe..8a1151747e 100644
--- a/contrib/libs/grpc/src/cpp/server/secure_server_credentials.h
+++ b/contrib/libs/grpc/src/cpp/server/secure_server_credentials.h
@@ -1,23 +1,23 @@
-/*
- *
- * 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 GRPC_INTERNAL_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H
-#define GRPC_INTERNAL_CPP_SERVER_SECURE_SERVER_CREDENTIALS_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 GRPC_SRC_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H
+#define GRPC_SRC_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H
#include <stddef.h>
@@ -27,10 +27,8 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
-#include <grpc/impl/codegen/grpc_types.h>
#include <grpcpp/security/auth_metadata_processor.h>
#include <grpcpp/security/server_credentials.h>
-#include <grpcpp/support/config.h>
#include "src/cpp/server/thread_pool_interface.h"
@@ -86,4 +84,4 @@ class SecureServerCredentials final : public ServerCredentials {
} // namespace grpc
-#endif // GRPC_INTERNAL_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H
+#endif // GRPC_SRC_CPP_SERVER_SECURE_SERVER_CREDENTIALS_H
diff --git a/contrib/libs/grpc/src/cpp/server/server_builder.cc b/contrib/libs/grpc/src/cpp/server/server_builder.cc
index 9b30a4c723..92a06dfd58 100644
--- a/contrib/libs/grpc/src/cpp/server/server_builder.cc
+++ b/contrib/libs/grpc/src/cpp/server/server_builder.cc
@@ -1,27 +1,26 @@
-/*
- *
- * 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.
+//
+//
#include <limits.h>
#include <stdint.h>
#include <string.h>
#include <algorithm>
-#include <iterator>
#include <memory>
#include <util/generic/string.h>
#include <util/string/cast.h>
@@ -29,13 +28,11 @@
#include <vector>
#include <grpc/grpc.h>
-#include <grpc/impl/codegen/compression_types.h>
-#include <grpc/impl/codegen/grpc_types.h>
+#include <grpc/impl/compression_types.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/workaround_list.h>
#include <grpcpp/completion_queue.h>
-#include <grpcpp/impl/codegen/server_interface.h>
#include <grpcpp/impl/server_builder_option.h>
#include <grpcpp/impl/server_builder_plugin.h>
#include <grpcpp/impl/service_type.h>
@@ -45,8 +42,8 @@
#include <grpcpp/server.h>
#include <grpcpp/server_builder.h>
#include <grpcpp/server_context.h>
+#include <grpcpp/server_interface.h>
#include <grpcpp/support/channel_arguments.h>
-#include <grpcpp/support/config.h>
#include <grpcpp/support/server_interceptor.h>
#include "src/core/lib/gpr/string.h"
@@ -161,6 +158,13 @@ void ServerBuilder::experimental_type::SetAuthorizationPolicyProvider(
builder_->authorization_provider_ = std::move(provider);
}
+void ServerBuilder::experimental_type::EnableCallMetricRecording(
+ experimental::ServerMetricRecorder* server_metric_recorder) {
+ builder_->AddChannelArgument(GRPC_ARG_SERVER_CALL_METRIC_RECORDING, 1);
+ GPR_ASSERT(builder_->server_metric_recorder_ == nullptr);
+ builder_->server_metric_recorder_ = server_metric_recorder;
+}
+
ServerBuilder& ServerBuilder::SetOption(
std::unique_ptr<ServerBuilderOption> option) {
options_.push_back(std::move(option));
@@ -358,18 +362,11 @@ std::unique_ptr<grpc::Server> ServerBuilder::BuildAndStart() {
gpr_log(GPR_INFO, "Callback server.");
}
- // Merge the application and internal interceptors together.
- // Internal interceptors go first.
- auto creators = std::move(internal_interceptor_creators_);
- creators.insert(creators.end(),
- std::make_move_iterator(interceptor_creators_.begin()),
- std::make_move_iterator(interceptor_creators_.end()));
-
std::unique_ptr<grpc::Server> server(new grpc::Server(
&args, sync_server_cqs, sync_server_settings_.min_pollers,
sync_server_settings_.max_pollers, sync_server_settings_.cq_timeout_msec,
std::move(acceptors_), server_config_fetcher_, resource_quota_,
- std::move(creators)));
+ std::move(interceptor_creators_), server_metric_recorder_));
ServerInitializer* initializer = server->initializer();
diff --git a/contrib/libs/grpc/src/cpp/server/server_callback.cc b/contrib/libs/grpc/src/cpp/server/server_callback.cc
index e62052b36f..be02a22ccd 100644
--- a/contrib/libs/grpc/src/cpp/server/server_callback.cc
+++ b/contrib/libs/grpc/src/cpp/server/server_callback.cc
@@ -1,21 +1,22 @@
-/*
- * 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.
- *
- */
+//
+// 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.
+//
+//
+
+#include "y_absl/status/status.h"
-#include <grpcpp/impl/codegen/server_callback.h>
#include <grpcpp/support/server_callback.h>
#include "src/core/lib/iomgr/closure.h"
@@ -48,7 +49,7 @@ void ServerCallbackCall::ScheduleOnDone(bool inline_ondone) {
}
};
ClosureWithArg* arg = new ClosureWithArg(this);
- grpc_core::Executor::Run(&arg->closure, GRPC_ERROR_NONE);
+ grpc_core::Executor::Run(&arg->closure, y_absl::OkStatus());
}
}
@@ -78,7 +79,7 @@ void ServerCallbackCall::CallOnCancel(ServerReactor* reactor) {
}
};
ClosureWithArg* arg = new ClosureWithArg(this, reactor);
- grpc_core::Executor::Run(&arg->closure, GRPC_ERROR_NONE);
+ grpc_core::Executor::Run(&arg->closure, y_absl::OkStatus());
}
}
diff --git a/contrib/libs/grpc/src/cpp/server/server_cc.cc b/contrib/libs/grpc/src/cpp/server/server_cc.cc
index 3b3d021639..ca74152843 100644
--- a/contrib/libs/grpc/src/cpp/server/server_cc.cc
+++ b/contrib/libs/grpc/src/cpp/server/server_cc.cc
@@ -1,19 +1,19 @@
-/*
- * 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.
+//
+//
#include <limits.h>
#include <string.h>
@@ -26,15 +26,14 @@
#include <sstream>
#include <util/generic/string.h>
#include <util/string/cast.h>
+#include <type_traits>
#include <utility>
#include <vector>
-#include "y_absl/memory/memory.h"
+#include "y_absl/status/status.h"
#include <grpc/byte_buffer.h>
#include <grpc/grpc.h>
-#include <grpc/impl/codegen/gpr_types.h>
-#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
@@ -44,25 +43,23 @@
#include <grpcpp/generic/async_generic_service.h>
#include <grpcpp/health_check_service_interface.h>
#include <grpcpp/impl/call.h>
+#include <grpcpp/impl/call_op_set.h>
#include <grpcpp/impl/call_op_set_interface.h>
-#include <grpcpp/impl/codegen/call_op_set.h>
-#include <grpcpp/impl/codegen/completion_queue_tag.h>
-#include <grpcpp/impl/codegen/interceptor_common.h>
-#include <grpcpp/impl/codegen/metadata_map.h>
-#include <grpcpp/impl/codegen/server_callback_handlers.h>
-#include <grpcpp/impl/codegen/server_interface.h>
-#include <grpcpp/impl/codegen/sync.h>
-#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/impl/completion_queue_tag.h>
+#include <grpcpp/impl/interceptor_common.h>
+#include <grpcpp/impl/metadata_map.h>
#include <grpcpp/impl/rpc_method.h>
#include <grpcpp/impl/rpc_service_method.h>
+#include <grpcpp/impl/server_callback_handlers.h>
#include <grpcpp/impl/server_initializer.h>
#include <grpcpp/impl/service_type.h>
+#include <grpcpp/impl/sync.h>
#include <grpcpp/security/server_credentials.h>
#include <grpcpp/server.h>
#include <grpcpp/server_context.h>
+#include <grpcpp/server_interface.h>
#include <grpcpp/support/channel_arguments.h>
#include <grpcpp/support/client_interceptor.h>
-#include <grpcpp/support/config.h>
#include <grpcpp/support/interceptor.h>
#include <grpcpp/support/method_handler.h>
#include <grpcpp/support/server_interceptor.h>
@@ -71,7 +68,6 @@
#include "src/core/ext/transport/inproc/inproc_transport.h"
#include "src/core/lib/gprpp/manual_constructor.h"
-#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/resource_quota/api.h"
@@ -156,12 +152,14 @@ ServerInterface::BaseAsyncRequest::BaseAsyncRequest(
delete_on_finalize_(delete_on_finalize),
call_(nullptr),
done_intercepting_(false) {
- /* Set up interception state partially for the receive ops. call_wrapper_ is
- * not filled at this point, but it will be filled before the interceptors are
- * run. */
+ // Set up interception state partially for the receive ops. call_wrapper_ is
+ // not filled at this point, but it will be filled before the interceptors are
+ // run.
interceptor_methods_.SetCall(&call_wrapper_);
interceptor_methods_.SetReverse();
call_cq_->RegisterAvalanching(); // This op will trigger more ops
+ call_metric_recording_enabled_ = server_->call_metric_recording_enabled();
+ server_metric_recorder_ = server_->server_metric_recorder();
}
ServerInterface::BaseAsyncRequest::~BaseAsyncRequest() {
@@ -177,7 +175,8 @@ bool ServerInterface::BaseAsyncRequest::FinalizeResult(void** tag,
}
return true;
}
- context_->set_call(call_);
+ context_->set_call(call_, call_metric_recording_enabled_,
+ server_metric_recorder_);
context_->cq_ = call_cq_;
if (call_wrapper_.call() == nullptr) {
// Fill it since it is empty.
@@ -221,7 +220,7 @@ void ServerInterface::BaseAsyncRequest::
grpc_core::ExecCtx exec_ctx;
grpc_cq_begin_op(notification_cq_->cq(), this);
grpc_cq_end_op(
- notification_cq_->cq(), this, GRPC_ERROR_NONE,
+ notification_cq_->cq(), this, y_absl::OkStatus(),
[](void* /*arg*/, grpc_cq_completion* completion) { delete completion; },
nullptr, new grpc_cq_completion());
}
@@ -426,7 +425,8 @@ class Server::SyncRequest final : public grpc::internal::CompletionQueueTag {
call_, server_, &cq_, server_->max_receive_message_size(),
ctx_->ctx.set_server_rpc_info(method_->name(), method_->method_type(),
server_->interceptor_creators_));
- ctx_->ctx.set_call(call_);
+ ctx_->ctx.set_call(call_, server_->call_metric_recording_enabled(),
+ server_->server_metric_recorder());
ctx_->ctx.cq_ = &cq_;
request_metadata_.count = 0;
@@ -654,7 +654,9 @@ class Server::CallbackRequest final
}
// Bind the call, deadline, and metadata from what we got
- req_->ctx_->set_call(req_->call_);
+ req_->ctx_->set_call(req_->call_,
+ req_->server_->call_metric_recording_enabled(),
+ req_->server_->server_metric_recorder());
req_->ctx_->cq_ = req_->cq_;
req_->ctx_->BindDeadlineAndMetadata(req_->deadline_,
&req_->request_metadata_);
@@ -841,7 +843,7 @@ class Server::SyncRequestThreadManager : public grpc::ThreadManager {
void AddUnknownSyncMethod() {
if (has_sync_method_) {
- unknown_method_ = y_absl::make_unique<grpc::internal::RpcServiceMethod>(
+ unknown_method_ = std::make_unique<grpc::internal::RpcServiceMethod>(
"unknown", grpc::internal::RpcMethod::BIDI_STREAMING,
new grpc::internal::UnknownMethodHandler(kUnknownRpcMethod));
grpc_core::Server::FromC(server_->server())
@@ -885,7 +887,6 @@ class Server::SyncRequestThreadManager : public grpc::ThreadManager {
std::shared_ptr<Server::GlobalCallbacks> global_callbacks_;
};
-static grpc::internal::GrpcLibraryInitializer g_gli_initializer;
Server::Server(
grpc::ChannelArguments* args,
std::shared_ptr<std::vector<std::unique_ptr<grpc::ServerCompletionQueue>>>
@@ -897,7 +898,8 @@ Server::Server(
grpc_resource_quota* server_rq,
std::vector<
std::unique_ptr<grpc::experimental::ServerInterceptorFactoryInterface>>
- interceptor_creators)
+ interceptor_creators,
+ experimental::ServerMetricRecorder* server_metric_recorder)
: acceptors_(std::move(acceptors)),
interceptor_creators_(std::move(interceptor_creators)),
max_receive_message_size_(INT_MIN),
@@ -907,8 +909,8 @@ Server::Server(
shutdown_notified_(false),
server_(nullptr),
server_initializer_(new ServerInitializer(this)),
- health_check_service_disabled_(false) {
- g_gli_initializer.summon();
+ health_check_service_disabled_(false),
+ server_metric_recorder_(server_metric_recorder) {
gpr_once_init(&grpc::g_once_init_callbacks, grpc::InitGlobalCallbacks);
global_callbacks_ = grpc::g_callbacks;
global_callbacks_->UpdateArguments(args);
@@ -955,6 +957,10 @@ Server::Server(
strcmp(channel_args.args[i].key, GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH)) {
max_receive_message_size_ = channel_args.args[i].value.integer;
}
+ if (0 == strcmp(channel_args.args[i].key,
+ GRPC_ARG_SERVER_CALL_METRIC_RECORDING)) {
+ call_metric_recording_enabled_ = channel_args.args[i].value.integer;
+ }
}
server_ = grpc_server_create(&channel_args, nullptr);
grpc_server_set_config_fetcher(server_, server_config_fetcher);
@@ -1163,7 +1169,7 @@ void Server::Start(grpc::ServerCompletionQueue** cqs, size_t num_cqs) {
// explicit one.
if (health_check_service_ == nullptr && !health_check_service_disabled_ &&
grpc::DefaultHealthCheckServiceEnabled()) {
- auto default_hc_service = y_absl::make_unique<DefaultHealthCheckService>();
+ auto default_hc_service = std::make_unique<DefaultHealthCheckService>();
auto* hc_service_impl = default_hc_service->GetHealthCheckService();
health_check_service_ = std::move(default_hc_service);
RegisterService(nullptr, hc_service_impl);
@@ -1196,7 +1202,7 @@ void Server::Start(grpc::ServerCompletionQueue** cqs, size_t num_cqs) {
bool unknown_rpc_needed =
!has_async_generic_service_ && !has_callback_generic_service_;
if (unknown_rpc_needed && has_callback_methods_) {
- unimplemented_service_ = y_absl::make_unique<grpc::CallbackGenericService>();
+ unimplemented_service_ = std::make_unique<grpc::CallbackGenericService>();
RegisterCallbackGenericService(unimplemented_service_.get());
unknown_rpc_needed = false;
}
@@ -1221,7 +1227,7 @@ void Server::Start(grpc::ServerCompletionQueue** cqs, size_t num_cqs) {
// to deal with the case of thread exhaustion
if (sync_server_cqs_ != nullptr && !sync_server_cqs_->empty()) {
resource_exhausted_handler_ =
- y_absl::make_unique<grpc::internal::ResourceExhaustedHandler>(
+ std::make_unique<grpc::internal::ResourceExhaustedHandler>(
kServerThreadpoolExhausted);
}
diff --git a/contrib/libs/grpc/src/cpp/server/server_context.cc b/contrib/libs/grpc/src/cpp/server/server_context.cc
index 7f1ef4d617..9ac95695ba 100644
--- a/contrib/libs/grpc/src/cpp/server/server_context.cc
+++ b/contrib/libs/grpc/src/cpp/server/server_context.cc
@@ -1,26 +1,27 @@
-/*
- *
- * 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.
+//
+//
#include <assert.h>
#include <atomic>
#include <cstdlib>
#include <functional>
+#include <initializer_list>
#include <map>
#include <new>
#include <util/generic/string.h>
@@ -28,13 +29,12 @@
#include <utility>
#include <vector>
+#include "y_absl/strings/str_format.h"
#include "y_absl/strings/string_view.h"
#include <grpc/compression.h>
#include <grpc/grpc.h>
-#include <grpc/impl/codegen/compression_types.h>
-#include <grpc/impl/codegen/gpr_types.h>
-#include <grpc/impl/codegen/grpc_types.h>
+#include <grpc/impl/compression_types.h>
#include <grpc/load_reporting.h>
#include <grpc/status.h>
#include <grpc/support/alloc.h>
@@ -42,30 +42,30 @@
#include <grpc/support/time.h>
#include <grpcpp/completion_queue.h>
#include <grpcpp/ext/call_metric_recorder.h>
+#include <grpcpp/ext/server_metric_recorder.h>
#include <grpcpp/impl/call.h>
+#include <grpcpp/impl/call_op_set.h>
#include <grpcpp/impl/call_op_set_interface.h>
-#include <grpcpp/impl/codegen/call_op_set.h>
-#include <grpcpp/impl/codegen/callback_common.h>
-#include <grpcpp/impl/codegen/completion_queue_tag.h>
-#include <grpcpp/impl/codegen/interceptor_common.h>
-#include <grpcpp/impl/codegen/metadata_map.h>
-#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/impl/completion_queue_tag.h>
+#include <grpcpp/impl/interceptor_common.h>
+#include <grpcpp/impl/metadata_map.h>
#include <grpcpp/server_context.h>
-#include <grpcpp/support/config.h>
+#include <grpcpp/support/callback_common.h>
#include <grpcpp/support/interceptor.h>
#include <grpcpp/support/server_callback.h>
#include <grpcpp/support/server_interceptor.h>
#include <grpcpp/support/string_ref.h>
+#include "src/core/lib/channel/context.h"
+#include "src/core/lib/gprpp/crash.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/surface/call.h"
+#include "src/cpp/server/backend_metric_recorder.h"
namespace grpc {
-static internal::GrpcLibraryInitializer g_gli_initializer;
-
// CompletionOp
class ServerContextBase::CompletionOp final
@@ -138,15 +138,15 @@ class ServerContextBase::CompletionOp final
// This will be called while interceptors are run if the RPC is a hijacked
// RPC. This should set hijacking state for each of the ops.
void SetHijackingState() override {
- /* Servers don't allow hijacking */
- GPR_ASSERT(false);
+ // Servers don't allow hijacking
+ grpc_core::Crash("unreachable");
}
- /* Should be called after interceptors are done running */
+ // Should be called after interceptors are done running
void ContinueFillOpsAfterInterception() override {}
- /* Should be called after interceptors are done running on the finalize result
- * path */
+ // Should be called after interceptors are done running on the finalize result
+ // path
void ContinueFinalizeResultAfterInterception() override {
done_intercepting_ = true;
if (!has_tag_) {
@@ -155,7 +155,7 @@ class ServerContextBase::CompletionOp final
// Unref can delete this, so do not access anything from this afterward.
return;
}
- /* Start a phony op so that we can return the tag */
+ // Start a phony op so that we can return the tag
GPR_ASSERT(grpc_call_start_batch(call_.call(), nullptr, 0, core_cq_tag_,
nullptr) == GRPC_CALL_OK);
}
@@ -200,7 +200,7 @@ void ServerContextBase::CompletionOp::FillOps(internal::Call* call) {
// explanatory log on failure.
GPR_ASSERT(grpc_call_start_batch(call->call(), &ops, 1, core_cq_tag_,
nullptr) == GRPC_CALL_OK);
- /* No interceptors to run here */
+ // No interceptors to run here
}
bool ServerContextBase::CompletionOp::FinalizeResult(void** tag, bool* status) {
@@ -242,7 +242,7 @@ bool ServerContextBase::CompletionOp::FinalizeResult(void** tag, bool* status) {
if (call_cancel && callback_controller_ != nullptr) {
callback_controller_->MaybeCallOnCancel();
}
- /* Add interception point and run through interceptors */
+ // Add interception point and run through interceptors
interceptor_methods_.AddInterceptionHookPoint(
experimental::InterceptionHookPoints::POST_RECV_CLOSE);
if (interceptor_methods_.RunInterceptors()) {
@@ -262,9 +262,7 @@ bool ServerContextBase::CompletionOp::FinalizeResult(void** tag, bool* status) {
// ServerContextBase body
ServerContextBase::ServerContextBase()
- : deadline_(gpr_inf_future(GPR_CLOCK_REALTIME)) {
- g_gli_initializer.summon();
-}
+ : deadline_(gpr_inf_future(GPR_CLOCK_REALTIME)) {}
ServerContextBase::ServerContextBase(gpr_timespec deadline,
grpc_metadata_array* arr)
@@ -374,9 +372,8 @@ void ServerContextBase::set_compression_algorithm(
compression_algorithm_ = algorithm;
const char* algorithm_name = nullptr;
if (!grpc_compression_algorithm_name(algorithm, &algorithm_name)) {
- gpr_log(GPR_ERROR, "Name for compression algorithm '%d' unknown.",
- algorithm);
- abort();
+ grpc_core::Crash(y_absl::StrFormat(
+ "Name for compression algorithm '%d' unknown.", algorithm));
}
GPR_ASSERT(algorithm_name != nullptr);
AddInitialMetadata(GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY, algorithm_name);
@@ -405,10 +402,16 @@ void ServerContextBase::SetLoadReportingCosts(
}
}
-void ServerContextBase::CreateCallMetricRecorder() {
+void ServerContextBase::CreateCallMetricRecorder(
+ experimental::ServerMetricRecorder* server_metric_recorder) {
+ if (call_.call == nullptr) return;
GPR_ASSERT(call_metric_recorder_ == nullptr);
grpc_core::Arena* arena = grpc_call_get_arena(call_.call);
- call_metric_recorder_ = arena->New<experimental::CallMetricRecorder>(arena);
+ auto* backend_metric_state =
+ arena->New<BackendMetricState>(server_metric_recorder);
+ call_metric_recorder_ = backend_metric_state;
+ grpc_call_context_set(call_.call, GRPC_CONTEXT_BACKEND_METRIC_PROVIDER,
+ backend_metric_state, nullptr);
}
grpc::string_ref ServerContextBase::ExperimentalGetAuthority() const {
diff --git a/contrib/libs/grpc/src/cpp/server/server_credentials.cc b/contrib/libs/grpc/src/cpp/server/server_credentials.cc
deleted file mode 100644
index 454e8b4e9d..0000000000
--- a/contrib/libs/grpc/src/cpp/server/server_credentials.cc
+++ /dev/null
@@ -1,29 +0,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.
- *
- */
-
-#include <grpcpp/impl/grpc_library.h>
-#include <grpcpp/security/server_credentials.h>
-
-namespace grpc {
-
-static internal::GrpcLibraryInitializer g_gli_initializer;
-ServerCredentials::ServerCredentials() { g_gli_initializer.summon(); }
-
-ServerCredentials::~ServerCredentials() {}
-
-} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/server/server_posix.cc b/contrib/libs/grpc/src/cpp/server/server_posix.cc
index 01c75c25cd..ecc1848a1f 100644
--- a/contrib/libs/grpc/src/cpp/server/server_posix.cc
+++ b/contrib/libs/grpc/src/cpp/server/server_posix.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include <grpc/grpc.h>
#include <grpc/grpc_posix.h>
diff --git a/contrib/libs/grpc/src/cpp/server/thread_pool_interface.h b/contrib/libs/grpc/src/cpp/server/thread_pool_interface.h
index 028842a776..cb31c7cd3a 100644
--- a/contrib/libs/grpc/src/cpp/server/thread_pool_interface.h
+++ b/contrib/libs/grpc/src/cpp/server/thread_pool_interface.h
@@ -1,23 +1,23 @@
-/*
- *
- * 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 GRPC_INTERNAL_CPP_THREAD_POOL_INTERFACE_H
-#define GRPC_INTERNAL_CPP_THREAD_POOL_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 GRPC_SRC_CPP_SERVER_THREAD_POOL_INTERFACE_H
+#define GRPC_SRC_CPP_SERVER_THREAD_POOL_INTERFACE_H
#include <functional>
@@ -40,4 +40,4 @@ ThreadPoolInterface* CreateDefaultThreadPool();
} // namespace grpc
-#endif // GRPC_INTERNAL_CPP_THREAD_POOL_INTERFACE_H
+#endif // GRPC_SRC_CPP_SERVER_THREAD_POOL_INTERFACE_H
diff --git a/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.cc b/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.cc
index d6144f9409..b5461be677 100644
--- a/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.cc
+++ b/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.cc
@@ -1,29 +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.
- *
- */
+//
+//
+// 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.
+//
+//
#include "src/cpp/thread_manager/thread_manager.h"
-#include <stdlib.h>
-
#include <climits>
+#include <initializer_list>
+
+#include "y_absl/strings/str_format.h"
#include <grpc/support/log.h>
+#include "src/core/lib/gprpp/crash.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/resource_quota/resource_quota.h"
@@ -126,11 +128,10 @@ void ThreadManager::CleanupCompletedThreads() {
void ThreadManager::Initialize() {
if (!thread_quota_->Reserve(min_pollers_)) {
- gpr_log(GPR_ERROR,
- "No thread quota available to even create the minimum required "
- "polling threads (i.e %d). Unable to start the thread manager",
- min_pollers_);
- abort();
+ grpc_core::Crash(y_absl::StrFormat(
+ "No thread quota available to even create the minimum required "
+ "polling threads (i.e %d). Unable to start the thread manager",
+ min_pollers_));
}
{
diff --git a/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.h b/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.h
index b2bbba7c6e..c15eaa2be8 100644
--- a/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.h
+++ b/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.h
@@ -1,23 +1,23 @@
-/*
- *
- * 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 GRPC_INTERNAL_CPP_THREAD_MANAGER_H
-#define GRPC_INTERNAL_CPP_THREAD_MANAGER_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 GRPC_SRC_CPP_THREAD_MANAGER_THREAD_MANAGER_H
+#define GRPC_SRC_CPP_THREAD_MANAGER_THREAD_MANAGER_H
#include <list>
@@ -176,4 +176,4 @@ class ThreadManager {
} // namespace grpc
-#endif // GRPC_INTERNAL_CPP_THREAD_MANAGER_H
+#endif // GRPC_SRC_CPP_THREAD_MANAGER_THREAD_MANAGER_H
diff --git a/contrib/libs/grpc/src/cpp/util/byte_buffer_cc.cc b/contrib/libs/grpc/src/cpp/util/byte_buffer_cc.cc
index 38441ed617..acb60921df 100644
--- a/contrib/libs/grpc/src/cpp/util/byte_buffer_cc.cc
+++ b/contrib/libs/grpc/src/cpp/util/byte_buffer_cc.cc
@@ -1,37 +1,34 @@
-/*
- *
- * 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.
+//
+//
#include <vector>
#include <grpc/byte_buffer.h>
#include <grpc/byte_buffer_reader.h>
-#include <grpc/impl/codegen/compression_types.h>
-#include <grpc/impl/codegen/grpc_types.h>
+#include <grpc/grpc.h>
+#include <grpc/impl/compression_types.h>
#include <grpc/slice.h>
-#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/support/byte_buffer.h>
#include <grpcpp/support/slice.h>
#include <grpcpp/support/status.h>
namespace grpc {
-static internal::GrpcLibraryInitializer g_gli_initializer;
-
Status ByteBuffer::TrySingleSlice(Slice* slice) const {
if (!buffer_) {
return Status(StatusCode::FAILED_PRECONDITION, "Buffer not initialized");
diff --git a/contrib/libs/grpc/src/cpp/util/status.cc b/contrib/libs/grpc/src/cpp/util/status.cc
index 93696d8126..0a130bca84 100644
--- a/contrib/libs/grpc/src/cpp/util/status.cc
+++ b/contrib/libs/grpc/src/cpp/util/status.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include <grpcpp/support/status.h>
diff --git a/contrib/libs/grpc/src/cpp/util/string_ref.cc b/contrib/libs/grpc/src/cpp/util/string_ref.cc
index 35348d6138..67b2e018a6 100644
--- a/contrib/libs/grpc/src/cpp/util/string_ref.cc
+++ b/contrib/libs/grpc/src/cpp/util/string_ref.cc
@@ -1,20 +1,20 @@
-/*
- *
- * 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.
+//
+//
#include <stddef.h>
@@ -22,6 +22,6 @@
namespace grpc {
-const size_t string_ref::npos = size_t(-1);
+const size_t string_ref::npos = static_cast<size_t>(-1);
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/util/time_cc.cc b/contrib/libs/grpc/src/cpp/util/time_cc.cc
index 62ee375896..458a0e0cf7 100644
--- a/contrib/libs/grpc/src/cpp/util/time_cc.cc
+++ b/contrib/libs/grpc/src/cpp/util/time_cc.cc
@@ -1,25 +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.
- *
- */
+//
+//
+// 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.
+//
+//
#include <chrono>
#include <cstdint>
-#include <grpc/impl/codegen/gpr_types.h>
#include <grpc/support/time.h>
#include <grpcpp/support/time.h>