grpc 1.13.0 → 1.14.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +403 -153
- data/include/grpc/grpc.h +0 -8
- data/include/grpc/grpc_security.h +59 -2
- data/include/grpc/impl/codegen/grpc_types.h +8 -2
- data/include/grpc/impl/codegen/log.h +112 -0
- data/include/grpc/module.modulemap +2 -0
- data/include/grpc/support/log.h +2 -88
- data/include/grpc/support/string_util.h +2 -0
- data/src/boringssl/err_data.c +597 -593
- data/src/core/ext/filters/client_channel/client_channel.cc +715 -770
- data/src/core/ext/filters/client_channel/client_channel.h +5 -0
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +111 -0
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +69 -0
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +9 -0
- data/src/core/ext/filters/client_channel/http_proxy.cc +22 -5
- data/src/core/ext/filters/client_channel/lb_policy.h +15 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +3 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +3 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c +19 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h +54 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c +19 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h +54 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +4 -17
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +37 -63
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +79 -0
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +5 -2
- data/src/core/ext/filters/client_channel/lb_policy_factory.cc +8 -0
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +4 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +317 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +48 -9
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +40 -293
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +106 -84
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +6 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +6 -5
- data/src/core/ext/filters/client_channel/subchannel.cc +36 -6
- data/src/core/ext/filters/client_channel/subchannel.h +4 -0
- data/src/core/ext/filters/deadline/deadline_filter.cc +18 -15
- data/src/core/ext/filters/deadline/deadline_filter.h +5 -5
- data/src/core/ext/filters/http/client/http_client_filter.cc +10 -9
- data/src/core/ext/filters/http/server/http_server_filter.h +1 -1
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +1 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +33 -22
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/internal.h +10 -3
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +17 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +21 -16
- data/src/core/ext/transport/inproc/inproc_transport.cc +46 -6
- data/src/core/lib/channel/channel_stack.cc +22 -24
- data/src/core/lib/channel/channel_trace.cc +28 -63
- data/src/core/lib/channel/channel_trace.h +13 -17
- data/src/core/lib/channel/channelz.cc +143 -0
- data/src/core/lib/channel/channelz.h +124 -0
- data/src/core/lib/channel/channelz_registry.cc +7 -24
- data/src/core/lib/channel/channelz_registry.h +12 -8
- data/src/core/lib/channel/connected_channel.cc +8 -1
- data/src/core/{ext/filters/load_reporting/server_load_reporting_filter.h → lib/gpr/alloc.h} +7 -9
- data/src/core/lib/gpr/arena.cc +8 -8
- data/src/core/lib/gpr/string.cc +28 -0
- data/src/core/lib/gpr/string.h +10 -0
- data/src/core/lib/gprpp/abstract.h +5 -2
- data/src/core/lib/gprpp/inlined_vector.h +57 -3
- data/src/core/lib/gprpp/memory.h +2 -2
- data/src/core/lib/gprpp/ref_counted_ptr.h +5 -0
- data/src/core/lib/gprpp/thd_posix.cc +1 -1
- data/src/core/lib/iomgr/call_combiner.h +80 -0
- data/src/core/lib/iomgr/closure.h +3 -2
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +2 -2
- data/src/core/lib/iomgr/error.cc +12 -0
- data/src/core/lib/iomgr/error.h +5 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +36 -9
- data/src/core/lib/iomgr/ev_epollex_linux.cc +172 -46
- data/src/core/lib/iomgr/ev_epollsig_linux.cc +47 -21
- data/src/core/lib/iomgr/ev_poll_posix.cc +10 -4
- data/src/core/lib/iomgr/ev_posix.cc +17 -9
- data/src/core/lib/iomgr/ev_posix.h +20 -4
- data/src/core/lib/iomgr/executor.cc +196 -140
- data/src/core/lib/iomgr/executor.h +47 -14
- data/src/core/lib/iomgr/iomgr.cc +2 -0
- data/src/core/lib/iomgr/iomgr.h +5 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.cc +1 -0
- data/src/core/lib/iomgr/socket_utils.h +9 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +4 -0
- data/src/core/lib/iomgr/socket_utils_uv.cc +4 -0
- data/src/core/lib/iomgr/socket_utils_windows.cc +4 -0
- data/src/core/lib/iomgr/tcp_client_posix.cc +3 -5
- data/src/core/lib/iomgr/tcp_posix.cc +6 -1
- data/src/core/lib/iomgr/tcp_server_posix.cc +3 -3
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +1 -1
- data/src/core/lib/iomgr/timer_manager.cc +0 -1
- data/src/core/lib/iomgr/udp_server.cc +2 -3
- data/src/core/lib/json/json.cc +10 -0
- data/src/core/lib/json/json.h +5 -0
- data/src/core/lib/security/context/security_context.cc +8 -8
- data/src/core/lib/security/context/security_context.h +6 -2
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +2 -1
- data/src/core/lib/security/credentials/local/local_credentials.cc +77 -0
- data/src/core/lib/security/credentials/local/local_credentials.h +40 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +17 -3
- data/src/core/lib/security/security_connector/local_security_connector.cc +245 -0
- data/src/core/lib/security/security_connector/local_security_connector.h +58 -0
- data/src/core/lib/security/security_connector/security_connector.cc +30 -5
- data/src/core/lib/security/security_connector/security_connector.h +1 -0
- data/src/core/lib/security/transport/client_auth_filter.cc +5 -1
- data/src/core/lib/security/transport/server_auth_filter.cc +4 -5
- data/src/core/lib/surface/call.cc +75 -32
- data/src/core/lib/surface/call.h +2 -0
- data/src/core/lib/surface/channel.cc +32 -13
- data/src/core/lib/surface/channel.h +4 -0
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/transport.cc +20 -9
- data/src/core/lib/transport/transport.h +12 -10
- data/src/core/lib/transport/transport_op_string.cc +0 -7
- data/src/core/plugin_registry/grpc_plugin_registry.cc +0 -4
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h +2 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +2 -1
- data/src/core/tsi/alts/handshaker/altscontext.pb.c +0 -1
- data/src/core/tsi/alts/handshaker/altscontext.pb.h +1 -2
- data/src/core/tsi/alts/handshaker/handshaker.pb.c +0 -1
- data/src/core/tsi/alts/handshaker/handshaker.pb.h +1 -2
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.c +0 -1
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.h +1 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +2 -2
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +47 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h +3 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +12 -11
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h +7 -2
- data/src/core/tsi/local_transport_security.cc +209 -0
- data/src/core/tsi/local_transport_security.h +51 -0
- data/src/core/tsi/ssl_transport_security.cc +2 -3
- data/src/{core/ext → cpp/ext/filters}/census/grpc_context.cc +0 -0
- data/src/ruby/ext/grpc/rb_channel_credentials.c +3 -3
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +18 -18
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +29 -29
- data/src/ruby/lib/grpc/generic/active_call.rb +19 -23
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/call_credentials_spec.rb +1 -1
- data/src/ruby/spec/call_spec.rb +1 -1
- data/src/ruby/spec/channel_credentials_spec.rb +1 -1
- data/src/ruby/spec/channel_spec.rb +1 -1
- data/src/ruby/spec/client_auth_spec.rb +1 -12
- data/src/ruby/spec/client_server_spec.rb +1 -1
- data/src/ruby/spec/compression_options_spec.rb +1 -1
- data/src/ruby/spec/error_sanity_spec.rb +1 -1
- data/src/ruby/spec/generic/client_stub_spec.rb +13 -1
- data/src/ruby/spec/generic/rpc_desc_spec.rb +1 -1
- data/src/ruby/spec/generic/rpc_server_pool_spec.rb +1 -1
- data/src/ruby/spec/generic/service_spec.rb +1 -1
- data/src/ruby/spec/google_rpc_status_utils_spec.rb +1 -12
- data/src/ruby/spec/pb/duplicate/codegen_spec.rb +1 -0
- data/src/ruby/spec/pb/health/checker_spec.rb +1 -1
- data/src/ruby/spec/server_credentials_spec.rb +1 -1
- data/src/ruby/spec/server_spec.rb +1 -1
- data/src/ruby/spec/spec_helper.rb +1 -0
- data/src/ruby/spec/support/services.rb +1 -1
- data/src/ruby/spec/time_consts_spec.rb +1 -1
- data/third_party/boringssl/crypto/asn1/tasn_dec.c +40 -19
- data/third_party/boringssl/crypto/bytestring/cbs.c +1 -0
- data/third_party/boringssl/crypto/cipher_extra/e_aesccm.c +47 -15
- data/third_party/boringssl/crypto/ec_extra/ec_asn1.c +9 -10
- data/third_party/boringssl/crypto/ecdh/ecdh.c +4 -3
- data/third_party/boringssl/crypto/fipsmodule/bn/add.c +30 -54
- data/third_party/boringssl/crypto/fipsmodule/bn/bn.c +7 -1
- data/third_party/boringssl/crypto/fipsmodule/bn/cmp.c +8 -8
- data/third_party/boringssl/crypto/fipsmodule/bn/div.c +97 -11
- data/third_party/boringssl/crypto/fipsmodule/bn/gcd.c +274 -218
- data/third_party/boringssl/crypto/fipsmodule/bn/internal.h +111 -34
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery.c +2 -2
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery_inv.c +1 -1
- data/third_party/boringssl/crypto/fipsmodule/bn/mul.c +24 -6
- data/third_party/boringssl/crypto/fipsmodule/bn/prime.c +324 -63
- data/third_party/boringssl/crypto/fipsmodule/bn/random.c +74 -21
- data/third_party/boringssl/crypto/fipsmodule/bn/shift.c +128 -86
- data/third_party/boringssl/crypto/fipsmodule/bn/sqrt.c +1 -1
- data/third_party/boringssl/crypto/fipsmodule/ec/ec_key.c +67 -112
- data/third_party/boringssl/crypto/fipsmodule/ec/internal.h +8 -1
- data/third_party/boringssl/crypto/fipsmodule/ec/oct.c +5 -5
- data/third_party/boringssl/crypto/fipsmodule/ec/p224-64.c +9 -17
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64-table.h +5378 -5418
- data/third_party/boringssl/crypto/fipsmodule/ec/simple.c +32 -32
- data/third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.c +5 -11
- data/third_party/boringssl/crypto/fipsmodule/rsa/blinding.c +16 -40
- data/third_party/boringssl/crypto/fipsmodule/rsa/internal.h +1 -6
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa.c +41 -29
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.c +63 -49
- data/third_party/boringssl/crypto/x509/vpm_int.h +1 -0
- data/third_party/boringssl/crypto/x509/x509_vfy.c +4 -0
- data/third_party/boringssl/crypto/x509/x509_vpm.c +44 -22
- data/third_party/boringssl/include/openssl/aead.h +8 -2
- data/third_party/boringssl/include/openssl/asn1.h +1 -0
- data/third_party/boringssl/include/openssl/base.h +4 -0
- data/third_party/boringssl/include/openssl/bn.h +13 -3
- data/third_party/boringssl/include/openssl/bytestring.h +4 -4
- data/third_party/boringssl/include/openssl/ec.h +10 -4
- data/third_party/boringssl/include/openssl/ec_key.h +0 -3
- data/third_party/boringssl/include/openssl/rsa.h +1 -0
- data/third_party/boringssl/include/openssl/ssl.h +8 -3
- data/third_party/boringssl/include/openssl/ssl3.h +0 -1
- data/third_party/boringssl/include/openssl/x509.h +1 -0
- data/third_party/boringssl/include/openssl/x509v3.h +1 -0
- data/third_party/boringssl/ssl/handshake_client.cc +36 -64
- data/third_party/boringssl/ssl/ssl_cipher.cc +4 -0
- data/third_party/boringssl/ssl/ssl_lib.cc +1 -1
- metadata +45 -38
- data/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc +0 -222
- data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc +0 -71
- data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h +0 -61
- data/src/ruby/spec/pb/package_with_underscore/checker_spec.rb +0 -51
- data/src/ruby/spec/pb/package_with_underscore/data.proto +0 -23
- data/src/ruby/spec/pb/package_with_underscore/service.proto +0 -23
@@ -0,0 +1,54 @@
|
|
1
|
+
/* Automatically generated nanopb header */
|
2
|
+
/* Generated by nanopb-0.3.7-dev */
|
3
|
+
|
4
|
+
#ifndef PB_GOOGLE_PROTOBUF_TIMESTAMP_PB_H_INCLUDED
|
5
|
+
#define PB_GOOGLE_PROTOBUF_TIMESTAMP_PB_H_INCLUDED
|
6
|
+
#include "pb.h"
|
7
|
+
/* @@protoc_insertion_point(includes) */
|
8
|
+
#if PB_PROTO_HEADER_VERSION != 30
|
9
|
+
#error Regenerate this file with the current version of nanopb generator.
|
10
|
+
#endif
|
11
|
+
|
12
|
+
#ifdef __cplusplus
|
13
|
+
extern "C" {
|
14
|
+
#endif
|
15
|
+
|
16
|
+
/* Struct definitions */
|
17
|
+
typedef struct _google_protobuf_Timestamp {
|
18
|
+
bool has_seconds;
|
19
|
+
int64_t seconds;
|
20
|
+
bool has_nanos;
|
21
|
+
int32_t nanos;
|
22
|
+
/* @@protoc_insertion_point(struct:google_protobuf_Timestamp) */
|
23
|
+
} google_protobuf_Timestamp;
|
24
|
+
|
25
|
+
/* Default values for struct fields */
|
26
|
+
|
27
|
+
/* Initializer values for message structs */
|
28
|
+
#define google_protobuf_Timestamp_init_default {false, 0, false, 0}
|
29
|
+
#define google_protobuf_Timestamp_init_zero {false, 0, false, 0}
|
30
|
+
|
31
|
+
/* Field tags (for use in manual encoding/decoding) */
|
32
|
+
#define google_protobuf_Timestamp_seconds_tag 1
|
33
|
+
#define google_protobuf_Timestamp_nanos_tag 2
|
34
|
+
|
35
|
+
/* Struct field encoding specification for nanopb */
|
36
|
+
extern const pb_field_t google_protobuf_Timestamp_fields[3];
|
37
|
+
|
38
|
+
/* Maximum encoded size of messages (where known) */
|
39
|
+
#define google_protobuf_Timestamp_size 22
|
40
|
+
|
41
|
+
/* Message IDs (where set with "msgid" option) */
|
42
|
+
#ifdef PB_MSGID
|
43
|
+
|
44
|
+
#define TIMESTAMP_MESSAGES \
|
45
|
+
|
46
|
+
|
47
|
+
#endif
|
48
|
+
|
49
|
+
#ifdef __cplusplus
|
50
|
+
} /* extern "C" */
|
51
|
+
#endif
|
52
|
+
/* @@protoc_insertion_point(eof) */
|
53
|
+
|
54
|
+
#endif
|
data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
/* Generated by nanopb-0.3.7-dev */
|
3
3
|
|
4
4
|
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h"
|
5
|
-
|
6
5
|
/* @@protoc_insertion_point(includes) */
|
7
6
|
#if PB_PROTO_HEADER_VERSION != 30
|
8
7
|
#error Regenerate this file with the current version of nanopb generator.
|
@@ -10,18 +9,6 @@
|
|
10
9
|
|
11
10
|
|
12
11
|
|
13
|
-
const pb_field_t grpc_lb_v1_Duration_fields[3] = {
|
14
|
-
PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, grpc_lb_v1_Duration, seconds, seconds, 0),
|
15
|
-
PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Duration, nanos, seconds, 0),
|
16
|
-
PB_LAST_FIELD
|
17
|
-
};
|
18
|
-
|
19
|
-
const pb_field_t grpc_lb_v1_Timestamp_fields[3] = {
|
20
|
-
PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, grpc_lb_v1_Timestamp, seconds, seconds, 0),
|
21
|
-
PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Timestamp, nanos, seconds, 0),
|
22
|
-
PB_LAST_FIELD
|
23
|
-
};
|
24
|
-
|
25
12
|
const pb_field_t grpc_lb_v1_LoadBalanceRequest_fields[3] = {
|
26
13
|
PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_lb_v1_LoadBalanceRequest, initial_request, initial_request, &grpc_lb_v1_InitialLoadBalanceRequest_fields),
|
27
14
|
PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v1_LoadBalanceRequest, client_stats, initial_request, &grpc_lb_v1_ClientStats_fields),
|
@@ -40,7 +27,7 @@ const pb_field_t grpc_lb_v1_ClientStatsPerToken_fields[3] = {
|
|
40
27
|
};
|
41
28
|
|
42
29
|
const pb_field_t grpc_lb_v1_ClientStats_fields[7] = {
|
43
|
-
PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_lb_v1_ClientStats, timestamp, timestamp, &
|
30
|
+
PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_lb_v1_ClientStats, timestamp, timestamp, &google_protobuf_Timestamp_fields),
|
44
31
|
PB_FIELD( 2, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_started, timestamp, 0),
|
45
32
|
PB_FIELD( 3, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished, num_calls_started, 0),
|
46
33
|
PB_FIELD( 6, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished_with_client_failed_to_send, num_calls_finished, 0),
|
@@ -57,7 +44,7 @@ const pb_field_t grpc_lb_v1_LoadBalanceResponse_fields[3] = {
|
|
57
44
|
|
58
45
|
const pb_field_t grpc_lb_v1_InitialLoadBalanceResponse_fields[3] = {
|
59
46
|
PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, grpc_lb_v1_InitialLoadBalanceResponse, load_balancer_delegate, load_balancer_delegate, 0),
|
60
|
-
PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval, load_balancer_delegate, &
|
47
|
+
PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval, load_balancer_delegate, &google_protobuf_Duration_fields),
|
61
48
|
PB_LAST_FIELD
|
62
49
|
};
|
63
50
|
|
@@ -84,7 +71,7 @@ const pb_field_t grpc_lb_v1_Server_fields[5] = {
|
|
84
71
|
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
|
85
72
|
* field descriptors.
|
86
73
|
*/
|
87
|
-
PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 65536 && pb_membersize(grpc_lb_v1_ClientStats, timestamp) < 65536 && pb_membersize(grpc_lb_v1_ClientStats, calls_finished_with_drop) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 65536 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 65536 && pb_membersize(grpc_lb_v1_ServerList, servers) < 65536),
|
74
|
+
PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 65536 && pb_membersize(grpc_lb_v1_ClientStats, timestamp) < 65536 && pb_membersize(grpc_lb_v1_ClientStats, calls_finished_with_drop) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 65536 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 65536 && pb_membersize(grpc_lb_v1_ServerList, servers) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_grpc_lb_v1_LoadBalanceRequest_grpc_lb_v1_InitialLoadBalanceRequest_grpc_lb_v1_ClientStatsPerToken_grpc_lb_v1_ClientStats_grpc_lb_v1_LoadBalanceResponse_grpc_lb_v1_InitialLoadBalanceResponse_grpc_lb_v1_ServerList_grpc_lb_v1_Server)
|
88
75
|
#endif
|
89
76
|
|
90
77
|
#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
|
@@ -95,7 +82,7 @@ PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request)
|
|
95
82
|
* numbers or field sizes that are larger than what can fit in the default
|
96
83
|
* 8 bit descriptors.
|
97
84
|
*/
|
98
|
-
PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 256 && pb_membersize(grpc_lb_v1_ClientStats, timestamp) < 256 && pb_membersize(grpc_lb_v1_ClientStats, calls_finished_with_drop) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 256 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 256 && pb_membersize(grpc_lb_v1_ServerList, servers) < 256),
|
85
|
+
PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 256 && pb_membersize(grpc_lb_v1_ClientStats, timestamp) < 256 && pb_membersize(grpc_lb_v1_ClientStats, calls_finished_with_drop) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 256 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 256 && pb_membersize(grpc_lb_v1_ServerList, servers) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_grpc_lb_v1_LoadBalanceRequest_grpc_lb_v1_InitialLoadBalanceRequest_grpc_lb_v1_ClientStatsPerToken_grpc_lb_v1_ClientStats_grpc_lb_v1_LoadBalanceResponse_grpc_lb_v1_InitialLoadBalanceResponse_grpc_lb_v1_ServerList_grpc_lb_v1_Server)
|
99
86
|
#endif
|
100
87
|
|
101
88
|
|
data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h
CHANGED
@@ -3,7 +3,9 @@
|
|
3
3
|
|
4
4
|
#ifndef PB_GRPC_LB_V1_LOAD_BALANCER_PB_H_INCLUDED
|
5
5
|
#define PB_GRPC_LB_V1_LOAD_BALANCER_PB_H_INCLUDED
|
6
|
-
#include "
|
6
|
+
#include "pb.h"
|
7
|
+
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h"
|
8
|
+
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h"
|
7
9
|
/* @@protoc_insertion_point(includes) */
|
8
10
|
#if PB_PROTO_HEADER_VERSION != 30
|
9
11
|
#error Regenerate this file with the current version of nanopb generator.
|
@@ -19,6 +21,21 @@ typedef struct _grpc_lb_v1_ServerList {
|
|
19
21
|
/* @@protoc_insertion_point(struct:grpc_lb_v1_ServerList) */
|
20
22
|
} grpc_lb_v1_ServerList;
|
21
23
|
|
24
|
+
typedef struct _grpc_lb_v1_ClientStats {
|
25
|
+
bool has_timestamp;
|
26
|
+
google_protobuf_Timestamp timestamp;
|
27
|
+
bool has_num_calls_started;
|
28
|
+
int64_t num_calls_started;
|
29
|
+
bool has_num_calls_finished;
|
30
|
+
int64_t num_calls_finished;
|
31
|
+
bool has_num_calls_finished_with_client_failed_to_send;
|
32
|
+
int64_t num_calls_finished_with_client_failed_to_send;
|
33
|
+
bool has_num_calls_finished_known_received;
|
34
|
+
int64_t num_calls_finished_known_received;
|
35
|
+
pb_callback_t calls_finished_with_drop;
|
36
|
+
/* @@protoc_insertion_point(struct:grpc_lb_v1_ClientStats) */
|
37
|
+
} grpc_lb_v1_ClientStats;
|
38
|
+
|
22
39
|
typedef struct _grpc_lb_v1_ClientStatsPerToken {
|
23
40
|
pb_callback_t load_balance_token;
|
24
41
|
bool has_num_calls;
|
@@ -26,20 +43,20 @@ typedef struct _grpc_lb_v1_ClientStatsPerToken {
|
|
26
43
|
/* @@protoc_insertion_point(struct:grpc_lb_v1_ClientStatsPerToken) */
|
27
44
|
} grpc_lb_v1_ClientStatsPerToken;
|
28
45
|
|
29
|
-
typedef struct _grpc_lb_v1_Duration {
|
30
|
-
bool has_seconds;
|
31
|
-
int64_t seconds;
|
32
|
-
bool has_nanos;
|
33
|
-
int32_t nanos;
|
34
|
-
/* @@protoc_insertion_point(struct:grpc_lb_v1_Duration) */
|
35
|
-
} grpc_lb_v1_Duration;
|
36
|
-
|
37
46
|
typedef struct _grpc_lb_v1_InitialLoadBalanceRequest {
|
38
47
|
bool has_name;
|
39
48
|
char name[128];
|
40
49
|
/* @@protoc_insertion_point(struct:grpc_lb_v1_InitialLoadBalanceRequest) */
|
41
50
|
} grpc_lb_v1_InitialLoadBalanceRequest;
|
42
51
|
|
52
|
+
typedef struct _grpc_lb_v1_InitialLoadBalanceResponse {
|
53
|
+
bool has_load_balancer_delegate;
|
54
|
+
char load_balancer_delegate[64];
|
55
|
+
bool has_client_stats_report_interval;
|
56
|
+
google_protobuf_Duration client_stats_report_interval;
|
57
|
+
/* @@protoc_insertion_point(struct:grpc_lb_v1_InitialLoadBalanceResponse) */
|
58
|
+
} grpc_lb_v1_InitialLoadBalanceResponse;
|
59
|
+
|
43
60
|
typedef PB_BYTES_ARRAY_T(16) grpc_lb_v1_Server_ip_address_t;
|
44
61
|
typedef struct _grpc_lb_v1_Server {
|
45
62
|
bool has_ip_address;
|
@@ -53,37 +70,6 @@ typedef struct _grpc_lb_v1_Server {
|
|
53
70
|
/* @@protoc_insertion_point(struct:grpc_lb_v1_Server) */
|
54
71
|
} grpc_lb_v1_Server;
|
55
72
|
|
56
|
-
typedef struct _grpc_lb_v1_Timestamp {
|
57
|
-
bool has_seconds;
|
58
|
-
int64_t seconds;
|
59
|
-
bool has_nanos;
|
60
|
-
int32_t nanos;
|
61
|
-
/* @@protoc_insertion_point(struct:grpc_lb_v1_Timestamp) */
|
62
|
-
} grpc_lb_v1_Timestamp;
|
63
|
-
|
64
|
-
typedef struct _grpc_lb_v1_ClientStats {
|
65
|
-
bool has_timestamp;
|
66
|
-
grpc_lb_v1_Timestamp timestamp;
|
67
|
-
bool has_num_calls_started;
|
68
|
-
int64_t num_calls_started;
|
69
|
-
bool has_num_calls_finished;
|
70
|
-
int64_t num_calls_finished;
|
71
|
-
bool has_num_calls_finished_with_client_failed_to_send;
|
72
|
-
int64_t num_calls_finished_with_client_failed_to_send;
|
73
|
-
bool has_num_calls_finished_known_received;
|
74
|
-
int64_t num_calls_finished_known_received;
|
75
|
-
pb_callback_t calls_finished_with_drop;
|
76
|
-
/* @@protoc_insertion_point(struct:grpc_lb_v1_ClientStats) */
|
77
|
-
} grpc_lb_v1_ClientStats;
|
78
|
-
|
79
|
-
typedef struct _grpc_lb_v1_InitialLoadBalanceResponse {
|
80
|
-
bool has_load_balancer_delegate;
|
81
|
-
char load_balancer_delegate[64];
|
82
|
-
bool has_client_stats_report_interval;
|
83
|
-
grpc_lb_v1_Duration client_stats_report_interval;
|
84
|
-
/* @@protoc_insertion_point(struct:grpc_lb_v1_InitialLoadBalanceResponse) */
|
85
|
-
} grpc_lb_v1_InitialLoadBalanceResponse;
|
86
|
-
|
87
73
|
typedef struct _grpc_lb_v1_LoadBalanceRequest {
|
88
74
|
bool has_initial_request;
|
89
75
|
grpc_lb_v1_InitialLoadBalanceRequest initial_request;
|
@@ -103,56 +89,46 @@ typedef struct _grpc_lb_v1_LoadBalanceResponse {
|
|
103
89
|
/* Default values for struct fields */
|
104
90
|
|
105
91
|
/* Initializer values for message structs */
|
106
|
-
#define grpc_lb_v1_Duration_init_default {false, 0, false, 0}
|
107
|
-
#define grpc_lb_v1_Timestamp_init_default {false, 0, false, 0}
|
108
92
|
#define grpc_lb_v1_LoadBalanceRequest_init_default {false, grpc_lb_v1_InitialLoadBalanceRequest_init_default, false, grpc_lb_v1_ClientStats_init_default}
|
109
93
|
#define grpc_lb_v1_InitialLoadBalanceRequest_init_default {false, ""}
|
110
94
|
#define grpc_lb_v1_ClientStatsPerToken_init_default {{{NULL}, NULL}, false, 0}
|
111
|
-
#define grpc_lb_v1_ClientStats_init_default {false,
|
95
|
+
#define grpc_lb_v1_ClientStats_init_default {false, google_protobuf_Timestamp_init_default, false, 0, false, 0, false, 0, false, 0, {{NULL}, NULL}}
|
112
96
|
#define grpc_lb_v1_LoadBalanceResponse_init_default {false, grpc_lb_v1_InitialLoadBalanceResponse_init_default, false, grpc_lb_v1_ServerList_init_default}
|
113
|
-
#define grpc_lb_v1_InitialLoadBalanceResponse_init_default {false, "", false,
|
97
|
+
#define grpc_lb_v1_InitialLoadBalanceResponse_init_default {false, "", false, google_protobuf_Duration_init_default}
|
114
98
|
#define grpc_lb_v1_ServerList_init_default {{{NULL}, NULL}}
|
115
99
|
#define grpc_lb_v1_Server_init_default {false, {0, {0}}, false, 0, false, "", false, 0}
|
116
|
-
#define grpc_lb_v1_Duration_init_zero {false, 0, false, 0}
|
117
|
-
#define grpc_lb_v1_Timestamp_init_zero {false, 0, false, 0}
|
118
100
|
#define grpc_lb_v1_LoadBalanceRequest_init_zero {false, grpc_lb_v1_InitialLoadBalanceRequest_init_zero, false, grpc_lb_v1_ClientStats_init_zero}
|
119
101
|
#define grpc_lb_v1_InitialLoadBalanceRequest_init_zero {false, ""}
|
120
102
|
#define grpc_lb_v1_ClientStatsPerToken_init_zero {{{NULL}, NULL}, false, 0}
|
121
|
-
#define grpc_lb_v1_ClientStats_init_zero {false,
|
103
|
+
#define grpc_lb_v1_ClientStats_init_zero {false, google_protobuf_Timestamp_init_zero, false, 0, false, 0, false, 0, false, 0, {{NULL}, NULL}}
|
122
104
|
#define grpc_lb_v1_LoadBalanceResponse_init_zero {false, grpc_lb_v1_InitialLoadBalanceResponse_init_zero, false, grpc_lb_v1_ServerList_init_zero}
|
123
|
-
#define grpc_lb_v1_InitialLoadBalanceResponse_init_zero {false, "", false,
|
105
|
+
#define grpc_lb_v1_InitialLoadBalanceResponse_init_zero {false, "", false, google_protobuf_Duration_init_zero}
|
124
106
|
#define grpc_lb_v1_ServerList_init_zero {{{NULL}, NULL}}
|
125
107
|
#define grpc_lb_v1_Server_init_zero {false, {0, {0}}, false, 0, false, "", false, 0}
|
126
108
|
|
127
109
|
/* Field tags (for use in manual encoding/decoding) */
|
128
110
|
#define grpc_lb_v1_ServerList_servers_tag 1
|
129
|
-
#define grpc_lb_v1_ClientStatsPerToken_load_balance_token_tag 1
|
130
|
-
#define grpc_lb_v1_ClientStatsPerToken_num_calls_tag 2
|
131
|
-
#define grpc_lb_v1_Duration_seconds_tag 1
|
132
|
-
#define grpc_lb_v1_Duration_nanos_tag 2
|
133
|
-
#define grpc_lb_v1_InitialLoadBalanceRequest_name_tag 1
|
134
|
-
#define grpc_lb_v1_Server_ip_address_tag 1
|
135
|
-
#define grpc_lb_v1_Server_port_tag 2
|
136
|
-
#define grpc_lb_v1_Server_load_balance_token_tag 3
|
137
|
-
#define grpc_lb_v1_Server_drop_tag 4
|
138
|
-
#define grpc_lb_v1_Timestamp_seconds_tag 1
|
139
|
-
#define grpc_lb_v1_Timestamp_nanos_tag 2
|
140
111
|
#define grpc_lb_v1_ClientStats_timestamp_tag 1
|
141
112
|
#define grpc_lb_v1_ClientStats_num_calls_started_tag 2
|
142
113
|
#define grpc_lb_v1_ClientStats_num_calls_finished_tag 3
|
143
114
|
#define grpc_lb_v1_ClientStats_num_calls_finished_with_client_failed_to_send_tag 6
|
144
115
|
#define grpc_lb_v1_ClientStats_num_calls_finished_known_received_tag 7
|
145
116
|
#define grpc_lb_v1_ClientStats_calls_finished_with_drop_tag 8
|
117
|
+
#define grpc_lb_v1_ClientStatsPerToken_load_balance_token_tag 1
|
118
|
+
#define grpc_lb_v1_ClientStatsPerToken_num_calls_tag 2
|
119
|
+
#define grpc_lb_v1_InitialLoadBalanceRequest_name_tag 1
|
146
120
|
#define grpc_lb_v1_InitialLoadBalanceResponse_load_balancer_delegate_tag 1
|
147
121
|
#define grpc_lb_v1_InitialLoadBalanceResponse_client_stats_report_interval_tag 2
|
122
|
+
#define grpc_lb_v1_Server_ip_address_tag 1
|
123
|
+
#define grpc_lb_v1_Server_port_tag 2
|
124
|
+
#define grpc_lb_v1_Server_load_balance_token_tag 3
|
125
|
+
#define grpc_lb_v1_Server_drop_tag 4
|
148
126
|
#define grpc_lb_v1_LoadBalanceRequest_initial_request_tag 1
|
149
127
|
#define grpc_lb_v1_LoadBalanceRequest_client_stats_tag 2
|
150
128
|
#define grpc_lb_v1_LoadBalanceResponse_initial_response_tag 1
|
151
129
|
#define grpc_lb_v1_LoadBalanceResponse_server_list_tag 2
|
152
130
|
|
153
131
|
/* Struct field encoding specification for nanopb */
|
154
|
-
extern const pb_field_t grpc_lb_v1_Duration_fields[3];
|
155
|
-
extern const pb_field_t grpc_lb_v1_Timestamp_fields[3];
|
156
132
|
extern const pb_field_t grpc_lb_v1_LoadBalanceRequest_fields[3];
|
157
133
|
extern const pb_field_t grpc_lb_v1_InitialLoadBalanceRequest_fields[2];
|
158
134
|
extern const pb_field_t grpc_lb_v1_ClientStatsPerToken_fields[3];
|
@@ -163,8 +139,6 @@ extern const pb_field_t grpc_lb_v1_ServerList_fields[2];
|
|
163
139
|
extern const pb_field_t grpc_lb_v1_Server_fields[5];
|
164
140
|
|
165
141
|
/* Maximum encoded size of messages (where known) */
|
166
|
-
#define grpc_lb_v1_Duration_size 22
|
167
|
-
#define grpc_lb_v1_Timestamp_size 22
|
168
142
|
#define grpc_lb_v1_LoadBalanceRequest_size (140 + grpc_lb_v1_ClientStats_size)
|
169
143
|
#define grpc_lb_v1_InitialLoadBalanceRequest_size 131
|
170
144
|
/* grpc_lb_v1_ClientStatsPerToken_size depends on runtime parameters */
|
@@ -58,6 +58,8 @@ class PickFirst : public LoadBalancingPolicy {
|
|
58
58
|
void HandOffPendingPicksLocked(LoadBalancingPolicy* new_policy) override;
|
59
59
|
void PingOneLocked(grpc_closure* on_initiate, grpc_closure* on_ack) override;
|
60
60
|
void ExitIdleLocked() override;
|
61
|
+
void FillChildRefsForChannelz(ChildRefsList* child_subchannels,
|
62
|
+
ChildRefsList* child_channels) override;
|
61
63
|
|
62
64
|
private:
|
63
65
|
~PickFirst();
|
@@ -103,10 +105,23 @@ class PickFirst : public LoadBalancingPolicy {
|
|
103
105
|
}
|
104
106
|
};
|
105
107
|
|
108
|
+
// Helper class to ensure that any function that modifies the child refs
|
109
|
+
// data structures will update the channelz snapshot data structures before
|
110
|
+
// returning.
|
111
|
+
class AutoChildRefsUpdater {
|
112
|
+
public:
|
113
|
+
explicit AutoChildRefsUpdater(PickFirst* pf) : pf_(pf) {}
|
114
|
+
~AutoChildRefsUpdater() { pf_->UpdateChildRefsLocked(); }
|
115
|
+
|
116
|
+
private:
|
117
|
+
PickFirst* pf_;
|
118
|
+
};
|
119
|
+
|
106
120
|
void ShutdownLocked() override;
|
107
121
|
|
108
122
|
void StartPickingLocked();
|
109
123
|
void DestroyUnselectedSubchannelsLocked();
|
124
|
+
void UpdateChildRefsLocked();
|
110
125
|
|
111
126
|
// All our subchannels.
|
112
127
|
OrphanablePtr<PickFirstSubchannelList> subchannel_list_;
|
@@ -122,10 +137,17 @@ class PickFirst : public LoadBalancingPolicy {
|
|
122
137
|
PickState* pending_picks_ = nullptr;
|
123
138
|
// Our connectivity state tracker.
|
124
139
|
grpc_connectivity_state_tracker state_tracker_;
|
140
|
+
|
141
|
+
/// Lock and data used to capture snapshots of this channels child
|
142
|
+
/// channels and subchannels. This data is consumed by channelz.
|
143
|
+
gpr_mu child_refs_mu_;
|
144
|
+
ChildRefsList child_subchannels_;
|
145
|
+
ChildRefsList child_channels_;
|
125
146
|
};
|
126
147
|
|
127
148
|
PickFirst::PickFirst(const Args& args) : LoadBalancingPolicy(args) {
|
128
149
|
GPR_ASSERT(args.client_channel_factory != nullptr);
|
150
|
+
gpr_mu_init(&child_refs_mu_);
|
129
151
|
grpc_connectivity_state_init(&state_tracker_, GRPC_CHANNEL_IDLE,
|
130
152
|
"pick_first");
|
131
153
|
if (grpc_lb_pick_first_trace.enabled()) {
|
@@ -139,6 +161,7 @@ PickFirst::~PickFirst() {
|
|
139
161
|
if (grpc_lb_pick_first_trace.enabled()) {
|
140
162
|
gpr_log(GPR_INFO, "Destroying Pick First %p", this);
|
141
163
|
}
|
164
|
+
gpr_mu_destroy(&child_refs_mu_);
|
142
165
|
GPR_ASSERT(subchannel_list_ == nullptr);
|
143
166
|
GPR_ASSERT(latest_pending_subchannel_list_ == nullptr);
|
144
167
|
GPR_ASSERT(pending_picks_ == nullptr);
|
@@ -158,6 +181,7 @@ void PickFirst::HandOffPendingPicksLocked(LoadBalancingPolicy* new_policy) {
|
|
158
181
|
}
|
159
182
|
|
160
183
|
void PickFirst::ShutdownLocked() {
|
184
|
+
AutoChildRefsUpdater(this);
|
161
185
|
grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Channel shutdown");
|
162
186
|
if (grpc_lb_pick_first_trace.enabled()) {
|
163
187
|
gpr_log(GPR_INFO, "Pick First %p Shutting down", this);
|
@@ -280,7 +304,61 @@ void PickFirst::PingOneLocked(grpc_closure* on_initiate, grpc_closure* on_ack) {
|
|
280
304
|
}
|
281
305
|
}
|
282
306
|
|
307
|
+
void PickFirst::FillChildRefsForChannelz(
|
308
|
+
ChildRefsList* child_subchannels_to_fill, ChildRefsList* ignored) {
|
309
|
+
mu_guard guard(&child_refs_mu_);
|
310
|
+
for (size_t i = 0; i < child_subchannels_.size(); ++i) {
|
311
|
+
// TODO(ncteisen): implement a de dup loop that is not O(n^2). Might
|
312
|
+
// have to implement lightweight set. For now, we don't care about
|
313
|
+
// performance when channelz requests are made.
|
314
|
+
bool found = false;
|
315
|
+
for (size_t j = 0; j < child_subchannels_to_fill->size(); ++j) {
|
316
|
+
if ((*child_subchannels_to_fill)[j] == child_subchannels_[i]) {
|
317
|
+
found = true;
|
318
|
+
break;
|
319
|
+
}
|
320
|
+
}
|
321
|
+
if (!found) {
|
322
|
+
child_subchannels_to_fill->push_back(child_subchannels_[i]);
|
323
|
+
}
|
324
|
+
}
|
325
|
+
}
|
326
|
+
|
327
|
+
void PickFirst::UpdateChildRefsLocked() {
|
328
|
+
ChildRefsList cs;
|
329
|
+
if (subchannel_list_ != nullptr) {
|
330
|
+
for (size_t i = 0; i < subchannel_list_->num_subchannels(); ++i) {
|
331
|
+
if (subchannel_list_->subchannel(i)->subchannel() != nullptr) {
|
332
|
+
grpc_core::channelz::SubchannelNode* subchannel_node =
|
333
|
+
grpc_subchannel_get_channelz_node(
|
334
|
+
subchannel_list_->subchannel(i)->subchannel());
|
335
|
+
if (subchannel_node != nullptr) {
|
336
|
+
cs.push_back(subchannel_node->subchannel_uuid());
|
337
|
+
}
|
338
|
+
}
|
339
|
+
}
|
340
|
+
}
|
341
|
+
if (latest_pending_subchannel_list_ != nullptr) {
|
342
|
+
for (size_t i = 0; i < latest_pending_subchannel_list_->num_subchannels();
|
343
|
+
++i) {
|
344
|
+
if (latest_pending_subchannel_list_->subchannel(i)->subchannel() !=
|
345
|
+
nullptr) {
|
346
|
+
grpc_core::channelz::SubchannelNode* subchannel_node =
|
347
|
+
grpc_subchannel_get_channelz_node(
|
348
|
+
latest_pending_subchannel_list_->subchannel(i)->subchannel());
|
349
|
+
if (subchannel_node != nullptr) {
|
350
|
+
cs.push_back(subchannel_node->subchannel_uuid());
|
351
|
+
}
|
352
|
+
}
|
353
|
+
}
|
354
|
+
}
|
355
|
+
// atomically update the data that channelz will actually be looking at.
|
356
|
+
mu_guard guard(&child_refs_mu_);
|
357
|
+
child_subchannels_ = std::move(cs);
|
358
|
+
}
|
359
|
+
|
283
360
|
void PickFirst::UpdateLocked(const grpc_channel_args& args) {
|
361
|
+
AutoChildRefsUpdater guard(this);
|
284
362
|
const grpc_arg* arg = grpc_channel_args_find(&args, GRPC_ARG_LB_ADDRESSES);
|
285
363
|
if (arg == nullptr || arg->type != GRPC_ARG_POINTER) {
|
286
364
|
if (subchannel_list_ == nullptr) {
|
@@ -388,6 +466,7 @@ void PickFirst::UpdateLocked(const grpc_channel_args& args) {
|
|
388
466
|
void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
|
389
467
|
grpc_connectivity_state connectivity_state, grpc_error* error) {
|
390
468
|
PickFirst* p = static_cast<PickFirst*>(subchannel_list()->policy());
|
469
|
+
AutoChildRefsUpdater guard(p);
|
391
470
|
// The notification must be for a subchannel in either the current or
|
392
471
|
// latest pending subchannel lists.
|
393
472
|
GPR_ASSERT(subchannel_list() == p->subchannel_list_.get() ||
|
@@ -69,6 +69,9 @@ class RoundRobin : public LoadBalancingPolicy {
|
|
69
69
|
void HandOffPendingPicksLocked(LoadBalancingPolicy* new_policy) override;
|
70
70
|
void PingOneLocked(grpc_closure* on_initiate, grpc_closure* on_ack) override;
|
71
71
|
void ExitIdleLocked() override;
|
72
|
+
// TODO(ncteisen): implement this in a follow up PR
|
73
|
+
void FillChildRefsForChannelz(ChildRefsList* child_subchannels,
|
74
|
+
ChildRefsList* child_channels) override {}
|
72
75
|
|
73
76
|
private:
|
74
77
|
~RoundRobin();
|
@@ -354,11 +357,11 @@ bool RoundRobin::PickLocked(PickState* pick) {
|
|
354
357
|
if (DoPickLocked(pick)) return true;
|
355
358
|
}
|
356
359
|
/* no pick currently available. Save for later in list of pending picks */
|
360
|
+
pick->next = pending_picks_;
|
361
|
+
pending_picks_ = pick;
|
357
362
|
if (!started_picking_) {
|
358
363
|
StartPickingLocked();
|
359
364
|
}
|
360
|
-
pick->next = pending_picks_;
|
361
|
-
pending_picks_ = pick;
|
362
365
|
return false;
|
363
366
|
}
|
364
367
|
|
@@ -153,3 +153,11 @@ grpc_lb_addresses* grpc_lb_addresses_find_channel_arg(
|
|
153
153
|
return nullptr;
|
154
154
|
return static_cast<grpc_lb_addresses*>(lb_addresses_arg->value.pointer.p);
|
155
155
|
}
|
156
|
+
|
157
|
+
bool grpc_lb_addresses_contains_balancer_address(
|
158
|
+
const grpc_lb_addresses& addresses) {
|
159
|
+
for (size_t i = 0; i < addresses.num_addresses; ++i) {
|
160
|
+
if (addresses.addresses[i].is_balancer) return true;
|
161
|
+
}
|
162
|
+
return false;
|
163
|
+
}
|