aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/grpc/src/cpp
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/grpc/src/cpp
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
downloadydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
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.cc88
-rw-r--r--contrib/libs/grpc/src/cpp/client/client_context.cc42
-rw-r--r--contrib/libs/grpc/src/cpp/client/create_channel.cc28
-rw-r--r--contrib/libs/grpc/src/cpp/client/create_channel_internal.cc22
-rw-r--r--contrib/libs/grpc/src/cpp/client/create_channel_internal.h22
-rw-r--r--contrib/libs/grpc/src/cpp/client/create_channel_posix.cc24
-rw-r--r--contrib/libs/grpc/src/cpp/client/credentials_cc.cc24
-rw-r--r--contrib/libs/grpc/src/cpp/client/insecure_credentials.cc28
-rw-r--r--contrib/libs/grpc/src/cpp/client/secure_credentials.cc200
-rw-r--r--contrib/libs/grpc/src/cpp/client/secure_credentials.h50
-rw-r--r--contrib/libs/grpc/src/cpp/codegen/codegen_init.cc24
-rw-r--r--contrib/libs/grpc/src/cpp/common/alarm.cc182
-rw-r--r--contrib/libs/grpc/src/cpp/common/auth_property_iterator.cc22
-rw-r--r--contrib/libs/grpc/src/cpp/common/channel_arguments.cc62
-rw-r--r--contrib/libs/grpc/src/cpp/common/channel_filter.cc74
-rw-r--r--contrib/libs/grpc/src/cpp/common/channel_filter.h306
-rw-r--r--contrib/libs/grpc/src/cpp/common/completion_queue_cc.cc84
-rw-r--r--contrib/libs/grpc/src/cpp/common/core_codegen.cc186
-rw-r--r--contrib/libs/grpc/src/cpp/common/insecure_create_auth_context.cc22
-rw-r--r--contrib/libs/grpc/src/cpp/common/resource_quota_cc.cc22
-rw-r--r--contrib/libs/grpc/src/cpp/common/rpc_method.cc22
-rw-r--r--contrib/libs/grpc/src/cpp/common/secure_auth_context.cc20
-rw-r--r--contrib/libs/grpc/src/cpp/common/secure_auth_context.h22
-rw-r--r--contrib/libs/grpc/src/cpp/common/secure_channel_arguments.cc22
-rw-r--r--contrib/libs/grpc/src/cpp/common/secure_create_auth_context.cc22
-rw-r--r--contrib/libs/grpc/src/cpp/common/version_cc.cc24
-rw-r--r--contrib/libs/grpc/src/cpp/ext/proto_server_reflection.cc32
-rw-r--r--contrib/libs/grpc/src/cpp/ext/proto_server_reflection.h22
-rw-r--r--contrib/libs/grpc/src/cpp/ext/proto_server_reflection_plugin.cc28
-rw-r--r--contrib/libs/grpc/src/cpp/server/async_generic_service.cc24
-rw-r--r--contrib/libs/grpc/src/cpp/server/channel_argument_option.cc108
-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.cc46
-rw-r--r--contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h26
-rw-r--r--contrib/libs/grpc/src/cpp/server/health/default_health_check_service.cc128
-rw-r--r--contrib/libs/grpc/src/cpp/server/health/default_health_check_service.h100
-rw-r--r--contrib/libs/grpc/src/cpp/server/health/health_check_service.cc62
-rw-r--r--contrib/libs/grpc/src/cpp/server/health/health_check_service_server_builder_option.cc68
-rw-r--r--contrib/libs/grpc/src/cpp/server/insecure_server_credentials.cc22
-rw-r--r--contrib/libs/grpc/src/cpp/server/load_reporter/load_data_store.cc512
-rw-r--r--contrib/libs/grpc/src/cpp/server/load_reporter/load_data_store.h550
-rw-r--r--contrib/libs/grpc/src/cpp/server/secure_server_credentials.cc60
-rw-r--r--contrib/libs/grpc/src/cpp/server/secure_server_credentials.h22
-rw-r--r--contrib/libs/grpc/src/cpp/server/server_builder.cc100
-rw-r--r--contrib/libs/grpc/src/cpp/server/server_cc.cc206
-rw-r--r--contrib/libs/grpc/src/cpp/server/server_context.cc52
-rw-r--r--contrib/libs/grpc/src/cpp/server/server_credentials.cc20
-rw-r--r--contrib/libs/grpc/src/cpp/server/server_posix.cc24
-rw-r--r--contrib/libs/grpc/src/cpp/server/thread_pool_interface.h28
-rw-r--r--contrib/libs/grpc/src/cpp/thread_manager/thread_manager.cc182
-rw-r--r--contrib/libs/grpc/src/cpp/thread_manager/thread_manager.h38
-rw-r--r--contrib/libs/grpc/src/cpp/util/byte_buffer_cc.cc28
-rw-r--r--contrib/libs/grpc/src/cpp/util/error_details.cc66
-rw-r--r--contrib/libs/grpc/src/cpp/util/status.cc22
-rw-r--r--contrib/libs/grpc/src/cpp/util/string_ref.cc22
-rw-r--r--contrib/libs/grpc/src/cpp/util/time_cc.cc34
57 files changed, 2159 insertions, 2159 deletions
diff --git a/contrib/libs/grpc/src/cpp/README.md b/contrib/libs/grpc/src/cpp/README.md
index a077a639969..967a0a43b7f 100755
--- a/contrib/libs/grpc/src/cpp/README.md
+++ b/contrib/libs/grpc/src/cpp/README.md
@@ -163,7 +163,7 @@ You can find out how to build and run our simplest gRPC C++ example in our
[C++ quick start](../../examples/cpp).
For more detailed documentation on using gRPC in C++ , see our main
-documentation site at [grpc.io](https://grpc.io), specifically:
+documentation site at [grpc.io](https://grpc.io), specifically:
* [Overview](https://grpc.io/docs): An introduction to gRPC with a simple
Hello World example in all our supported languages, including C++.
diff --git a/contrib/libs/grpc/src/cpp/client/channel_cc.cc b/contrib/libs/grpc/src/cpp/client/channel_cc.cc
index 03374b11f9f..ac95c29efcd 100644
--- a/contrib/libs/grpc/src/cpp/client/channel_cc.cc
+++ b/contrib/libs/grpc/src/cpp/client/channel_cc.cc
@@ -1,22 +1,22 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/channel.h>
+#include <grpcpp/channel.h>
#include <cstring>
#include <memory>
@@ -25,20 +25,20 @@
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/sync.h>
-#include <grpc/support/time.h>
-#include <grpcpp/client_context.h>
-#include <grpcpp/completion_queue.h>
-#include <grpcpp/impl/call.h>
+#include <grpc/support/sync.h>
+#include <grpc/support/time.h>
+#include <grpcpp/client_context.h>
+#include <grpcpp/completion_queue.h>
+#include <grpcpp/impl/call.h>
#include <grpcpp/impl/codegen/call_op_set.h>
-#include <grpcpp/impl/codegen/completion_queue_tag.h>
-#include <grpcpp/impl/grpc_library.h>
-#include <grpcpp/impl/rpc_method.h>
-#include <grpcpp/security/credentials.h>
-#include <grpcpp/support/channel_arguments.h>
-#include <grpcpp/support/config.h>
-#include <grpcpp/support/status.h>
-#include "src/core/lib/gpr/string.h"
+#include <grpcpp/impl/codegen/completion_queue_tag.h>
+#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/impl/rpc_method.h>
+#include <grpcpp/security/credentials.h>
+#include <grpcpp/support/channel_arguments.h>
+#include <grpcpp/support/config.h>
+#include <grpcpp/support/status.h>
+#include "src/core/lib/gpr/string.h"
#include "src/core/lib/surface/completion_queue.h"
namespace grpc {
@@ -69,11 +69,11 @@ inline grpc_slice SliceFromArray(const char* arr, size_t len) {
TString GetChannelInfoField(grpc_channel* channel,
grpc_channel_info* channel_info,
char*** channel_info_field) {
- char* value = nullptr;
+ char* value = nullptr;
memset(channel_info, 0, sizeof(*channel_info));
*channel_info_field = &value;
grpc_channel_get_info(channel, channel_info);
- if (value == nullptr) return "";
+ if (value == nullptr) return "";
TString result = value;
gpr_free(value);
return result;
@@ -105,7 +105,7 @@ void ChannelResetConnectionBackoff(Channel* channel) {
const ::grpc::internal::RpcMethod& method, ::grpc::ClientContext* context,
::grpc::CompletionQueue* cq, size_t interceptor_pos) {
const bool kRegistered = method.channel_tag() && context->authority().empty();
- grpc_call* c_call = nullptr;
+ grpc_call* c_call = nullptr;
if (kRegistered) {
c_call = grpc_channel_create_registered_call(
c_channel_, context->propagate_from_call_,
@@ -120,19 +120,19 @@ void ChannelResetConnectionBackoff(Channel* channel) {
}
grpc_slice method_slice =
SliceFromArray(method.name(), strlen(method.name()));
- grpc_slice host_slice;
- if (host_str != nullptr) {
+ grpc_slice host_slice;
+ if (host_str != nullptr) {
host_slice = ::grpc::SliceFromCopiedString(*host_str);
- }
- c_call = grpc_channel_create_call(
- c_channel_, context->propagate_from_call_,
- context->propagation_options_.c_bitmask(), cq->cq(), method_slice,
- host_str == nullptr ? nullptr : &host_slice, context->raw_deadline(),
- nullptr);
- grpc_slice_unref(method_slice);
- if (host_str != nullptr) {
- grpc_slice_unref(host_slice);
- }
+ }
+ c_call = grpc_channel_create_call(
+ c_channel_, context->propagate_from_call_,
+ context->propagation_options_.c_bitmask(), cq->cq(), method_slice,
+ host_str == nullptr ? nullptr : &host_slice, context->raw_deadline(),
+ nullptr);
+ grpc_slice_unref(method_slice);
+ if (host_str != nullptr) {
+ grpc_slice_unref(host_slice);
+ }
}
grpc_census_call_set_context(c_call, context->census_context());
@@ -161,7 +161,7 @@ void Channel::PerformOpsOnCall(::grpc::internal::CallOpSetInterface* ops,
void* Channel::RegisterMethod(const char* method) {
return grpc_channel_register_call(
- c_channel_, method, host_.empty() ? nullptr : host_.c_str(), nullptr);
+ c_channel_, method, host_.empty() ? nullptr : host_.c_str(), nullptr);
}
grpc_connectivity_state Channel::GetState(bool try_to_connect) {
@@ -169,7 +169,7 @@ grpc_connectivity_state Channel::GetState(bool try_to_connect) {
}
namespace {
-
+
class TagSaver final : public ::grpc::internal::CompletionQueueTag {
public:
explicit TagSaver(void* tag) : tag_(tag) {}
@@ -198,10 +198,10 @@ bool Channel::WaitForStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline) {
::grpc::CompletionQueue cq;
bool ok = false;
- void* tag = nullptr;
- NotifyOnStateChangeImpl(last_observed, deadline, &cq, nullptr);
+ void* tag = nullptr;
+ NotifyOnStateChangeImpl(last_observed, deadline, &cq, nullptr);
cq.Next(&tag, &ok);
- GPR_ASSERT(tag == nullptr);
+ GPR_ASSERT(tag == nullptr);
return ok;
}
diff --git a/contrib/libs/grpc/src/cpp/client/client_context.cc b/contrib/libs/grpc/src/cpp/client/client_context.cc
index 67f4168617e..b75343d0895 100644
--- a/contrib/libs/grpc/src/cpp/client/client_context.cc
+++ b/contrib/libs/grpc/src/cpp/client/client_context.cc
@@ -1,22 +1,22 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/client_context.h>
+#include <grpcpp/client_context.h>
#include <grpc/compression.h>
#include <grpc/grpc.h>
@@ -26,10 +26,10 @@
#include <grpcpp/impl/codegen/interceptor_common.h>
#include <grpcpp/impl/codegen/sync.h>
-#include <grpcpp/impl/grpc_library.h>
-#include <grpcpp/security/credentials.h>
-#include <grpcpp/server_context.h>
-#include <grpcpp/support/time.h>
+#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/security/credentials.h>
+#include <grpcpp/server_context.h>
+#include <grpcpp/support/time.h>
namespace grpc {
@@ -59,15 +59,15 @@ ClientContext::ClientContext()
call_canceled_(false),
deadline_(gpr_inf_future(GPR_CLOCK_REALTIME)),
census_context_(nullptr),
- propagate_from_call_(nullptr),
+ propagate_from_call_(nullptr),
compression_algorithm_(GRPC_COMPRESS_NONE),
- initial_metadata_corked_(false) {
+ initial_metadata_corked_(false) {
g_client_callbacks->DefaultConstructor(this);
}
ClientContext::~ClientContext() {
if (call_) {
- grpc_call_unref(call_);
+ grpc_call_unref(call_);
}
g_client_callbacks->Destructor(this);
}
@@ -132,8 +132,8 @@ void ClientContext::set_call(grpc_call* call,
void ClientContext::set_compression_algorithm(
grpc_compression_algorithm algorithm) {
- compression_algorithm_ = algorithm;
- const char* algorithm_name = nullptr;
+ 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);
@@ -172,7 +172,7 @@ TString ClientContext::peer() const {
void ClientContext::SetGlobalCallbacks(GlobalCallbacks* client_callbacks) {
GPR_ASSERT(g_client_callbacks == g_default_client_callbacks);
- GPR_ASSERT(client_callbacks != nullptr);
+ GPR_ASSERT(client_callbacks != nullptr);
GPR_ASSERT(client_callbacks != g_default_client_callbacks);
g_client_callbacks = client_callbacks;
}
diff --git a/contrib/libs/grpc/src/cpp/client/create_channel.cc b/contrib/libs/grpc/src/cpp/client/create_channel.cc
index f8ec80c09e0..97327490ed2 100644
--- a/contrib/libs/grpc/src/cpp/client/create_channel.cc
+++ b/contrib/libs/grpc/src/cpp/client/create_channel.cc
@@ -1,28 +1,28 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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 <grpcpp/channel.h>
-#include <grpcpp/create_channel.h>
-#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/security/credentials.h>
-#include <grpcpp/support/channel_arguments.h>
+#include <grpcpp/support/channel_arguments.h>
#include "src/cpp/client/create_channel_internal.h"
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 f1a89d86c62..da2a878a227 100644
--- a/contrib/libs/grpc/src/cpp/client/create_channel_internal.cc
+++ b/contrib/libs/grpc/src/cpp/client/create_channel_internal.cc
@@ -1,24 +1,24 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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 <grpcpp/channel.h>
+#include <grpcpp/channel.h>
struct grpc_channel;
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 9224b4ceac8..09d4e56b023 100644
--- a/contrib/libs/grpc/src/cpp/client/create_channel_internal.h
+++ b/contrib/libs/grpc/src/cpp/client/create_channel_internal.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -23,7 +23,7 @@
#include <grpcpp/channel.h>
#include <grpcpp/impl/codegen/client_interceptor.h>
-#include <grpcpp/support/config.h>
+#include <grpcpp/support/config.h>
struct grpc_channel;
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 d58410df8dd..db09eda8a66 100644
--- a/contrib/libs/grpc/src/cpp/client/create_channel_posix.cc
+++ b/contrib/libs/grpc/src/cpp/client/create_channel_posix.cc
@@ -1,25 +1,25 @@
/*
*
- * Copyright 2016 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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>
-#include <grpcpp/channel.h>
-#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/support/channel_arguments.h>
#include "src/cpp/client/create_channel_internal.h"
diff --git a/contrib/libs/grpc/src/cpp/client/credentials_cc.cc b/contrib/libs/grpc/src/cpp/client/credentials_cc.cc
index 9847edd3420..9dfb2f491ca 100644
--- a/contrib/libs/grpc/src/cpp/client/credentials_cc.cc
+++ b/contrib/libs/grpc/src/cpp/client/credentials_cc.cc
@@ -1,23 +1,23 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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>
+#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/security/credentials.h>
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 b8e122d6ba0..e5bafff70af 100644
--- a/contrib/libs/grpc/src/cpp/client/insecure_credentials.cc
+++ b/contrib/libs/grpc/src/cpp/client/insecure_credentials.cc
@@ -1,27 +1,27 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/security/credentials.h>
+#include <grpcpp/security/credentials.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
-#include <grpcpp/channel.h>
-#include <grpcpp/support/channel_arguments.h>
-#include <grpcpp/support/config.h>
+#include <grpcpp/channel.h>
+#include <grpcpp/support/channel_arguments.h>
+#include <grpcpp/support/config.h>
#include "src/cpp/client/create_channel_internal.h"
namespace grpc {
diff --git a/contrib/libs/grpc/src/cpp/client/secure_credentials.cc b/contrib/libs/grpc/src/cpp/client/secure_credentials.cc
index 830ae02c48c..0f6db3caa53 100644
--- a/contrib/libs/grpc/src/cpp/client/secure_credentials.cc
+++ b/contrib/libs/grpc/src/cpp/client/secure_credentials.cc
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -22,11 +22,11 @@
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string_util.h>
-#include <grpcpp/channel.h>
+#include <grpc/support/string_util.h>
+#include <grpcpp/channel.h>
#include <grpcpp/impl/codegen/status.h>
-#include <grpcpp/impl/grpc_library.h>
-#include <grpcpp/support/channel_arguments.h>
+#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/support/channel_arguments.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/iomgr/error.h"
@@ -82,16 +82,16 @@ bool SecureCallCredentials::ApplyToCall(grpc_call* call) {
namespace {
std::shared_ptr<ChannelCredentials> WrapChannelCredentials(
grpc_channel_credentials* creds) {
- return creds == nullptr ? nullptr
- : std::shared_ptr<ChannelCredentials>(
- new SecureChannelCredentials(creds));
+ return creds == nullptr ? nullptr
+ : std::shared_ptr<ChannelCredentials>(
+ new SecureChannelCredentials(creds));
}
std::shared_ptr<CallCredentials> WrapCallCredentials(
grpc_call_credentials* creds) {
- return creds == nullptr ? nullptr
- : std::shared_ptr<CallCredentials>(
- new SecureCallCredentials(creds));
+ return creds == nullptr ? nullptr
+ : std::shared_ptr<CallCredentials>(
+ new SecureCallCredentials(creds));
}
} // namespace
@@ -115,8 +115,8 @@ std::shared_ptr<ChannelCredentials> SslCredentials(
return WrapChannelCredentials(c_creds);
}
-namespace experimental {
-
+namespace experimental {
+
namespace {
void ClearStsCredentialsOptions(StsCredentialsOptions* options) {
@@ -265,21 +265,21 @@ std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
c_plugin, min_security_level, nullptr));
}
-// Builds ALTS Credentials given ALTS specific options
-std::shared_ptr<ChannelCredentials> AltsCredentials(
- const AltsCredentialsOptions& options) {
+// Builds ALTS Credentials given ALTS specific options
+std::shared_ptr<ChannelCredentials> AltsCredentials(
+ const AltsCredentialsOptions& options) {
grpc::GrpcLibraryCodegen init; // To call grpc_init().
- grpc_alts_credentials_options* c_options =
- grpc_alts_credentials_client_options_create();
+ grpc_alts_credentials_options* c_options =
+ grpc_alts_credentials_client_options_create();
for (const auto& service_account : options.target_service_accounts) {
- grpc_alts_credentials_client_options_add_target_service_account(
+ grpc_alts_credentials_client_options_add_target_service_account(
c_options, service_account.c_str());
- }
- grpc_channel_credentials* c_creds = grpc_alts_credentials_create(c_options);
- grpc_alts_credentials_options_destroy(c_options);
- return WrapChannelCredentials(c_creds);
-}
-
+ }
+ grpc_channel_credentials* c_creds = grpc_alts_credentials_create(c_options);
+ grpc_alts_credentials_options_destroy(c_options);
+ return WrapChannelCredentials(c_creds);
+}
+
// Builds Local Credentials
std::shared_ptr<ChannelCredentials> LocalCredentials(
grpc_local_connect_type type) {
@@ -294,8 +294,8 @@ std::shared_ptr<ChannelCredentials> TlsCredentials(
grpc_tls_credentials_create(options.c_credentials_options()));
}
-} // namespace experimental
-
+} // namespace experimental
+
// Builds credentials for use when running in GCE
std::shared_ptr<CallCredentials> GoogleComputeEngineCredentials() {
grpc::GrpcLibraryCodegen init; // To call grpc_init().
@@ -362,18 +362,18 @@ std::shared_ptr<ChannelCredentials> CompositeChannelCredentials(
return nullptr;
}
-std::shared_ptr<CallCredentials> CompositeCallCredentials(
- const std::shared_ptr<CallCredentials>& creds1,
- const std::shared_ptr<CallCredentials>& creds2) {
- SecureCallCredentials* s_creds1 = creds1->AsSecureCredentials();
- SecureCallCredentials* s_creds2 = creds2->AsSecureCredentials();
- if (s_creds1 != nullptr && s_creds2 != nullptr) {
- return WrapCallCredentials(grpc_composite_call_credentials_create(
- s_creds1->GetRawCreds(), s_creds2->GetRawCreds(), nullptr));
- }
- return nullptr;
-}
-
+std::shared_ptr<CallCredentials> CompositeCallCredentials(
+ const std::shared_ptr<CallCredentials>& creds1,
+ const std::shared_ptr<CallCredentials>& creds2) {
+ SecureCallCredentials* s_creds1 = creds1->AsSecureCredentials();
+ SecureCallCredentials* s_creds2 = creds2->AsSecureCredentials();
+ if (s_creds1 != nullptr && s_creds2 != nullptr) {
+ return WrapCallCredentials(grpc_composite_call_credentials_create(
+ s_creds1->GetRawCreds(), s_creds2->GetRawCreds(), nullptr));
+ }
+ return nullptr;
+}
+
std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
std::unique_ptr<MetadataCredentialsPlugin> plugin) {
grpc::GrpcLibraryCodegen init; // To call grpc_init().
@@ -391,7 +391,7 @@ std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
namespace {
void DeleteWrapper(void* wrapper, grpc_error* /*ignored*/) {
MetadataCredentialsPluginWrapper* w =
- static_cast<MetadataCredentialsPluginWrapper*>(wrapper);
+ static_cast<MetadataCredentialsPluginWrapper*>(wrapper);
delete w;
}
} // namespace
@@ -411,19 +411,19 @@ void MetadataCredentialsPluginWrapper::Destroy(void* wrapper) {
GRPC_ERROR_NONE);
}
-int MetadataCredentialsPluginWrapper::GetMetadata(
+int MetadataCredentialsPluginWrapper::GetMetadata(
void* wrapper, grpc_auth_metadata_context context,
- grpc_credentials_plugin_metadata_cb cb, void* user_data,
- grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
- size_t* num_creds_md, grpc_status_code* status,
- const char** error_details) {
+ grpc_credentials_plugin_metadata_cb cb, void* user_data,
+ grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
+ size_t* num_creds_md, grpc_status_code* status,
+ const char** error_details) {
GPR_ASSERT(wrapper);
MetadataCredentialsPluginWrapper* w =
- static_cast<MetadataCredentialsPluginWrapper*>(wrapper);
+ static_cast<MetadataCredentialsPluginWrapper*>(wrapper);
if (!w->plugin_) {
- *num_creds_md = 0;
- *status = GRPC_STATUS_OK;
- *error_details = nullptr;
+ *num_creds_md = 0;
+ *status = GRPC_STATUS_OK;
+ *error_details = nullptr;
return 1;
}
if (w->plugin_->IsBlocking()) {
@@ -431,36 +431,36 @@ int MetadataCredentialsPluginWrapper::GetMetadata(
// Make a copy for InvokePlugin.
grpc_auth_metadata_context context_copy = grpc_auth_metadata_context();
grpc_auth_metadata_context_copy(&context, &context_copy);
- // Asynchronous return.
+ // Asynchronous return.
w->thread_pool_->Add([w, context_copy, cb, user_data]() mutable {
w->MetadataCredentialsPluginWrapper::InvokePlugin(
context_copy, cb, user_data, nullptr, nullptr, nullptr, nullptr);
grpc_auth_metadata_context_reset(&context_copy);
});
- return 0;
+ return 0;
} else {
- // Synchronous return.
- w->InvokePlugin(context, cb, user_data, creds_md, num_creds_md, status,
- error_details);
- return 1;
+ // Synchronous return.
+ w->InvokePlugin(context, cb, user_data, creds_md, num_creds_md, status,
+ error_details);
+ return 1;
}
}
-namespace {
-
-void UnrefMetadata(const std::vector<grpc_metadata>& md) {
+namespace {
+
+void UnrefMetadata(const std::vector<grpc_metadata>& md) {
for (const auto& metadatum : md) {
grpc_slice_unref(metadatum.key);
grpc_slice_unref(metadatum.value);
- }
-}
-
-} // namespace
-
+ }
+}
+
+} // namespace
+
void MetadataCredentialsPluginWrapper::InvokePlugin(
grpc_auth_metadata_context context, grpc_credentials_plugin_metadata_cb cb,
- void* user_data, grpc_metadata creds_md[4], size_t* num_creds_md,
- grpc_status_code* status_code, const char** error_details) {
+ void* user_data, grpc_metadata creds_md[4], size_t* num_creds_md,
+ grpc_status_code* status_code, const char** error_details) {
std::multimap<TString, TString> metadata;
// const_cast is safe since the SecureAuthContext only inc/dec the refcount
@@ -478,32 +478,32 @@ void MetadataCredentialsPluginWrapper::InvokePlugin(
md_entry.flags = 0;
md.push_back(md_entry);
}
- if (creds_md != nullptr) {
- // Synchronous return.
- if (md.size() > GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX) {
- *num_creds_md = 0;
- *status_code = GRPC_STATUS_INTERNAL;
- *error_details = gpr_strdup(
- "blocking plugin credentials returned too many metadata keys");
- UnrefMetadata(md);
- } else {
- for (const auto& elem : md) {
- creds_md[*num_creds_md].key = elem.key;
- creds_md[*num_creds_md].value = elem.value;
- creds_md[*num_creds_md].flags = elem.flags;
- ++(*num_creds_md);
- }
- *status_code = static_cast<grpc_status_code>(status.error_code());
- *error_details =
- status.ok() ? nullptr : gpr_strdup(status.error_message().c_str());
- }
- } else {
- // Asynchronous return.
- cb(user_data, md.empty() ? nullptr : &md[0], md.size(),
- static_cast<grpc_status_code>(status.error_code()),
- status.error_message().c_str());
- UnrefMetadata(md);
- }
+ if (creds_md != nullptr) {
+ // Synchronous return.
+ if (md.size() > GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX) {
+ *num_creds_md = 0;
+ *status_code = GRPC_STATUS_INTERNAL;
+ *error_details = gpr_strdup(
+ "blocking plugin credentials returned too many metadata keys");
+ UnrefMetadata(md);
+ } else {
+ for (const auto& elem : md) {
+ creds_md[*num_creds_md].key = elem.key;
+ creds_md[*num_creds_md].value = elem.value;
+ creds_md[*num_creds_md].flags = elem.flags;
+ ++(*num_creds_md);
+ }
+ *status_code = static_cast<grpc_status_code>(status.error_code());
+ *error_details =
+ status.ok() ? nullptr : gpr_strdup(status.error_message().c_str());
+ }
+ } else {
+ // Asynchronous return.
+ cb(user_data, md.empty() ? nullptr : &md[0], md.size(),
+ static_cast<grpc_status_code>(status.error_code()),
+ status.error_message().c_str());
+ UnrefMetadata(md);
+ }
}
MetadataCredentialsPluginWrapper::MetadataCredentialsPluginWrapper(
diff --git a/contrib/libs/grpc/src/cpp/client/secure_credentials.h b/contrib/libs/grpc/src/cpp/client/secure_credentials.h
index 4d4ac5bce88..4fc79346bf4 100644
--- a/contrib/libs/grpc/src/cpp/client/secure_credentials.h
+++ b/contrib/libs/grpc/src/cpp/client/secure_credentials.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -21,9 +21,9 @@
#include <grpc/grpc_security.h>
-#include <grpcpp/security/credentials.h>
+#include <grpcpp/security/credentials.h>
#include <grpcpp/security/tls_credentials_options.h>
-#include <grpcpp/support/config.h>
+#include <grpcpp/support/config.h>
#include "y_absl/strings/str_cat.h"
#include "src/core/lib/security/credentials/credentials.h"
@@ -84,27 +84,27 @@ grpc_sts_credentials_options StsCredentialsCppToCoreOptions(
} // namespace experimental
-class MetadataCredentialsPluginWrapper final : private GrpcLibraryCodegen {
+class MetadataCredentialsPluginWrapper final : private GrpcLibraryCodegen {
public:
static void Destroy(void* wrapper);
- static int GetMetadata(
- void* wrapper, grpc_auth_metadata_context context,
- grpc_credentials_plugin_metadata_cb cb, void* user_data,
- grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
- size_t* num_creds_md, grpc_status_code* status,
- const char** error_details);
+ static int GetMetadata(
+ void* wrapper, grpc_auth_metadata_context context,
+ grpc_credentials_plugin_metadata_cb cb, void* user_data,
+ grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
+ size_t* num_creds_md, grpc_status_code* status,
+ const char** error_details);
static char* DebugString(void* wrapper);
explicit MetadataCredentialsPluginWrapper(
std::unique_ptr<MetadataCredentialsPlugin> plugin);
private:
- void InvokePlugin(
- grpc_auth_metadata_context context,
- grpc_credentials_plugin_metadata_cb cb, void* user_data,
- grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
- size_t* num_creds_md, grpc_status_code* status_code,
- const char** error_details);
+ void InvokePlugin(
+ grpc_auth_metadata_context context,
+ grpc_credentials_plugin_metadata_cb cb, void* user_data,
+ grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
+ size_t* num_creds_md, grpc_status_code* status_code,
+ const char** error_details);
std::unique_ptr<ThreadPoolInterface> thread_pool_;
std::unique_ptr<MetadataCredentialsPlugin> plugin_;
};
diff --git a/contrib/libs/grpc/src/cpp/codegen/codegen_init.cc b/contrib/libs/grpc/src/cpp/codegen/codegen_init.cc
index fc32fa7748e..e1e47cbb17b 100644
--- a/contrib/libs/grpc/src/cpp/codegen/codegen_init.cc
+++ b/contrib/libs/grpc/src/cpp/codegen/codegen_init.cc
@@ -1,23 +1,23 @@
/*
*
- * Copyright 2016 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/codegen/grpc_library.h>
+#include <grpcpp/impl/codegen/core_codegen_interface.h>
+#include <grpcpp/impl/codegen/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
diff --git a/contrib/libs/grpc/src/cpp/common/alarm.cc b/contrib/libs/grpc/src/cpp/common/alarm.cc
index addd1e80377..a2612874b20 100644
--- a/contrib/libs/grpc/src/cpp/common/alarm.cc
+++ b/contrib/libs/grpc/src/cpp/common/alarm.cc
@@ -1,45 +1,45 @@
-/*
- * 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 <grpcpp/alarm.h>
-
-#include <memory>
-
-#include <grpc/support/log.h>
-#include <grpc/support/port_platform.h>
-#include <grpcpp/completion_queue.h>
-#include <grpcpp/impl/grpc_library.h>
-#include <grpcpp/support/time.h>
-#include "src/core/lib/iomgr/exec_ctx.h"
+/*
+ * Copyright 2018 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <grpcpp/alarm.h>
+
+#include <memory>
+
+#include <grpc/support/log.h>
+#include <grpc/support/port_platform.h>
+#include <grpcpp/completion_queue.h>
+#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/support/time.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/executor.h"
-#include "src/core/lib/iomgr/timer.h"
-#include "src/core/lib/surface/completion_queue.h"
-
-#include <grpc/support/log.h>
-#include "src/core/lib/debug/trace.h"
-
+#include "src/core/lib/iomgr/timer.h"
+#include "src/core/lib/surface/completion_queue.h"
+
+#include <grpc/support/log.h>
+#include "src/core/lib/debug/trace.h"
+
namespace grpc {
-
-namespace internal {
+
+namespace internal {
class AlarmImpl : public ::grpc::internal::CompletionQueueTag {
- public:
- AlarmImpl() : cq_(nullptr), tag_(nullptr) {
- gpr_ref_init(&refs_, 1);
- grpc_timer_init_unset(&timer_);
+ public:
+ AlarmImpl() : cq_(nullptr), tag_(nullptr) {
+ gpr_ref_init(&refs_, 1);
+ grpc_timer_init_unset(&timer_);
}
~AlarmImpl() {}
bool FinalizeResult(void** tag, bool* /*status*/) override {
@@ -73,10 +73,10 @@ class AlarmImpl : public ::grpc::internal::CompletionQueueTag {
this, grpc_schedule_on_exec_ctx);
grpc_timer_init(&timer_, grpc_timespec_to_millis_round_up(deadline),
&on_alarm_);
- }
+ }
void Set(gpr_timespec deadline, std::function<void(bool)> f) {
grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
- grpc_core::ExecCtx exec_ctx;
+ grpc_core::ExecCtx exec_ctx;
// Don't use any CQ at all. Instead just use the timer to fire the function
callback_ = std::move(f);
Ref();
@@ -94,54 +94,54 @@ class AlarmImpl : public ::grpc::internal::CompletionQueueTag {
error);
},
this, grpc_schedule_on_exec_ctx);
- grpc_timer_init(&timer_, grpc_timespec_to_millis_round_up(deadline),
- &on_alarm_);
- }
- void Cancel() {
+ grpc_timer_init(&timer_, grpc_timespec_to_millis_round_up(deadline),
+ &on_alarm_);
+ }
+ void Cancel() {
grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
- grpc_core::ExecCtx exec_ctx;
- grpc_timer_cancel(&timer_);
- }
- void Destroy() {
- Cancel();
- Unref();
- }
-
- private:
- void Ref() { gpr_ref(&refs_); }
- void Unref() {
- if (gpr_unref(&refs_)) {
- delete this;
- }
- }
-
- grpc_timer timer_;
- gpr_refcount refs_;
- grpc_closure on_alarm_;
- grpc_cq_completion completion_;
- // completion queue where events about this alarm will be posted
- grpc_completion_queue* cq_;
- void* tag_;
+ grpc_core::ExecCtx exec_ctx;
+ grpc_timer_cancel(&timer_);
+ }
+ void Destroy() {
+ Cancel();
+ Unref();
+ }
+
+ private:
+ void Ref() { gpr_ref(&refs_); }
+ void Unref() {
+ if (gpr_unref(&refs_)) {
+ delete this;
+ }
+ }
+
+ grpc_timer timer_;
+ gpr_refcount refs_;
+ grpc_closure on_alarm_;
+ grpc_cq_completion completion_;
+ // completion queue where events about this alarm will be posted
+ grpc_completion_queue* cq_;
+ void* tag_;
std::function<void(bool)> callback_;
-};
-} // namespace internal
-
+};
+} // 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()) {
+ g_gli_initializer.summon();
+}
+
void Alarm::SetInternal(::grpc::CompletionQueue* cq, gpr_timespec deadline,
void* tag) {
- // Note that we know that alarm_ is actually an internal::AlarmImpl
- // but we declared it as the base pointer to avoid a forward declaration
- // or exposing core data structures in the C++ public headers.
- // Thus it is safe to use a static_cast to the subclass here, and the
- // C++ style guide allows us to do so in this case
- static_cast<internal::AlarmImpl*>(alarm_)->Set(cq, deadline, tag);
-}
-
+ // Note that we know that alarm_ is actually an internal::AlarmImpl
+ // but we declared it as the base pointer to avoid a forward declaration
+ // or exposing core data structures in the C++ public headers.
+ // Thus it is safe to use a static_cast to the subclass here, and the
+ // C++ style guide allows us to do so in this case
+ static_cast<internal::AlarmImpl*>(alarm_)->Set(cq, deadline, tag);
+}
+
void Alarm::SetInternal(gpr_timespec deadline, std::function<void(bool)> f) {
// Note that we know that alarm_ is actually an internal::AlarmImpl
// but we declared it as the base pointer to avoid a forward declaration
@@ -151,11 +151,11 @@ void Alarm::SetInternal(gpr_timespec deadline, std::function<void(bool)> f) {
static_cast<internal::AlarmImpl*>(alarm_)->Set(deadline, std::move(f));
}
-Alarm::~Alarm() {
- if (alarm_ != nullptr) {
- static_cast<internal::AlarmImpl*>(alarm_)->Destroy();
- }
-}
-
-void Alarm::Cancel() { static_cast<internal::AlarmImpl*>(alarm_)->Cancel(); }
+Alarm::~Alarm() {
+ if (alarm_ != nullptr) {
+ static_cast<internal::AlarmImpl*>(alarm_)->Destroy();
+ }
+}
+
+void Alarm::Cancel() { static_cast<internal::AlarmImpl*>(alarm_)->Cancel(); }
} // namespace grpc
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 eb088fa9d96..fbb18e9915c 100644
--- a/contrib/libs/grpc/src/cpp/common/auth_property_iterator.cc
+++ b/contrib/libs/grpc/src/cpp/common/auth_property_iterator.cc
@@ -1,22 +1,22 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/security/auth_context.h>
+#include <grpcpp/security/auth_context.h>
#include <grpc/grpc_security.h>
diff --git a/contrib/libs/grpc/src/cpp/common/channel_arguments.cc b/contrib/libs/grpc/src/cpp/common/channel_arguments.cc
index 8b8d4f688f5..5a5dd91b5ec 100644
--- a/contrib/libs/grpc/src/cpp/common/channel_arguments.cc
+++ b/contrib/libs/grpc/src/cpp/common/channel_arguments.cc
@@ -1,32 +1,32 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/channel_arguments.h>
+#include <grpcpp/support/channel_arguments.h>
#include <sstream>
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/support/log.h>
-#include <grpcpp/grpcpp.h>
-#include <grpcpp/resource_quota.h>
+#include <grpcpp/grpcpp.h>
+#include <grpcpp/resource_quota.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/socket_mutator.h"
-
+
namespace grpc {
ChannelArguments::ChannelArguments() {
@@ -66,7 +66,7 @@ ChannelArguments::ChannelArguments(const ChannelArguments& other)
}
ChannelArguments::~ChannelArguments() {
- grpc_core::ExecCtx exec_ctx;
+ grpc_core::ExecCtx exec_ctx;
for (auto& arg : args_) {
if (arg.type == GRPC_ARG_POINTER) {
arg.value.pointer.vtable->destroy(arg.value.pointer.p);
@@ -84,27 +84,27 @@ void ChannelArguments::SetCompressionAlgorithm(
SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM, algorithm);
}
-void ChannelArguments::SetGrpclbFallbackTimeout(int fallback_timeout) {
- SetInt(GRPC_ARG_GRPCLB_FALLBACK_TIMEOUT_MS, fallback_timeout);
-}
-
+void ChannelArguments::SetGrpclbFallbackTimeout(int fallback_timeout) {
+ SetInt(GRPC_ARG_GRPCLB_FALLBACK_TIMEOUT_MS, fallback_timeout);
+}
+
void ChannelArguments::SetSocketMutator(grpc_socket_mutator* mutator) {
if (!mutator) {
return;
}
grpc_arg mutator_arg = grpc_socket_mutator_to_arg(mutator);
bool replaced = false;
- grpc_core::ExecCtx exec_ctx;
+ grpc_core::ExecCtx exec_ctx;
for (auto& arg : args_) {
if (arg.type == mutator_arg.type &&
TString(arg.key) == TString(mutator_arg.key)) {
- GPR_ASSERT(!replaced);
+ GPR_ASSERT(!replaced);
arg.value.pointer.vtable->destroy(arg.value.pointer.p);
arg.value.pointer = mutator_arg.value.pointer;
replaced = true;
}
}
-
+
if (!replaced) {
strings_.push_back(TString(mutator_arg.key));
args_.push_back(mutator_arg);
@@ -122,18 +122,18 @@ void ChannelArguments::SetUserAgentPrefix(
return;
}
bool replaced = false;
- auto strings_it = strings_.begin();
+ auto strings_it = strings_.begin();
for (auto& arg : args_) {
- ++strings_it;
- if (arg.type == GRPC_ARG_STRING) {
+ ++strings_it;
+ if (arg.type == GRPC_ARG_STRING) {
if (TString(arg.key) == GRPC_ARG_PRIMARY_USER_AGENT_STRING) {
- GPR_ASSERT(arg.value.string == strings_it->c_str());
- *(strings_it) = user_agent_prefix + " " + arg.value.string;
+ GPR_ASSERT(arg.value.string == strings_it->c_str());
+ *(strings_it) = user_agent_prefix + " " + arg.value.string;
arg.value.string = const_cast<char*>(strings_it->c_str());
- replaced = true;
- break;
- }
- ++strings_it;
+ replaced = true;
+ break;
+ }
+ ++strings_it;
}
}
if (!replaced) {
diff --git a/contrib/libs/grpc/src/cpp/common/channel_filter.cc b/contrib/libs/grpc/src/cpp/common/channel_filter.cc
index b0cc1aa6c35..8df6c7b98f5 100644
--- a/contrib/libs/grpc/src/cpp/common/channel_filter.cc
+++ b/contrib/libs/grpc/src/cpp/common/channel_filter.cc
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2016 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -21,44 +21,44 @@
#include "src/core/lib/channel/channel_stack.h"
#include "src/cpp/common/channel_filter.h"
-#include <grpcpp/impl/codegen/slice.h>
-
+#include <grpcpp/impl/codegen/slice.h>
+
namespace grpc {
// MetadataBatch
-grpc_linked_mdelem* MetadataBatch::AddMetadata(const string& key,
- const string& value) {
- grpc_linked_mdelem* storage = new grpc_linked_mdelem;
- storage->md = grpc_mdelem_from_slices(SliceFromCopiedString(key),
- SliceFromCopiedString(value));
- GRPC_LOG_IF_ERROR("MetadataBatch::AddMetadata",
- grpc_metadata_batch_link_head(batch_, storage));
+grpc_linked_mdelem* MetadataBatch::AddMetadata(const string& key,
+ const string& value) {
+ grpc_linked_mdelem* storage = new grpc_linked_mdelem;
+ storage->md = grpc_mdelem_from_slices(SliceFromCopiedString(key),
+ SliceFromCopiedString(value));
+ GRPC_LOG_IF_ERROR("MetadataBatch::AddMetadata",
+ grpc_metadata_batch_link_head(batch_, storage));
return storage;
}
// ChannelData
-void ChannelData::StartTransportOp(grpc_channel_element* elem,
- TransportOp* op) {
- grpc_channel_next_op(elem, op->op());
+void ChannelData::StartTransportOp(grpc_channel_element* elem,
+ TransportOp* op) {
+ grpc_channel_next_op(elem, op->op());
}
-void ChannelData::GetInfo(grpc_channel_element* elem,
- const grpc_channel_info* channel_info) {
- grpc_channel_next_get_info(elem, channel_info);
+void ChannelData::GetInfo(grpc_channel_element* elem,
+ const grpc_channel_info* channel_info) {
+ grpc_channel_next_get_info(elem, channel_info);
}
// CallData
-void CallData::StartTransportStreamOpBatch(grpc_call_element* elem,
- TransportStreamOpBatch* op) {
- grpc_call_next_op(elem, op->op());
+void CallData::StartTransportStreamOpBatch(grpc_call_element* elem,
+ TransportStreamOpBatch* op) {
+ grpc_call_next_op(elem, op->op());
}
-void CallData::SetPollsetOrPollsetSet(grpc_call_element* elem,
- grpc_polling_entity* pollent) {
- grpc_call_stack_ignore_set_pollset_or_pollset_set(elem, pollent);
+void CallData::SetPollsetOrPollsetSet(grpc_call_element* elem,
+ grpc_polling_entity* pollent) {
+ grpc_call_stack_ignore_set_pollset_or_pollset_set(elem, pollent);
}
// internal code used by RegisterChannelFilter()
@@ -66,14 +66,14 @@ void CallData::SetPollsetOrPollsetSet(grpc_call_element* elem,
namespace internal {
// Note: Implicitly initialized to nullptr due to static lifetime.
-std::vector<FilterRecord>* channel_filters;
+std::vector<FilterRecord>* channel_filters;
namespace {
-bool MaybeAddFilter(grpc_channel_stack_builder* builder, void* arg) {
- const FilterRecord& filter = *static_cast<FilterRecord*>(arg);
+bool MaybeAddFilter(grpc_channel_stack_builder* builder, void* arg) {
+ const FilterRecord& filter = *static_cast<FilterRecord*>(arg);
if (filter.include_filter) {
- const grpc_channel_args* args =
+ const grpc_channel_args* args =
grpc_channel_stack_builder_get_channel_arguments(builder);
if (!filter.include_filter(*args)) return true;
}
@@ -85,9 +85,9 @@ bool MaybeAddFilter(grpc_channel_stack_builder* builder, void* arg) {
void ChannelFilterPluginInit() {
for (size_t i = 0; i < channel_filters->size(); ++i) {
- FilterRecord& filter = (*channel_filters)[i];
+ FilterRecord& filter = (*channel_filters)[i];
grpc_channel_init_register_stage(filter.stack_type, filter.priority,
- MaybeAddFilter, (void*)&filter);
+ MaybeAddFilter, (void*)&filter);
}
}
diff --git a/contrib/libs/grpc/src/cpp/common/channel_filter.h b/contrib/libs/grpc/src/cpp/common/channel_filter.h
index 9720230fc21..5ce720b3075 100644
--- a/contrib/libs/grpc/src/cpp/common/channel_filter.h
+++ b/contrib/libs/grpc/src/cpp/common/channel_filter.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2016 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -21,7 +21,7 @@
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
-#include <grpcpp/impl/codegen/config.h>
+#include <grpcpp/impl/codegen/config.h>
#include <functional>
#include <vector>
@@ -47,22 +47,22 @@ class MetadataBatch {
/// Borrows a pointer to \a batch, but does NOT take ownership.
/// The caller must ensure that \a batch continues to exist for as
/// long as the MetadataBatch object does.
- explicit MetadataBatch(grpc_metadata_batch* batch) : batch_(batch) {}
+ explicit MetadataBatch(grpc_metadata_batch* batch) : batch_(batch) {}
- grpc_metadata_batch* batch() const { return batch_; }
+ grpc_metadata_batch* batch() const { return batch_; }
/// Adds metadata and returns the newly allocated storage.
/// The caller takes ownership of the result, which must exist for the
/// lifetime of the gRPC call.
- grpc_linked_mdelem* AddMetadata(const string& key, const string& value);
+ grpc_linked_mdelem* AddMetadata(const string& key, const string& value);
class const_iterator : public std::iterator<std::bidirectional_iterator_tag,
const grpc_mdelem> {
public:
- const grpc_mdelem& operator*() const { return elem_->md; }
- const grpc_mdelem operator->() const { return elem_->md; }
+ const grpc_mdelem& operator*() const { return elem_->md; }
+ const grpc_mdelem operator->() const { return elem_->md; }
- const_iterator& operator++() {
+ const_iterator& operator++() {
elem_ = elem_->next;
return *this;
}
@@ -71,7 +71,7 @@ class MetadataBatch {
operator++();
return tmp;
}
- const_iterator& operator--() {
+ const_iterator& operator--() {
elem_ = elem_->prev;
return *this;
}
@@ -81,25 +81,25 @@ class MetadataBatch {
return tmp;
}
- bool operator==(const const_iterator& other) const {
+ bool operator==(const const_iterator& other) const {
return elem_ == other.elem_;
}
- bool operator!=(const const_iterator& other) const {
+ bool operator!=(const const_iterator& other) const {
return elem_ != other.elem_;
}
private:
friend class MetadataBatch;
- explicit const_iterator(grpc_linked_mdelem* elem) : elem_(elem) {}
+ explicit const_iterator(grpc_linked_mdelem* elem) : elem_(elem) {}
- grpc_linked_mdelem* elem_;
+ grpc_linked_mdelem* elem_;
};
const_iterator begin() const { return const_iterator(batch_->list.head); }
const_iterator end() const { return const_iterator(nullptr); }
private:
- grpc_metadata_batch* batch_; // Not owned.
+ grpc_metadata_batch* batch_; // Not owned.
};
/// A C++ wrapper for the \c grpc_transport_op struct.
@@ -108,103 +108,103 @@ class TransportOp {
/// Borrows a pointer to \a op, but does NOT take ownership.
/// The caller must ensure that \a op continues to exist for as
/// long as the TransportOp object does.
- explicit TransportOp(grpc_transport_op* op) : op_(op) {}
+ explicit TransportOp(grpc_transport_op* op) : op_(op) {}
- grpc_transport_op* op() const { return op_; }
+ grpc_transport_op* op() const { return op_; }
// TODO(roth): Add a C++ wrapper for grpc_error?
- grpc_error* disconnect_with_error() const {
+ grpc_error* disconnect_with_error() const {
return op_->disconnect_with_error;
}
- bool send_goaway() const { return op_->goaway_error != GRPC_ERROR_NONE; }
+ bool send_goaway() const { return op_->goaway_error != GRPC_ERROR_NONE; }
// TODO(roth): Add methods for additional fields as needed.
private:
- grpc_transport_op* op_; // Not owned.
+ grpc_transport_op* op_; // Not owned.
};
-/// A C++ wrapper for the \c grpc_transport_stream_op_batch struct.
-class TransportStreamOpBatch {
+/// A C++ wrapper for the \c grpc_transport_stream_op_batch struct.
+class TransportStreamOpBatch {
public:
/// Borrows a pointer to \a op, but does NOT take ownership.
/// The caller must ensure that \a op continues to exist for as
- /// long as the TransportStreamOpBatch object does.
- explicit TransportStreamOpBatch(grpc_transport_stream_op_batch* op)
+ /// long as the TransportStreamOpBatch object does.
+ explicit TransportStreamOpBatch(grpc_transport_stream_op_batch* op)
: op_(op),
- send_initial_metadata_(
- op->send_initial_metadata
- ? op->payload->send_initial_metadata.send_initial_metadata
- : nullptr),
- send_trailing_metadata_(
- op->send_trailing_metadata
- ? op->payload->send_trailing_metadata.send_trailing_metadata
- : nullptr),
- recv_initial_metadata_(
- op->recv_initial_metadata
- ? op->payload->recv_initial_metadata.recv_initial_metadata
- : nullptr),
- recv_trailing_metadata_(
- op->recv_trailing_metadata
- ? op->payload->recv_trailing_metadata.recv_trailing_metadata
- : nullptr) {}
-
- grpc_transport_stream_op_batch* op() const { return op_; }
-
- grpc_closure* on_complete() const { return op_->on_complete; }
- void set_on_complete(grpc_closure* closure) { op_->on_complete = closure; }
-
- MetadataBatch* send_initial_metadata() {
- return op_->send_initial_metadata ? &send_initial_metadata_ : nullptr;
+ send_initial_metadata_(
+ op->send_initial_metadata
+ ? op->payload->send_initial_metadata.send_initial_metadata
+ : nullptr),
+ send_trailing_metadata_(
+ op->send_trailing_metadata
+ ? op->payload->send_trailing_metadata.send_trailing_metadata
+ : nullptr),
+ recv_initial_metadata_(
+ op->recv_initial_metadata
+ ? op->payload->recv_initial_metadata.recv_initial_metadata
+ : nullptr),
+ recv_trailing_metadata_(
+ op->recv_trailing_metadata
+ ? op->payload->recv_trailing_metadata.recv_trailing_metadata
+ : nullptr) {}
+
+ grpc_transport_stream_op_batch* op() const { return op_; }
+
+ grpc_closure* on_complete() const { return op_->on_complete; }
+ void set_on_complete(grpc_closure* closure) { op_->on_complete = closure; }
+
+ MetadataBatch* send_initial_metadata() {
+ return op_->send_initial_metadata ? &send_initial_metadata_ : nullptr;
}
- MetadataBatch* send_trailing_metadata() {
- return op_->send_trailing_metadata ? &send_trailing_metadata_ : nullptr;
+ MetadataBatch* send_trailing_metadata() {
+ return op_->send_trailing_metadata ? &send_trailing_metadata_ : nullptr;
}
- MetadataBatch* recv_initial_metadata() {
- return op_->recv_initial_metadata ? &recv_initial_metadata_ : nullptr;
+ MetadataBatch* recv_initial_metadata() {
+ return op_->recv_initial_metadata ? &recv_initial_metadata_ : nullptr;
}
- MetadataBatch* recv_trailing_metadata() {
- return op_->recv_trailing_metadata ? &recv_trailing_metadata_ : nullptr;
+ MetadataBatch* recv_trailing_metadata() {
+ return op_->recv_trailing_metadata ? &recv_trailing_metadata_ : nullptr;
}
- uint32_t* send_initial_metadata_flags() const {
- return op_->send_initial_metadata ? &op_->payload->send_initial_metadata
- .send_initial_metadata_flags
- : nullptr;
+ uint32_t* send_initial_metadata_flags() const {
+ return op_->send_initial_metadata ? &op_->payload->send_initial_metadata
+ .send_initial_metadata_flags
+ : nullptr;
}
- grpc_closure* recv_initial_metadata_ready() const {
- return op_->recv_initial_metadata
- ? op_->payload->recv_initial_metadata.recv_initial_metadata_ready
- : nullptr;
+ grpc_closure* recv_initial_metadata_ready() const {
+ return op_->recv_initial_metadata
+ ? op_->payload->recv_initial_metadata.recv_initial_metadata_ready
+ : nullptr;
}
- void set_recv_initial_metadata_ready(grpc_closure* closure) {
- op_->payload->recv_initial_metadata.recv_initial_metadata_ready = closure;
+ void set_recv_initial_metadata_ready(grpc_closure* closure) {
+ op_->payload->recv_initial_metadata.recv_initial_metadata_ready = closure;
}
- grpc_core::OrphanablePtr<grpc_core::ByteStream>* send_message() const {
- return op_->send_message ? &op_->payload->send_message.send_message
- : nullptr;
+ grpc_core::OrphanablePtr<grpc_core::ByteStream>* send_message() const {
+ return op_->send_message ? &op_->payload->send_message.send_message
+ : nullptr;
}
- void set_send_message(
- grpc_core::OrphanablePtr<grpc_core::ByteStream> send_message) {
- op_->send_message = true;
- op_->payload->send_message.send_message = std::move(send_message);
- }
-
- grpc_core::OrphanablePtr<grpc_core::ByteStream>* recv_message() const {
- return op_->recv_message ? op_->payload->recv_message.recv_message
- : nullptr;
+ void set_send_message(
+ grpc_core::OrphanablePtr<grpc_core::ByteStream> send_message) {
+ op_->send_message = true;
+ op_->payload->send_message.send_message = std::move(send_message);
}
- void set_recv_message(
- grpc_core::OrphanablePtr<grpc_core::ByteStream>* recv_message) {
- op_->recv_message = true;
- op_->payload->recv_message.recv_message = recv_message;
+
+ grpc_core::OrphanablePtr<grpc_core::ByteStream>* recv_message() const {
+ return op_->recv_message ? op_->payload->recv_message.recv_message
+ : nullptr;
+ }
+ void set_recv_message(
+ grpc_core::OrphanablePtr<grpc_core::ByteStream>* recv_message) {
+ op_->recv_message = true;
+ op_->payload->recv_message.recv_message = recv_message;
}
- census_context* get_census_context() const {
- return static_cast<census_context*>(
- op_->payload->context[GRPC_CONTEXT_TRACING].value);
+ census_context* get_census_context() const {
+ return static_cast<census_context*>(
+ op_->payload->context[GRPC_CONTEXT_TRACING].value);
}
const gpr_atm* get_peer_string() const {
@@ -220,7 +220,7 @@ class TransportStreamOpBatch {
}
private:
- grpc_transport_stream_op_batch* op_; // Not owned.
+ grpc_transport_stream_op_batch* op_; // Not owned.
MetadataBatch send_initial_metadata_;
MetadataBatch send_trailing_metadata_;
MetadataBatch recv_initial_metadata_;
@@ -230,52 +230,52 @@ class TransportStreamOpBatch {
/// Represents channel data.
class ChannelData {
public:
- ChannelData() {}
+ ChannelData() {}
virtual ~ChannelData() {}
- // TODO(roth): Come up with a more C++-like API for the channel element.
-
- /// Initializes the channel data.
+ // TODO(roth): Come up with a more C++-like API for the channel element.
+
+ /// Initializes the channel data.
virtual grpc_error* Init(grpc_channel_element* /*elem*/,
grpc_channel_element_args* /*args*/) {
return GRPC_ERROR_NONE;
}
- // Called before destruction.
+ // Called before destruction.
virtual void Destroy(grpc_channel_element* /*elem*/) {}
- virtual void StartTransportOp(grpc_channel_element* elem, TransportOp* op);
+ virtual void StartTransportOp(grpc_channel_element* elem, TransportOp* op);
- virtual void GetInfo(grpc_channel_element* elem,
- const grpc_channel_info* channel_info);
+ virtual void GetInfo(grpc_channel_element* elem,
+ const grpc_channel_info* channel_info);
};
/// Represents call data.
class CallData {
public:
- CallData() {}
+ CallData() {}
virtual ~CallData() {}
- // TODO(roth): Come up with a more C++-like API for the call element.
-
+ // TODO(roth): Come up with a more C++-like API for the call element.
+
/// Initializes the call data.
virtual grpc_error* Init(grpc_call_element* /*elem*/,
const grpc_call_element_args* /*args*/) {
return GRPC_ERROR_NONE;
}
- // Called before destruction.
+ // Called before destruction.
virtual void Destroy(grpc_call_element* /*elem*/,
const grpc_call_final_info* /*final_info*/,
grpc_closure* /*then_call_closure*/) {}
/// Starts a new stream operation.
- virtual void StartTransportStreamOpBatch(grpc_call_element* elem,
- TransportStreamOpBatch* op);
+ virtual void StartTransportStreamOpBatch(grpc_call_element* elem,
+ TransportStreamOpBatch* op);
/// Sets a pollset or pollset set.
- virtual void SetPollsetOrPollsetSet(grpc_call_element* elem,
- grpc_polling_entity* pollent);
+ virtual void SetPollsetOrPollsetSet(grpc_call_element* elem,
+ grpc_polling_entity* pollent);
};
namespace internal {
@@ -288,73 +288,73 @@ class ChannelFilter final {
public:
static const size_t channel_data_size = sizeof(ChannelDataType);
- static grpc_error* InitChannelElement(grpc_channel_element* elem,
- grpc_channel_element_args* args) {
- // Construct the object in the already-allocated memory.
- ChannelDataType* channel_data = new (elem->channel_data) ChannelDataType();
- return channel_data->Init(elem, args);
+ static grpc_error* InitChannelElement(grpc_channel_element* elem,
+ grpc_channel_element_args* args) {
+ // Construct the object in the already-allocated memory.
+ ChannelDataType* channel_data = new (elem->channel_data) ChannelDataType();
+ return channel_data->Init(elem, args);
}
- static void DestroyChannelElement(grpc_channel_element* elem) {
- ChannelDataType* channel_data =
- static_cast<ChannelDataType*>(elem->channel_data);
- channel_data->Destroy(elem);
- channel_data->~ChannelDataType();
+ static void DestroyChannelElement(grpc_channel_element* elem) {
+ ChannelDataType* channel_data =
+ static_cast<ChannelDataType*>(elem->channel_data);
+ channel_data->Destroy(elem);
+ channel_data->~ChannelDataType();
}
- static void StartTransportOp(grpc_channel_element* elem,
- grpc_transport_op* op) {
- ChannelDataType* channel_data =
- static_cast<ChannelDataType*>(elem->channel_data);
+ static void StartTransportOp(grpc_channel_element* elem,
+ grpc_transport_op* op) {
+ ChannelDataType* channel_data =
+ static_cast<ChannelDataType*>(elem->channel_data);
TransportOp op_wrapper(op);
- channel_data->StartTransportOp(elem, &op_wrapper);
+ channel_data->StartTransportOp(elem, &op_wrapper);
}
- static void GetChannelInfo(grpc_channel_element* elem,
- const grpc_channel_info* channel_info) {
- ChannelDataType* channel_data =
- static_cast<ChannelDataType*>(elem->channel_data);
- channel_data->GetInfo(elem, channel_info);
+ static void GetChannelInfo(grpc_channel_element* elem,
+ const grpc_channel_info* channel_info) {
+ ChannelDataType* channel_data =
+ static_cast<ChannelDataType*>(elem->channel_data);
+ channel_data->GetInfo(elem, channel_info);
}
static const size_t call_data_size = sizeof(CallDataType);
- static grpc_error* InitCallElement(grpc_call_element* elem,
- const grpc_call_element_args* args) {
+ static grpc_error* InitCallElement(grpc_call_element* elem,
+ const grpc_call_element_args* args) {
// Construct the object in the already-allocated memory.
- CallDataType* call_data = new (elem->call_data) CallDataType();
- return call_data->Init(elem, args);
+ CallDataType* call_data = new (elem->call_data) CallDataType();
+ return call_data->Init(elem, args);
}
- static void DestroyCallElement(grpc_call_element* elem,
- const grpc_call_final_info* final_info,
- grpc_closure* then_call_closure) {
- CallDataType* call_data = static_cast<CallDataType*>(elem->call_data);
- call_data->Destroy(elem, final_info, then_call_closure);
- call_data->~CallDataType();
+ static void DestroyCallElement(grpc_call_element* elem,
+ const grpc_call_final_info* final_info,
+ grpc_closure* then_call_closure) {
+ CallDataType* call_data = static_cast<CallDataType*>(elem->call_data);
+ call_data->Destroy(elem, final_info, then_call_closure);
+ call_data->~CallDataType();
}
- static void StartTransportStreamOpBatch(grpc_call_element* elem,
- grpc_transport_stream_op_batch* op) {
- CallDataType* call_data = static_cast<CallDataType*>(elem->call_data);
- TransportStreamOpBatch op_wrapper(op);
- call_data->StartTransportStreamOpBatch(elem, &op_wrapper);
+ static void StartTransportStreamOpBatch(grpc_call_element* elem,
+ grpc_transport_stream_op_batch* op) {
+ CallDataType* call_data = static_cast<CallDataType*>(elem->call_data);
+ TransportStreamOpBatch op_wrapper(op);
+ call_data->StartTransportStreamOpBatch(elem, &op_wrapper);
}
- static void SetPollsetOrPollsetSet(grpc_call_element* elem,
- grpc_polling_entity* pollent) {
- CallDataType* call_data = static_cast<CallDataType*>(elem->call_data);
- call_data->SetPollsetOrPollsetSet(elem, pollent);
+ static void SetPollsetOrPollsetSet(grpc_call_element* elem,
+ grpc_polling_entity* pollent) {
+ CallDataType* call_data = static_cast<CallDataType*>(elem->call_data);
+ call_data->SetPollsetOrPollsetSet(elem, pollent);
}
};
struct FilterRecord {
grpc_channel_stack_type stack_type;
int priority;
- std::function<bool(const grpc_channel_args&)> include_filter;
+ std::function<bool(const grpc_channel_args&)> include_filter;
grpc_channel_filter filter;
};
-extern std::vector<FilterRecord>* channel_filters;
+extern std::vector<FilterRecord>* channel_filters;
void ChannelFilterPluginInit();
void ChannelFilterPluginShutdown();
@@ -373,8 +373,8 @@ void ChannelFilterPluginShutdown();
/// decide whether to add a filter or not.
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) {
+ const char* name, grpc_channel_stack_type stack_type, int priority,
+ std::function<bool(const grpc_channel_args&)> include_filter) {
// If we haven't been called before, initialize channel_filters and
// call grpc_register_plugin().
if (internal::channel_filters == nullptr) {
@@ -389,11 +389,11 @@ void RegisterChannelFilter(
stack_type,
priority,
include_filter,
- {FilterType::StartTransportStreamOpBatch, FilterType::StartTransportOp,
+ {FilterType::StartTransportStreamOpBatch, FilterType::StartTransportOp,
FilterType::call_data_size, FilterType::InitCallElement,
FilterType::SetPollsetOrPollsetSet, FilterType::DestroyCallElement,
FilterType::channel_data_size, FilterType::InitChannelElement,
- FilterType::DestroyChannelElement, FilterType::GetChannelInfo, name}};
+ FilterType::DestroyChannelElement, FilterType::GetChannelInfo, name}};
internal::channel_filters->push_back(filter_record);
}
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 e5dc4fd590f..96a7105eaf4 100644
--- a/contrib/libs/grpc/src/cpp/common/completion_queue_cc.cc
+++ b/contrib/libs/grpc/src/cpp/common/completion_queue_cc.cc
@@ -1,39 +1,39 @@
/*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/completion_queue.h>
#include <memory>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
-#include <grpcpp/impl/grpc_library.h>
-#include <grpcpp/support/time.h>
+#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/support/time.h>
namespace grpc {
static internal::GrpcLibraryInitializer g_gli_initializer;
-// 'CompletionQueue' constructor can safely call GrpcLibraryCodegen(false) here
-// i.e not have GrpcLibraryCodegen call grpc_init(). This is because, to create
-// 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) {
+// 'CompletionQueue' constructor can safely call GrpcLibraryCodegen(false) here
+// i.e not have GrpcLibraryCodegen call grpc_init(). This is because, to create
+// 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) {
InitialAvalanching();
}
@@ -70,30 +70,30 @@ CompletionQueue::NextStatus CompletionQueue::AsyncNextInternal(
}
}
-CompletionQueue::CompletionQueueTLSCache::CompletionQueueTLSCache(
- CompletionQueue* cq)
- : cq_(cq), flushed_(false) {
- grpc_completion_queue_thread_local_cache_init(cq_->cq_);
-}
-
-CompletionQueue::CompletionQueueTLSCache::~CompletionQueueTLSCache() {
- GPR_ASSERT(flushed_);
-}
-
-bool CompletionQueue::CompletionQueueTLSCache::Flush(void** tag, bool* ok) {
- int res = 0;
- void* res_tag;
- flushed_ = true;
- if (grpc_completion_queue_thread_local_cache_flush(cq_->cq_, &res_tag,
- &res)) {
+CompletionQueue::CompletionQueueTLSCache::CompletionQueueTLSCache(
+ CompletionQueue* cq)
+ : cq_(cq), flushed_(false) {
+ grpc_completion_queue_thread_local_cache_init(cq_->cq_);
+}
+
+CompletionQueue::CompletionQueueTLSCache::~CompletionQueueTLSCache() {
+ GPR_ASSERT(flushed_);
+}
+
+bool CompletionQueue::CompletionQueueTLSCache::Flush(void** tag, bool* ok) {
+ int res = 0;
+ void* res_tag;
+ flushed_ = true;
+ if (grpc_completion_queue_thread_local_cache_flush(cq_->cq_, &res_tag,
+ &res)) {
auto core_cq_tag =
static_cast<::grpc::internal::CompletionQueueTag*>(res_tag);
- *ok = res == 1;
+ *ok = res == 1;
if (core_cq_tag->FinalizeResult(tag, ok)) {
- return true;
- }
- }
- return false;
-}
-
+ return true;
+ }
+ }
+ return false;
+}
+
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/common/core_codegen.cc b/contrib/libs/grpc/src/cpp/common/core_codegen.cc
index 079e390f089..75383ed5110 100644
--- a/contrib/libs/grpc/src/cpp/common/core_codegen.cc
+++ b/contrib/libs/grpc/src/cpp/common/core_codegen.cc
@@ -1,22 +1,22 @@
/*
*
- * Copyright 2016 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.h>
+#include <grpcpp/impl/codegen/core_codegen.h>
#include <stdlib.h>
@@ -29,7 +29,7 @@
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/sync.h>
-#include <grpcpp/support/config.h>
+#include <grpcpp/support/config.h>
#include "src/core/lib/profiling/timers.h"
@@ -37,28 +37,28 @@ struct grpc_byte_buffer;
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);
-}
-
+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(
+ 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);
+ 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);
}
-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);
}
@@ -78,9 +78,9 @@ 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::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); }
@@ -94,18 +94,18 @@ int CoreCodegen::gpr_cv_wait(gpr_cv* cv, gpr_mu* mu,
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);
-}
-
+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);
-}
-
+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,
@@ -113,20 +113,20 @@ grpc_call_error CoreCodegen::grpc_call_start_batch(grpc_call* call,
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);
-}
-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);
-}
+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);
+}
+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);
@@ -152,20 +152,20 @@ grpc_byte_buffer* CoreCodegen::grpc_raw_byte_buffer_create(grpc_slice* slice,
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_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);
}
@@ -174,33 +174,33 @@ 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_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);
-}
-
+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);
@@ -230,10 +230,10 @@ 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);
+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();
}
diff --git a/contrib/libs/grpc/src/cpp/common/insecure_create_auth_context.cc b/contrib/libs/grpc/src/cpp/common/insecure_create_auth_context.cc
index 36e7b2a971e..4e5cbd03723 100644
--- a/contrib/libs/grpc/src/cpp/common/insecure_create_auth_context.cc
+++ b/contrib/libs/grpc/src/cpp/common/insecure_create_auth_context.cc
@@ -1,24 +1,24 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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 <grpcpp/security/auth_context.h>
+#include <grpcpp/security/auth_context.h>
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 40ec0841015..64abff96338 100644
--- a/contrib/libs/grpc/src/cpp/common/resource_quota_cc.cc
+++ b/contrib/libs/grpc/src/cpp/common/resource_quota_cc.cc
@@ -1,23 +1,23 @@
/*
*
- * Copyright 2016 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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 <grpcpp/resource_quota.h>
+#include <grpcpp/resource_quota.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 4c5b18e7bf7..a47dd3e4444 100644
--- a/contrib/libs/grpc/src/cpp/common/rpc_method.cc
+++ b/contrib/libs/grpc/src/cpp/common/rpc_method.cc
@@ -1,21 +1,21 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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>
+#include <grpcpp/impl/rpc_method.h>
namespace grpc {} // namespace grpc
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 165523de859..e1f97889c8e 100644
--- a/contrib/libs/grpc/src/cpp/common/secure_auth_context.cc
+++ b/contrib/libs/grpc/src/cpp/common/secure_auth_context.cc
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
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 d2890c66150..51013efac70 100644
--- a/contrib/libs/grpc/src/cpp/common/secure_auth_context.h
+++ b/contrib/libs/grpc/src/cpp/common/secure_auth_context.h
@@ -1,25 +1,25 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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
-#include <grpcpp/security/auth_context.h>
+#include <grpcpp/security/auth_context.h>
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/security/context/security_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 08114a6c83f..844bc627ab3 100644
--- a/contrib/libs/grpc/src/cpp/common/secure_channel_arguments.cc
+++ b/contrib/libs/grpc/src/cpp/common/secure_channel_arguments.cc
@@ -1,22 +1,22 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/channel_arguments.h>
+#include <grpcpp/support/channel_arguments.h>
#include <grpc/grpc_security.h>
#include "src/core/lib/channel/channel_args.h"
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 6ddf22c1a57..908c46629e6 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,25 +1,25 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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 <grpcpp/security/auth_context.h>
+#include <grpcpp/security/auth_context.h>
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/cpp/common/secure_auth_context.h"
diff --git a/contrib/libs/grpc/src/cpp/common/version_cc.cc b/contrib/libs/grpc/src/cpp/common/version_cc.cc
index 26501822aab..7f4228346a9 100644
--- a/contrib/libs/grpc/src/cpp/common/version_cc.cc
+++ b/contrib/libs/grpc/src/cpp/common/version_cc.cc
@@ -1,26 +1,26 @@
/*
*
- * Copyright 2016 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/core/surface/version.c.template */
-#include <grpcpp/grpcpp.h>
+#include <grpcpp/grpcpp.h>
namespace grpc {
TString Version() { return "1.33.2"; }
-} // namespace grpc
+} // 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 cb669348f09..1b388210c05 100644
--- a/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.cc
+++ b/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.cc
@@ -1,35 +1,35 @@
/*
*
- * Copyright 2016 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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 <unordered_set>
#include <vector>
-#include <grpcpp/grpcpp.h>
+#include <grpcpp/grpcpp.h>
#include "src/cpp/ext/proto_server_reflection.h"
using grpc::Status;
using grpc::StatusCode;
-using grpc::reflection::v1alpha::ErrorResponse;
-using grpc::reflection::v1alpha::ExtensionNumberResponse;
-using grpc::reflection::v1alpha::ExtensionRequest;
-using grpc::reflection::v1alpha::FileDescriptorResponse;
-using grpc::reflection::v1alpha::ListServiceResponse;
+using grpc::reflection::v1alpha::ErrorResponse;
+using grpc::reflection::v1alpha::ExtensionNumberResponse;
+using grpc::reflection::v1alpha::ExtensionRequest;
+using grpc::reflection::v1alpha::FileDescriptorResponse;
+using grpc::reflection::v1alpha::ListServiceResponse;
using grpc::reflection::v1alpha::ServerReflectionRequest;
using grpc::reflection::v1alpha::ServerReflectionResponse;
using grpc::reflection::v1alpha::ServiceResponse;
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 2255d56125e..2d17eed95a8 100644
--- a/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.h
+++ b/contrib/libs/grpc/src/cpp/ext/proto_server_reflection.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -22,7 +22,7 @@
#include <unordered_set>
#include <vector>
-#include <grpcpp/grpcpp.h>
+#include <grpcpp/grpcpp.h>
#include "src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h"
namespace grpc {
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 6de2952ecdc..007193d7f72 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,25 +1,25 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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>
-#include <grpcpp/impl/server_initializer.h>
-#include <grpcpp/server.h>
+#include <grpcpp/ext/proto_server_reflection_plugin.h>
+#include <grpcpp/impl/server_builder_plugin.h>
+#include <grpcpp/impl/server_initializer.h>
+#include <grpcpp/server.h>
#include "src/cpp/ext/proto_server_reflection.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 2a549e674fa..07697a52d1f 100644
--- a/contrib/libs/grpc/src/cpp/server/async_generic_service.cc
+++ b/contrib/libs/grpc/src/cpp/server/async_generic_service.cc
@@ -1,24 +1,24 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/generic/async_generic_service.h>
+#include <grpcpp/generic/async_generic_service.h>
-#include <grpcpp/server.h>
+#include <grpcpp/server.h>
namespace grpc {
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 69be1ead746..9aad932429d 100644
--- a/contrib/libs/grpc/src/cpp/server/channel_argument_option.cc
+++ b/contrib/libs/grpc/src/cpp/server/channel_argument_option.cc
@@ -1,65 +1,65 @@
-/*
- *
- * 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 <grpcpp/impl/channel_argument_option.h>
-
-namespace grpc {
-
-std::unique_ptr<ServerBuilderOption> MakeChannelArgumentOption(
+/*
+ *
+ * Copyright 2017 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <grpcpp/impl/channel_argument_option.h>
+
+namespace grpc {
+
+std::unique_ptr<ServerBuilderOption> MakeChannelArgumentOption(
const TString& name, const TString& value) {
- class StringOption final : public ServerBuilderOption {
- public:
+ class StringOption final : public ServerBuilderOption {
+ public:
StringOption(const TString& name, const TString& value)
- : name_(name), value_(value) {}
-
- virtual void UpdateArguments(ChannelArguments* args) override {
- args->SetString(name_, value_);
- }
- virtual void UpdatePlugins(
+ : name_(name), value_(value) {}
+
+ virtual void UpdateArguments(ChannelArguments* args) override {
+ args->SetString(name_, value_);
+ }
+ virtual void UpdatePlugins(
std::vector<std::unique_ptr<ServerBuilderPlugin>>* /*plugins*/)
override {}
-
- private:
+
+ private:
const TString name_;
const TString value_;
- };
- return std::unique_ptr<ServerBuilderOption>(new StringOption(name, value));
-}
-
-std::unique_ptr<ServerBuilderOption> MakeChannelArgumentOption(
+ };
+ return std::unique_ptr<ServerBuilderOption>(new StringOption(name, value));
+}
+
+std::unique_ptr<ServerBuilderOption> MakeChannelArgumentOption(
const TString& name, int value) {
- class IntOption final : public ServerBuilderOption {
- public:
+ class IntOption final : public ServerBuilderOption {
+ public:
IntOption(const TString& name, int value)
- : name_(name), value_(value) {}
-
- virtual void UpdateArguments(ChannelArguments* args) override {
- args->SetInt(name_, value_);
- }
- virtual void UpdatePlugins(
+ : name_(name), value_(value) {}
+
+ virtual void UpdateArguments(ChannelArguments* args) override {
+ args->SetInt(name_, value_);
+ }
+ virtual void UpdatePlugins(
std::vector<std::unique_ptr<ServerBuilderPlugin>>* /*plugins*/)
override {}
-
- private:
+
+ private:
const TString name_;
- const int value_;
- };
- return std::unique_ptr<ServerBuilderOption>(new IntOption(name, value));
-}
-
-} // namespace grpc
+ const int value_;
+ };
+ return std::unique_ptr<ServerBuilderOption>(new IntOption(name, value));
+}
+
+} // namespace grpc
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 16ca3783e87..8ca3e32c2fb 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,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -23,22 +23,22 @@
#ifndef GRPC_CUSTOM_DEFAULT_THREAD_POOL
namespace grpc {
-namespace {
+namespace {
-ThreadPoolInterface* CreateDefaultThreadPoolImpl() {
+ThreadPoolInterface* CreateDefaultThreadPoolImpl() {
int cores = gpr_cpu_num_cores();
if (!cores) cores = 4;
return new DynamicThreadPool(cores);
}
-CreateThreadPoolFunc g_ctp_impl = CreateDefaultThreadPoolImpl;
-
-} // namespace
-
-ThreadPoolInterface* CreateDefaultThreadPool() { return g_ctp_impl(); }
-
-void SetCreateThreadPool(CreateThreadPoolFunc func) { g_ctp_impl = func; }
-
+CreateThreadPoolFunc g_ctp_impl = CreateDefaultThreadPoolImpl;
+
+} // namespace
+
+ThreadPoolInterface* CreateDefaultThreadPool() { return g_ctp_impl(); }
+
+void SetCreateThreadPool(CreateThreadPoolFunc func) { g_ctp_impl = func; }
+
} // namespace grpc
#endif // !GRPC_CUSTOM_DEFAULT_THREAD_POOL
diff --git a/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.cc b/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.cc
index db6036c9258..77c5d6a263d 100644
--- a/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.cc
+++ b/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.cc
@@ -1,40 +1,40 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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 <grpc/support/log.h>
+#include "src/cpp/server/dynamic_thread_pool.h"
+
+#include <grpc/support/log.h>
#include <grpcpp/impl/codegen/sync.h>
-#include "src/core/lib/gprpp/thd.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();
+ thd_("grpcpp_dynamic_pool",
+ [](void* th) {
+ static_cast<DynamicThreadPool::DynamicThread*>(th)->ThreadFunc();
+ },
+ this) {
+ thd_.Start();
}
-DynamicThreadPool::DynamicThread::~DynamicThread() { thd_.Join(); }
+DynamicThreadPool::DynamicThread::~DynamicThread() { thd_.Join(); }
void DynamicThreadPool::DynamicThread::ThreadFunc() {
pool_->ThreadFunc();
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 42d2ea4ba69..6f9f943bc38 100644
--- a/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h
+++ b/contrib/libs/grpc/src/cpp/server/dynamic_thread_pool.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -23,10 +23,10 @@
#include <memory>
#include <queue>
-#include <grpcpp/support/config.h>
+#include <grpcpp/support/config.h>
#include "src/core/lib/gprpp/sync.h"
-#include "src/core/lib/gprpp/thd.h"
+#include "src/core/lib/gprpp/thd.h"
#include "src/cpp/server/thread_pool_interface.h"
namespace grpc {
@@ -46,7 +46,7 @@ class DynamicThreadPool final : public ThreadPoolInterface {
private:
DynamicThreadPool* pool_;
- grpc_core::Thread thd_;
+ grpc_core::Thread thd_;
void ThreadFunc();
};
grpc_core::Mutex mu_;
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 16f81ea474a..3cc508d0cbf 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,37 +1,37 @@
-/*
- *
- * Copyright 2016 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <memory>
-
+/*
+ *
+ * Copyright 2016 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <memory>
+
#include "upb/upb.hpp"
-#include <grpc/slice.h>
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
+#include <grpc/slice.h>
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
#include <grpcpp/impl/codegen/method_handler.h>
-
+
#include "src/cpp/server/health/default_health_check_service.h"
#include "src/proto/grpc/health/v1/health.upb.h"
#include "upb/upb.hpp"
-
+
#define MAX_SERVICE_NAME_LENGTH 200
-namespace grpc {
+namespace grpc {
//
// DefaultHealthCheckService
@@ -144,12 +144,12 @@ void DefaultHealthCheckService::ServiceData::RemoveCallHandler(
// DefaultHealthCheckService::HealthCheckServiceImpl
//
-namespace {
-const char kHealthCheckMethodName[] = "/grpc.health.v1.Health/Check";
+namespace {
+const char kHealthCheckMethodName[] = "/grpc.health.v1.Health/Check";
const char kHealthWatchMethodName[] = "/grpc.health.v1.Health/Watch";
-} // namespace
-
-DefaultHealthCheckService::HealthCheckServiceImpl::HealthCheckServiceImpl(
+} // namespace
+
+DefaultHealthCheckService::HealthCheckServiceImpl::HealthCheckServiceImpl(
DefaultHealthCheckService* database,
std::unique_ptr<ServerCompletionQueue> cq)
: database_(database), cq_(std::move(cq)) {
@@ -162,8 +162,8 @@ DefaultHealthCheckService::HealthCheckServiceImpl::HealthCheckServiceImpl(
// Create serving thread.
thread_ = std::unique_ptr<::grpc_core::Thread>(
new ::grpc_core::Thread("grpc_health_check_service", Serve, this));
-}
-
+}
+
DefaultHealthCheckService::HealthCheckServiceImpl::~HealthCheckServiceImpl() {
// We will reach here after the server starts shutting down.
shutdown_ = true;
@@ -201,28 +201,28 @@ void DefaultHealthCheckService::HealthCheckServiceImpl::Serve(void* arg) {
bool DefaultHealthCheckService::HealthCheckServiceImpl::DecodeRequest(
const ByteBuffer& request, TString* service_name) {
- std::vector<Slice> slices;
+ std::vector<Slice> slices;
if (!request.Dump(&slices).ok()) return false;
- uint8_t* request_bytes = nullptr;
- size_t request_size = 0;
+ uint8_t* request_bytes = nullptr;
+ size_t request_size = 0;
if (slices.size() == 1) {
- request_bytes = const_cast<uint8_t*>(slices[0].begin());
- request_size = slices[0].size();
+ request_bytes = const_cast<uint8_t*>(slices[0].begin());
+ request_size = slices[0].size();
} else if (slices.size() > 1) {
request_bytes = static_cast<uint8_t*>(gpr_malloc(request.Length()));
- uint8_t* copy_to = request_bytes;
- for (size_t i = 0; i < slices.size(); i++) {
- memcpy(copy_to, slices[i].begin(), slices[i].size());
- copy_to += slices[i].size();
- }
- }
+ uint8_t* copy_to = request_bytes;
+ for (size_t i = 0; i < slices.size(); i++) {
+ memcpy(copy_to, slices[i].begin(), slices[i].size());
+ copy_to += slices[i].size();
+ }
+ }
upb::Arena arena;
grpc_health_v1_HealthCheckRequest* request_struct =
grpc_health_v1_HealthCheckRequest_parse(
reinterpret_cast<char*>(request_bytes), request_size, arena.ptr());
if (slices.size() > 1) {
gpr_free(request_bytes);
- }
+ }
if (request_struct == nullptr) {
return false;
}
@@ -234,7 +234,7 @@ bool DefaultHealthCheckService::HealthCheckServiceImpl::DecodeRequest(
service_name->assign(service.data, service.size);
return true;
}
-
+
bool DefaultHealthCheckService::HealthCheckServiceImpl::EncodeResponse(
ServingStatus status, ByteBuffer* response) {
upb::Arena arena;
@@ -253,12 +253,12 @@ bool DefaultHealthCheckService::HealthCheckServiceImpl::EncodeResponse(
return false;
}
grpc_slice response_slice = grpc_slice_from_copied_buffer(buf, buf_length);
- Slice encoded_response(response_slice, Slice::STEAL_REF);
- ByteBuffer response_buffer(&encoded_response, 1);
- response->Swap(&response_buffer);
+ Slice encoded_response(response_slice, Slice::STEAL_REF);
+ ByteBuffer response_buffer(&encoded_response, 1);
+ response->Swap(&response_buffer);
return true;
-}
-
+}
+
//
// DefaultHealthCheckService::HealthCheckServiceImpl::CheckCallHandler
//
@@ -281,8 +281,8 @@ void DefaultHealthCheckService::HealthCheckServiceImpl::CheckCallHandler::
service->RequestAsyncUnary(0, &handler->ctx_, &handler->request_,
&handler->writer_, cq, cq, &handler->next_);
}
-}
-
+}
+
DefaultHealthCheckService::HealthCheckServiceImpl::CheckCallHandler::
CheckCallHandler(ServerCompletionQueue* cq,
DefaultHealthCheckService* database,
@@ -329,17 +329,17 @@ void DefaultHealthCheckService::HealthCheckServiceImpl::CheckCallHandler::
}
}
}
-}
-
+}
+
void DefaultHealthCheckService::HealthCheckServiceImpl::CheckCallHandler::
OnFinishDone(std::shared_ptr<CallHandler> self, bool ok) {
if (ok) {
gpr_log(GPR_DEBUG, "[HCS %p] Health check call finished for handler %p",
service_, this);
- }
+ }
self.reset(); // To appease clang-tidy.
-}
-
+}
+
//
// DefaultHealthCheckService::HealthCheckServiceImpl::WatchCallHandler
//
@@ -368,9 +368,9 @@ void DefaultHealthCheckService::HealthCheckServiceImpl::WatchCallHandler::
service->RequestAsyncServerStreaming(1, &handler->ctx_, &handler->request_,
&handler->stream_, cq, cq,
&handler->next_);
- }
-}
-
+ }
+}
+
DefaultHealthCheckService::HealthCheckServiceImpl::WatchCallHandler::
WatchCallHandler(ServerCompletionQueue* cq,
DefaultHealthCheckService* database,
@@ -403,8 +403,8 @@ void DefaultHealthCheckService::HealthCheckServiceImpl::WatchCallHandler::
"[HCS %p] Health watch started for service \"%s\" (handler: %p)",
service_, service_name_.c_str(), this);
database_->RegisterCallHandler(service_name_, std::move(self));
-}
-
+}
+
void DefaultHealthCheckService::HealthCheckServiceImpl::WatchCallHandler::
SendHealth(std::shared_ptr<CallHandler> self, ServingStatus status) {
grpc_core::MutexLock lock(&send_mu_);
@@ -501,4 +501,4 @@ void DefaultHealthCheckService::HealthCheckServiceImpl::WatchCallHandler::
SendFinish(std::move(self), Status::CANCELLED);
}
-} // namespace grpc
+} // namespace grpc
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 3d7935ae8c2..9da1dfc15fa 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,50 +1,50 @@
-/*
- *
- * 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_INTERNAL_CPP_SERVER_DEFAULT_HEALTH_CHECK_SERVICE_H
+#define GRPC_INTERNAL_CPP_SERVER_DEFAULT_HEALTH_CHECK_SERVICE_H
+
#include <atomic>
#include <set>
-
+
#include <grpc/support/log.h>
#include <grpcpp/grpcpp.h>
-#include <grpcpp/health_check_service_interface.h>
+#include <grpcpp/health_check_service_interface.h>
#include <grpcpp/impl/codegen/async_generic_service.h>
#include <grpcpp/impl/codegen/async_unary_call.h>
#include <grpcpp/impl/codegen/completion_queue.h>
-#include <grpcpp/impl/codegen/service_type.h>
-#include <grpcpp/support/byte_buffer.h>
-
+#include <grpcpp/impl/codegen/service_type.h>
+#include <grpcpp/support/byte_buffer.h>
+
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/gprpp/thd.h"
-namespace grpc {
-
-// Default implementation of HealthCheckServiceInterface. Server will create and
-// own it.
-class DefaultHealthCheckService final : public HealthCheckServiceInterface {
- public:
+namespace grpc {
+
+// Default implementation of HealthCheckServiceInterface. Server will create and
+// own it.
+class DefaultHealthCheckService final : public HealthCheckServiceInterface {
+ public:
enum ServingStatus { NOT_FOUND, SERVING, NOT_SERVING };
- // The service impl to register with the server.
- class HealthCheckServiceImpl : public Service {
- public:
+ // The service impl to register with the server.
+ class HealthCheckServiceImpl : public Service {
+ public:
// Base class for call handlers.
class CallHandler {
public:
@@ -52,15 +52,15 @@ class DefaultHealthCheckService final : public HealthCheckServiceInterface {
virtual void SendHealth(std::shared_ptr<CallHandler> self,
ServingStatus status) = 0;
};
-
+
HealthCheckServiceImpl(DefaultHealthCheckService* database,
std::unique_ptr<ServerCompletionQueue> cq);
-
+
~HealthCheckServiceImpl();
void StartServingThread();
- private:
+ private:
// A tag that can be called with a bool argument. It's tailored for
// CallHandler's use. Before being used, it should be constructed with a
// method of CallHandler and a shared pointer to the handler. The
@@ -230,21 +230,21 @@ class DefaultHealthCheckService final : public HealthCheckServiceInterface {
grpc_core::Mutex cq_shutdown_mu_;
std::atomic_bool shutdown_{false};
std::unique_ptr<::grpc_core::Thread> thread_;
- };
-
- DefaultHealthCheckService();
+ };
+
+ DefaultHealthCheckService();
void SetServingStatus(const TString& service_name, bool serving) override;
- void SetServingStatus(bool serving) override;
+ void SetServingStatus(bool serving) override;
void Shutdown() override;
ServingStatus GetServingStatus(const TString& service_name) const;
-
+
HealthCheckServiceImpl* GetHealthCheckService(
std::unique_ptr<ServerCompletionQueue> cq);
- private:
+ private:
// Stores the current serving status of a service and any call
// handlers registered for updates when the service's status changes.
class ServiceData {
@@ -276,9 +276,9 @@ class DefaultHealthCheckService final : public HealthCheckServiceInterface {
mutable grpc_core::Mutex mu_;
bool shutdown_ = false; // Guarded by mu_.
std::map<TString, ServiceData> services_map_; // Guarded by mu_.
- std::unique_ptr<HealthCheckServiceImpl> impl_;
-};
-
-} // namespace grpc
-
-#endif // GRPC_INTERNAL_CPP_SERVER_DEFAULT_HEALTH_CHECK_SERVICE_H
+ std::unique_ptr<HealthCheckServiceImpl> impl_;
+};
+
+} // namespace grpc
+
+#endif // GRPC_INTERNAL_CPP_SERVER_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 ce625563efd..a0fa2d62f58 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,34 +1,34 @@
-/*
- *
- * 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>
-
+
namespace grpc {
-namespace {
-bool g_grpc_default_health_check_service_enabled = false;
-} // namespace
-
-bool DefaultHealthCheckServiceEnabled() {
- return g_grpc_default_health_check_service_enabled;
-}
-
-void EnableDefaultHealthCheckService(bool enable) {
- g_grpc_default_health_check_service_enabled = enable;
-}
-
+namespace {
+bool g_grpc_default_health_check_service_enabled = false;
+} // namespace
+
+bool DefaultHealthCheckServiceEnabled() {
+ return g_grpc_default_health_check_service_enabled;
+}
+
+void EnableDefaultHealthCheckService(bool enable) {
+ g_grpc_default_health_check_service_enabled = enable;
+}
+
} // namespace grpc
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 7b176b07499..3fa384ace9e 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,35 +1,35 @@
-/*
- *
- * 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/ext/health_check_service_server_builder_option.h>
-
-namespace grpc {
-
-HealthCheckServiceServerBuilderOption::HealthCheckServiceServerBuilderOption(
- std::unique_ptr<HealthCheckServiceInterface> hc)
- : hc_(std::move(hc)) {}
-// Hand over hc_ to the server.
-void HealthCheckServiceServerBuilderOption::UpdateArguments(
- ChannelArguments* args) {
- args->SetPointer(kHealthCheckServiceInterfaceArg, hc_.release());
-}
-
-void HealthCheckServiceServerBuilderOption::UpdatePlugins(
+/*
+ *
+ * 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/ext/health_check_service_server_builder_option.h>
+
+namespace grpc {
+
+HealthCheckServiceServerBuilderOption::HealthCheckServiceServerBuilderOption(
+ std::unique_ptr<HealthCheckServiceInterface> hc)
+ : hc_(std::move(hc)) {}
+// Hand over hc_ to the server.
+void HealthCheckServiceServerBuilderOption::UpdateArguments(
+ ChannelArguments* args) {
+ args->SetPointer(kHealthCheckServiceInterfaceArg, hc_.release());
+}
+
+void HealthCheckServiceServerBuilderOption::UpdatePlugins(
std::vector<std::unique_ptr<ServerBuilderPlugin>>* /*plugins*/) {}
-
-} // namespace grpc
+
+} // namespace grpc
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 493f6067f4a..3f33f4e045c 100644
--- a/contrib/libs/grpc/src/cpp/server/insecure_server_credentials.cc
+++ b/contrib/libs/grpc/src/cpp/server/insecure_server_credentials.cc
@@ -1,22 +1,22 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/security/server_credentials.h>
+#include <grpcpp/security/server_credentials.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
diff --git a/contrib/libs/grpc/src/cpp/server/load_reporter/load_data_store.cc b/contrib/libs/grpc/src/cpp/server/load_reporter/load_data_store.cc
index 46be0cd6aa2..f07fa812a7d 100644
--- a/contrib/libs/grpc/src/cpp/server/load_reporter/load_data_store.cc
+++ b/contrib/libs/grpc/src/cpp/server/load_reporter/load_data_store.cc
@@ -1,82 +1,82 @@
-/*
- *
- * 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/impl/codegen/port_platform.h>
#include <stdio.h>
-#include <cstdlib>
-#include <set>
-#include <unordered_map>
-#include <vector>
-
+#include <cstdlib>
+#include <set>
+#include <unordered_map>
+#include <vector>
+
#include "src/core/lib/iomgr/socket_utils.h"
-#include "src/cpp/server/load_reporter/load_data_store.h"
-
-namespace grpc {
-namespace load_reporter {
-
-// Some helper functions.
-namespace {
-
-// Given a map from type K to a set of value type V, finds the set associated
-// with the given key and erases the value from the set. If the set becomes
-// empty, also erases the key-set pair. Returns true if the value is erased
-// successfully.
-template <typename K, typename V>
-bool UnorderedMapOfSetEraseKeyValue(std::unordered_map<K, std::set<V>>& map,
- const K& key, const V& value) {
- auto it = map.find(key);
- if (it != map.end()) {
- size_t erased = it->second.erase(value);
- if (it->second.size() == 0) {
- map.erase(it);
- }
- return erased;
- }
- return false;
-};
-
-// Given a map from type K to a set of value type V, removes the given key and
-// the associated set, and returns the set. Returns an empty set if the key is
-// not found.
-template <typename K, typename V>
-std::set<V> UnorderedMapOfSetExtract(std::unordered_map<K, std::set<V>>& map,
- const K& key) {
- auto it = map.find(key);
- if (it != map.end()) {
- auto set = std::move(it->second);
- map.erase(it);
- return set;
- }
- return {};
-};
-
-// From a non-empty container, returns a pointer to a random element.
-template <typename C>
-const typename C::value_type* RandomElement(const C& container) {
- GPR_ASSERT(!container.empty());
- auto it = container.begin();
- std::advance(it, std::rand() % container.size());
- return &(*it);
-}
-
-} // namespace
-
+#include "src/cpp/server/load_reporter/load_data_store.h"
+
+namespace grpc {
+namespace load_reporter {
+
+// Some helper functions.
+namespace {
+
+// Given a map from type K to a set of value type V, finds the set associated
+// with the given key and erases the value from the set. If the set becomes
+// empty, also erases the key-set pair. Returns true if the value is erased
+// successfully.
+template <typename K, typename V>
+bool UnorderedMapOfSetEraseKeyValue(std::unordered_map<K, std::set<V>>& map,
+ const K& key, const V& value) {
+ auto it = map.find(key);
+ if (it != map.end()) {
+ size_t erased = it->second.erase(value);
+ if (it->second.size() == 0) {
+ map.erase(it);
+ }
+ return erased;
+ }
+ return false;
+};
+
+// Given a map from type K to a set of value type V, removes the given key and
+// the associated set, and returns the set. Returns an empty set if the key is
+// not found.
+template <typename K, typename V>
+std::set<V> UnorderedMapOfSetExtract(std::unordered_map<K, std::set<V>>& map,
+ const K& key) {
+ auto it = map.find(key);
+ if (it != map.end()) {
+ auto set = std::move(it->second);
+ map.erase(it);
+ return set;
+ }
+ return {};
+};
+
+// From a non-empty container, returns a pointer to a random element.
+template <typename C>
+const typename C::value_type* RandomElement(const C& container) {
+ GPR_ASSERT(!container.empty());
+ auto it = container.begin();
+ std::advance(it, std::rand() % container.size());
+ return &(*it);
+}
+
+} // namespace
+
LoadRecordKey::LoadRecordKey(const TString& client_ip_and_token,
TString user_id)
: user_id_(std::move(user_id)) {
@@ -138,201 +138,201 @@ LoadRecordValue::LoadRecordValue(TString metric_name, uint64_t num_calls,
CallMetricValue(num_calls, total_metric_value));
}
-void PerBalancerStore::MergeRow(const LoadRecordKey& key,
- const LoadRecordValue& value) {
- // During suspension, the load data received will be dropped.
- if (!suspended_) {
- load_record_map_[key].MergeFrom(value);
- gpr_log(GPR_DEBUG,
- "[PerBalancerStore %p] Load data merged (Key: %s, Value: %s).",
- this, key.ToString().c_str(), value.ToString().c_str());
- } else {
- gpr_log(GPR_DEBUG,
- "[PerBalancerStore %p] Load data dropped (Key: %s, Value: %s).",
- this, key.ToString().c_str(), value.ToString().c_str());
- }
- // We always keep track of num_calls_in_progress_, so that when this
- // store is resumed, we still have a correct value of
- // num_calls_in_progress_.
- GPR_ASSERT(static_cast<int64_t>(num_calls_in_progress_) +
- value.GetNumCallsInProgressDelta() >=
- 0);
- num_calls_in_progress_ += value.GetNumCallsInProgressDelta();
-}
-
-void PerBalancerStore::Suspend() {
- suspended_ = true;
- load_record_map_.clear();
- gpr_log(GPR_DEBUG, "[PerBalancerStore %p] Suspended.", this);
-}
-
-void PerBalancerStore::Resume() {
- suspended_ = false;
- gpr_log(GPR_DEBUG, "[PerBalancerStore %p] Resumed.", this);
-}
-
-uint64_t PerBalancerStore::GetNumCallsInProgressForReport() {
- GPR_ASSERT(!suspended_);
- last_reported_num_calls_in_progress_ = num_calls_in_progress_;
- return num_calls_in_progress_;
-}
-
+void PerBalancerStore::MergeRow(const LoadRecordKey& key,
+ const LoadRecordValue& value) {
+ // During suspension, the load data received will be dropped.
+ if (!suspended_) {
+ load_record_map_[key].MergeFrom(value);
+ gpr_log(GPR_DEBUG,
+ "[PerBalancerStore %p] Load data merged (Key: %s, Value: %s).",
+ this, key.ToString().c_str(), value.ToString().c_str());
+ } else {
+ gpr_log(GPR_DEBUG,
+ "[PerBalancerStore %p] Load data dropped (Key: %s, Value: %s).",
+ this, key.ToString().c_str(), value.ToString().c_str());
+ }
+ // We always keep track of num_calls_in_progress_, so that when this
+ // store is resumed, we still have a correct value of
+ // num_calls_in_progress_.
+ GPR_ASSERT(static_cast<int64_t>(num_calls_in_progress_) +
+ value.GetNumCallsInProgressDelta() >=
+ 0);
+ num_calls_in_progress_ += value.GetNumCallsInProgressDelta();
+}
+
+void PerBalancerStore::Suspend() {
+ suspended_ = true;
+ load_record_map_.clear();
+ gpr_log(GPR_DEBUG, "[PerBalancerStore %p] Suspended.", this);
+}
+
+void PerBalancerStore::Resume() {
+ suspended_ = false;
+ gpr_log(GPR_DEBUG, "[PerBalancerStore %p] Resumed.", this);
+}
+
+uint64_t PerBalancerStore::GetNumCallsInProgressForReport() {
+ GPR_ASSERT(!suspended_);
+ last_reported_num_calls_in_progress_ = num_calls_in_progress_;
+ return num_calls_in_progress_;
+}
+
void PerHostStore::ReportStreamCreated(const TString& lb_id,
const TString& load_key) {
- GPR_ASSERT(lb_id != kInvalidLbId);
- SetUpForNewLbId(lb_id, load_key);
- // Prior to this one, there was no load balancer receiving report, so we may
- // have unassigned orphaned stores to assign to this new balancer.
- // TODO(juanlishen): If the load key of this new stream is the same with
- // some previously adopted orphan store, we may want to take the orphan to
- // this stream. Need to discuss with LB team.
- if (assigned_stores_.size() == 1) {
- for (const auto& p : per_balancer_stores_) {
+ GPR_ASSERT(lb_id != kInvalidLbId);
+ SetUpForNewLbId(lb_id, load_key);
+ // Prior to this one, there was no load balancer receiving report, so we may
+ // have unassigned orphaned stores to assign to this new balancer.
+ // TODO(juanlishen): If the load key of this new stream is the same with
+ // some previously adopted orphan store, we may want to take the orphan to
+ // this stream. Need to discuss with LB team.
+ if (assigned_stores_.size() == 1) {
+ for (const auto& p : per_balancer_stores_) {
const TString& other_lb_id = p.first;
- const std::unique_ptr<PerBalancerStore>& orphaned_store = p.second;
- if (other_lb_id != lb_id) {
- orphaned_store->Resume();
- AssignOrphanedStore(orphaned_store.get(), lb_id);
- }
- }
- }
- // The first connected balancer will adopt the kInvalidLbId.
- if (per_balancer_stores_.size() == 1) {
- SetUpForNewLbId(kInvalidLbId, "");
- ReportStreamClosed(kInvalidLbId);
- }
-}
-
+ const std::unique_ptr<PerBalancerStore>& orphaned_store = p.second;
+ if (other_lb_id != lb_id) {
+ orphaned_store->Resume();
+ AssignOrphanedStore(orphaned_store.get(), lb_id);
+ }
+ }
+ }
+ // The first connected balancer will adopt the kInvalidLbId.
+ if (per_balancer_stores_.size() == 1) {
+ SetUpForNewLbId(kInvalidLbId, "");
+ ReportStreamClosed(kInvalidLbId);
+ }
+}
+
void PerHostStore::ReportStreamClosed(const TString& lb_id) {
- auto it_store_for_gone_lb = per_balancer_stores_.find(lb_id);
- GPR_ASSERT(it_store_for_gone_lb != per_balancer_stores_.end());
- // Remove this closed stream from our records.
- GPR_ASSERT(UnorderedMapOfSetEraseKeyValue(
- load_key_to_receiving_lb_ids_, it_store_for_gone_lb->second->load_key(),
- lb_id));
- std::set<PerBalancerStore*> orphaned_stores =
- UnorderedMapOfSetExtract(assigned_stores_, lb_id);
- // The stores that were assigned to this balancer are orphaned now. They
- // should be re-assigned to other balancers which are still receiving reports.
- for (PerBalancerStore* orphaned_store : orphaned_stores) {
+ auto it_store_for_gone_lb = per_balancer_stores_.find(lb_id);
+ GPR_ASSERT(it_store_for_gone_lb != per_balancer_stores_.end());
+ // Remove this closed stream from our records.
+ GPR_ASSERT(UnorderedMapOfSetEraseKeyValue(
+ load_key_to_receiving_lb_ids_, it_store_for_gone_lb->second->load_key(),
+ lb_id));
+ std::set<PerBalancerStore*> orphaned_stores =
+ UnorderedMapOfSetExtract(assigned_stores_, lb_id);
+ // The stores that were assigned to this balancer are orphaned now. They
+ // should be re-assigned to other balancers which are still receiving reports.
+ for (PerBalancerStore* orphaned_store : orphaned_stores) {
const TString* new_receiver = nullptr;
- auto it = load_key_to_receiving_lb_ids_.find(orphaned_store->load_key());
- if (it != load_key_to_receiving_lb_ids_.end()) {
- // First, try to pick from the active balancers with the same load key.
- new_receiver = RandomElement(it->second);
- } else if (!assigned_stores_.empty()) {
- // If failed, pick from all the remaining active balancers.
- new_receiver = &(RandomElement(assigned_stores_)->first);
- }
- if (new_receiver != nullptr) {
- AssignOrphanedStore(orphaned_store, *new_receiver);
- } else {
- // Load data for an LB ID that can't be assigned to any stream should
- // be dropped.
- orphaned_store->Suspend();
- }
- }
-}
-
-PerBalancerStore* PerHostStore::FindPerBalancerStore(
+ auto it = load_key_to_receiving_lb_ids_.find(orphaned_store->load_key());
+ if (it != load_key_to_receiving_lb_ids_.end()) {
+ // First, try to pick from the active balancers with the same load key.
+ new_receiver = RandomElement(it->second);
+ } else if (!assigned_stores_.empty()) {
+ // If failed, pick from all the remaining active balancers.
+ new_receiver = &(RandomElement(assigned_stores_)->first);
+ }
+ if (new_receiver != nullptr) {
+ AssignOrphanedStore(orphaned_store, *new_receiver);
+ } else {
+ // Load data for an LB ID that can't be assigned to any stream should
+ // be dropped.
+ orphaned_store->Suspend();
+ }
+ }
+}
+
+PerBalancerStore* PerHostStore::FindPerBalancerStore(
const TString& lb_id) const {
- return per_balancer_stores_.find(lb_id) != per_balancer_stores_.end()
- ? per_balancer_stores_.find(lb_id)->second.get()
- : nullptr;
-}
-
-const std::set<PerBalancerStore*>* PerHostStore::GetAssignedStores(
+ return per_balancer_stores_.find(lb_id) != per_balancer_stores_.end()
+ ? per_balancer_stores_.find(lb_id)->second.get()
+ : nullptr;
+}
+
+const std::set<PerBalancerStore*>* PerHostStore::GetAssignedStores(
const TString& lb_id) const {
- auto it = assigned_stores_.find(lb_id);
- if (it == assigned_stores_.end()) return nullptr;
- return &(it->second);
-}
-
-void PerHostStore::AssignOrphanedStore(PerBalancerStore* orphaned_store,
+ auto it = assigned_stores_.find(lb_id);
+ if (it == assigned_stores_.end()) return nullptr;
+ return &(it->second);
+}
+
+void PerHostStore::AssignOrphanedStore(PerBalancerStore* orphaned_store,
const TString& new_receiver) {
- auto it = assigned_stores_.find(new_receiver);
- GPR_ASSERT(it != assigned_stores_.end());
- it->second.insert(orphaned_store);
- gpr_log(GPR_INFO,
- "[PerHostStore %p] Re-assigned orphaned store (%p) with original LB"
- " ID of %s to new receiver %s",
- this, orphaned_store, orphaned_store->lb_id().c_str(),
- new_receiver.c_str());
-}
-
+ auto it = assigned_stores_.find(new_receiver);
+ GPR_ASSERT(it != assigned_stores_.end());
+ it->second.insert(orphaned_store);
+ gpr_log(GPR_INFO,
+ "[PerHostStore %p] Re-assigned orphaned store (%p) with original LB"
+ " ID of %s to new receiver %s",
+ this, orphaned_store, orphaned_store->lb_id().c_str(),
+ new_receiver.c_str());
+}
+
void PerHostStore::SetUpForNewLbId(const TString& lb_id,
const TString& load_key) {
- // The top-level caller (i.e., LoadReportService) should guarantee the
- // lb_id is unique for each reporting stream.
- GPR_ASSERT(per_balancer_stores_.find(lb_id) == per_balancer_stores_.end());
- GPR_ASSERT(assigned_stores_.find(lb_id) == assigned_stores_.end());
- load_key_to_receiving_lb_ids_[load_key].insert(lb_id);
- std::unique_ptr<PerBalancerStore> per_balancer_store(
- new PerBalancerStore(lb_id, load_key));
- assigned_stores_[lb_id] = {per_balancer_store.get()};
- per_balancer_stores_[lb_id] = std::move(per_balancer_store);
-}
-
-PerBalancerStore* LoadDataStore::FindPerBalancerStore(
- const string& hostname, const string& lb_id) const {
- auto it = per_host_stores_.find(hostname);
- if (it != per_host_stores_.end()) {
- const PerHostStore& per_host_store = it->second;
- return per_host_store.FindPerBalancerStore(lb_id);
- } else {
- return nullptr;
- }
-}
-
+ // The top-level caller (i.e., LoadReportService) should guarantee the
+ // lb_id is unique for each reporting stream.
+ GPR_ASSERT(per_balancer_stores_.find(lb_id) == per_balancer_stores_.end());
+ GPR_ASSERT(assigned_stores_.find(lb_id) == assigned_stores_.end());
+ load_key_to_receiving_lb_ids_[load_key].insert(lb_id);
+ std::unique_ptr<PerBalancerStore> per_balancer_store(
+ new PerBalancerStore(lb_id, load_key));
+ assigned_stores_[lb_id] = {per_balancer_store.get()};
+ per_balancer_stores_[lb_id] = std::move(per_balancer_store);
+}
+
+PerBalancerStore* LoadDataStore::FindPerBalancerStore(
+ const string& hostname, const string& lb_id) const {
+ auto it = per_host_stores_.find(hostname);
+ if (it != per_host_stores_.end()) {
+ const PerHostStore& per_host_store = it->second;
+ return per_host_store.FindPerBalancerStore(lb_id);
+ } else {
+ return nullptr;
+ }
+}
+
void LoadDataStore::MergeRow(const TString& hostname,
- const LoadRecordKey& key,
- const LoadRecordValue& value) {
- PerBalancerStore* per_balancer_store =
- FindPerBalancerStore(hostname, key.lb_id());
- if (per_balancer_store != nullptr) {
- per_balancer_store->MergeRow(key, value);
- return;
- }
- // Unknown LB ID. Track it until its number of in-progress calls drops to
- // zero.
- int64_t in_progress_delta = value.GetNumCallsInProgressDelta();
- if (in_progress_delta != 0) {
- auto it_tracker = unknown_balancer_id_trackers_.find(key.lb_id());
- if (it_tracker == unknown_balancer_id_trackers_.end()) {
- gpr_log(
- GPR_DEBUG,
- "[LoadDataStore %p] Start tracking unknown balancer (lb_id_: %s).",
- this, key.lb_id().c_str());
- unknown_balancer_id_trackers_.insert(
- {key.lb_id(), static_cast<uint64_t>(in_progress_delta)});
- } else if ((it_tracker->second += in_progress_delta) == 0) {
- unknown_balancer_id_trackers_.erase(it_tracker);
- gpr_log(GPR_DEBUG,
- "[LoadDataStore %p] Stop tracking unknown balancer (lb_id_: %s).",
- this, key.lb_id().c_str());
- }
- }
-}
-
-const std::set<PerBalancerStore*>* LoadDataStore::GetAssignedStores(
+ const LoadRecordKey& key,
+ const LoadRecordValue& value) {
+ PerBalancerStore* per_balancer_store =
+ FindPerBalancerStore(hostname, key.lb_id());
+ if (per_balancer_store != nullptr) {
+ per_balancer_store->MergeRow(key, value);
+ return;
+ }
+ // Unknown LB ID. Track it until its number of in-progress calls drops to
+ // zero.
+ int64_t in_progress_delta = value.GetNumCallsInProgressDelta();
+ if (in_progress_delta != 0) {
+ auto it_tracker = unknown_balancer_id_trackers_.find(key.lb_id());
+ if (it_tracker == unknown_balancer_id_trackers_.end()) {
+ gpr_log(
+ GPR_DEBUG,
+ "[LoadDataStore %p] Start tracking unknown balancer (lb_id_: %s).",
+ this, key.lb_id().c_str());
+ unknown_balancer_id_trackers_.insert(
+ {key.lb_id(), static_cast<uint64_t>(in_progress_delta)});
+ } else if ((it_tracker->second += in_progress_delta) == 0) {
+ unknown_balancer_id_trackers_.erase(it_tracker);
+ gpr_log(GPR_DEBUG,
+ "[LoadDataStore %p] Stop tracking unknown balancer (lb_id_: %s).",
+ this, key.lb_id().c_str());
+ }
+ }
+}
+
+const std::set<PerBalancerStore*>* LoadDataStore::GetAssignedStores(
const TString& hostname, const TString& lb_id) {
- auto it = per_host_stores_.find(hostname);
- if (it == per_host_stores_.end()) return nullptr;
- return it->second.GetAssignedStores(lb_id);
-}
-
+ auto it = per_host_stores_.find(hostname);
+ if (it == per_host_stores_.end()) return nullptr;
+ return it->second.GetAssignedStores(lb_id);
+}
+
void LoadDataStore::ReportStreamCreated(const TString& hostname,
const TString& lb_id,
const TString& load_key) {
- per_host_stores_[hostname].ReportStreamCreated(lb_id, load_key);
-}
-
+ per_host_stores_[hostname].ReportStreamCreated(lb_id, load_key);
+}
+
void LoadDataStore::ReportStreamClosed(const TString& hostname,
const TString& lb_id) {
- auto it_per_host_store = per_host_stores_.find(hostname);
- GPR_ASSERT(it_per_host_store != per_host_stores_.end());
- it_per_host_store->second.ReportStreamClosed(lb_id);
-}
-
-} // namespace load_reporter
-} // namespace grpc
+ auto it_per_host_store = per_host_stores_.find(hostname);
+ GPR_ASSERT(it_per_host_store != per_host_stores_.end());
+ it_per_host_store->second.ReportStreamClosed(lb_id);
+}
+
+} // namespace load_reporter
+} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/server/load_reporter/load_data_store.h b/contrib/libs/grpc/src/cpp/server/load_reporter/load_data_store.h
index 362dbd66f71..61ba618331a 100644
--- a/contrib/libs/grpc/src/cpp/server/load_reporter/load_data_store.h
+++ b/contrib/libs/grpc/src/cpp/server/load_reporter/load_data_store.h
@@ -1,161 +1,161 @@
-/*
- *
- * 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_SRC_CPP_SERVER_LOAD_REPORTER_LOAD_DATA_STORE_H
-#define GRPC_SRC_CPP_SERVER_LOAD_REPORTER_LOAD_DATA_STORE_H
-
-#include <grpc/support/port_platform.h>
-
-#include <memory>
-#include <set>
-#include <unordered_map>
-
-#include <grpc/support/log.h>
-#include <grpcpp/impl/codegen/config.h>
-
+/*
+ *
+ * Copyright 2018 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef GRPC_SRC_CPP_SERVER_LOAD_REPORTER_LOAD_DATA_STORE_H
+#define GRPC_SRC_CPP_SERVER_LOAD_REPORTER_LOAD_DATA_STORE_H
+
+#include <grpc/support/port_platform.h>
+
+#include <memory>
+#include <set>
+#include <unordered_map>
+
+#include <grpc/support/log.h>
+#include <grpcpp/impl/codegen/config.h>
+
#include "src/cpp/server/load_reporter/constants.h"
#include <util/string/cast.h>
-namespace grpc {
-namespace load_reporter {
-
-// The load data storage is organized in hierarchy. The LoadDataStore is the
-// top-level data store. In LoadDataStore, for each host we keep a
-// PerHostStore, in which for each balancer we keep a PerBalancerStore. Each
-// PerBalancerStore maintains a map of load records, mapping from LoadRecordKey
-// to LoadRecordValue. The LoadRecordValue contains a map of customized call
-// metrics, mapping from a call metric name to the CallMetricValue.
-
-// The value of a customized call metric.
-class CallMetricValue {
- public:
- explicit CallMetricValue(uint64_t num_calls = 0,
- double total_metric_value = 0)
- : num_calls_(num_calls), total_metric_value_(total_metric_value) {}
-
- void MergeFrom(CallMetricValue other) {
- num_calls_ += other.num_calls_;
- total_metric_value_ += other.total_metric_value_;
- }
-
- // Getters.
- uint64_t num_calls() const { return num_calls_; }
- double total_metric_value() const { return total_metric_value_; }
-
- private:
- // The number of calls that finished with this metric.
- uint64_t num_calls_ = 0;
- // The sum of metric values across all the calls that finished with this
- // metric.
- double total_metric_value_ = 0;
-};
-
-// The key of a load record.
-class LoadRecordKey {
- public:
+namespace grpc {
+namespace load_reporter {
+
+// The load data storage is organized in hierarchy. The LoadDataStore is the
+// top-level data store. In LoadDataStore, for each host we keep a
+// PerHostStore, in which for each balancer we keep a PerBalancerStore. Each
+// PerBalancerStore maintains a map of load records, mapping from LoadRecordKey
+// to LoadRecordValue. The LoadRecordValue contains a map of customized call
+// metrics, mapping from a call metric name to the CallMetricValue.
+
+// The value of a customized call metric.
+class CallMetricValue {
+ public:
+ explicit CallMetricValue(uint64_t num_calls = 0,
+ double total_metric_value = 0)
+ : num_calls_(num_calls), total_metric_value_(total_metric_value) {}
+
+ void MergeFrom(CallMetricValue other) {
+ num_calls_ += other.num_calls_;
+ total_metric_value_ += other.total_metric_value_;
+ }
+
+ // Getters.
+ uint64_t num_calls() const { return num_calls_; }
+ double total_metric_value() const { return total_metric_value_; }
+
+ private:
+ // The number of calls that finished with this metric.
+ uint64_t num_calls_ = 0;
+ // The sum of metric values across all the calls that finished with this
+ // metric.
+ double total_metric_value_ = 0;
+};
+
+// The key of a load record.
+class LoadRecordKey {
+ public:
LoadRecordKey(TString lb_id, TString lb_tag, TString user_id,
TString client_ip_hex)
- : lb_id_(std::move(lb_id)),
- lb_tag_(std::move(lb_tag)),
- user_id_(std::move(user_id)),
- client_ip_hex_(std::move(client_ip_hex)) {}
-
+ : lb_id_(std::move(lb_id)),
+ lb_tag_(std::move(lb_tag)),
+ user_id_(std::move(user_id)),
+ client_ip_hex_(std::move(client_ip_hex)) {}
+
// Parses the input client_ip_and_token to set client IP, LB ID, and LB tag.
LoadRecordKey(const TString& client_ip_and_token, TString user_id);
TString ToString() const {
- return "[lb_id_=" + lb_id_ + ", lb_tag_=" + lb_tag_ +
- ", user_id_=" + user_id_ + ", client_ip_hex_=" + client_ip_hex_ +
- "]";
- }
-
- bool operator==(const LoadRecordKey& other) const {
- return lb_id_ == other.lb_id_ && lb_tag_ == other.lb_tag_ &&
- user_id_ == other.user_id_ && client_ip_hex_ == other.client_ip_hex_;
- }
-
+ return "[lb_id_=" + lb_id_ + ", lb_tag_=" + lb_tag_ +
+ ", user_id_=" + user_id_ + ", client_ip_hex_=" + client_ip_hex_ +
+ "]";
+ }
+
+ bool operator==(const LoadRecordKey& other) const {
+ return lb_id_ == other.lb_id_ && lb_tag_ == other.lb_tag_ &&
+ user_id_ == other.user_id_ && client_ip_hex_ == other.client_ip_hex_;
+ }
+
// Gets the client IP bytes in network order (i.e., big-endian).
TString GetClientIpBytes() const;
- // Getters.
+ // Getters.
const TString& lb_id() const { return lb_id_; }
const TString& lb_tag() const { return lb_tag_; }
const TString& user_id() const { return user_id_; }
const TString& client_ip_hex() const { return client_ip_hex_; }
-
- struct Hasher {
+
+ struct Hasher {
void hash_combine(size_t* seed, const TString& k) const {
*seed ^= std::hash<TString>()(k) + 0x9e3779b9 + (*seed << 6) +
- (*seed >> 2);
- }
-
- size_t operator()(const LoadRecordKey& k) const {
- size_t h = 0;
- hash_combine(&h, k.lb_id_);
- hash_combine(&h, k.lb_tag_);
- hash_combine(&h, k.user_id_);
- hash_combine(&h, k.client_ip_hex_);
- return h;
- }
- };
-
- private:
+ (*seed >> 2);
+ }
+
+ size_t operator()(const LoadRecordKey& k) const {
+ size_t h = 0;
+ hash_combine(&h, k.lb_id_);
+ hash_combine(&h, k.lb_tag_);
+ hash_combine(&h, k.user_id_);
+ hash_combine(&h, k.client_ip_hex_);
+ return h;
+ }
+ };
+
+ private:
TString lb_id_;
TString lb_tag_;
TString user_id_;
TString client_ip_hex_;
-};
-
-// The value of a load record.
-class LoadRecordValue {
- public:
- explicit LoadRecordValue(uint64_t start_count = 0, uint64_t ok_count = 0,
+};
+
+// The value of a load record.
+class LoadRecordValue {
+ public:
+ explicit LoadRecordValue(uint64_t start_count = 0, uint64_t ok_count = 0,
uint64_t error_count = 0, uint64_t bytes_sent = 0,
uint64_t bytes_recv = 0, uint64_t latency_ms = 0)
- : start_count_(start_count),
- ok_count_(ok_count),
- error_count_(error_count),
- bytes_sent_(bytes_sent),
- bytes_recv_(bytes_recv),
- latency_ms_(latency_ms) {}
-
+ : start_count_(start_count),
+ ok_count_(ok_count),
+ error_count_(error_count),
+ bytes_sent_(bytes_sent),
+ bytes_recv_(bytes_recv),
+ latency_ms_(latency_ms) {}
+
LoadRecordValue(TString metric_name, uint64_t num_calls,
double total_metric_value);
- void MergeFrom(const LoadRecordValue& other) {
- start_count_ += other.start_count_;
- ok_count_ += other.ok_count_;
- error_count_ += other.error_count_;
- bytes_sent_ += other.bytes_sent_;
- bytes_recv_ += other.bytes_recv_;
- latency_ms_ += other.latency_ms_;
- for (const auto& p : other.call_metrics_) {
+ void MergeFrom(const LoadRecordValue& other) {
+ start_count_ += other.start_count_;
+ ok_count_ += other.ok_count_;
+ error_count_ += other.error_count_;
+ bytes_sent_ += other.bytes_sent_;
+ bytes_recv_ += other.bytes_recv_;
+ latency_ms_ += other.latency_ms_;
+ for (const auto& p : other.call_metrics_) {
const TString& key = p.first;
- const CallMetricValue& value = p.second;
- call_metrics_[key].MergeFrom(value);
- }
- }
-
- int64_t GetNumCallsInProgressDelta() const {
- return static_cast<int64_t>(start_count_ - ok_count_ - error_count_);
- }
-
+ const CallMetricValue& value = p.second;
+ call_metrics_[key].MergeFrom(value);
+ }
+ }
+
+ int64_t GetNumCallsInProgressDelta() const {
+ return static_cast<int64_t>(start_count_ - ok_count_ - error_count_);
+ }
+
TString ToString() const {
return "[start_count_=" + ::ToString(start_count_) +
", ok_count_=" + ::ToString(ok_count_) +
@@ -164,185 +164,185 @@ class LoadRecordValue {
", bytes_recv_=" + ::ToString(bytes_recv_) +
", latency_ms_=" + ::ToString(latency_ms_) + ", " +
::ToString(call_metrics_.size()) + " other call metric(s)]";
- }
-
+ }
+
bool InsertCallMetric(const TString& metric_name,
- const CallMetricValue& metric_value) {
- return call_metrics_.insert({metric_name, metric_value}).second;
- }
-
- // Getters.
- uint64_t start_count() const { return start_count_; }
- uint64_t ok_count() const { return ok_count_; }
- uint64_t error_count() const { return error_count_; }
+ const CallMetricValue& metric_value) {
+ return call_metrics_.insert({metric_name, metric_value}).second;
+ }
+
+ // Getters.
+ uint64_t start_count() const { return start_count_; }
+ uint64_t ok_count() const { return ok_count_; }
+ uint64_t error_count() const { return error_count_; }
uint64_t bytes_sent() const { return bytes_sent_; }
uint64_t bytes_recv() const { return bytes_recv_; }
uint64_t latency_ms() const { return latency_ms_; }
const std::unordered_map<TString, CallMetricValue>& call_metrics() const {
- return call_metrics_;
- }
-
- private:
- uint64_t start_count_ = 0;
- uint64_t ok_count_ = 0;
- uint64_t error_count_ = 0;
+ return call_metrics_;
+ }
+
+ private:
+ uint64_t start_count_ = 0;
+ uint64_t ok_count_ = 0;
+ uint64_t error_count_ = 0;
uint64_t bytes_sent_ = 0;
uint64_t bytes_recv_ = 0;
uint64_t latency_ms_ = 0;
std::unordered_map<TString, CallMetricValue> call_metrics_;
-};
-
-// Stores the data associated with a particular LB ID.
-class PerBalancerStore {
- public:
- using LoadRecordMap =
- std::unordered_map<LoadRecordKey, LoadRecordValue, LoadRecordKey::Hasher>;
-
+};
+
+// Stores the data associated with a particular LB ID.
+class PerBalancerStore {
+ public:
+ using LoadRecordMap =
+ std::unordered_map<LoadRecordKey, LoadRecordValue, LoadRecordKey::Hasher>;
+
PerBalancerStore(TString lb_id, TString load_key)
- : lb_id_(std::move(lb_id)), load_key_(std::move(load_key)) {}
-
- // Merge a load record with the given key and value if the store is not
- // suspended.
- void MergeRow(const LoadRecordKey& key, const LoadRecordValue& value);
-
- // Suspend this store, so that no detailed load data will be recorded.
- void Suspend();
- // Resume this store from suspension.
- void Resume();
- // Is this store suspended or not?
- bool IsSuspended() const { return suspended_; }
-
- bool IsNumCallsInProgressChangedSinceLastReport() const {
- return num_calls_in_progress_ != last_reported_num_calls_in_progress_;
- }
-
- uint64_t GetNumCallsInProgressForReport();
-
+ : lb_id_(std::move(lb_id)), load_key_(std::move(load_key)) {}
+
+ // Merge a load record with the given key and value if the store is not
+ // suspended.
+ void MergeRow(const LoadRecordKey& key, const LoadRecordValue& value);
+
+ // Suspend this store, so that no detailed load data will be recorded.
+ void Suspend();
+ // Resume this store from suspension.
+ void Resume();
+ // Is this store suspended or not?
+ bool IsSuspended() const { return suspended_; }
+
+ bool IsNumCallsInProgressChangedSinceLastReport() const {
+ return num_calls_in_progress_ != last_reported_num_calls_in_progress_;
+ }
+
+ uint64_t GetNumCallsInProgressForReport();
+
TString ToString() {
- return "[PerBalancerStore lb_id_=" + lb_id_ + " load_key_=" + load_key_ +
- "]";
- }
-
- void ClearLoadRecordMap() { load_record_map_.clear(); }
-
- // Getters.
+ return "[PerBalancerStore lb_id_=" + lb_id_ + " load_key_=" + load_key_ +
+ "]";
+ }
+
+ void ClearLoadRecordMap() { load_record_map_.clear(); }
+
+ // Getters.
const TString& lb_id() const { return lb_id_; }
const TString& load_key() const { return load_key_; }
- const LoadRecordMap& load_record_map() const { return load_record_map_; }
-
- private:
+ const LoadRecordMap& load_record_map() const { return load_record_map_; }
+
+ private:
TString lb_id_;
- // TODO(juanlishen): Use bytestring protobuf type?
+ // TODO(juanlishen): Use bytestring protobuf type?
TString load_key_;
- LoadRecordMap load_record_map_;
- uint64_t num_calls_in_progress_ = 0;
- uint64_t last_reported_num_calls_in_progress_ = 0;
- bool suspended_ = false;
-};
-
-// Stores the data associated with a particular host.
-class PerHostStore {
- public:
- // When a report stream is created, a PerBalancerStore is created for the
- // LB ID (guaranteed unique) associated with that stream. If it is the only
- // active store, adopt all the orphaned stores. If it is the first created
- // store, adopt the store of kInvalidLbId.
+ LoadRecordMap load_record_map_;
+ uint64_t num_calls_in_progress_ = 0;
+ uint64_t last_reported_num_calls_in_progress_ = 0;
+ bool suspended_ = false;
+};
+
+// Stores the data associated with a particular host.
+class PerHostStore {
+ public:
+ // When a report stream is created, a PerBalancerStore is created for the
+ // LB ID (guaranteed unique) associated with that stream. If it is the only
+ // active store, adopt all the orphaned stores. If it is the first created
+ // store, adopt the store of kInvalidLbId.
void ReportStreamCreated(const TString& lb_id,
const TString& load_key);
-
- // When a report stream is closed, the PerBalancerStores assigned to the
- // associate LB ID need to be re-assigned to other active balancers,
- // ideally with the same load key. If there is no active balancer, we have
- // to suspend those stores and drop the incoming load data until they are
- // resumed.
+
+ // When a report stream is closed, the PerBalancerStores assigned to the
+ // associate LB ID need to be re-assigned to other active balancers,
+ // ideally with the same load key. If there is no active balancer, we have
+ // to suspend those stores and drop the incoming load data until they are
+ // resumed.
void ReportStreamClosed(const TString& lb_id);
-
- // Returns null if not found. Caller doesn't own the returned store.
+
+ // Returns null if not found. Caller doesn't own the returned store.
PerBalancerStore* FindPerBalancerStore(const TString& lb_id) const;
-
- // Returns null if lb_id is not found. The returned pointer points to the
- // underlying data structure, which is not owned by the caller.
- const std::set<PerBalancerStore*>* GetAssignedStores(
+
+ // Returns null if lb_id is not found. The returned pointer points to the
+ // underlying data structure, which is not owned by the caller.
+ const std::set<PerBalancerStore*>* GetAssignedStores(
const TString& lb_id) const;
-
- private:
- // Creates a PerBalancerStore for the given LB ID, assigns the store to
- // itself, and records the LB ID to the load key.
+
+ private:
+ // Creates a PerBalancerStore for the given LB ID, assigns the store to
+ // itself, and records the LB ID to the load key.
void SetUpForNewLbId(const TString& lb_id, const TString& load_key);
-
- void AssignOrphanedStore(PerBalancerStore* orphaned_store,
+
+ void AssignOrphanedStore(PerBalancerStore* orphaned_store,
const TString& new_receiver);
-
+
std::unordered_map<TString, std::set<TString>>
- load_key_to_receiving_lb_ids_;
-
- // Key: LB ID. The key set includes all the LB IDs that have been
- // allocated for reporting streams so far.
- // Value: the unique pointer to the PerBalancerStore of the LB ID.
+ load_key_to_receiving_lb_ids_;
+
+ // Key: LB ID. The key set includes all the LB IDs that have been
+ // allocated for reporting streams so far.
+ // Value: the unique pointer to the PerBalancerStore of the LB ID.
std::unordered_map<TString, std::unique_ptr<PerBalancerStore>>
- per_balancer_stores_;
-
- // Key: LB ID. The key set includes the LB IDs of the balancers that are
- // currently receiving report.
- // Value: the set of raw pointers to the PerBalancerStores assigned to the LB
- // ID. Note that the sets in assigned_stores_ form a division of the value set
- // of per_balancer_stores_.
+ per_balancer_stores_;
+
+ // Key: LB ID. The key set includes the LB IDs of the balancers that are
+ // currently receiving report.
+ // Value: the set of raw pointers to the PerBalancerStores assigned to the LB
+ // ID. Note that the sets in assigned_stores_ form a division of the value set
+ // of per_balancer_stores_.
std::unordered_map<TString, std::set<PerBalancerStore*>> assigned_stores_;
-};
-
-// Thread-unsafe two-level bookkeeper of all the load data.
-// Note: We never remove any store objects from this class, as per the
-// current spec. That's because premature removal of the store objects
-// may lead to loss of critical information, e.g., mapping from lb_id to
-// load_key, and the number of in-progress calls. Such loss will cause
-// information inconsistency when the balancer is re-connected. Keeping
-// all the stores should be fine for PerHostStore, since we assume there
-// should only be a few hostnames. But it's a potential problem for
-// PerBalancerStore.
-class LoadDataStore {
- public:
- // Returns null if not found. Caller doesn't own the returned store.
+};
+
+// Thread-unsafe two-level bookkeeper of all the load data.
+// Note: We never remove any store objects from this class, as per the
+// current spec. That's because premature removal of the store objects
+// may lead to loss of critical information, e.g., mapping from lb_id to
+// load_key, and the number of in-progress calls. Such loss will cause
+// information inconsistency when the balancer is re-connected. Keeping
+// all the stores should be fine for PerHostStore, since we assume there
+// should only be a few hostnames. But it's a potential problem for
+// PerBalancerStore.
+class LoadDataStore {
+ public:
+ // Returns null if not found. Caller doesn't own the returned store.
PerBalancerStore* FindPerBalancerStore(const TString& hostname,
const TString& lb_id) const;
-
- // Returns null if hostname or lb_id is not found. The returned pointer points
- // to the underlying data structure, which is not owned by the caller.
- const std::set<PerBalancerStore*>* GetAssignedStores(const string& hostname,
- const string& lb_id);
-
- // If a PerBalancerStore can be found by the hostname and LB ID in
- // LoadRecordKey, the load data will be merged to that store. Otherwise,
- // only track the number of the in-progress calls for this unknown LB ID.
+
+ // Returns null if hostname or lb_id is not found. The returned pointer points
+ // to the underlying data structure, which is not owned by the caller.
+ const std::set<PerBalancerStore*>* GetAssignedStores(const string& hostname,
+ const string& lb_id);
+
+ // If a PerBalancerStore can be found by the hostname and LB ID in
+ // LoadRecordKey, the load data will be merged to that store. Otherwise,
+ // only track the number of the in-progress calls for this unknown LB ID.
void MergeRow(const TString& hostname, const LoadRecordKey& key,
- const LoadRecordValue& value);
-
- // Is the given lb_id a tracked unknown LB ID (i.e., the LB ID was associated
- // with some received load data but unknown to this load data store)?
+ const LoadRecordValue& value);
+
+ // Is the given lb_id a tracked unknown LB ID (i.e., the LB ID was associated
+ // with some received load data but unknown to this load data store)?
bool IsTrackedUnknownBalancerId(const TString& lb_id) const {
- return unknown_balancer_id_trackers_.find(lb_id) !=
- unknown_balancer_id_trackers_.end();
- }
-
- // Wrapper around PerHostStore::ReportStreamCreated.
+ return unknown_balancer_id_trackers_.find(lb_id) !=
+ unknown_balancer_id_trackers_.end();
+ }
+
+ // Wrapper around PerHostStore::ReportStreamCreated.
void ReportStreamCreated(const TString& hostname,
const TString& lb_id,
const TString& load_key);
-
- // Wrapper around PerHostStore::ReportStreamClosed.
+
+ // Wrapper around PerHostStore::ReportStreamClosed.
void ReportStreamClosed(const TString& hostname,
const TString& lb_id);
-
- private:
- // Buffered data that was fetched from Census but hasn't been sent to
- // balancer. We need to keep this data ourselves because Census will
- // delete the data once it's returned.
+
+ private:
+ // Buffered data that was fetched from Census but hasn't been sent to
+ // balancer. We need to keep this data ourselves because Census will
+ // delete the data once it's returned.
std::unordered_map<TString, PerHostStore> per_host_stores_;
-
- // Tracks the number of in-progress calls for each unknown LB ID.
+
+ // Tracks the number of in-progress calls for each unknown LB ID.
std::unordered_map<TString, uint64_t> unknown_balancer_id_trackers_;
-};
-
-} // namespace load_reporter
-} // namespace grpc
-
-#endif // GRPC_SRC_CPP_SERVER_LOAD_REPORTER_LOAD_DATA_STORE_H
+};
+
+} // namespace load_reporter
+} // namespace grpc
+
+#endif // GRPC_SRC_CPP_SERVER_LOAD_REPORTER_LOAD_DATA_STORE_H
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 aba2b139a42..732602bcb70 100644
--- a/contrib/libs/grpc/src/cpp/server/secure_server_credentials.cc
+++ b/contrib/libs/grpc/src/cpp/server/secure_server_credentials.cc
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -20,24 +20,24 @@
#include <map>
#include <memory>
-#include <grpcpp/impl/codegen/slice.h>
+#include <grpcpp/impl/codegen/slice.h>
#include <grpcpp/impl/grpc_library.h>
-#include <grpcpp/security/auth_metadata_processor.h>
-
+#include <grpcpp/security/auth_metadata_processor.h>
+
#include "src/cpp/common/secure_auth_context.h"
#include "src/cpp/server/secure_server_credentials.h"
namespace grpc {
void AuthMetadataProcessorAyncWrapper::Destroy(void* wrapper) {
- auto* w = static_cast<AuthMetadataProcessorAyncWrapper*>(wrapper);
+ auto* w = static_cast<AuthMetadataProcessorAyncWrapper*>(wrapper);
delete w;
}
void AuthMetadataProcessorAyncWrapper::Process(
void* wrapper, grpc_auth_context* context, const grpc_metadata* md,
size_t num_md, grpc_process_auth_metadata_done_cb cb, void* user_data) {
- auto* w = static_cast<AuthMetadataProcessorAyncWrapper*>(wrapper);
+ auto* w = static_cast<AuthMetadataProcessorAyncWrapper*>(wrapper);
if (!w->processor_) {
// Early exit.
cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_OK, nullptr);
@@ -59,8 +59,8 @@ void AuthMetadataProcessorAyncWrapper::InvokeProcessor(
grpc_process_auth_metadata_done_cb cb, void* user_data) {
AuthMetadataProcessor::InputMetadata metadata;
for (size_t i = 0; i < num_md; i++) {
- metadata.insert(std::make_pair(StringRefFromSlice(&md[i].key),
- StringRefFromSlice(&md[i].value)));
+ metadata.insert(std::make_pair(StringRefFromSlice(&md[i].key),
+ StringRefFromSlice(&md[i].value)));
}
SecureAuthContext context(ctx);
AuthMetadataProcessor::OutputMetadata consumed_metadata;
@@ -125,19 +125,19 @@ std::shared_ptr<ServerCredentials> SslServerCredentials(
new SecureServerCredentials(c_creds));
}
-namespace experimental {
-
-std::shared_ptr<ServerCredentials> AltsServerCredentials(
+namespace experimental {
+
+std::shared_ptr<ServerCredentials> AltsServerCredentials(
const AltsServerCredentialsOptions& /* options */) {
- grpc_alts_credentials_options* c_options =
- grpc_alts_credentials_server_options_create();
- grpc_server_credentials* c_creds =
- grpc_alts_server_credentials_create(c_options);
- grpc_alts_credentials_options_destroy(c_options);
- return std::shared_ptr<ServerCredentials>(
- new SecureServerCredentials(c_creds));
-}
-
+ grpc_alts_credentials_options* c_options =
+ grpc_alts_credentials_server_options_create();
+ grpc_server_credentials* c_creds =
+ grpc_alts_server_credentials_create(c_options);
+ grpc_alts_credentials_options_destroy(c_options);
+ return std::shared_ptr<ServerCredentials>(
+ new SecureServerCredentials(c_creds));
+}
+
std::shared_ptr<ServerCredentials> LocalServerCredentials(
grpc_local_connect_type type) {
return std::shared_ptr<ServerCredentials>(
@@ -151,5 +151,5 @@ std::shared_ptr<ServerCredentials> TlsServerCredentials(
grpc_tls_server_credentials_create(options.c_credentials_options())));
}
-} // namespace experimental
+} // namespace experimental
} // namespace grpc
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 ec5fbb59edd..9e3fb3f9ebf 100644
--- a/contrib/libs/grpc/src/cpp/server/secure_server_credentials.h
+++ b/contrib/libs/grpc/src/cpp/server/secure_server_credentials.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -21,7 +21,7 @@
#include <memory>
-#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/security/server_credentials.h>
#include <grpcpp/security/tls_credentials_options.h>
#include <grpc/grpc_security.h>
diff --git a/contrib/libs/grpc/src/cpp/server/server_builder.cc b/contrib/libs/grpc/src/cpp/server/server_builder.cc
index c3851c279d4..0cc00b365ff 100644
--- a/contrib/libs/grpc/src/cpp/server/server_builder.cc
+++ b/contrib/libs/grpc/src/cpp/server/server_builder.cc
@@ -1,34 +1,34 @@
/*
*
- * Copyright 2015-2016 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/server_builder.h>
+#include <grpcpp/server_builder.h>
#include <grpc/support/cpu.h>
#include <grpc/support/log.h>
-#include <grpcpp/impl/service_type.h>
-#include <grpcpp/resource_quota.h>
-#include <grpcpp/server.h>
+#include <grpcpp/impl/service_type.h>
+#include <grpcpp/resource_quota.h>
+#include <grpcpp/server.h>
#include <utility>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
-#include "src/core/lib/gpr/useful.h"
+#include "src/core/lib/gpr/useful.h"
#include "src/cpp/server/external_connection_acceptor_impl.h"
#include "src/cpp/server/thread_pool_interface.h"
@@ -207,11 +207,11 @@ ServerBuilder& ServerBuilder::AddListeningPort(
int* selected_port) {
const TString uri_scheme = "dns:";
TString addr = addr_uri;
- if (addr_uri.compare(0, uri_scheme.size(), uri_scheme) == 0) {
- size_t pos = uri_scheme.size();
- while (addr_uri[pos] == '/') ++pos; // Skip slashes.
- addr = addr_uri.substr(pos);
- }
+ if (addr_uri.compare(0, uri_scheme.size(), uri_scheme) == 0) {
+ size_t pos = uri_scheme.size();
+ while (addr_uri[pos] == '/') ++pos; // Skip slashes.
+ addr = addr_uri.substr(pos);
+ }
Port port = {addr, std::move(creds), selected_port};
ports_.push_back(port);
return *this;
@@ -285,9 +285,9 @@ std::unique_ptr<grpc::Server> ServerBuilder::BuildAndStart() {
if (cq->IsFrequentlyPolled()) {
has_frequently_polled_cqs = true;
break;
- }
- }
-
+ }
+ }
+
// == Determine if the server has any callback methods ==
bool has_callback_methods = false;
for (const auto& service : services_) {
@@ -297,12 +297,12 @@ std::unique_ptr<grpc::Server> ServerBuilder::BuildAndStart() {
break;
}
}
-
+
const bool is_hybrid_server = has_sync_methods && has_frequently_polled_cqs;
if (has_sync_methods) {
- grpc_cq_polling_type polling_type =
- is_hybrid_server ? GRPC_CQ_NON_POLLING : GRPC_CQ_DEFAULT_POLLING;
+ grpc_cq_polling_type polling_type =
+ is_hybrid_server ? GRPC_CQ_NON_POLLING : GRPC_CQ_DEFAULT_POLLING;
// Create completion queues to listen to incoming rpc requests
for (int i = 0; i < sync_server_settings_.num_cqs; i++) {
@@ -314,16 +314,16 @@ std::unique_ptr<grpc::Server> ServerBuilder::BuildAndStart() {
// TODO(vjpai): Add a section here for plugins once they can support callback
// methods
- if (has_sync_methods) {
- // This is a Sync server
- gpr_log(GPR_INFO,
- "Synchronous server. Num CQs: %d, Min pollers: %d, Max Pollers: "
- "%d, CQ timeout (msec): %d",
- sync_server_settings_.num_cqs, sync_server_settings_.min_pollers,
- sync_server_settings_.max_pollers,
- sync_server_settings_.cq_timeout_msec);
- }
-
+ if (has_sync_methods) {
+ // This is a Sync server
+ gpr_log(GPR_INFO,
+ "Synchronous server. Num CQs: %d, Min pollers: %d, Max Pollers: "
+ "%d, CQ timeout (msec): %d",
+ sync_server_settings_.num_cqs, sync_server_settings_.min_pollers,
+ sync_server_settings_.max_pollers,
+ sync_server_settings_.cq_timeout_msec);
+ }
+
if (has_callback_methods) {
gpr_log(GPR_INFO, "Callback server.");
}
@@ -396,17 +396,17 @@ std::unique_ptr<grpc::Server> ServerBuilder::BuildAndStart() {
for (auto& port : ports_) {
int r = server->AddListeningPort(port.addr, port.creds.get());
- if (!r) {
+ if (!r) {
server->Shutdown();
- return nullptr;
- }
+ return nullptr;
+ }
if (port.selected_port != nullptr) {
*port.selected_port = r;
}
}
auto cqs_data = cqs_.empty() ? nullptr : &cqs_[0];
- server->Start(cqs_data, cqs_.size());
+ server->Start(cqs_data, cqs_.size());
for (const auto& value : plugins_) {
value->Finish(initializer);
@@ -421,14 +421,14 @@ void ServerBuilder::InternalAddPluginFactory(
(*g_plugin_factory_list).push_back(CreatePlugin);
}
-ServerBuilder& ServerBuilder::EnableWorkaround(grpc_workaround_list id) {
- switch (id) {
- case GRPC_WORKAROUND_ID_CRONET_COMPRESSION:
- return AddChannelArgument(GRPC_ARG_WORKAROUND_CRONET_COMPRESSION, 1);
- default:
- gpr_log(GPR_ERROR, "Workaround %u does not exist or is obsolete.", id);
- return *this;
- }
-}
-
+ServerBuilder& ServerBuilder::EnableWorkaround(grpc_workaround_list id) {
+ switch (id) {
+ case GRPC_WORKAROUND_ID_CRONET_COMPRESSION:
+ return AddChannelArgument(GRPC_ARG_WORKAROUND_CRONET_COMPRESSION, 1);
+ default:
+ gpr_log(GPR_ERROR, "Workaround %u does not exist or is obsolete.", id);
+ return *this;
+ }
+}
+
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/server/server_cc.cc b/contrib/libs/grpc/src/cpp/server/server_cc.cc
index 06507da0b93..c2a911c7f7c 100644
--- a/contrib/libs/grpc/src/cpp/server/server_cc.cc
+++ b/contrib/libs/grpc/src/cpp/server/server_cc.cc
@@ -1,23 +1,23 @@
/*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/server.h>
+#include <grpcpp/server.h>
-#include <cstdlib>
+#include <cstdlib>
#include <sstream>
#include <type_traits>
#include <utility>
@@ -26,37 +26,37 @@
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpcpp/completion_queue.h>
-#include <grpcpp/generic/async_generic_service.h>
-#include <grpcpp/impl/codegen/async_unary_call.h>
+#include <grpcpp/completion_queue.h>
+#include <grpcpp/generic/async_generic_service.h>
+#include <grpcpp/impl/codegen/async_unary_call.h>
#include <grpcpp/impl/codegen/byte_buffer.h>
#include <grpcpp/impl/codegen/call.h>
-#include <grpcpp/impl/codegen/completion_queue_tag.h>
+#include <grpcpp/impl/codegen/completion_queue_tag.h>
#include <grpcpp/impl/codegen/method_handler.h>
#include <grpcpp/impl/codegen/server_interceptor.h>
-#include <grpcpp/impl/grpc_library.h>
-#include <grpcpp/impl/rpc_service_method.h>
-#include <grpcpp/impl/server_initializer.h>
-#include <grpcpp/impl/service_type.h>
-#include <grpcpp/security/server_credentials.h>
-#include <grpcpp/server_context.h>
-#include <grpcpp/support/time.h>
-
-#include "src/core/ext/transport/inproc/inproc_transport.h"
+#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/impl/rpc_service_method.h>
+#include <grpcpp/impl/server_initializer.h>
+#include <grpcpp/impl/service_type.h>
+#include <grpcpp/security/server_credentials.h>
+#include <grpcpp/server_context.h>
+#include <grpcpp/support/time.h>
+
+#include "src/core/ext/transport/inproc/inproc_transport.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/profiling/timers.h"
-#include "src/core/lib/surface/call.h"
+#include "src/core/lib/surface/call.h"
#include "src/core/lib/surface/completion_queue.h"
#include "src/core/lib/surface/server.h"
-#include "src/cpp/client/create_channel_internal.h"
+#include "src/cpp/client/create_channel_internal.h"
#include "src/cpp/server/external_connection_acceptor_impl.h"
-#include "src/cpp/server/health/default_health_check_service.h"
+#include "src/cpp/server/health/default_health_check_service.h"
#include "src/cpp/thread_manager/thread_manager.h"
#include <util/stream/str.h>
namespace grpc {
-namespace {
+namespace {
// The default value for maximum number of threads that can be created in the
// sync server. This value of INT_MAX is chosen to match the default behavior if
@@ -72,26 +72,26 @@ class DefaultGlobalCallbacks final : public Server::GlobalCallbacks {
void PostSynchronousRequest(ServerContext* /*context*/) override {}
};
-std::shared_ptr<Server::GlobalCallbacks> g_callbacks = nullptr;
-gpr_once g_once_init_callbacks = GPR_ONCE_INIT;
+std::shared_ptr<Server::GlobalCallbacks> g_callbacks = nullptr;
+gpr_once g_once_init_callbacks = GPR_ONCE_INIT;
-void InitGlobalCallbacks() {
+void InitGlobalCallbacks() {
if (!g_callbacks) {
g_callbacks.reset(new DefaultGlobalCallbacks());
}
}
-class ShutdownTag : public internal::CompletionQueueTag {
- public:
+class ShutdownTag : public internal::CompletionQueueTag {
+ public:
bool FinalizeResult(void** /*tag*/, bool* /*status*/) { return false; }
-};
-
-class DummyTag : public internal::CompletionQueueTag {
- public:
+};
+
+class DummyTag : public internal::CompletionQueueTag {
+ public:
bool FinalizeResult(void** /*tag*/, bool* /*status*/) { return true; }
-};
-
-class UnimplementedAsyncRequestContext {
+};
+
+class UnimplementedAsyncRequestContext {
protected:
UnimplementedAsyncRequestContext() : generic_stream_(&server_context_) {}
@@ -108,8 +108,8 @@ using ::grpc::experimental::CallbackServerContext;
using ::grpc::experimental::GenericCallbackServerContext;
#endif
-} // namespace
-
+} // namespace
+
ServerInterface::BaseAsyncRequest::BaseAsyncRequest(
ServerInterface* server, ServerContext* context,
internal::ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq,
@@ -285,10 +285,10 @@ class ShutdownCallback : public grpc_experimental_completion_queue_functor {
};
} // namespace
-/// Use private inheritance rather than composition only to establish order
-/// of construction, since the public base class should be constructed after the
-/// elements belonging to the private base class are constructed. This is not
-/// possible using true composition.
+/// Use private inheritance rather than composition only to establish order
+/// of construction, since the public base class should be constructed after the
+/// elements belonging to the private base class are constructed. This is not
+/// possible using true composition.
class Server::UnimplementedAsyncRequest final
: private grpc::UnimplementedAsyncRequestContext,
public GenericAsyncRequest {
@@ -304,8 +304,8 @@ class Server::UnimplementedAsyncRequest final
grpc::GenericServerAsyncReaderWriter* stream() { return &generic_stream_; }
};
-/// UnimplementedAsyncResponse should not post user-visible completions to the
-/// C++ completion queue, but is generated as a CQ event by the core
+/// UnimplementedAsyncResponse should not post user-visible completions to the
+/// C++ completion queue, but is generated as a CQ event by the core
class Server::UnimplementedAsyncResponse final
: public grpc::internal::CallOpSet<
grpc::internal::CallOpSendInitialMetadata,
@@ -323,7 +323,7 @@ class Server::UnimplementedAsyncResponse final
} else {
// The tag was swallowed due to interception. We will see it again.
}
- return false;
+ return false;
}
private:
@@ -352,7 +352,7 @@ class Server::SyncRequest final : public grpc::internal::CompletionQueueTag {
grpc_metadata_array_destroy(&request_metadata_);
}
- void SetupRequest() { cq_ = grpc_completion_queue_create_for_pluck(nullptr); }
+ void SetupRequest() { cq_ = grpc_completion_queue_create_for_pluck(nullptr); }
void TeardownRequest() {
grpc_completion_queue_destroy(cq_);
@@ -365,22 +365,22 @@ class Server::SyncRequest final : public grpc::internal::CompletionQueueTag {
if (method_tag_) {
if (grpc_server_request_registered_call(
server, method_tag_, &call_, &deadline_, &request_metadata_,
- has_request_payload_ ? &request_payload_ : nullptr, cq_,
+ has_request_payload_ ? &request_payload_ : nullptr, cq_,
notify_cq, this) != GRPC_CALL_OK) {
- TeardownRequest();
- return;
- }
+ TeardownRequest();
+ return;
+ }
} else {
if (!call_details_) {
call_details_ = new grpc_call_details;
grpc_call_details_init(call_details_);
}
- if (grpc_server_request_call(server, &call_, call_details_,
- &request_metadata_, cq_, notify_cq,
- this) != GRPC_CALL_OK) {
- TeardownRequest();
- return;
- }
+ if (grpc_server_request_call(server, &call_, call_details_,
+ &request_metadata_, cq_, notify_cq,
+ this) != GRPC_CALL_OK) {
+ TeardownRequest();
+ return;
+ }
}
}
@@ -415,7 +415,7 @@ class Server::SyncRequest final : public grpc::internal::CompletionQueueTag {
public:
explicit CallData(Server* server, SyncRequest* mrd)
: cq_(mrd->cq_),
- ctx_(mrd->deadline_, &mrd->request_metadata_),
+ ctx_(mrd->deadline_, &mrd->request_metadata_),
has_request_payload_(mrd->has_request_payload_),
request_payload_(has_request_payload_ ? mrd->request_payload_
: nullptr),
@@ -445,7 +445,7 @@ class Server::SyncRequest final : public grpc::internal::CompletionQueueTag {
bool resources) {
global_callbacks_ = global_callbacks;
resources_ = resources;
-
+
interceptor_methods_.SetCall(&call_);
interceptor_methods_.SetReverse();
// Set interception point for RECV INITIAL METADATA
@@ -453,14 +453,14 @@ class Server::SyncRequest final : public grpc::internal::CompletionQueueTag {
grpc::experimental::InterceptionHookPoints::
POST_RECV_INITIAL_METADATA);
interceptor_methods_.SetRecvInitialMetadata(&ctx_.client_metadata_);
-
+
if (has_request_payload_) {
// Set interception point for RECV MESSAGE
auto* handler = resources_ ? method_->handler()
: server_->resource_exhausted_handler_.get();
request_ = handler->Deserialize(call_.call(), request_payload_,
&request_status_, nullptr);
-
+
request_payload_ = nullptr;
interceptor_methods_.AddInterceptionHookPoint(
grpc::experimental::InterceptionHookPoints::POST_RECV_MESSAGE);
@@ -760,11 +760,11 @@ class Server::SyncRequestThreadManager : public grpc::ThreadManager {
WorkStatus PollForWork(void** tag, bool* ok) override {
*tag = nullptr;
- // TODO(ctiller): workaround for GPR_TIMESPAN based deadlines not working
- // right now
+ // TODO(ctiller): workaround for GPR_TIMESPAN based deadlines not working
+ // right now
gpr_timespec deadline =
- gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
- gpr_time_from_millis(cq_timeout_msec_, GPR_TIMESPAN));
+ gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
+ gpr_time_from_millis(cq_timeout_msec_, GPR_TIMESPAN));
switch (server_cq_->AsyncNext(tag, ok, deadline)) {
case grpc::CompletionQueue::TIMEOUT:
@@ -792,10 +792,10 @@ class Server::SyncRequestThreadManager : public grpc::ThreadManager {
// Calldata takes ownership of the completion queue and interceptors
// inside sync_req
auto* cd = new SyncRequest::CallData(server_, sync_req);
- // Prepare for the next request
- if (!IsShutdown()) {
- sync_req->SetupRequest(); // Create new completion queue for sync_req
- sync_req->Request(server_->c_server(), server_cq_->cq());
+ // Prepare for the next request
+ if (!IsShutdown()) {
+ sync_req->SetupRequest(); // Create new completion queue for sync_req
+ sync_req->Request(server_->c_server(), server_cq_->cq());
}
GPR_TIMER_SCOPE("cd.Run()", 0);
@@ -820,13 +820,13 @@ class Server::SyncRequestThreadManager : public grpc::ThreadManager {
}
}
- void Shutdown() override {
- ThreadManager::Shutdown();
+ void Shutdown() override {
+ ThreadManager::Shutdown();
server_cq_->Shutdown();
- }
+ }
- void Wait() override {
- ThreadManager::Wait();
+ void Wait() override {
+ ThreadManager::Wait();
// Drain any pending items from the queue
void* tag;
bool ok;
@@ -886,13 +886,13 @@ Server::Server(
shutdown_notified_(false),
server_(nullptr),
server_initializer_(new ServerInitializer(this)),
- health_check_service_disabled_(false) {
+ health_check_service_disabled_(false) {
g_gli_initializer.summon();
gpr_once_init(&grpc::g_once_init_callbacks, grpc::InitGlobalCallbacks);
global_callbacks_ = grpc::g_callbacks;
global_callbacks_->UpdateArguments(args);
- if (sync_server_cqs_ != nullptr) {
+ if (sync_server_cqs_ != nullptr) {
bool default_rq_created = false;
if (server_rq == nullptr) {
server_rq = grpc_resource_quota_create("SyncServer-default-rq");
@@ -901,11 +901,11 @@ Server::Server(
default_rq_created = true;
}
- for (const auto& it : *sync_server_cqs_) {
- sync_req_mgrs_.emplace_back(new SyncRequestThreadManager(
+ for (const auto& it : *sync_server_cqs_) {
+ sync_req_mgrs_.emplace_back(new SyncRequestThreadManager(
this, it.get(), global_callbacks_, server_rq, min_pollers,
max_pollers, sync_cq_timeout_msec));
- }
+ }
if (default_rq_created) {
grpc_resource_quota_unref(server_rq);
@@ -919,22 +919,22 @@ Server::Server(
grpc_channel_args channel_args;
args->SetChannelArgs(&channel_args);
- for (size_t i = 0; i < channel_args.num_args; i++) {
+ for (size_t i = 0; i < channel_args.num_args; i++) {
if (0 == strcmp(channel_args.args[i].key,
grpc::kHealthCheckServiceInterfaceArg)) {
- if (channel_args.args[i].value.pointer.p == nullptr) {
- health_check_service_disabled_ = true;
- } else {
+ if (channel_args.args[i].value.pointer.p == nullptr) {
+ health_check_service_disabled_ = true;
+ } else {
health_check_service_.reset(
static_cast<grpc::HealthCheckServiceInterface*>(
channel_args.args[i].value.pointer.p));
- }
- }
+ }
+ }
if (0 ==
strcmp(channel_args.args[i].key, GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH)) {
max_receive_message_size_ = channel_args.args[i].value.integer;
}
- }
+ }
server_ = grpc_server_create(&channel_args, nullptr);
}
@@ -972,13 +972,13 @@ grpc_server* Server::c_server() { return server_; }
std::shared_ptr<grpc::Channel> Server::InProcessChannel(
const grpc::ChannelArguments& args) {
- grpc_channel_args channel_args = args.c_channel_args();
+ grpc_channel_args channel_args = args.c_channel_args();
return grpc::CreateChannelInternal(
"inproc", grpc_inproc_channel_create(server_, &channel_args, nullptr),
std::vector<std::unique_ptr<
grpc::experimental::ClientInterceptorFactoryInterface>>());
-}
-
+}
+
std::shared_ptr<grpc::Channel>
Server::experimental_type::InProcessChannelWithInterceptors(
const grpc::ChannelArguments& args,
@@ -1091,9 +1091,9 @@ void Server::RegisterCallbackGenericService(
int Server::AddListeningPort(const TString& addr,
grpc::ServerCredentials* creds) {
GPR_ASSERT(!started_);
- int port = creds->AddPortToServer(addr, server_);
- global_callbacks_->AddPort(this, addr, creds, port);
- return port;
+ int port = creds->AddPortToServer(addr, server_);
+ global_callbacks_->AddPort(this, addr, creds, port);
+ return port;
}
void Server::Ref() {
@@ -1123,15 +1123,15 @@ void Server::UnrefAndWaitLocked() {
void Server::Start(grpc::ServerCompletionQueue** cqs, size_t num_cqs) {
GPR_ASSERT(!started_);
- global_callbacks_->PreServerStart(this);
+ global_callbacks_->PreServerStart(this);
started_ = true;
-
- // Only create default health check service when user did not provide an
- // explicit one.
+
+ // Only create default health check service when user did not provide an
+ // explicit one.
grpc::ServerCompletionQueue* health_check_cq = nullptr;
grpc::DefaultHealthCheckService::HealthCheckServiceImpl*
default_health_check_service_impl = nullptr;
- if (health_check_service_ == nullptr && !health_check_service_disabled_ &&
+ if (health_check_service_ == nullptr && !health_check_service_disabled_ &&
grpc::DefaultHealthCheckServiceEnabled()) {
auto* default_hc_service = new grpc::DefaultHealthCheckService;
health_check_service_.reset(default_hc_service);
@@ -1147,8 +1147,8 @@ void Server::Start(grpc::ServerCompletionQueue** cqs, size_t num_cqs) {
default_hc_service->GetHealthCheckService(
std::unique_ptr<grpc::ServerCompletionQueue>(health_check_cq));
RegisterService(nullptr, default_health_check_service_impl);
- }
-
+ }
+
for (auto& acceptor : acceptors_) {
acceptor->GetCredentials()->AddPortToServer(acceptor->name(), server_);
}
diff --git a/contrib/libs/grpc/src/cpp/server/server_context.cc b/contrib/libs/grpc/src/cpp/server/server_context.cc
index e81b87723d4..458ac20d87c 100644
--- a/contrib/libs/grpc/src/cpp/server/server_context.cc
+++ b/contrib/libs/grpc/src/cpp/server/server_context.cc
@@ -1,35 +1,35 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/server_context.h>
-#include <algorithm>
-#include <utility>
+#include <algorithm>
+#include <utility>
#include <grpc/compression.h>
#include <grpc/grpc.h>
-#include <grpc/load_reporting.h>
+#include <grpc/load_reporting.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpcpp/impl/call.h>
+#include <grpcpp/impl/call.h>
#include <grpcpp/impl/codegen/completion_queue.h>
#include <grpcpp/support/server_callback.h>
-#include <grpcpp/support/time.h>
+#include <grpcpp/support/time.h>
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/sync.h"
@@ -228,7 +228,7 @@ ServerContextBase::ServerContextBase()
ServerContextBase::ServerContextBase(gpr_timespec deadline,
grpc_metadata_array* arr)
: deadline_(deadline) {
- std::swap(*client_metadata_.arr(), *arr);
+ std::swap(*client_metadata_.arr(), *arr);
}
void ServerContextBase::BindDeadlineAndMetadata(gpr_timespec deadline,
@@ -281,8 +281,8 @@ void ServerContextBase::BeginCompletionOp(
internal::CompletionQueueTag* ServerContextBase::GetCompletionOpTag() {
return static_cast<internal::CompletionQueueTag*>(completion_op_);
-}
-
+}
+
void ServerContextBase::AddInitialMetadata(const TString& key,
const TString& value) {
initial_metadata_.insert(std::make_pair(key, value));
@@ -324,14 +324,14 @@ bool ServerContextBase::IsCancelled() const {
void ServerContextBase::set_compression_algorithm(
grpc_compression_algorithm algorithm) {
- compression_algorithm_ = algorithm;
- const char* algorithm_name = nullptr;
+ 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();
}
- GPR_ASSERT(algorithm_name != nullptr);
+ GPR_ASSERT(algorithm_name != nullptr);
AddInitialMetadata(GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY, algorithm_name);
}
@@ -353,9 +353,9 @@ const struct census_context* ServerContextBase::census_context() const {
void ServerContextBase::SetLoadReportingCosts(
const std::vector<TString>& cost_data) {
if (call_.call == nullptr) return;
- for (const auto& cost_datum : cost_data) {
- AddTrailingMetadata(GRPC_LB_COST_MD_KEY, cost_datum);
- }
-}
-
+ for (const auto& cost_datum : cost_data) {
+ AddTrailingMetadata(GRPC_LB_COST_MD_KEY, cost_datum);
+ }
+}
+
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/server/server_credentials.cc b/contrib/libs/grpc/src/cpp/server/server_credentials.cc
index 8197bc22ec3..c3b3a8b3793 100644
--- a/contrib/libs/grpc/src/cpp/server/server_credentials.cc
+++ b/contrib/libs/grpc/src/cpp/server/server_credentials.cc
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
diff --git a/contrib/libs/grpc/src/cpp/server/server_posix.cc b/contrib/libs/grpc/src/cpp/server/server_posix.cc
index f0ca1a60daa..c3d40d4fa2d 100644
--- a/contrib/libs/grpc/src/cpp/server/server_posix.cc
+++ b/contrib/libs/grpc/src/cpp/server/server_posix.cc
@@ -1,22 +1,22 @@
/*
*
- * Copyright 2016 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/server_posix.h>
+#include <grpcpp/server_posix.h>
#include <grpc/grpc_posix.h>
@@ -25,7 +25,7 @@ namespace grpc {
#ifdef GPR_SUPPORT_CHANNELS_FROM_FD
void AddInsecureChannelFromFd(grpc::Server* server, int fd) {
- grpc_server_add_insecure_channel_from_fd(server->c_server(), nullptr, fd);
+ grpc_server_add_insecure_channel_from_fd(server->c_server(), nullptr, fd);
}
#endif // GPR_SUPPORT_CHANNELS_FROM_FD
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 8c901ce9773..028842a776f 100644
--- a/contrib/libs/grpc/src/cpp/server/thread_pool_interface.h
+++ b/contrib/libs/grpc/src/cpp/server/thread_pool_interface.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -32,10 +32,10 @@ class ThreadPoolInterface {
virtual void Add(const std::function<void()>& callback) = 0;
};
-// Allows different codebases to use their own thread pool impls
-typedef ThreadPoolInterface* (*CreateThreadPoolFunc)(void);
-void SetCreateThreadPool(CreateThreadPoolFunc func);
-
+// Allows different codebases to use their own thread pool impls
+typedef ThreadPoolInterface* (*CreateThreadPoolFunc)(void);
+void SetCreateThreadPool(CreateThreadPoolFunc func);
+
ThreadPoolInterface* CreateDefaultThreadPool();
} // namespace grpc
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 db174086fd5..c8560aa81dd 100644
--- a/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.cc
+++ b/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.cc
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2016 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -21,33 +21,33 @@
#include <climits>
#include <grpc/support/log.h>
-#include "src/core/lib/gprpp/thd.h"
+#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/exec_ctx.h"
-
+
namespace grpc {
ThreadManager::WorkerThread::WorkerThread(ThreadManager* thd_mgr)
- : thd_mgr_(thd_mgr) {
- // Make thread creation exclusive with respect to its join happening in
- // ~WorkerThread().
- thd_ = grpc_core::Thread(
- "grpcpp_sync_server",
- [](void* th) { static_cast<ThreadManager::WorkerThread*>(th)->Run(); },
+ : thd_mgr_(thd_mgr) {
+ // Make thread creation exclusive with respect to its join happening in
+ // ~WorkerThread().
+ thd_ = grpc_core::Thread(
+ "grpcpp_sync_server",
+ [](void* th) { static_cast<ThreadManager::WorkerThread*>(th)->Run(); },
this, &created_);
if (!created_) {
gpr_log(GPR_ERROR, "Could not create grpc_sync_server worker-thread");
}
-}
+}
void ThreadManager::WorkerThread::Run() {
thd_mgr_->MainWorkLoop();
thd_mgr_->MarkAsCompleted(this);
}
-ThreadManager::WorkerThread::~WorkerThread() {
- // Don't join until the thread is fully constructed.
- thd_.Join();
-}
+ThreadManager::WorkerThread::~WorkerThread() {
+ // Don't join until the thread is fully constructed.
+ thd_.Join();
+}
ThreadManager::ThreadManager(const char* name,
grpc_resource_quota* resource_quota,
@@ -113,14 +113,14 @@ void ThreadManager::MarkAsCompleted(WorkerThread* thd) {
}
void ThreadManager::CleanupCompletedThreads() {
- std::list<WorkerThread*> completed_threads;
- {
- // swap out the completed threads list: allows other threads to clean up
- // more quickly
+ std::list<WorkerThread*> completed_threads;
+ {
+ // swap out the completed threads list: allows other threads to clean up
+ // more quickly
grpc_core::MutexLock lock(&list_mu_);
- completed_threads.swap(completed_threads_);
+ completed_threads.swap(completed_threads_);
}
- for (auto thd : completed_threads) delete thd;
+ for (auto thd : completed_threads) delete thd;
}
void ThreadManager::Initialize() {
@@ -132,14 +132,14 @@ void ThreadManager::Initialize() {
abort();
}
- {
+ {
grpc_core::MutexLock lock(&mu_);
- num_pollers_ = min_pollers_;
- num_threads_ = min_pollers_;
+ num_pollers_ = min_pollers_;
+ num_threads_ = min_pollers_;
max_active_threads_sofar_ = min_pollers_;
}
- for (int i = 0; i < min_pollers_; i++) {
+ for (int i = 0; i < min_pollers_; i++) {
WorkerThread* worker = new WorkerThread(this);
GPR_ASSERT(worker->created()); // Must be able to create the minimum
worker->Start();
@@ -147,30 +147,30 @@ void ThreadManager::Initialize() {
}
void ThreadManager::MainWorkLoop() {
- while (true) {
- void* tag;
- bool ok;
+ while (true) {
+ void* tag;
+ bool ok;
WorkStatus work_status = PollForWork(&tag, &ok);
grpc_core::ReleasableMutexLock lock(&mu_);
- // Reduce the number of pollers by 1 and check what happened with the poll
- num_pollers_--;
- bool done = false;
- switch (work_status) {
- case TIMEOUT:
- // If we timed out and we have more pollers than we need (or we are
- // shutdown), finish this thread
- if (shutdown_ || num_pollers_ > max_pollers_) done = true;
+ // Reduce the number of pollers by 1 and check what happened with the poll
+ num_pollers_--;
+ bool done = false;
+ switch (work_status) {
+ case TIMEOUT:
+ // If we timed out and we have more pollers than we need (or we are
+ // shutdown), finish this thread
+ if (shutdown_ || num_pollers_ > max_pollers_) done = true;
+ break;
+ case SHUTDOWN:
+ // If the thread manager is shutdown, finish this thread
+ done = true;
break;
- case SHUTDOWN:
- // If the thread manager is shutdown, finish this thread
- done = true;
- break;
- case WORK_FOUND:
+ case WORK_FOUND:
// If we got work and there are now insufficient pollers and there is
// quota available to create a new thread, start a new poller thread
bool resource_exhausted = false;
- if (!shutdown_ && num_pollers_ < min_pollers_) {
+ if (!shutdown_ && num_pollers_ < min_pollers_) {
if (grpc_resource_user_allocate_threads(resource_user_, 1)) {
// We can allocate a new poller thread
num_pollers_++;
@@ -202,57 +202,57 @@ void ThreadManager::MainWorkLoop() {
lock.Unlock();
resource_exhausted = true;
}
- } else {
+ } else {
// There are a sufficient number of pollers available so we can do
// the work and continue polling with our existing poller threads
lock.Unlock();
- }
- // Lock is always released at this point - do the application work
+ }
+ // Lock is always released at this point - do the application work
// or return resource exhausted if there is new work but we couldn't
// get a thread in which to do it.
DoWork(tag, ok, !resource_exhausted);
- // Take the lock again to check post conditions
+ // Take the lock again to check post conditions
lock.Lock();
- // If we're shutdown, we should finish at this point.
- if (shutdown_) done = true;
- break;
+ // If we're shutdown, we should finish at this point.
+ if (shutdown_) done = true;
+ break;
}
- // If we decided to finish the thread, break out of the while loop
- if (done) break;
+ // If we decided to finish the thread, break out of the while loop
+ if (done) break;
- // Otherwise go back to polling as long as it doesn't exceed max_pollers_
- //
- // **WARNING**:
- // There is a possibility of threads thrashing here (i.e excessive thread
- // shutdowns and creations than the ideal case). This happens if max_poller_
- // count is small and the rate of incoming requests is also small. In such
- // scenarios we can possibly configure max_pollers_ to a higher value and/or
- // increase the cq timeout.
- //
- // However, not doing this check here and unconditionally incrementing
- // num_pollers (and hoping that the system will eventually settle down) has
- // far worse consequences i.e huge number of threads getting created to the
- // point of thread-exhaustion. For example: if the incoming request rate is
- // very high, all the polling threads will return very quickly from
- // PollForWork() with WORK_FOUND. They all briefly decrement num_pollers_
- // counter thereby possibly - and briefly - making it go below min_pollers;
- // This will most likely result in the creation of a new poller since
- // num_pollers_ dipped below min_pollers_.
- //
- // Now, If we didn't do the max_poller_ check here, all these threads will
- // go back to doing PollForWork() and the whole cycle repeats (with a new
- // thread being added in each cycle). Once the total number of threads in
- // the system crosses a certain threshold (around ~1500), there is heavy
- // contention on mutexes (the mu_ here or the mutexes in gRPC core like the
- // pollset mutex) that makes DoWork() take longer to finish thereby causing
- // new poller threads to be created even faster. This results in a thread
- // avalanche.
- if (num_pollers_ < max_pollers_) {
- num_pollers_++;
- } else {
- break;
+ // Otherwise go back to polling as long as it doesn't exceed max_pollers_
+ //
+ // **WARNING**:
+ // There is a possibility of threads thrashing here (i.e excessive thread
+ // shutdowns and creations than the ideal case). This happens if max_poller_
+ // count is small and the rate of incoming requests is also small. In such
+ // scenarios we can possibly configure max_pollers_ to a higher value and/or
+ // increase the cq timeout.
+ //
+ // However, not doing this check here and unconditionally incrementing
+ // num_pollers (and hoping that the system will eventually settle down) has
+ // far worse consequences i.e huge number of threads getting created to the
+ // point of thread-exhaustion. For example: if the incoming request rate is
+ // very high, all the polling threads will return very quickly from
+ // PollForWork() with WORK_FOUND. They all briefly decrement num_pollers_
+ // counter thereby possibly - and briefly - making it go below min_pollers;
+ // This will most likely result in the creation of a new poller since
+ // num_pollers_ dipped below min_pollers_.
+ //
+ // Now, If we didn't do the max_poller_ check here, all these threads will
+ // go back to doing PollForWork() and the whole cycle repeats (with a new
+ // thread being added in each cycle). Once the total number of threads in
+ // the system crosses a certain threshold (around ~1500), there is heavy
+ // contention on mutexes (the mu_ here or the mutexes in gRPC core like the
+ // pollset mutex) that makes DoWork() take longer to finish thereby causing
+ // new poller threads to be created even faster. This results in a thread
+ // avalanche.
+ if (num_pollers_ < max_pollers_) {
+ num_pollers_++;
+ } else {
+ break;
}
- };
+ };
// This thread is exiting. Do some cleanup work i.e delete already completed
// worker threads
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 29a3b990275..43f1fd5585f 100644
--- a/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.h
+++ b/contrib/libs/grpc/src/cpp/thread_manager/thread_manager.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2016 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -22,12 +22,12 @@
#include <list>
#include <memory>
-#include <grpcpp/support/config.h>
+#include <grpcpp/support/config.h>
#include "src/core/lib/gprpp/sync.h"
-#include "src/core/lib/gprpp/thd.h"
+#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/resource_quota.h"
-
+
namespace grpc {
class ThreadManager {
@@ -78,14 +78,14 @@ class ThreadManager {
// Mark the ThreadManager as shutdown and begin draining the work. This is a
// non-blocking call and the caller should call Wait(), a blocking call which
// returns only once the shutdown is complete
- virtual void Shutdown();
+ virtual void Shutdown();
// Has Shutdown() been called
bool IsShutdown();
// A blocking call that returns only after the ThreadManager has shutdown and
// all the threads have drained all the outstanding work
- virtual void Wait();
+ virtual void Wait();
// Max number of concurrent threads that were ever active in this thread
// manager so far. This is useful for debugging purposes (and in unit tests)
@@ -93,8 +93,8 @@ class ThreadManager {
int GetMaxActiveThreadsSoFar();
private:
- // Helper wrapper class around grpc_core::Thread. Takes a ThreadManager object
- // and starts a new grpc_core::Thread to calls the Run() function.
+ // Helper wrapper class around grpc_core::Thread. Takes a ThreadManager object
+ // and starts a new grpc_core::Thread to calls the Run() function.
//
// The Run() function calls ThreadManager::MainWorkLoop() function and once
// that completes, it marks the WorkerThread completed by calling
@@ -130,8 +130,8 @@ class ThreadManager {
// thd_mgr_>MarkAsCompleted(this) to mark the thread as completed
void Run();
- ThreadManager* const thd_mgr_;
- grpc_core::Thread thd_;
+ ThreadManager* const thd_mgr_;
+ grpc_core::Thread thd_;
bool created_;
};
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 01fbe33239a..fb705906455 100644
--- a/contrib/libs/grpc/src/cpp/util/byte_buffer_cc.cc
+++ b/contrib/libs/grpc/src/cpp/util/byte_buffer_cc.cc
@@ -1,29 +1,29 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/byte_buffer.h>
+#include <grpc/byte_buffer.h>
#include <grpc/byte_buffer_reader.h>
-#include <grpcpp/impl/grpc_library.h>
-#include <grpcpp/support/byte_buffer.h>
+#include <grpcpp/impl/grpc_library.h>
+#include <grpcpp/support/byte_buffer.h>
namespace grpc {
-static internal::GrpcLibraryInitializer g_gli_initializer;
+static internal::GrpcLibraryInitializer g_gli_initializer;
Status ByteBuffer::Dump(std::vector<Slice>* slices) const {
slices->clear();
diff --git a/contrib/libs/grpc/src/cpp/util/error_details.cc b/contrib/libs/grpc/src/cpp/util/error_details.cc
index 49d60544547..dfd3351be15 100644
--- a/contrib/libs/grpc/src/cpp/util/error_details.cc
+++ b/contrib/libs/grpc/src/cpp/util/error_details.cc
@@ -1,50 +1,50 @@
-/*
- *
- * 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 <grpcpp/support/error_details.h>
-
-#include "src/proto/grpc/status/status.pb.h"
-
+/*
+ *
+ * Copyright 2017 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <grpcpp/support/error_details.h>
+
+#include "src/proto/grpc/status/status.pb.h"
+
namespace grpc {
-
+
grpc::Status ExtractErrorDetails(const grpc::Status& from,
::google::rpc::Status* to) {
- if (to == nullptr) {
+ if (to == nullptr) {
return grpc::Status(grpc::StatusCode::FAILED_PRECONDITION, "");
- }
+ }
if (!to->ParseFromString(TProtoStringType(from.error_details()))) {
return grpc::Status(grpc::StatusCode::INVALID_ARGUMENT, "");
- }
+ }
return grpc::Status::OK;
-}
-
+}
+
grpc::Status SetErrorDetails(const ::google::rpc::Status& from,
grpc::Status* to) {
- if (to == nullptr) {
+ if (to == nullptr) {
return grpc::Status(grpc::StatusCode::FAILED_PRECONDITION, "");
- }
+ }
grpc::StatusCode code = grpc::StatusCode::UNKNOWN;
if (from.code() >= grpc::StatusCode::OK &&
from.code() <= grpc::StatusCode::UNAUTHENTICATED) {
code = static_cast<grpc::StatusCode>(from.code());
- }
+ }
*to = grpc::Status(code, from.message(), from.SerializeAsString());
return grpc::Status::OK;
-}
-
+}
+
} // namespace grpc
diff --git a/contrib/libs/grpc/src/cpp/util/status.cc b/contrib/libs/grpc/src/cpp/util/status.cc
index 95c20b21482..93696d81268 100644
--- a/contrib/libs/grpc/src/cpp/util/status.cc
+++ b/contrib/libs/grpc/src/cpp/util/status.cc
@@ -1,22 +1,22 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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>
+#include <grpcpp/support/status.h>
namespace grpc {
diff --git a/contrib/libs/grpc/src/cpp/util/string_ref.cc b/contrib/libs/grpc/src/cpp/util/string_ref.cc
index 6b15c2a53be..8b09a82a634 100644
--- a/contrib/libs/grpc/src/cpp/util/string_ref.cc
+++ b/contrib/libs/grpc/src/cpp/util/string_ref.cc
@@ -1,22 +1,22 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/string_ref.h>
+#include <grpcpp/support/string_ref.h>
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 2bfe2bd40e8..6c9c228d7cd 100644
--- a/contrib/libs/grpc/src/cpp/util/time_cc.cc
+++ b/contrib/libs/grpc/src/cpp/util/time_cc.cc
@@ -1,27 +1,27 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * 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
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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/time.h>
-#include <grpcpp/support/config.h>
-#include <grpcpp/support/time.h>
+#include <grpcpp/support/config.h>
+#include <grpcpp/support/time.h>
using std::chrono::duration_cast;
-using std::chrono::high_resolution_clock;
+using std::chrono::high_resolution_clock;
using std::chrono::nanoseconds;
using std::chrono::seconds;
using std::chrono::system_clock;
@@ -39,8 +39,8 @@ void Timepoint2Timespec(const system_clock::time_point& from,
return;
}
nanoseconds nsecs = duration_cast<nanoseconds>(deadline - secs);
- to->tv_sec = static_cast<int64_t>(secs.count());
- to->tv_nsec = static_cast<int32_t>(nsecs.count());
+ to->tv_sec = static_cast<int64_t>(secs.count());
+ to->tv_nsec = static_cast<int32_t>(nsecs.count());
to->clock_type = GPR_CLOCK_REALTIME;
}
@@ -55,8 +55,8 @@ void TimepointHR2Timespec(const high_resolution_clock::time_point& from,
return;
}
nanoseconds nsecs = duration_cast<nanoseconds>(deadline - secs);
- to->tv_sec = static_cast<int64_t>(secs.count());
- to->tv_nsec = static_cast<int32_t>(nsecs.count());
+ to->tv_sec = static_cast<int64_t>(secs.count());
+ to->tv_nsec = static_cast<int32_t>(nsecs.count());
to->clock_type = GPR_CLOCK_REALTIME;
}