grpc 1.25.0 → 1.26.0.pre1
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 +782 -291
- data/include/grpc/impl/codegen/grpc_types.h +4 -0
- data/include/grpc/impl/codegen/port_platform.h +7 -0
- data/include/grpc/support/alloc.h +0 -16
- data/src/core/ext/filters/client_channel/backend_metric.cc +2 -2
- data/src/core/ext/filters/client_channel/backup_poller.cc +1 -1
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +2 -2
- data/src/core/ext/filters/client_channel/client_channel.cc +95 -88
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +7 -7
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +4 -2
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +1 -1
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +3 -3
- data/src/core/ext/filters/client_channel/connector.h +40 -45
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +10 -10
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +16 -13
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +66 -37
- data/src/core/ext/filters/client_channel/http_proxy.cc +107 -116
- data/src/core/ext/filters/client_channel/http_proxy.h +5 -1
- data/src/core/ext/filters/client_channel/lb_policy.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy.h +9 -5
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +10 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +18 -19
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +4 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +4 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +6 -9
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +368 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +157 -77
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +5 -5
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +1 -1
- data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +8 -8
- data/src/core/ext/filters/client_channel/proxy_mapper.h +14 -34
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.cc +46 -79
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +23 -17
- data/src/core/ext/filters/client_channel/resolver.cc +2 -1
- data/src/core/ext/filters/client_channel/resolver.h +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +4 -4
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +13 -10
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +3 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +9 -8
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +17 -16
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +4 -4
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +9 -9
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +5 -3
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver_factory.h +3 -3
- data/src/core/ext/filters/client_channel/resolver_registry.cc +14 -12
- data/src/core/ext/filters/client_channel/resolver_registry.h +6 -4
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +6 -6
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +6 -6
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +5 -5
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +3 -3
- data/src/core/ext/filters/client_channel/service_config.cc +15 -14
- data/src/core/ext/filters/client_channel/service_config.h +14 -19
- data/src/core/ext/filters/client_channel/subchannel.cc +38 -36
- data/src/core/ext/filters/client_channel/subchannel.h +11 -12
- data/src/core/ext/filters/client_channel/subchannel_interface.h +1 -1
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +19 -9
- data/src/core/ext/filters/client_channel/xds/xds_api.h +19 -9
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +3 -3
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +6 -5
- data/src/core/ext/filters/client_channel/xds/xds_client.cc +58 -31
- data/src/core/ext/filters/client_channel/xds/xds_client.h +20 -15
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.cc +5 -3
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +18 -15
- data/src/core/ext/filters/client_idle/client_idle_filter.cc +10 -10
- data/src/core/ext/filters/deadline/deadline_filter.cc +15 -13
- data/src/core/ext/filters/http/client/http_client_filter.cc +12 -12
- data/src/core/ext/filters/http/client_authority_filter.cc +3 -3
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +13 -7
- data/src/core/ext/filters/http/server/http_server_filter.cc +14 -13
- data/src/core/ext/filters/max_age/max_age_filter.cc +16 -14
- data/src/core/ext/filters/message_size/message_size_filter.cc +10 -8
- data/src/core/ext/filters/message_size/message_size_filter.h +1 -1
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +9 -8
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +141 -174
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +31 -1
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +7 -6
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +14 -12
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +8 -5
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +46 -38
- data/src/core/ext/transport/chttp2/transport/context_list.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/flow_control.h +0 -5
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +6 -7
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +4 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +11 -8
- data/src/core/ext/transport/chttp2/transport/internal.h +3 -3
- data/src/core/ext/transport/chttp2/transport/parsing.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/writing.cc +3 -2
- data/src/core/ext/transport/inproc/inproc_transport.cc +65 -41
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +141 -70
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +352 -118
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +8 -4
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +65 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +16 -2
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +36 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +12 -5
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +34 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +13 -12
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +28 -24
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +5 -4
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +13 -0
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +23 -23
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +48 -44
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/type/http.upb.c +16 -0
- data/src/core/ext/upb-generated/envoy/type/http.upb.h +36 -0
- data/src/core/ext/upb-generated/envoy/type/percent.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/type/range.upb.c +0 -1
- data/src/core/lib/avl/avl.cc +1 -1
- data/src/core/lib/channel/channel_stack.cc +1 -1
- data/src/core/lib/channel/channel_stack.h +16 -4
- data/src/core/lib/channel/channel_trace.cc +4 -4
- data/src/core/lib/channel/channelz.cc +46 -46
- data/src/core/lib/channel/channelz.h +37 -35
- data/src/core/lib/channel/channelz_registry.cc +2 -2
- data/src/core/lib/channel/channelz_registry.h +1 -1
- data/src/core/lib/channel/connected_channel.cc +3 -2
- data/src/core/lib/channel/handshaker.cc +1 -1
- data/src/core/lib/channel/handshaker_registry.cc +5 -5
- data/src/core/lib/channel/handshaker_registry.h +3 -3
- data/src/core/lib/compression/message_compress.cc +3 -2
- data/src/core/lib/compression/stream_compression_identity.cc +5 -7
- data/src/core/lib/gpr/alloc.cc +4 -29
- data/src/core/lib/gpr/cpu_linux.cc +1 -1
- data/src/core/lib/gprpp/fork.cc +4 -4
- data/src/core/lib/gprpp/global_config_env.cc +7 -7
- data/src/core/lib/gprpp/global_config_env.h +2 -2
- data/src/core/lib/gprpp/host_port.cc +8 -8
- data/src/core/lib/gprpp/host_port.h +3 -3
- data/src/core/lib/gprpp/inlined_vector.h +13 -0
- data/src/core/lib/gprpp/map.h +2 -9
- data/src/core/lib/gprpp/memory.h +12 -98
- data/src/core/lib/gprpp/orphanable.h +3 -3
- data/src/core/lib/gprpp/ref_counted.h +3 -3
- data/src/core/lib/gprpp/ref_counted_ptr.h +1 -1
- data/src/core/lib/gprpp/string_view.h +45 -23
- data/src/core/lib/gprpp/thd.h +1 -1
- data/src/core/lib/gprpp/thd_posix.cc +6 -5
- data/src/core/lib/gprpp/thd_windows.cc +3 -3
- data/src/core/lib/http/httpcli.cc +1 -1
- data/src/core/lib/http/httpcli_security_connector.cc +3 -3
- data/src/core/lib/iomgr/buffer_list.cc +10 -5
- data/src/core/lib/iomgr/call_combiner.cc +7 -6
- data/src/core/lib/iomgr/call_combiner.h +4 -3
- data/src/core/lib/iomgr/cfstream_handle.cc +2 -2
- data/src/core/lib/iomgr/closure.h +33 -135
- data/src/core/lib/iomgr/combiner.cc +10 -17
- data/src/core/lib/iomgr/combiner.h +0 -2
- data/src/core/lib/iomgr/endpoint_cfstream.cc +2 -2
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +1 -1
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +3 -2
- data/src/core/lib/iomgr/ev_epollex_linux.cc +23 -13
- data/src/core/lib/iomgr/ev_poll_posix.cc +30 -17
- data/src/core/lib/iomgr/exec_ctx.cc +52 -5
- data/src/core/lib/iomgr/exec_ctx.h +6 -2
- data/src/core/lib/iomgr/executor.cc +16 -37
- data/src/core/lib/iomgr/executor.h +4 -7
- data/src/core/lib/iomgr/executor/threadpool.cc +4 -4
- data/src/core/lib/iomgr/iomgr_custom.cc +1 -1
- data/src/core/lib/iomgr/lockfree_event.cc +9 -8
- data/src/core/lib/iomgr/logical_thread.cc +103 -0
- data/src/core/lib/iomgr/logical_thread.h +52 -0
- data/src/core/lib/iomgr/pollset_custom.cc +5 -5
- data/src/core/lib/iomgr/pollset_set_custom.cc +9 -9
- data/src/core/lib/iomgr/pollset_windows.cc +16 -2
- data/src/core/lib/iomgr/port.h +3 -0
- data/src/core/lib/iomgr/resolve_address_custom.cc +4 -4
- data/src/core/lib/iomgr/resolve_address_posix.cc +8 -9
- data/src/core/lib/iomgr/resolve_address_windows.cc +4 -6
- data/src/core/lib/iomgr/resource_quota.cc +26 -21
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +11 -0
- data/src/core/lib/iomgr/socket_windows.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_custom.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_posix.cc +5 -4
- data/src/core/lib/iomgr/tcp_client_windows.cc +2 -2
- data/src/core/lib/iomgr/tcp_custom.cc +10 -9
- data/src/core/lib/iomgr/tcp_posix.cc +19 -15
- data/src/core/lib/iomgr/tcp_server_custom.cc +3 -2
- data/src/core/lib/iomgr/tcp_server_posix.cc +5 -4
- data/src/core/lib/iomgr/tcp_server_windows.cc +5 -3
- data/src/core/lib/iomgr/tcp_windows.cc +16 -13
- data/src/core/lib/iomgr/timer_custom.cc +4 -3
- data/src/core/lib/iomgr/timer_generic.cc +11 -9
- data/src/core/lib/iomgr/udp_server.cc +16 -13
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +8 -5
- data/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc +45 -57
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +7 -6
- data/src/core/lib/security/credentials/credentials.cc +8 -8
- data/src/core/lib/security/credentials/credentials.h +5 -5
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +5 -5
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +1 -1
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +4 -4
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +4 -4
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +2 -2
- data/src/core/lib/security/credentials/local/local_credentials.cc +3 -3
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +13 -11
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +6 -5
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +4 -4
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +5 -5
- data/src/core/lib/security/credentials/tls/spiffe_credentials.cc +2 -2
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +28 -22
- data/src/core/lib/security/security_connector/alts/alts_security_connector.h +5 -0
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +10 -10
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +2 -1
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +8 -8
- data/src/core/lib/security/security_connector/security_connector.h +1 -1
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +9 -9
- data/src/core/lib/security/security_connector/ssl_utils.cc +5 -4
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc +14 -15
- data/src/core/lib/security/transport/client_auth_filter.cc +4 -3
- data/src/core/lib/security/transport/secure_endpoint.cc +9 -8
- data/src/core/lib/security/transport/security_handshaker.cc +67 -23
- data/src/core/lib/security/transport/server_auth_filter.cc +6 -5
- data/src/core/lib/security/transport/target_authority_table.h +1 -1
- data/src/core/lib/slice/b64.cc +3 -4
- data/src/core/lib/slice/b64.h +1 -2
- data/src/core/lib/slice/slice.cc +8 -13
- data/src/core/lib/surface/call.cc +19 -19
- data/src/core/lib/surface/call.h +6 -7
- data/src/core/lib/surface/call_log_batch.cc +1 -2
- data/src/core/lib/surface/channel.cc +17 -18
- data/src/core/lib/surface/channel.h +4 -19
- data/src/core/lib/surface/channel_ping.cc +1 -1
- data/src/core/lib/surface/completion_queue.cc +21 -22
- data/src/core/lib/surface/completion_queue_factory.cc +1 -1
- data/src/core/lib/surface/init.cc +1 -1
- data/src/core/lib/surface/init_secure.cc +2 -2
- data/src/core/lib/surface/lame_client.cc +10 -12
- data/src/core/lib/surface/server.cc +24 -18
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/byte_stream.cc +2 -2
- data/src/core/lib/transport/byte_stream.h +2 -1
- data/src/core/lib/transport/connectivity_state.cc +4 -4
- data/src/core/lib/transport/connectivity_state.h +2 -2
- data/src/core/lib/transport/metadata.cc +8 -10
- data/src/core/lib/transport/metadata.h +5 -8
- data/src/core/lib/transport/metadata_batch.cc +6 -0
- data/src/core/lib/transport/static_metadata.cc +2 -4
- data/src/core/lib/transport/status_metadata.cc +7 -0
- data/src/core/lib/transport/status_metadata.h +18 -0
- data/src/core/lib/transport/transport.cc +9 -7
- data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +292 -43
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +197 -46
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +4 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +5 -0
- data/src/core/tsi/ssl/session_cache/ssl_session.h +1 -1
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -1
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +4 -4
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +1 -1
- data/src/core/tsi/ssl_transport_security.cc +2 -1
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +0 -4
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +0 -6
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/upb/upb/decode.c +1 -0
- metadata +34 -32
- data/src/core/ext/filters/client_channel/connector.cc +0 -41
- data/src/core/ext/filters/client_channel/proxy_mapper.cc +0 -48
- data/src/core/lib/gprpp/set.h +0 -33
@@ -43,8 +43,7 @@
|
|
43
43
|
// For debugging refcounting.
|
44
44
|
#ifndef NDEBUG
|
45
45
|
#define GRPC_SUBCHANNEL_REF(p, r) (p)->Ref(__FILE__, __LINE__, (r))
|
46
|
-
#define GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(p, r)
|
47
|
-
(p)->RefFromWeakRef(__FILE__, __LINE__, (r))
|
46
|
+
#define GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(p, r) (p)->RefFromWeakRef()
|
48
47
|
#define GRPC_SUBCHANNEL_UNREF(p, r) (p)->Unref(__FILE__, __LINE__, (r))
|
49
48
|
#define GRPC_SUBCHANNEL_WEAK_REF(p, r) (p)->WeakRef(__FILE__, __LINE__, (r))
|
50
49
|
#define GRPC_SUBCHANNEL_WEAK_UNREF(p, r) (p)->WeakUnref(__FILE__, __LINE__, (r))
|
@@ -198,12 +197,12 @@ class Subchannel {
|
|
198
197
|
};
|
199
198
|
|
200
199
|
// The ctor and dtor are not intended to use directly.
|
201
|
-
Subchannel(SubchannelKey* key,
|
200
|
+
Subchannel(SubchannelKey* key, OrphanablePtr<SubchannelConnector> connector,
|
202
201
|
const grpc_channel_args* args);
|
203
202
|
~Subchannel();
|
204
203
|
|
205
204
|
// Creates a subchannel given \a connector and \a args.
|
206
|
-
static Subchannel* Create(
|
205
|
+
static Subchannel* Create(OrphanablePtr<SubchannelConnector> connector,
|
207
206
|
const grpc_channel_args* args);
|
208
207
|
|
209
208
|
// Strong and weak refcounting.
|
@@ -214,7 +213,7 @@ class Subchannel {
|
|
214
213
|
// Attempts to return a strong ref when only the weak refcount is guaranteed
|
215
214
|
// non-zero. If the strong refcount is zero, does not alter the refcount and
|
216
215
|
// returns null.
|
217
|
-
Subchannel* RefFromWeakRef(
|
216
|
+
Subchannel* RefFromWeakRef();
|
218
217
|
|
219
218
|
// Gets the string representing the subchannel address.
|
220
219
|
// Caller doesn't take ownership.
|
@@ -243,7 +242,7 @@ class Subchannel {
|
|
243
242
|
// destroyed or when CancelConnectivityStateWatch() is called.
|
244
243
|
void WatchConnectivityState(
|
245
244
|
grpc_connectivity_state initial_state,
|
246
|
-
UniquePtr<char> health_check_service_name,
|
245
|
+
grpc_core::UniquePtr<char> health_check_service_name,
|
247
246
|
OrphanablePtr<ConnectivityStateWatcherInterface> watcher);
|
248
247
|
|
249
248
|
// Cancels a connectivity state watch.
|
@@ -294,8 +293,8 @@ class Subchannel {
|
|
294
293
|
private:
|
295
294
|
// TODO(roth): Once we can use C++-14 heterogeneous lookups, this can
|
296
295
|
// be a set instead of a map.
|
297
|
-
|
298
|
-
|
296
|
+
std::map<ConnectivityStateWatcherInterface*,
|
297
|
+
OrphanablePtr<ConnectivityStateWatcherInterface>>
|
299
298
|
watchers_;
|
300
299
|
};
|
301
300
|
|
@@ -312,7 +311,7 @@ class Subchannel {
|
|
312
311
|
public:
|
313
312
|
void AddWatcherLocked(
|
314
313
|
Subchannel* subchannel, grpc_connectivity_state initial_state,
|
315
|
-
UniquePtr<char> health_check_service_name,
|
314
|
+
grpc_core::UniquePtr<char> health_check_service_name,
|
316
315
|
OrphanablePtr<ConnectivityStateWatcherInterface> watcher);
|
317
316
|
void RemoveWatcherLocked(const char* health_check_service_name,
|
318
317
|
ConnectivityStateWatcherInterface* watcher);
|
@@ -328,7 +327,7 @@ class Subchannel {
|
|
328
327
|
private:
|
329
328
|
class HealthWatcher;
|
330
329
|
|
331
|
-
|
330
|
+
std::map<const char*, OrphanablePtr<HealthWatcher>, StringLess> map_;
|
332
331
|
};
|
333
332
|
|
334
333
|
class ConnectedSubchannelStateWatcher;
|
@@ -366,9 +365,9 @@ class Subchannel {
|
|
366
365
|
gpr_atm ref_pair_;
|
367
366
|
|
368
367
|
// Connection states.
|
369
|
-
|
368
|
+
OrphanablePtr<SubchannelConnector> connector_;
|
370
369
|
// Set during connection.
|
371
|
-
|
370
|
+
SubchannelConnector::Result connecting_result_;
|
372
371
|
grpc_closure on_connecting_finished_;
|
373
372
|
// Active connection, or null.
|
374
373
|
RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
|
@@ -66,7 +66,7 @@ class SubchannelInterface : public RefCounted<SubchannelInterface> {
|
|
66
66
|
// the previous watcher using CancelConnectivityStateWatch().
|
67
67
|
virtual void WatchConnectivityState(
|
68
68
|
grpc_connectivity_state initial_state,
|
69
|
-
|
69
|
+
std::unique_ptr<ConnectivityStateWatcherInterface> watcher) = 0;
|
70
70
|
|
71
71
|
// Cancels a connectivity state watch.
|
72
72
|
// If the watcher has already been destroyed, this is a no-op.
|
@@ -30,6 +30,7 @@
|
|
30
30
|
|
31
31
|
#include "envoy/api/v2/core/address.upb.h"
|
32
32
|
#include "envoy/api/v2/core/base.upb.h"
|
33
|
+
#include "envoy/api/v2/core/health_check.upb.h"
|
33
34
|
#include "envoy/api/v2/discovery.upb.h"
|
34
35
|
#include "envoy/api/v2/eds.upb.h"
|
35
36
|
#include "envoy/api/v2/endpoint/endpoint.upb.h"
|
@@ -87,7 +88,8 @@ bool XdsPriorityListUpdate::Contains(
|
|
87
88
|
return false;
|
88
89
|
}
|
89
90
|
|
90
|
-
bool XdsDropConfig::ShouldDrop(
|
91
|
+
bool XdsDropConfig::ShouldDrop(
|
92
|
+
const grpc_core::UniquePtr<char>** category_name) const {
|
91
93
|
for (size_t i = 0; i < drop_category_list_.size(); ++i) {
|
92
94
|
const auto& drop_category = drop_category_list_[i];
|
93
95
|
// Generate a random number in [0, 1000000).
|
@@ -113,9 +115,9 @@ void PopulateListValue(upb_arena* arena, google_protobuf_ListValue* list_value,
|
|
113
115
|
}
|
114
116
|
}
|
115
117
|
|
116
|
-
void PopulateMetadata(
|
117
|
-
|
118
|
-
|
118
|
+
void PopulateMetadata(upb_arena* arena, google_protobuf_Struct* metadata_pb,
|
119
|
+
const std::map<const char*, XdsBootstrap::MetadataValue,
|
120
|
+
StringLess>& metadata) {
|
119
121
|
for (const auto& p : metadata) {
|
120
122
|
google_protobuf_Struct_FieldsEntry* field =
|
121
123
|
google_protobuf_Struct_add_fields(metadata_pb, arena);
|
@@ -223,6 +225,13 @@ namespace {
|
|
223
225
|
grpc_error* ServerAddressParseAndAppend(
|
224
226
|
const envoy_api_v2_endpoint_LbEndpoint* lb_endpoint,
|
225
227
|
ServerAddressList* list) {
|
228
|
+
// If health_status is not HEALTHY or UNKNOWN, skip this endpoint.
|
229
|
+
const int32_t health_status =
|
230
|
+
envoy_api_v2_endpoint_LbEndpoint_health_status(lb_endpoint);
|
231
|
+
if (health_status != envoy_api_v2_core_UNKNOWN &&
|
232
|
+
health_status != envoy_api_v2_core_HEALTHY) {
|
233
|
+
return GRPC_ERROR_NONE;
|
234
|
+
}
|
226
235
|
// Find the ip:port.
|
227
236
|
const envoy_api_v2_endpoint_Endpoint* endpoint =
|
228
237
|
envoy_api_v2_endpoint_LbEndpoint_endpoint(lb_endpoint);
|
@@ -250,11 +259,11 @@ grpc_error* ServerAddressParseAndAppend(
|
|
250
259
|
|
251
260
|
namespace {
|
252
261
|
|
253
|
-
UniquePtr<char> StringCopy(const upb_strview& strview) {
|
262
|
+
grpc_core::UniquePtr<char> StringCopy(const upb_strview& strview) {
|
254
263
|
char* str = static_cast<char*>(gpr_malloc(strview.size + 1));
|
255
264
|
memcpy(str, strview.data, strview.size);
|
256
265
|
str[strview.size] = '\0';
|
257
|
-
return UniquePtr<char>(str);
|
266
|
+
return grpc_core::UniquePtr<char>(str);
|
258
267
|
}
|
259
268
|
|
260
269
|
} // namespace
|
@@ -533,9 +542,10 @@ grpc_slice XdsLrsRequestCreateAndEncode(const char* server_name,
|
|
533
542
|
return LrsRequestEncode(request, arena.ptr());
|
534
543
|
}
|
535
544
|
|
536
|
-
grpc_error* XdsLrsResponseDecodeAndParse(
|
537
|
-
|
538
|
-
|
545
|
+
grpc_error* XdsLrsResponseDecodeAndParse(
|
546
|
+
const grpc_slice& encoded_response,
|
547
|
+
grpc_core::UniquePtr<char>* cluster_name,
|
548
|
+
grpc_millis* load_reporting_interval) {
|
539
549
|
upb::Arena arena;
|
540
550
|
// Decode the response.
|
541
551
|
const envoy_service_load_stats_v2_LoadStatsResponse* decoded_response =
|
@@ -59,7 +59,7 @@ class XdsPriorityListUpdate {
|
|
59
59
|
|
60
60
|
size_t size() const { return localities.size(); }
|
61
61
|
|
62
|
-
|
62
|
+
std::map<RefCountedPtr<XdsLocalityName>, Locality, XdsLocalityName::Less>
|
63
63
|
localities;
|
64
64
|
};
|
65
65
|
|
@@ -101,19 +101,20 @@ class XdsDropConfig : public RefCounted<XdsDropConfig> {
|
|
101
101
|
parts_per_million == other.parts_per_million;
|
102
102
|
}
|
103
103
|
|
104
|
-
UniquePtr<char> name;
|
104
|
+
grpc_core::UniquePtr<char> name;
|
105
105
|
const uint32_t parts_per_million;
|
106
106
|
};
|
107
107
|
|
108
108
|
using DropCategoryList = InlinedVector<DropCategory, 2>;
|
109
109
|
|
110
|
-
void AddCategory(UniquePtr<char> name,
|
110
|
+
void AddCategory(grpc_core::UniquePtr<char> name,
|
111
|
+
uint32_t parts_per_million) {
|
111
112
|
drop_category_list_.emplace_back(
|
112
113
|
DropCategory{std::move(name), parts_per_million});
|
113
114
|
}
|
114
115
|
|
115
116
|
// The only method invoked from the data plane combiner.
|
116
|
-
bool ShouldDrop(const UniquePtr<char>** category_name) const;
|
117
|
+
bool ShouldDrop(const grpc_core::UniquePtr<char>** category_name) const;
|
117
118
|
|
118
119
|
const DropCategoryList& drop_category_list() const {
|
119
120
|
return drop_category_list_;
|
@@ -136,8 +137,16 @@ struct EdsUpdate {
|
|
136
137
|
bool drop_all = false;
|
137
138
|
};
|
138
139
|
|
139
|
-
|
140
|
-
|
140
|
+
struct CdsUpdate {
|
141
|
+
// The name to use in the EDS request.
|
142
|
+
// If null, the cluster name will be used.
|
143
|
+
grpc_core::UniquePtr<char> eds_service_name;
|
144
|
+
// The LRS server to use for load reporting.
|
145
|
+
// If null, load reporting will be disabled.
|
146
|
+
// If set to the empty string, will use the same server we obtained
|
147
|
+
// the CDS data from.
|
148
|
+
grpc_core::UniquePtr<char> lrs_load_reporting_server_name;
|
149
|
+
};
|
141
150
|
|
142
151
|
// Creates an EDS request querying \a service_name.
|
143
152
|
grpc_slice XdsEdsRequestCreateAndEncode(const char* server_name,
|
@@ -162,9 +171,10 @@ grpc_slice XdsLrsRequestCreateAndEncode(const char* server_name,
|
|
162
171
|
// Parses the LRS response and returns \a cluster_name and \a
|
163
172
|
// load_reporting_interval for client-side load reporting. If there is any
|
164
173
|
// error, the output config is invalid.
|
165
|
-
grpc_error* XdsLrsResponseDecodeAndParse(
|
166
|
-
|
167
|
-
|
174
|
+
grpc_error* XdsLrsResponseDecodeAndParse(
|
175
|
+
const grpc_slice& encoded_response,
|
176
|
+
grpc_core::UniquePtr<char>* cluster_name,
|
177
|
+
grpc_millis* load_reporting_interval);
|
168
178
|
|
169
179
|
} // namespace grpc_core
|
170
180
|
|
@@ -29,8 +29,8 @@
|
|
29
29
|
|
30
30
|
namespace grpc_core {
|
31
31
|
|
32
|
-
|
33
|
-
UniquePtr<char> path(gpr_getenv("GRPC_XDS_BOOTSTRAP"));
|
32
|
+
std::unique_ptr<XdsBootstrap> XdsBootstrap::ReadFromFile(grpc_error** error) {
|
33
|
+
grpc_core::UniquePtr<char> path(gpr_getenv("GRPC_XDS_BOOTSTRAP"));
|
34
34
|
if (path == nullptr) {
|
35
35
|
*error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
36
36
|
"GRPC_XDS_BOOTSTRAP env var not set");
|
@@ -320,7 +320,7 @@ grpc_error* XdsBootstrap::ParseLocality(grpc_json* json) {
|
|
320
320
|
|
321
321
|
InlinedVector<grpc_error*, 1> XdsBootstrap::ParseMetadataStruct(
|
322
322
|
grpc_json* json,
|
323
|
-
|
323
|
+
std::map<const char*, XdsBootstrap::MetadataValue, StringLess>* result) {
|
324
324
|
InlinedVector<grpc_error*, 1> error_list;
|
325
325
|
for (grpc_json* child = json->child; child != nullptr; child = child->next) {
|
326
326
|
if (child->key == nullptr) {
|
@@ -40,7 +40,7 @@ class XdsBootstrap {
|
|
40
40
|
double double_value;
|
41
41
|
const char* string_value;
|
42
42
|
bool bool_value;
|
43
|
-
|
43
|
+
std::map<const char*, MetadataValue, StringLess> struct_value;
|
44
44
|
std::vector<MetadataValue> list_value;
|
45
45
|
};
|
46
46
|
|
@@ -50,7 +50,7 @@ class XdsBootstrap {
|
|
50
50
|
const char* locality_region = nullptr;
|
51
51
|
const char* locality_zone = nullptr;
|
52
52
|
const char* locality_subzone = nullptr;
|
53
|
-
|
53
|
+
std::map<const char*, MetadataValue, StringLess> metadata;
|
54
54
|
};
|
55
55
|
|
56
56
|
struct ChannelCreds {
|
@@ -60,7 +60,7 @@ class XdsBootstrap {
|
|
60
60
|
|
61
61
|
// If *error is not GRPC_ERROR_NONE after returning, then there was an
|
62
62
|
// error reading the file.
|
63
|
-
static
|
63
|
+
static std::unique_ptr<XdsBootstrap> ReadFromFile(grpc_error** error);
|
64
64
|
|
65
65
|
// Do not instantiate directly -- use ReadFromFile() above instead.
|
66
66
|
XdsBootstrap(grpc_slice contents, grpc_error** error);
|
@@ -80,7 +80,8 @@ class XdsBootstrap {
|
|
80
80
|
grpc_error* ParseLocality(grpc_json* json);
|
81
81
|
|
82
82
|
InlinedVector<grpc_error*, 1> ParseMetadataStruct(
|
83
|
-
grpc_json* json,
|
83
|
+
grpc_json* json,
|
84
|
+
std::map<const char*, MetadataValue, StringLess>* result);
|
84
85
|
InlinedVector<grpc_error*, 1> ParseMetadataList(
|
85
86
|
grpc_json* json, std::vector<MetadataValue>* result);
|
86
87
|
grpc_error* ParseMetadataValue(grpc_json* json, size_t idx,
|
@@ -91,7 +92,7 @@ class XdsBootstrap {
|
|
91
92
|
|
92
93
|
const char* server_uri_ = nullptr;
|
93
94
|
InlinedVector<ChannelCreds, 1> channel_creds_;
|
94
|
-
|
95
|
+
std::unique_ptr<Node> node_;
|
95
96
|
};
|
96
97
|
|
97
98
|
} // namespace grpc_core
|
@@ -244,7 +244,7 @@ class XdsClient::ChannelState::LrsCallState
|
|
244
244
|
grpc_closure on_status_received_;
|
245
245
|
|
246
246
|
// Load reporting state.
|
247
|
-
UniquePtr<char> cluster_name_;
|
247
|
+
grpc_core::UniquePtr<char> cluster_name_;
|
248
248
|
grpc_millis load_reporting_interval_ = 0;
|
249
249
|
OrphanablePtr<Reporter> reporter_;
|
250
250
|
};
|
@@ -378,16 +378,16 @@ bool XdsClient::ChannelState::HasActiveAdsCall() const {
|
|
378
378
|
|
379
379
|
void XdsClient::ChannelState::MaybeStartAdsCall() {
|
380
380
|
if (ads_calld_ != nullptr) return;
|
381
|
-
ads_calld_.reset(
|
382
|
-
Ref(DEBUG_LOCATION, "ChannelState+ads")));
|
381
|
+
ads_calld_.reset(
|
382
|
+
new RetryableCall<AdsCallState>(Ref(DEBUG_LOCATION, "ChannelState+ads")));
|
383
383
|
}
|
384
384
|
|
385
385
|
void XdsClient::ChannelState::StopAdsCall() { ads_calld_.reset(); }
|
386
386
|
|
387
387
|
void XdsClient::ChannelState::MaybeStartLrsCall() {
|
388
388
|
if (lrs_calld_ != nullptr) return;
|
389
|
-
lrs_calld_.reset(
|
390
|
-
Ref(DEBUG_LOCATION, "ChannelState+lrs")));
|
389
|
+
lrs_calld_.reset(
|
390
|
+
new RetryableCall<LrsCallState>(Ref(DEBUG_LOCATION, "ChannelState+lrs")));
|
391
391
|
}
|
392
392
|
|
393
393
|
void XdsClient::ChannelState::StopLrsCall() { lrs_calld_.reset(); }
|
@@ -396,7 +396,7 @@ void XdsClient::ChannelState::StartConnectivityWatchLocked() {
|
|
396
396
|
grpc_channel_element* client_channel_elem =
|
397
397
|
grpc_channel_stack_last_element(grpc_channel_get_channel_stack(channel_));
|
398
398
|
GPR_ASSERT(client_channel_elem->filter == &grpc_client_channel_filter);
|
399
|
-
watcher_ =
|
399
|
+
watcher_ = new StateWatcher(Ref());
|
400
400
|
grpc_client_channel_start_connectivity_watch(
|
401
401
|
client_channel_elem, GRPC_CHANNEL_IDLE,
|
402
402
|
OrphanablePtr<AsyncConnectivityStateWatcherInterface>(watcher_));
|
@@ -639,7 +639,7 @@ void XdsClient::ChannelState::AdsCallState::OnResponseReceived(
|
|
639
639
|
}
|
640
640
|
|
641
641
|
void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked(
|
642
|
-
void* arg, grpc_error* error) {
|
642
|
+
void* arg, grpc_error* /*error*/) {
|
643
643
|
AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
|
644
644
|
XdsClient* xds_client = ads_calld->xds_client();
|
645
645
|
// Empty payload means the call was cancelled.
|
@@ -736,8 +736,11 @@ void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked(
|
|
736
736
|
}
|
737
737
|
}
|
738
738
|
// Start load reporting if needed.
|
739
|
-
|
740
|
-
if (
|
739
|
+
auto& lrs_call = ads_calld->chand()->lrs_calld_;
|
740
|
+
if (lrs_call != nullptr) {
|
741
|
+
LrsCallState* lrs_calld = lrs_call->calld();
|
742
|
+
if (lrs_calld != nullptr) lrs_calld->MaybeStartReportingLocked();
|
743
|
+
}
|
741
744
|
// Ignore identical update.
|
742
745
|
const EdsUpdate& prev_update = xds_client->cluster_state_.eds_update;
|
743
746
|
const bool priority_list_changed =
|
@@ -1083,7 +1086,7 @@ void XdsClient::ChannelState::LrsCallState::OnInitialRequestSent(
|
|
1083
1086
|
}
|
1084
1087
|
|
1085
1088
|
void XdsClient::ChannelState::LrsCallState::OnInitialRequestSentLocked(
|
1086
|
-
void* arg, grpc_error* error) {
|
1089
|
+
void* arg, grpc_error* /*error*/) {
|
1087
1090
|
LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
|
1088
1091
|
// Clear the send_message_payload_.
|
1089
1092
|
grpc_byte_buffer_destroy(lrs_calld->send_message_payload_);
|
@@ -1102,7 +1105,7 @@ void XdsClient::ChannelState::LrsCallState::OnResponseReceived(
|
|
1102
1105
|
}
|
1103
1106
|
|
1104
1107
|
void XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked(
|
1105
|
-
void* arg, grpc_error* error) {
|
1108
|
+
void* arg, grpc_error* /*error*/) {
|
1106
1109
|
LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
|
1107
1110
|
XdsClient* xds_client = lrs_calld->xds_client();
|
1108
1111
|
// Empty payload means the call was cancelled.
|
@@ -1121,7 +1124,7 @@ void XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked(
|
|
1121
1124
|
// This anonymous lambda is a hack to avoid the usage of goto.
|
1122
1125
|
[&]() {
|
1123
1126
|
// Parse the response.
|
1124
|
-
UniquePtr<char> new_cluster_name;
|
1127
|
+
grpc_core::UniquePtr<char> new_cluster_name;
|
1125
1128
|
grpc_millis new_load_reporting_interval;
|
1126
1129
|
grpc_error* parse_error = XdsLrsResponseDecodeAndParse(
|
1127
1130
|
response_slice, &new_cluster_name, &new_load_reporting_interval);
|
@@ -1237,24 +1240,24 @@ bool XdsClient::ChannelState::LrsCallState::IsCurrentCallOnChannel() const {
|
|
1237
1240
|
|
1238
1241
|
namespace {
|
1239
1242
|
|
1240
|
-
UniquePtr<char> GenerateBuildVersionString() {
|
1243
|
+
grpc_core::UniquePtr<char> GenerateBuildVersionString() {
|
1241
1244
|
char* build_version_str;
|
1242
1245
|
gpr_asprintf(&build_version_str, "gRPC C-core %s %s", grpc_version_string(),
|
1243
1246
|
GPR_PLATFORM_STRING);
|
1244
|
-
return UniquePtr<char>(build_version_str);
|
1247
|
+
return grpc_core::UniquePtr<char>(build_version_str);
|
1245
1248
|
}
|
1246
1249
|
|
1247
1250
|
} // namespace
|
1248
1251
|
|
1249
1252
|
XdsClient::XdsClient(Combiner* combiner, grpc_pollset_set* interested_parties,
|
1250
1253
|
StringView server_name,
|
1251
|
-
|
1254
|
+
std::unique_ptr<ServiceConfigWatcherInterface> watcher,
|
1252
1255
|
const grpc_channel_args& channel_args, grpc_error** error)
|
1253
1256
|
: build_version_(GenerateBuildVersionString()),
|
1254
1257
|
combiner_(GRPC_COMBINER_REF(combiner, "xds_client")),
|
1255
1258
|
interested_parties_(interested_parties),
|
1256
1259
|
bootstrap_(XdsBootstrap::ReadFromFile(error)),
|
1257
|
-
server_name_(server_name
|
1260
|
+
server_name_(StringViewToCString(server_name)),
|
1258
1261
|
service_config_watcher_(std::move(watcher)) {
|
1259
1262
|
if (*error != GRPC_ERROR_NONE) {
|
1260
1263
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
@@ -1286,18 +1289,31 @@ void XdsClient::Orphan() {
|
|
1286
1289
|
Unref(DEBUG_LOCATION, "XdsClient::Orphan()");
|
1287
1290
|
}
|
1288
1291
|
|
1289
|
-
void XdsClient::WatchClusterData(
|
1290
|
-
|
1291
|
-
|
1292
|
+
void XdsClient::WatchClusterData(
|
1293
|
+
StringView cluster, std::unique_ptr<ClusterWatcherInterface> watcher) {
|
1294
|
+
ClusterWatcherInterface* w = watcher.get();
|
1295
|
+
cluster_state_.cluster_watchers[w] = std::move(watcher);
|
1296
|
+
// TODO(juanlishen): Start CDS call if not already started and return
|
1297
|
+
// real data via watcher.
|
1298
|
+
CdsUpdate update;
|
1299
|
+
update.eds_service_name = StringViewToCString(cluster);
|
1300
|
+
update.lrs_load_reporting_server_name.reset(gpr_strdup(""));
|
1301
|
+
w->OnClusterChanged(std::move(update));
|
1292
1302
|
}
|
1293
1303
|
|
1294
1304
|
void XdsClient::CancelClusterDataWatch(StringView cluster,
|
1295
1305
|
ClusterWatcherInterface* watcher) {
|
1296
|
-
|
1306
|
+
auto it = cluster_state_.cluster_watchers.find(watcher);
|
1307
|
+
if (it != cluster_state_.cluster_watchers.end()) {
|
1308
|
+
cluster_state_.cluster_watchers.erase(it);
|
1309
|
+
}
|
1310
|
+
if (chand_ != nullptr && cluster_state_.cluster_watchers.empty()) {
|
1311
|
+
// TODO(juanlishen): Stop CDS call.
|
1312
|
+
}
|
1297
1313
|
}
|
1298
1314
|
|
1299
|
-
void XdsClient::WatchEndpointData(
|
1300
|
-
|
1315
|
+
void XdsClient::WatchEndpointData(
|
1316
|
+
StringView /*cluster*/, std::unique_ptr<EndpointWatcherInterface> watcher) {
|
1301
1317
|
EndpointWatcherInterface* w = watcher.get();
|
1302
1318
|
cluster_state_.endpoint_watchers[w] = std::move(watcher);
|
1303
1319
|
// If we've already received an EDS update, notify the new watcher
|
@@ -1308,7 +1324,7 @@ void XdsClient::WatchEndpointData(StringView cluster,
|
|
1308
1324
|
chand_->MaybeStartAdsCall();
|
1309
1325
|
}
|
1310
1326
|
|
1311
|
-
void XdsClient::CancelEndpointDataWatch(StringView cluster
|
1327
|
+
void XdsClient::CancelEndpointDataWatch(StringView /*cluster*/,
|
1312
1328
|
EndpointWatcherInterface* watcher) {
|
1313
1329
|
auto it = cluster_state_.endpoint_watchers.find(watcher);
|
1314
1330
|
if (it != cluster_state_.endpoint_watchers.end()) {
|
@@ -1319,14 +1335,20 @@ void XdsClient::CancelEndpointDataWatch(StringView cluster,
|
|
1319
1335
|
}
|
1320
1336
|
}
|
1321
1337
|
|
1322
|
-
void XdsClient::AddClientStats(StringView
|
1338
|
+
void XdsClient::AddClientStats(StringView /*lrs_server*/,
|
1339
|
+
StringView /*cluster*/,
|
1323
1340
|
XdsClientStats* client_stats) {
|
1341
|
+
// TODO(roth): When we add support for direct federation, use the
|
1342
|
+
// server name specified in lrs_server.
|
1324
1343
|
cluster_state_.client_stats.insert(client_stats);
|
1325
1344
|
chand_->MaybeStartLrsCall();
|
1326
1345
|
}
|
1327
1346
|
|
1328
|
-
void XdsClient::RemoveClientStats(StringView
|
1347
|
+
void XdsClient::RemoveClientStats(StringView /*lrs_server*/,
|
1348
|
+
StringView /*cluster*/,
|
1329
1349
|
XdsClientStats* client_stats) {
|
1350
|
+
// TODO(roth): When we add support for direct federation, use the
|
1351
|
+
// server name specified in lrs_server.
|
1330
1352
|
// TODO(roth): In principle, we should try to send a final load report
|
1331
1353
|
// containing whatever final stats have been accumulated since the
|
1332
1354
|
// last load report.
|
@@ -1362,14 +1384,19 @@ void XdsClient::NotifyOnServiceConfig(void* arg, grpc_error* error) {
|
|
1362
1384
|
XdsClient* self = static_cast<XdsClient*>(arg);
|
1363
1385
|
// TODO(roth): When we add support for WeightedClusters, select the
|
1364
1386
|
// LB policy based on that functionality.
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
"
|
1387
|
+
char* json;
|
1388
|
+
gpr_asprintf(&json,
|
1389
|
+
"{\n"
|
1390
|
+
" \"loadBalancingConfig\":[\n"
|
1391
|
+
" { \"cds_experimental\":{\n"
|
1392
|
+
" \"cluster\": \"%s\"\n"
|
1393
|
+
" } }\n"
|
1394
|
+
" ]\n"
|
1395
|
+
"}",
|
1396
|
+
self->server_name_.get());
|
1371
1397
|
RefCountedPtr<ServiceConfig> service_config =
|
1372
1398
|
ServiceConfig::Create(json, &error);
|
1399
|
+
gpr_free(json);
|
1373
1400
|
if (error != GRPC_ERROR_NONE) {
|
1374
1401
|
self->service_config_watcher_->OnError(error);
|
1375
1402
|
} else {
|