grpc 1.18.0 → 1.22.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 +4731 -7404
- data/etc/roots.pem +146 -0
- data/include/grpc/grpc.h +11 -6
- data/include/grpc/grpc_security.h +297 -4
- data/include/grpc/grpc_security_constants.h +1 -1
- data/include/grpc/impl/codegen/byte_buffer.h +13 -0
- data/include/grpc/impl/codegen/gpr_types.h +1 -1
- data/include/grpc/impl/codegen/grpc_types.h +30 -7
- data/include/grpc/impl/codegen/port_platform.h +88 -7
- data/include/grpc/impl/codegen/slice.h +2 -22
- data/include/grpc/impl/codegen/status.h +2 -1
- data/include/grpc/impl/codegen/sync_posix.h +18 -0
- data/include/grpc/slice.h +3 -3
- data/src/core/ext/filters/client_channel/backup_poller.cc +21 -16
- data/src/core/ext/filters/client_channel/backup_poller.h +8 -2
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +3 -1
- data/src/core/ext/filters/client_channel/client_channel.cc +2435 -1557
- data/src/core/ext/filters/client_channel/client_channel.h +2 -10
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +6 -89
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +8 -33
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +22 -34
- data/src/core/ext/filters/client_channel/client_channel_factory.h +19 -38
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +9 -11
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +179 -0
- data/src/core/ext/filters/client_channel/global_subchannel_pool.h +68 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +59 -55
- data/src/core/ext/filters/client_channel/health/health_check_client.h +20 -9
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +146 -157
- data/src/core/ext/filters/client_channel/http_connect_handshaker.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +29 -32
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +844 -859
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +3 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +2 -6
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +6 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +14 -12
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +16 -12
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +185 -312
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +143 -375
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +192 -245
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +1554 -955
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc +0 -43
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc +14 -10
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +2 -2
- data/src/core/ext/filters/client_channel/lb_policy.cc +115 -22
- data/src/core/ext/filters/client_channel/lb_policy.h +260 -129
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +5 -2
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +107 -4
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +10 -3
- data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +96 -0
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +56 -0
- data/src/core/ext/filters/client_channel/parse_address.cc +24 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +121 -122
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +84 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +3 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +179 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +24 -10
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +111 -47
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +7 -13
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc +39 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc +0 -6
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +2 -64
- data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc +28 -0
- data/src/core/{lib/iomgr/network_status_tracker.cc → ext/filters/client_channel/resolver/dns/dns_resolver_selection.h} +8 -15
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +36 -82
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +111 -72
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +13 -8
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +28 -63
- data/src/core/ext/filters/client_channel/resolver.cc +54 -1
- data/src/core/ext/filters/client_channel/resolver.h +52 -23
- data/src/core/ext/filters/client_channel/resolver_factory.h +3 -1
- data/src/core/ext/filters/client_channel/resolver_registry.cc +5 -2
- data/src/core/ext/filters/client_channel/resolver_registry.h +5 -4
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +368 -241
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +58 -76
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +543 -0
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +139 -0
- data/src/core/ext/filters/client_channel/server_address.cc +4 -54
- data/src/core/ext/filters/client_channel/server_address.h +1 -13
- data/src/core/ext/filters/client_channel/service_config.cc +329 -0
- data/src/core/ext/filters/client_channel/service_config.h +205 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +803 -838
- data/src/core/ext/filters/client_channel/subchannel.h +295 -128
- data/src/core/ext/filters/client_channel/subchannel_interface.h +113 -0
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +97 -0
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +94 -0
- data/src/core/ext/filters/deadline/deadline_filter.cc +3 -4
- data/src/core/ext/filters/deadline/deadline_filter.h +3 -2
- data/src/core/ext/filters/http/client/http_client_filter.cc +7 -5
- data/src/core/ext/filters/http/client/http_client_filter.h +1 -1
- data/src/core/ext/filters/http/client_authority_filter.cc +6 -3
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +4 -3
- data/src/core/ext/filters/http/server/http_server_filter.cc +18 -12
- data/src/core/ext/filters/max_age/max_age_filter.cc +5 -2
- data/src/core/ext/filters/message_size/message_size_filter.cc +119 -77
- data/src/core/ext/filters/message_size/message_size_filter.h +33 -0
- data/src/core/ext/transport/chttp2/alpn/alpn.h +1 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +13 -12
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +45 -47
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +134 -143
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +68 -21
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +4 -4
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +7 -6
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +4 -3
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +9 -7
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +156 -94
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +33 -37
- data/src/core/ext/transport/chttp2/transport/frame_data.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +6 -5
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +3 -2
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -4
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +8 -6
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +6 -4
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +7 -6
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +74 -55
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +33 -11
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -2
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +7 -14
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +10 -1
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +9 -5
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +9 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +43 -30
- data/src/core/ext/transport/chttp2/transport/parsing.cc +52 -70
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/writing.cc +70 -33
- data/src/core/ext/transport/inproc/inproc_transport.cc +26 -18
- data/src/core/lib/channel/channel_args.cc +2 -101
- data/src/core/lib/channel/channel_args.h +3 -37
- data/src/core/lib/channel/channel_stack.h +10 -6
- data/src/core/lib/channel/channel_trace.cc +4 -4
- data/src/core/lib/channel/channel_trace.h +4 -4
- data/src/core/lib/channel/channelz.cc +168 -38
- data/src/core/lib/channel/channelz.h +40 -44
- data/src/core/lib/channel/channelz_registry.cc +75 -107
- data/src/core/lib/channel/channelz_registry.h +10 -28
- data/src/core/lib/channel/connected_channel.cc +2 -2
- data/src/core/lib/channel/context.h +2 -2
- data/src/core/lib/channel/handshaker.cc +151 -218
- data/src/core/lib/channel/handshaker.h +110 -101
- data/src/core/lib/channel/handshaker_factory.h +11 -19
- data/src/core/lib/channel/handshaker_registry.cc +67 -51
- data/src/core/lib/channel/handshaker_registry.h +21 -16
- data/src/core/lib/compression/algorithm_metadata.h +3 -3
- data/src/core/lib/compression/compression.cc +14 -9
- data/src/core/lib/compression/compression_args.cc +127 -0
- data/src/core/lib/compression/compression_args.h +55 -0
- data/src/core/lib/compression/compression_internal.cc +16 -12
- data/src/core/lib/compression/compression_internal.h +1 -1
- data/src/core/lib/compression/stream_compression.cc +3 -2
- data/src/core/lib/compression/stream_compression.h +2 -2
- data/src/core/lib/compression/stream_compression_gzip.cc +9 -9
- data/src/core/lib/debug/trace.cc +13 -7
- data/src/core/lib/debug/trace.h +14 -1
- data/src/core/lib/gpr/arena.h +13 -9
- data/src/core/lib/gpr/cpu_posix.cc +5 -3
- data/src/core/lib/gpr/env.h +3 -6
- data/src/core/lib/gpr/env_linux.cc +6 -1
- data/src/core/lib/gpr/env_posix.cc +5 -0
- data/src/core/lib/gpr/env_windows.cc +7 -5
- data/src/core/lib/gpr/log.cc +9 -13
- data/src/core/lib/gpr/log_posix.cc +2 -1
- data/src/core/lib/gpr/string.cc +20 -7
- data/src/core/lib/gpr/string.h +10 -3
- data/src/core/lib/gpr/sync_posix.cc +65 -4
- data/src/core/lib/gpr/time.cc +8 -0
- data/src/core/lib/gpr/time_posix.cc +21 -2
- data/src/core/lib/gprpp/arena.cc +103 -0
- data/src/core/lib/gprpp/arena.h +121 -0
- data/src/core/lib/gprpp/atomic.h +75 -5
- data/src/core/lib/gprpp/fork.cc +13 -32
- data/src/core/lib/gprpp/fork.h +5 -1
- data/src/core/lib/gprpp/global_config.h +96 -0
- data/src/core/lib/gprpp/global_config_custom.h +29 -0
- data/src/core/lib/gprpp/global_config_env.cc +135 -0
- data/src/core/lib/gprpp/global_config_env.h +131 -0
- data/src/core/lib/gprpp/global_config_generic.h +44 -0
- data/src/core/lib/gprpp/inlined_vector.h +8 -0
- data/src/core/lib/gprpp/map.h +436 -0
- data/src/core/lib/gprpp/memory.h +2 -2
- data/src/core/lib/gprpp/optional.h +48 -0
- data/src/core/lib/gprpp/orphanable.h +6 -5
- data/src/core/lib/gprpp/{mutex_lock.h → pair.h} +15 -19
- data/src/core/lib/gprpp/ref_counted.h +36 -17
- data/src/core/lib/gprpp/sync.h +126 -0
- data/src/core/lib/gprpp/thd.h +42 -7
- data/src/core/lib/gprpp/thd_posix.cc +31 -13
- data/src/core/lib/gprpp/thd_windows.cc +47 -34
- data/src/core/lib/http/httpcli.cc +6 -5
- data/src/core/lib/http/httpcli_security_connector.cc +13 -15
- data/src/core/lib/http/parser.cc +3 -2
- data/src/core/lib/http/parser.h +2 -1
- data/src/core/lib/iomgr/buffer_list.cc +182 -24
- data/src/core/lib/iomgr/buffer_list.h +72 -10
- data/src/core/lib/iomgr/call_combiner.cc +84 -90
- data/src/core/lib/iomgr/call_combiner.h +75 -82
- data/src/core/lib/iomgr/cfstream_handle.cc +203 -0
- data/src/core/lib/iomgr/cfstream_handle.h +86 -0
- data/src/core/lib/iomgr/combiner.cc +11 -3
- data/src/core/lib/iomgr/combiner.h +1 -1
- data/src/core/lib/iomgr/endpoint.cc +2 -2
- data/src/core/lib/iomgr/endpoint.h +3 -2
- data/src/core/lib/iomgr/endpoint_cfstream.cc +375 -0
- data/src/core/lib/iomgr/endpoint_cfstream.h +49 -0
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +2 -2
- data/src/core/lib/iomgr/error.cc +21 -17
- data/src/core/lib/iomgr/error.h +36 -6
- data/src/core/lib/iomgr/error_cfstream.cc +52 -0
- data/src/core/lib/iomgr/error_cfstream.h +31 -0
- data/src/core/lib/iomgr/error_internal.h +1 -1
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +44 -28
- data/src/core/lib/iomgr/ev_epollex_linux.cc +173 -194
- data/src/core/lib/iomgr/ev_poll_posix.cc +16 -487
- data/src/core/lib/iomgr/ev_posix.cc +29 -19
- data/src/core/lib/iomgr/ev_posix.h +19 -3
- data/src/core/lib/iomgr/ev_windows.cc +2 -2
- data/src/core/lib/iomgr/exec_ctx.cc +1 -0
- data/src/core/lib/iomgr/exec_ctx.h +137 -8
- data/src/core/lib/iomgr/executor.cc +147 -95
- data/src/core/lib/iomgr/executor.h +55 -49
- data/src/core/lib/iomgr/fork_posix.cc +6 -5
- data/src/core/lib/{gprpp/atomic_with_std.h → iomgr/grpc_if_nametoindex.h} +8 -13
- data/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc +42 -0
- data/src/core/lib/iomgr/{network_status_tracker.h → grpc_if_nametoindex_unsupported.cc} +15 -9
- data/src/core/lib/iomgr/internal_errqueue.cc +3 -5
- data/src/core/lib/iomgr/internal_errqueue.h +105 -3
- data/src/core/lib/iomgr/iomgr.cc +20 -13
- data/src/core/lib/iomgr/iomgr.h +15 -0
- data/src/core/lib/iomgr/iomgr_custom.cc +17 -3
- data/src/core/lib/iomgr/iomgr_custom.h +2 -0
- data/src/core/lib/iomgr/iomgr_internal.cc +10 -0
- data/src/core/lib/iomgr/iomgr_internal.h +12 -0
- data/src/core/lib/iomgr/iomgr_posix.cc +19 -2
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +93 -0
- data/src/core/lib/iomgr/iomgr_windows.cc +18 -2
- data/src/core/lib/iomgr/lockfree_event.cc +4 -4
- data/src/core/lib/iomgr/port.h +35 -0
- data/src/core/lib/iomgr/resolve_address_posix.cc +4 -3
- data/src/core/lib/iomgr/resolve_address_windows.cc +2 -1
- data/src/core/lib/iomgr/resource_quota.cc +40 -37
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +6 -2
- data/src/core/lib/iomgr/socket_windows.cc +19 -0
- data/src/core/lib/iomgr/socket_windows.h +8 -0
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +216 -0
- data/src/core/lib/iomgr/tcp_client_custom.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_posix.cc +3 -3
- data/src/core/lib/iomgr/tcp_client_windows.cc +7 -5
- data/src/core/lib/iomgr/tcp_custom.cc +10 -14
- data/src/core/lib/iomgr/tcp_posix.cc +256 -140
- data/src/core/lib/iomgr/tcp_server.cc +5 -0
- data/src/core/lib/iomgr/tcp_server.h +24 -0
- data/src/core/lib/iomgr/tcp_server_custom.cc +14 -12
- data/src/core/lib/iomgr/tcp_server_posix.cc +86 -12
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -0
- data/src/core/lib/iomgr/tcp_server_windows.cc +13 -11
- data/src/core/lib/iomgr/tcp_uv.cc +5 -7
- data/src/core/lib/iomgr/tcp_windows.cc +8 -14
- data/src/core/lib/iomgr/timer.h +2 -1
- data/src/core/lib/iomgr/timer_generic.cc +16 -16
- data/src/core/lib/iomgr/timer_manager.cc +20 -11
- data/src/core/lib/iomgr/udp_server.cc +8 -6
- data/src/core/lib/iomgr/wakeup_fd_posix.cc +1 -19
- data/src/core/lib/json/json.cc +1 -4
- data/src/core/lib/profiling/basic_timers.cc +10 -4
- data/src/core/lib/security/context/security_context.cc +6 -7
- data/src/core/lib/security/context/security_context.h +3 -4
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +1 -1
- data/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc +2 -2
- data/src/core/lib/security/credentials/composite/composite_credentials.h +4 -0
- data/src/core/lib/security/credentials/credentials.h +9 -1
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +15 -3
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +2 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +2 -1
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +10 -6
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +3 -3
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +9 -8
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +20 -2
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +2 -2
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +192 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +210 -0
- data/src/core/lib/security/credentials/tls/spiffe_credentials.cc +129 -0
- data/src/core/lib/security/credentials/tls/spiffe_credentials.h +62 -0
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +10 -8
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +13 -12
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +7 -5
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +10 -8
- data/src/core/lib/security/security_connector/security_connector.cc +0 -1
- data/src/core/lib/security/security_connector/security_connector.h +3 -3
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +39 -38
- data/src/core/lib/security/security_connector/ssl_utils.cc +164 -26
- data/src/core/lib/security/security_connector/ssl_utils.h +70 -1
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc +426 -0
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.h +122 -0
- data/src/core/lib/security/transport/auth_filters.h +5 -2
- data/src/core/lib/security/transport/client_auth_filter.cc +55 -50
- data/src/core/lib/security/transport/secure_endpoint.cc +6 -6
- data/src/core/lib/security/transport/security_handshaker.cc +271 -303
- data/src/core/lib/security/transport/security_handshaker.h +11 -2
- data/src/core/lib/security/transport/server_auth_filter.cc +3 -3
- data/src/core/lib/slice/b64.h +2 -2
- data/src/core/lib/slice/percent_encoding.cc +3 -3
- data/src/core/lib/slice/percent_encoding.h +3 -3
- data/src/core/lib/slice/slice.cc +174 -122
- data/src/core/lib/slice/slice_buffer.cc +54 -21
- data/src/core/lib/slice/slice_hash_table.h +4 -4
- data/src/core/lib/slice/slice_intern.cc +49 -107
- data/src/core/lib/slice/slice_internal.h +264 -3
- data/src/core/lib/slice/slice_string_helpers.cc +10 -1
- data/src/core/lib/slice/slice_string_helpers.h +3 -1
- data/src/core/lib/slice/slice_utils.h +50 -0
- data/src/core/lib/slice/slice_weak_hash_table.h +6 -6
- data/src/core/lib/surface/api_trace.h +1 -1
- data/src/core/lib/surface/byte_buffer_reader.cc +17 -0
- data/src/core/lib/surface/call.cc +67 -46
- data/src/core/lib/surface/call.h +7 -2
- data/src/core/lib/surface/call_details.cc +0 -1
- data/src/core/lib/surface/channel.cc +89 -97
- data/src/core/lib/surface/channel.h +60 -6
- data/src/core/lib/surface/channel_init.h +5 -0
- data/src/core/lib/surface/completion_queue.cc +221 -216
- data/src/core/lib/surface/completion_queue.h +2 -1
- data/src/core/lib/surface/init.cc +82 -33
- data/src/core/lib/surface/init.h +1 -0
- data/src/core/lib/surface/init_secure.cc +1 -1
- data/src/core/lib/surface/lame_client.cc +5 -7
- data/src/core/lib/surface/server.cc +42 -47
- data/src/core/lib/surface/validate_metadata.cc +14 -8
- data/src/core/lib/surface/validate_metadata.h +13 -2
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/bdp_estimator.cc +3 -3
- data/src/core/lib/transport/bdp_estimator.h +2 -2
- data/src/core/lib/transport/connectivity_state.cc +10 -40
- data/src/core/lib/transport/connectivity_state.h +0 -8
- data/src/core/lib/transport/error_utils.cc +12 -0
- data/src/core/lib/transport/metadata.cc +258 -267
- data/src/core/lib/transport/metadata.h +227 -16
- data/src/core/lib/transport/metadata_batch.cc +1 -1
- data/src/core/lib/transport/metadata_batch.h +1 -1
- data/src/core/lib/transport/static_metadata.cc +477 -399
- data/src/core/lib/transport/static_metadata.h +273 -182
- data/src/core/lib/transport/status_metadata.cc +3 -3
- data/src/core/lib/transport/timeout_encoding.cc +1 -1
- data/src/core/lib/transport/timeout_encoding.h +1 -1
- data/src/core/lib/transport/transport.cc +39 -72
- data/src/core/lib/transport/transport.h +59 -24
- data/src/core/lib/transport/transport_impl.h +1 -1
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +3 -3
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +1 -1
- data/src/core/tsi/alts/handshaker/alts_shared_resource.h +1 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +4 -3
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +1 -1
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +1 -1
- data/src/core/tsi/fake_transport_security.cc +4 -4
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +1 -1
- data/src/core/tsi/ssl_transport_security.cc +12 -10
- data/src/core/tsi/ssl_transport_security.h +24 -4
- data/src/ruby/bin/math_pb.rb +18 -16
- data/src/ruby/ext/grpc/extconf.rb +12 -4
- data/src/ruby/ext/grpc/rb_call_credentials.c +8 -5
- data/src/ruby/ext/grpc/rb_channel.c +14 -10
- data/src/ruby/ext/grpc/rb_channel_credentials.c +8 -4
- data/src/ruby/ext/grpc/rb_compression_options.c +9 -7
- data/src/ruby/ext/grpc/rb_event_thread.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc.c +23 -24
- data/src/ruby/ext/grpc/rb_grpc.h +4 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +24 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +36 -0
- data/src/ruby/ext/grpc/rb_server.c +8 -4
- data/src/ruby/lib/grpc/errors.rb +22 -3
- data/src/ruby/lib/grpc/generic/bidi_call.rb +1 -1
- data/src/ruby/lib/grpc/generic/rpc_server.rb +2 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/README.md +1 -1
- data/src/ruby/pb/grpc/health/v1/health_pb.rb +13 -10
- data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +18 -0
- data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +3 -1
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +58 -56
- data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +2 -0
- data/src/ruby/spec/errors_spec.rb +141 -0
- data/third_party/cares/cares/ares.h +12 -0
- data/third_party/cares/cares/ares_create_query.c +5 -1
- data/third_party/cares/cares/ares_data.c +74 -73
- data/third_party/cares/cares/ares_destroy.c +6 -1
- data/third_party/cares/cares/ares_gethostbyaddr.c +5 -5
- data/third_party/cares/cares/ares_gethostbyname.c +15 -4
- data/third_party/cares/cares/ares_getnameinfo.c +11 -0
- data/third_party/cares/cares/ares_init.c +274 -173
- data/third_party/cares/cares/ares_library_init.c +21 -3
- data/third_party/cares/cares/ares_options.c +6 -2
- data/third_party/cares/cares/ares_parse_naptr_reply.c +7 -6
- data/third_party/cares/cares/ares_parse_ptr_reply.c +4 -2
- data/third_party/cares/cares/ares_platform.c +7 -0
- data/third_party/cares/cares/ares_private.h +19 -11
- data/third_party/cares/cares/ares_process.c +27 -2
- data/third_party/cares/cares/ares_rules.h +1 -1
- data/third_party/cares/cares/ares_search.c +7 -0
- data/third_party/cares/cares/ares_send.c +6 -0
- data/third_party/cares/cares/ares_strsplit.c +174 -0
- data/third_party/cares/cares/ares_strsplit.h +43 -0
- data/third_party/cares/cares/ares_version.h +4 -4
- data/third_party/cares/cares/config-win32.h +1 -1
- data/third_party/cares/cares/inet_ntop.c +2 -3
- data/third_party/cares/config_darwin/ares_config.h +3 -0
- data/third_party/cares/config_freebsd/ares_config.h +3 -0
- data/third_party/cares/config_linux/ares_config.h +3 -0
- data/third_party/cares/config_openbsd/ares_config.h +3 -0
- metadata +83 -48
- data/src/core/ext/filters/client_channel/request_routing.cc +0 -936
- data/src/core/ext/filters/client_channel/request_routing.h +0 -177
- data/src/core/ext/filters/client_channel/subchannel_index.cc +0 -248
- data/src/core/ext/filters/client_channel/subchannel_index.h +0 -76
- data/src/core/lib/channel/handshaker_factory.cc +0 -42
- data/src/core/lib/gpr/arena.cc +0 -192
- data/src/core/lib/gprpp/atomic_with_atm.h +0 -57
- data/src/core/lib/iomgr/wakeup_fd_cv.cc +0 -107
- data/src/core/lib/iomgr/wakeup_fd_cv.h +0 -69
- data/src/core/lib/transport/service_config.cc +0 -106
- data/src/core/lib/transport/service_config.h +0 -249
@@ -26,9 +26,8 @@
|
|
26
26
|
#include "src/core/ext/filters/client_channel/lb_policy_registry.h"
|
27
27
|
#include "src/core/ext/filters/client_channel/server_address.h"
|
28
28
|
#include "src/core/ext/filters/client_channel/subchannel.h"
|
29
|
-
#include "src/core/ext/filters/client_channel/subchannel_index.h"
|
30
29
|
#include "src/core/lib/channel/channel_args.h"
|
31
|
-
#include "src/core/lib/gprpp/
|
30
|
+
#include "src/core/lib/gprpp/sync.h"
|
32
31
|
#include "src/core/lib/iomgr/combiner.h"
|
33
32
|
#include "src/core/lib/iomgr/sockaddr_utils.h"
|
34
33
|
#include "src/core/lib/transport/connectivity_state.h"
|
@@ -47,26 +46,13 @@ constexpr char kPickFirst[] = "pick_first";
|
|
47
46
|
|
48
47
|
class PickFirst : public LoadBalancingPolicy {
|
49
48
|
public:
|
50
|
-
explicit PickFirst(
|
49
|
+
explicit PickFirst(Args args);
|
51
50
|
|
52
51
|
const char* name() const override { return kPickFirst; }
|
53
52
|
|
54
|
-
void UpdateLocked(
|
55
|
-
grpc_json* lb_config) override;
|
56
|
-
bool PickLocked(PickState* pick, grpc_error** error) override;
|
57
|
-
void CancelPickLocked(PickState* pick, grpc_error* error) override;
|
58
|
-
void CancelMatchingPicksLocked(uint32_t initial_metadata_flags_mask,
|
59
|
-
uint32_t initial_metadata_flags_eq,
|
60
|
-
grpc_error* error) override;
|
61
|
-
void NotifyOnStateChangeLocked(grpc_connectivity_state* state,
|
62
|
-
grpc_closure* closure) override;
|
63
|
-
grpc_connectivity_state CheckConnectivityLocked(
|
64
|
-
grpc_error** connectivity_error) override;
|
65
|
-
void HandOffPendingPicksLocked(LoadBalancingPolicy* new_policy) override;
|
53
|
+
void UpdateLocked(UpdateArgs args) override;
|
66
54
|
void ExitIdleLocked() override;
|
67
55
|
void ResetBackoffLocked() override;
|
68
|
-
void FillChildRefsForChannelz(channelz::ChildRefsList* child_subchannels,
|
69
|
-
channelz::ChildRefsList* ignored) override;
|
70
56
|
|
71
57
|
private:
|
72
58
|
~PickFirst();
|
@@ -80,12 +66,12 @@ class PickFirst : public LoadBalancingPolicy {
|
|
80
66
|
PickFirstSubchannelData(
|
81
67
|
SubchannelList<PickFirstSubchannelList, PickFirstSubchannelData>*
|
82
68
|
subchannel_list,
|
83
|
-
const ServerAddress& address,
|
84
|
-
|
85
|
-
: SubchannelData(subchannel_list, address, subchannel
|
69
|
+
const ServerAddress& address,
|
70
|
+
RefCountedPtr<SubchannelInterface> subchannel)
|
71
|
+
: SubchannelData(subchannel_list, address, std::move(subchannel)) {}
|
86
72
|
|
87
73
|
void ProcessConnectivityChangeLocked(
|
88
|
-
grpc_connectivity_state connectivity_state
|
74
|
+
grpc_connectivity_state connectivity_state) override;
|
89
75
|
|
90
76
|
// Processes the connectivity change to READY for an unselected subchannel.
|
91
77
|
void ProcessUnselectedReadyLocked();
|
@@ -100,10 +86,9 @@ class PickFirst : public LoadBalancingPolicy {
|
|
100
86
|
PickFirstSubchannelList(PickFirst* policy, TraceFlag* tracer,
|
101
87
|
const ServerAddressList& addresses,
|
102
88
|
grpc_combiner* combiner,
|
103
|
-
grpc_client_channel_factory* client_channel_factory,
|
104
89
|
const grpc_channel_args& args)
|
105
90
|
: SubchannelList(policy, tracer, addresses, combiner,
|
106
|
-
|
91
|
+
policy->channel_control_helper(), args) {
|
107
92
|
// Need to maintain a ref to the LB policy as long as we maintain
|
108
93
|
// any references to subchannels, since the subchannels'
|
109
94
|
// pollset_sets will include the LB policy's pollset_set.
|
@@ -114,155 +99,86 @@ class PickFirst : public LoadBalancingPolicy {
|
|
114
99
|
PickFirst* p = static_cast<PickFirst*>(policy());
|
115
100
|
p->Unref(DEBUG_LOCATION, "subchannel_list");
|
116
101
|
}
|
102
|
+
|
103
|
+
bool in_transient_failure() const { return in_transient_failure_; }
|
104
|
+
void set_in_transient_failure(bool in_transient_failure) {
|
105
|
+
in_transient_failure_ = in_transient_failure;
|
106
|
+
}
|
107
|
+
|
108
|
+
private:
|
109
|
+
bool in_transient_failure_ = false;
|
117
110
|
};
|
118
111
|
|
119
|
-
|
120
|
-
// data structures will update the channelz snapshot data structures before
|
121
|
-
// returning.
|
122
|
-
class AutoChildRefsUpdater {
|
112
|
+
class Picker : public SubchannelPicker {
|
123
113
|
public:
|
124
|
-
explicit
|
125
|
-
|
114
|
+
explicit Picker(
|
115
|
+
RefCountedPtr<ConnectedSubchannelInterface> connected_subchannel)
|
116
|
+
: connected_subchannel_(std::move(connected_subchannel)) {}
|
117
|
+
|
118
|
+
PickResult Pick(PickArgs args) override {
|
119
|
+
PickResult result;
|
120
|
+
result.type = PickResult::PICK_COMPLETE;
|
121
|
+
result.connected_subchannel = connected_subchannel_;
|
122
|
+
return result;
|
123
|
+
}
|
126
124
|
|
127
125
|
private:
|
128
|
-
|
126
|
+
RefCountedPtr<ConnectedSubchannelInterface> connected_subchannel_;
|
129
127
|
};
|
130
128
|
|
131
129
|
void ShutdownLocked() override;
|
132
130
|
|
133
|
-
void StartPickingLocked();
|
134
|
-
void UpdateChildRefsLocked();
|
135
|
-
|
136
131
|
// All our subchannels.
|
137
132
|
OrphanablePtr<PickFirstSubchannelList> subchannel_list_;
|
138
133
|
// Latest pending subchannel list.
|
139
134
|
OrphanablePtr<PickFirstSubchannelList> latest_pending_subchannel_list_;
|
140
135
|
// Selected subchannel in \a subchannel_list_.
|
141
136
|
PickFirstSubchannelData* selected_ = nullptr;
|
142
|
-
//
|
143
|
-
bool
|
137
|
+
// Are we in IDLE state?
|
138
|
+
bool idle_ = false;
|
144
139
|
// Are we shut down?
|
145
140
|
bool shutdown_ = false;
|
146
|
-
// List of picks that are waiting on connectivity.
|
147
|
-
PickState* pending_picks_ = nullptr;
|
148
|
-
// Our connectivity state tracker.
|
149
|
-
grpc_connectivity_state_tracker state_tracker_;
|
150
|
-
|
151
|
-
/// Lock and data used to capture snapshots of this channels child
|
152
|
-
/// channels and subchannels. This data is consumed by channelz.
|
153
|
-
gpr_mu child_refs_mu_;
|
154
|
-
channelz::ChildRefsList child_subchannels_;
|
155
|
-
channelz::ChildRefsList child_channels_;
|
156
141
|
};
|
157
142
|
|
158
|
-
PickFirst::PickFirst(
|
159
|
-
|
160
|
-
gpr_mu_init(&child_refs_mu_);
|
161
|
-
grpc_connectivity_state_init(&state_tracker_, GRPC_CHANNEL_IDLE,
|
162
|
-
"pick_first");
|
163
|
-
if (grpc_lb_pick_first_trace.enabled()) {
|
143
|
+
PickFirst::PickFirst(Args args) : LoadBalancingPolicy(std::move(args)) {
|
144
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
|
164
145
|
gpr_log(GPR_INFO, "Pick First %p created.", this);
|
165
146
|
}
|
166
|
-
UpdateLocked(*args.args, args.lb_config);
|
167
|
-
grpc_subchannel_index_ref();
|
168
147
|
}
|
169
148
|
|
170
149
|
PickFirst::~PickFirst() {
|
171
|
-
if (grpc_lb_pick_first_trace
|
150
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
|
172
151
|
gpr_log(GPR_INFO, "Destroying Pick First %p", this);
|
173
152
|
}
|
174
|
-
gpr_mu_destroy(&child_refs_mu_);
|
175
153
|
GPR_ASSERT(subchannel_list_ == nullptr);
|
176
154
|
GPR_ASSERT(latest_pending_subchannel_list_ == nullptr);
|
177
|
-
GPR_ASSERT(pending_picks_ == nullptr);
|
178
|
-
grpc_connectivity_state_destroy(&state_tracker_);
|
179
|
-
grpc_subchannel_index_unref();
|
180
|
-
}
|
181
|
-
|
182
|
-
void PickFirst::HandOffPendingPicksLocked(LoadBalancingPolicy* new_policy) {
|
183
|
-
PickState* pick;
|
184
|
-
while ((pick = pending_picks_) != nullptr) {
|
185
|
-
pending_picks_ = pick->next;
|
186
|
-
grpc_error* error = GRPC_ERROR_NONE;
|
187
|
-
if (new_policy->PickLocked(pick, &error)) {
|
188
|
-
// Synchronous return, schedule closure.
|
189
|
-
GRPC_CLOSURE_SCHED(pick->on_complete, error);
|
190
|
-
}
|
191
|
-
}
|
192
155
|
}
|
193
156
|
|
194
157
|
void PickFirst::ShutdownLocked() {
|
195
|
-
|
196
|
-
grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Channel shutdown");
|
197
|
-
if (grpc_lb_pick_first_trace.enabled()) {
|
158
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
|
198
159
|
gpr_log(GPR_INFO, "Pick First %p Shutting down", this);
|
199
160
|
}
|
200
161
|
shutdown_ = true;
|
201
|
-
PickState* pick;
|
202
|
-
while ((pick = pending_picks_) != nullptr) {
|
203
|
-
pending_picks_ = pick->next;
|
204
|
-
pick->connected_subchannel.reset();
|
205
|
-
GRPC_CLOSURE_SCHED(pick->on_complete, GRPC_ERROR_REF(error));
|
206
|
-
}
|
207
|
-
grpc_connectivity_state_set(&state_tracker_, GRPC_CHANNEL_SHUTDOWN,
|
208
|
-
GRPC_ERROR_REF(error), "shutdown");
|
209
162
|
subchannel_list_.reset();
|
210
163
|
latest_pending_subchannel_list_.reset();
|
211
|
-
TryReresolutionLocked(&grpc_lb_pick_first_trace, GRPC_ERROR_CANCELLED);
|
212
|
-
GRPC_ERROR_UNREF(error);
|
213
|
-
}
|
214
|
-
|
215
|
-
void PickFirst::CancelPickLocked(PickState* pick, grpc_error* error) {
|
216
|
-
PickState* pp = pending_picks_;
|
217
|
-
pending_picks_ = nullptr;
|
218
|
-
while (pp != nullptr) {
|
219
|
-
PickState* next = pp->next;
|
220
|
-
if (pp == pick) {
|
221
|
-
pick->connected_subchannel.reset();
|
222
|
-
GRPC_CLOSURE_SCHED(pick->on_complete,
|
223
|
-
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
224
|
-
"Pick Cancelled", &error, 1));
|
225
|
-
} else {
|
226
|
-
pp->next = pending_picks_;
|
227
|
-
pending_picks_ = pp;
|
228
|
-
}
|
229
|
-
pp = next;
|
230
|
-
}
|
231
|
-
GRPC_ERROR_UNREF(error);
|
232
164
|
}
|
233
165
|
|
234
|
-
void PickFirst::
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
166
|
+
void PickFirst::ExitIdleLocked() {
|
167
|
+
if (shutdown_) return;
|
168
|
+
if (idle_) {
|
169
|
+
idle_ = false;
|
170
|
+
if (subchannel_list_ == nullptr ||
|
171
|
+
subchannel_list_->num_subchannels() == 0) {
|
172
|
+
grpc_error* error = grpc_error_set_int(
|
173
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("No addresses to connect to"),
|
174
|
+
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
|
175
|
+
channel_control_helper()->UpdateState(
|
176
|
+
GRPC_CHANNEL_TRANSIENT_FAILURE,
|
177
|
+
UniquePtr<SubchannelPicker>(New<TransientFailurePicker>(error)));
|
246
178
|
} else {
|
247
|
-
|
248
|
-
|
179
|
+
subchannel_list_->subchannel(0)
|
180
|
+
->CheckConnectivityStateAndStartWatchingLocked();
|
249
181
|
}
|
250
|
-
pick = next;
|
251
|
-
}
|
252
|
-
GRPC_ERROR_UNREF(error);
|
253
|
-
}
|
254
|
-
|
255
|
-
void PickFirst::StartPickingLocked() {
|
256
|
-
started_picking_ = true;
|
257
|
-
if (subchannel_list_ != nullptr && subchannel_list_->num_subchannels() > 0) {
|
258
|
-
subchannel_list_->subchannel(0)
|
259
|
-
->CheckConnectivityStateAndStartWatchingLocked();
|
260
|
-
}
|
261
|
-
}
|
262
|
-
|
263
|
-
void PickFirst::ExitIdleLocked() {
|
264
|
-
if (!started_picking_) {
|
265
|
-
StartPickingLocked();
|
266
182
|
}
|
267
183
|
}
|
268
184
|
|
@@ -273,128 +189,52 @@ void PickFirst::ResetBackoffLocked() {
|
|
273
189
|
}
|
274
190
|
}
|
275
191
|
|
276
|
-
|
277
|
-
|
278
|
-
if (selected_ != nullptr) {
|
279
|
-
pick->connected_subchannel = selected_->connected_subchannel()->Ref();
|
280
|
-
return true;
|
281
|
-
}
|
282
|
-
// No subchannel selected yet, so handle asynchronously.
|
283
|
-
if (pick->on_complete == nullptr) {
|
284
|
-
*error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
285
|
-
"No pick result available but synchronous result required.");
|
286
|
-
return true;
|
287
|
-
}
|
288
|
-
pick->next = pending_picks_;
|
289
|
-
pending_picks_ = pick;
|
290
|
-
if (!started_picking_) {
|
291
|
-
StartPickingLocked();
|
292
|
-
}
|
293
|
-
return false;
|
294
|
-
}
|
295
|
-
|
296
|
-
grpc_connectivity_state PickFirst::CheckConnectivityLocked(grpc_error** error) {
|
297
|
-
return grpc_connectivity_state_get(&state_tracker_, error);
|
298
|
-
}
|
299
|
-
|
300
|
-
void PickFirst::NotifyOnStateChangeLocked(grpc_connectivity_state* current,
|
301
|
-
grpc_closure* notify) {
|
302
|
-
grpc_connectivity_state_notify_on_state_change(&state_tracker_, current,
|
303
|
-
notify);
|
304
|
-
}
|
305
|
-
|
306
|
-
void PickFirst::FillChildRefsForChannelz(
|
307
|
-
channelz::ChildRefsList* child_subchannels_to_fill,
|
308
|
-
channelz::ChildRefsList* ignored) {
|
309
|
-
MutexLock lock(&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
|
-
channelz::ChildRefsList cs;
|
329
|
-
if (subchannel_list_ != nullptr) {
|
330
|
-
subchannel_list_->PopulateChildRefsList(&cs);
|
331
|
-
}
|
332
|
-
if (latest_pending_subchannel_list_ != nullptr) {
|
333
|
-
latest_pending_subchannel_list_->PopulateChildRefsList(&cs);
|
334
|
-
}
|
335
|
-
// atomically update the data that channelz will actually be looking at.
|
336
|
-
MutexLock lock(&child_refs_mu_);
|
337
|
-
child_subchannels_ = std::move(cs);
|
338
|
-
}
|
339
|
-
|
340
|
-
void PickFirst::UpdateLocked(const grpc_channel_args& args,
|
341
|
-
grpc_json* lb_config) {
|
342
|
-
AutoChildRefsUpdater guard(this);
|
343
|
-
const ServerAddressList* addresses = FindServerAddressListChannelArg(&args);
|
344
|
-
if (addresses == nullptr) {
|
345
|
-
if (subchannel_list_ == nullptr) {
|
346
|
-
// If we don't have a current subchannel list, go into TRANSIENT FAILURE.
|
347
|
-
grpc_connectivity_state_set(
|
348
|
-
&state_tracker_, GRPC_CHANNEL_TRANSIENT_FAILURE,
|
349
|
-
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Missing update in args"),
|
350
|
-
"pf_update_missing");
|
351
|
-
} else {
|
352
|
-
// otherwise, keep using the current subchannel list (ignore this update).
|
353
|
-
gpr_log(GPR_ERROR,
|
354
|
-
"No valid LB addresses channel arg for Pick First %p update, "
|
355
|
-
"ignoring.",
|
356
|
-
this);
|
357
|
-
}
|
358
|
-
return;
|
359
|
-
}
|
360
|
-
if (grpc_lb_pick_first_trace.enabled()) {
|
192
|
+
void PickFirst::UpdateLocked(UpdateArgs args) {
|
193
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
|
361
194
|
gpr_log(GPR_INFO,
|
362
195
|
"Pick First %p received update with %" PRIuPTR " addresses", this,
|
363
|
-
addresses
|
196
|
+
args.addresses.size());
|
364
197
|
}
|
365
198
|
grpc_arg new_arg = grpc_channel_arg_integer_create(
|
366
199
|
const_cast<char*>(GRPC_ARG_INHIBIT_HEALTH_CHECKING), 1);
|
367
200
|
grpc_channel_args* new_args =
|
368
|
-
grpc_channel_args_copy_and_add(
|
201
|
+
grpc_channel_args_copy_and_add(args.args, &new_arg, 1);
|
369
202
|
auto subchannel_list = MakeOrphanable<PickFirstSubchannelList>(
|
370
|
-
this, &grpc_lb_pick_first_trace,
|
371
|
-
client_channel_factory(), *new_args);
|
203
|
+
this, &grpc_lb_pick_first_trace, args.addresses, combiner(), *new_args);
|
372
204
|
grpc_channel_args_destroy(new_args);
|
373
205
|
if (subchannel_list->num_subchannels() == 0) {
|
374
206
|
// Empty update or no valid subchannels. Unsubscribe from all current
|
375
|
-
// subchannels
|
376
|
-
grpc_connectivity_state_set(
|
377
|
-
&state_tracker_, GRPC_CHANNEL_TRANSIENT_FAILURE,
|
378
|
-
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Empty update"),
|
379
|
-
"pf_update_empty");
|
207
|
+
// subchannels.
|
380
208
|
subchannel_list_ = std::move(subchannel_list); // Empty list.
|
381
209
|
selected_ = nullptr;
|
210
|
+
// If not idle, put the channel in TRANSIENT_FAILURE.
|
211
|
+
// (If we are idle, then this will happen in ExitIdleLocked() if we
|
212
|
+
// haven't gotten a non-empty update by the time the application tries
|
213
|
+
// to start a new call.)
|
214
|
+
if (!idle_) {
|
215
|
+
grpc_error* error = grpc_error_set_int(
|
216
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Empty update"),
|
217
|
+
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
|
218
|
+
channel_control_helper()->UpdateState(
|
219
|
+
GRPC_CHANNEL_TRANSIENT_FAILURE,
|
220
|
+
UniquePtr<SubchannelPicker>(New<TransientFailurePicker>(error)));
|
221
|
+
}
|
382
222
|
return;
|
383
223
|
}
|
384
224
|
// If one of the subchannels in the new list is already in state
|
385
225
|
// READY, then select it immediately. This can happen when the
|
386
226
|
// currently selected subchannel is also present in the update. It
|
387
227
|
// can also happen if one of the subchannels in the update is already
|
388
|
-
// in the subchannel
|
228
|
+
// in the global subchannel pool because it's in use by another channel.
|
229
|
+
// TODO(roth): If we're in IDLE state, we should probably defer this
|
230
|
+
// check and instead do it in ExitIdleLocked().
|
389
231
|
for (size_t i = 0; i < subchannel_list->num_subchannels(); ++i) {
|
390
232
|
PickFirstSubchannelData* sd = subchannel_list->subchannel(i);
|
391
|
-
|
392
|
-
grpc_connectivity_state state = sd->CheckConnectivityStateLocked(&error);
|
393
|
-
GRPC_ERROR_UNREF(error);
|
233
|
+
grpc_connectivity_state state = sd->CheckConnectivityStateLocked();
|
394
234
|
if (state == GRPC_CHANNEL_READY) {
|
395
235
|
subchannel_list_ = std::move(subchannel_list);
|
396
|
-
sd->ProcessUnselectedReadyLocked();
|
397
236
|
sd->StartConnectivityWatchLocked();
|
237
|
+
sd->ProcessUnselectedReadyLocked();
|
398
238
|
// If there was a previously pending update (which may or may
|
399
239
|
// not have contained the currently selected subchannel), drop
|
400
240
|
// it, so that it doesn't override what we've done here.
|
@@ -402,7 +242,7 @@ void PickFirst::UpdateLocked(const grpc_channel_args& args,
|
|
402
242
|
// Make sure that subsequent calls to ExitIdleLocked() don't cause
|
403
243
|
// us to start watching a subchannel other than the one we've
|
404
244
|
// selected.
|
405
|
-
|
245
|
+
idle_ = false;
|
406
246
|
return;
|
407
247
|
}
|
408
248
|
}
|
@@ -410,19 +250,20 @@ void PickFirst::UpdateLocked(const grpc_channel_args& args,
|
|
410
250
|
// We don't yet have a selected subchannel, so replace the current
|
411
251
|
// subchannel list immediately.
|
412
252
|
subchannel_list_ = std::move(subchannel_list);
|
413
|
-
// If we'
|
253
|
+
// If we're not in IDLE state, start trying to connect to the first
|
414
254
|
// subchannel in the new list.
|
415
|
-
if (
|
255
|
+
if (!idle_) {
|
416
256
|
// Note: No need to use CheckConnectivityStateAndStartWatchingLocked()
|
417
257
|
// here, since we've already checked the initial connectivity
|
418
258
|
// state of all subchannels above.
|
419
259
|
subchannel_list_->subchannel(0)->StartConnectivityWatchLocked();
|
260
|
+
subchannel_list_->subchannel(0)->subchannel()->AttemptToConnect();
|
420
261
|
}
|
421
262
|
} else {
|
422
|
-
// We do have a selected subchannel
|
423
|
-
// the subchannels in the new list reports READY.
|
263
|
+
// We do have a selected subchannel (which means it's READY), so keep
|
264
|
+
// using it until one of the subchannels in the new list reports READY.
|
424
265
|
if (latest_pending_subchannel_list_ != nullptr) {
|
425
|
-
if (grpc_lb_pick_first_trace
|
266
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
|
426
267
|
gpr_log(GPR_INFO,
|
427
268
|
"Pick First %p Shutting down latest pending subchannel list "
|
428
269
|
"%p, about to be replaced by newer latest %p",
|
@@ -431,22 +272,24 @@ void PickFirst::UpdateLocked(const grpc_channel_args& args,
|
|
431
272
|
}
|
432
273
|
}
|
433
274
|
latest_pending_subchannel_list_ = std::move(subchannel_list);
|
434
|
-
// If we'
|
275
|
+
// If we're not in IDLE state, start trying to connect to the first
|
435
276
|
// subchannel in the new list.
|
436
|
-
if (
|
277
|
+
if (!idle_) {
|
437
278
|
// Note: No need to use CheckConnectivityStateAndStartWatchingLocked()
|
438
279
|
// here, since we've already checked the initial connectivity
|
439
280
|
// state of all subchannels above.
|
440
281
|
latest_pending_subchannel_list_->subchannel(0)
|
441
282
|
->StartConnectivityWatchLocked();
|
283
|
+
latest_pending_subchannel_list_->subchannel(0)
|
284
|
+
->subchannel()
|
285
|
+
->AttemptToConnect();
|
442
286
|
}
|
443
287
|
}
|
444
288
|
}
|
445
289
|
|
446
290
|
void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
|
447
|
-
grpc_connectivity_state connectivity_state
|
291
|
+
grpc_connectivity_state connectivity_state) {
|
448
292
|
PickFirst* p = static_cast<PickFirst*>(subchannel_list()->policy());
|
449
|
-
AutoChildRefsUpdater guard(p);
|
450
293
|
// The notification must be for a subchannel in either the current or
|
451
294
|
// latest pending subchannel lists.
|
452
295
|
GPR_ASSERT(subchannel_list() == p->subchannel_list_.get() ||
|
@@ -454,15 +297,16 @@ void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
|
|
454
297
|
GPR_ASSERT(connectivity_state != GRPC_CHANNEL_SHUTDOWN);
|
455
298
|
// Handle updates for the currently selected subchannel.
|
456
299
|
if (p->selected_ == this) {
|
457
|
-
if (grpc_lb_pick_first_trace
|
300
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
|
458
301
|
gpr_log(GPR_INFO,
|
459
|
-
"Pick First %p connectivity changed
|
302
|
+
"Pick First %p selected subchannel connectivity changed to %s", p,
|
303
|
+
grpc_connectivity_state_name(connectivity_state));
|
460
304
|
}
|
461
305
|
// If the new state is anything other than READY and there is a
|
462
306
|
// pending update, switch to the pending update.
|
463
307
|
if (connectivity_state != GRPC_CHANNEL_READY &&
|
464
308
|
p->latest_pending_subchannel_list_ != nullptr) {
|
465
|
-
if (grpc_lb_pick_first_trace
|
309
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
|
466
310
|
gpr_log(GPR_INFO,
|
467
311
|
"Pick First %p promoting pending subchannel list %p to "
|
468
312
|
"replace %p",
|
@@ -470,39 +314,52 @@ void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
|
|
470
314
|
p->subchannel_list_.get());
|
471
315
|
}
|
472
316
|
p->selected_ = nullptr;
|
473
|
-
|
317
|
+
CancelConnectivityWatchLocked(
|
318
|
+
"selected subchannel failed; switching to pending update");
|
474
319
|
p->subchannel_list_ = std::move(p->latest_pending_subchannel_list_);
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
320
|
+
// Set our state to that of the pending subchannel list.
|
321
|
+
if (p->subchannel_list_->in_transient_failure()) {
|
322
|
+
grpc_error* error = grpc_error_set_int(
|
323
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
324
|
+
"selected subchannel failed; switching to pending update"),
|
325
|
+
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
|
326
|
+
p->channel_control_helper()->UpdateState(
|
327
|
+
GRPC_CHANNEL_TRANSIENT_FAILURE,
|
328
|
+
UniquePtr<SubchannelPicker>(New<TransientFailurePicker>(error)));
|
329
|
+
} else {
|
330
|
+
p->channel_control_helper()->UpdateState(
|
331
|
+
GRPC_CHANNEL_CONNECTING,
|
332
|
+
UniquePtr<SubchannelPicker>(
|
333
|
+
New<QueuePicker>(p->Ref(DEBUG_LOCATION, "QueuePicker"))));
|
334
|
+
}
|
483
335
|
} else {
|
484
336
|
if (connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
|
485
|
-
// If the selected subchannel goes bad, request a re-resolution. We
|
486
|
-
// set the channel state to IDLE
|
487
|
-
//
|
488
|
-
//
|
489
|
-
|
490
|
-
|
491
|
-
GRPC_ERROR_NONE,
|
492
|
-
"selected_changed+reresolve");
|
493
|
-
p->started_picking_ = false;
|
494
|
-
p->TryReresolutionLocked(&grpc_lb_pick_first_trace, GRPC_ERROR_NONE);
|
495
|
-
// In transient failure. Rely on re-resolution to recover.
|
337
|
+
// If the selected subchannel goes bad, request a re-resolution. We
|
338
|
+
// also set the channel state to IDLE. The reason is that if the new
|
339
|
+
// state is TRANSIENT_FAILURE due to a GOAWAY reception we don't want
|
340
|
+
// to connect to the re-resolved backends until we leave IDLE state.
|
341
|
+
p->idle_ = true;
|
342
|
+
p->channel_control_helper()->RequestReresolution();
|
496
343
|
p->selected_ = nullptr;
|
497
|
-
|
344
|
+
CancelConnectivityWatchLocked("selected subchannel failed; going IDLE");
|
345
|
+
p->channel_control_helper()->UpdateState(
|
346
|
+
GRPC_CHANNEL_IDLE, UniquePtr<SubchannelPicker>(New<QueuePicker>(
|
347
|
+
p->Ref(DEBUG_LOCATION, "QueuePicker"))));
|
498
348
|
} else {
|
499
|
-
|
500
|
-
|
501
|
-
//
|
502
|
-
|
349
|
+
// This is unlikely but can happen when a subchannel has been asked
|
350
|
+
// to reconnect by a different channel and this channel has dropped
|
351
|
+
// some connectivity state notifications.
|
352
|
+
if (connectivity_state == GRPC_CHANNEL_READY) {
|
353
|
+
p->channel_control_helper()->UpdateState(
|
354
|
+
GRPC_CHANNEL_READY, UniquePtr<SubchannelPicker>(New<Picker>(
|
355
|
+
connected_subchannel()->Ref())));
|
356
|
+
} else { // CONNECTING
|
357
|
+
p->channel_control_helper()->UpdateState(
|
358
|
+
connectivity_state, UniquePtr<SubchannelPicker>(New<QueuePicker>(
|
359
|
+
p->Ref(DEBUG_LOCATION, "QueuePicker"))));
|
360
|
+
}
|
503
361
|
}
|
504
362
|
}
|
505
|
-
GRPC_ERROR_UNREF(error);
|
506
363
|
return;
|
507
364
|
}
|
508
365
|
// If we get here, there are two possible cases:
|
@@ -514,26 +371,37 @@ void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
|
|
514
371
|
// for a subchannel in p->latest_pending_subchannel_list_. The
|
515
372
|
// goal here is to find a subchannel from the update that we can
|
516
373
|
// select in place of the current one.
|
374
|
+
subchannel_list()->set_in_transient_failure(false);
|
517
375
|
switch (connectivity_state) {
|
518
376
|
case GRPC_CHANNEL_READY: {
|
519
377
|
ProcessUnselectedReadyLocked();
|
520
|
-
// Renew notification.
|
521
|
-
RenewConnectivityWatchLocked();
|
522
378
|
break;
|
523
379
|
}
|
524
380
|
case GRPC_CHANNEL_TRANSIENT_FAILURE: {
|
525
|
-
|
381
|
+
CancelConnectivityWatchLocked("connection attempt failed");
|
526
382
|
PickFirstSubchannelData* sd = this;
|
527
383
|
size_t next_index =
|
528
384
|
(sd->Index() + 1) % subchannel_list()->num_subchannels();
|
529
385
|
sd = subchannel_list()->subchannel(next_index);
|
530
|
-
//
|
531
|
-
|
532
|
-
|
533
|
-
p->
|
534
|
-
|
535
|
-
|
536
|
-
|
386
|
+
// If we're tried all subchannels, set state to TRANSIENT_FAILURE.
|
387
|
+
if (sd->Index() == 0) {
|
388
|
+
// Re-resolve if this is the most recent subchannel list.
|
389
|
+
if (subchannel_list() == (p->latest_pending_subchannel_list_ != nullptr
|
390
|
+
? p->latest_pending_subchannel_list_.get()
|
391
|
+
: p->subchannel_list_.get())) {
|
392
|
+
p->channel_control_helper()->RequestReresolution();
|
393
|
+
}
|
394
|
+
subchannel_list()->set_in_transient_failure(true);
|
395
|
+
// Only report new state in case 1.
|
396
|
+
if (subchannel_list() == p->subchannel_list_.get()) {
|
397
|
+
grpc_error* error = grpc_error_set_int(
|
398
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
399
|
+
"failed to connect to all addresses"),
|
400
|
+
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
|
401
|
+
p->channel_control_helper()->UpdateState(
|
402
|
+
GRPC_CHANNEL_TRANSIENT_FAILURE,
|
403
|
+
UniquePtr<SubchannelPicker>(New<TransientFailurePicker>(error)));
|
404
|
+
}
|
537
405
|
}
|
538
406
|
sd->CheckConnectivityStateAndStartWatchingLocked();
|
539
407
|
break;
|
@@ -542,18 +410,16 @@ void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
|
|
542
410
|
case GRPC_CHANNEL_IDLE: {
|
543
411
|
// Only update connectivity state in case 1.
|
544
412
|
if (subchannel_list() == p->subchannel_list_.get()) {
|
545
|
-
|
546
|
-
|
547
|
-
|
413
|
+
p->channel_control_helper()->UpdateState(
|
414
|
+
GRPC_CHANNEL_CONNECTING,
|
415
|
+
UniquePtr<SubchannelPicker>(
|
416
|
+
New<QueuePicker>(p->Ref(DEBUG_LOCATION, "QueuePicker"))));
|
548
417
|
}
|
549
|
-
// Renew notification.
|
550
|
-
RenewConnectivityWatchLocked();
|
551
418
|
break;
|
552
419
|
}
|
553
420
|
case GRPC_CHANNEL_SHUTDOWN:
|
554
421
|
GPR_UNREACHABLE_CODE(break);
|
555
422
|
}
|
556
|
-
GRPC_ERROR_UNREF(error);
|
557
423
|
}
|
558
424
|
|
559
425
|
void PickFirst::PickFirstSubchannelData::ProcessUnselectedReadyLocked() {
|
@@ -571,7 +437,7 @@ void PickFirst::PickFirstSubchannelData::ProcessUnselectedReadyLocked() {
|
|
571
437
|
subchannel_list() == p->latest_pending_subchannel_list_.get());
|
572
438
|
// Case 2. Promote p->latest_pending_subchannel_list_ to p->subchannel_list_.
|
573
439
|
if (subchannel_list() == p->latest_pending_subchannel_list_.get()) {
|
574
|
-
if (grpc_lb_pick_first_trace
|
440
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
|
575
441
|
gpr_log(GPR_INFO,
|
576
442
|
"Pick First %p promoting pending subchannel list %p to "
|
577
443
|
"replace %p",
|
@@ -581,40 +447,38 @@ void PickFirst::PickFirstSubchannelData::ProcessUnselectedReadyLocked() {
|
|
581
447
|
p->subchannel_list_ = std::move(p->latest_pending_subchannel_list_);
|
582
448
|
}
|
583
449
|
// Cases 1 and 2.
|
584
|
-
grpc_connectivity_state_set(&p->state_tracker_, GRPC_CHANNEL_READY,
|
585
|
-
GRPC_ERROR_NONE, "subchannel_ready");
|
586
450
|
p->selected_ = this;
|
587
|
-
|
451
|
+
p->channel_control_helper()->UpdateState(
|
452
|
+
GRPC_CHANNEL_READY,
|
453
|
+
UniquePtr<SubchannelPicker>(New<Picker>(connected_subchannel()->Ref())));
|
454
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
|
588
455
|
gpr_log(GPR_INFO, "Pick First %p selected subchannel %p", p, subchannel());
|
589
456
|
}
|
590
|
-
// Update any calls that were waiting for a pick.
|
591
|
-
PickState* pick;
|
592
|
-
while ((pick = p->pending_picks_)) {
|
593
|
-
p->pending_picks_ = pick->next;
|
594
|
-
pick->connected_subchannel = p->selected_->connected_subchannel()->Ref();
|
595
|
-
if (grpc_lb_pick_first_trace.enabled()) {
|
596
|
-
gpr_log(GPR_INFO, "Servicing pending pick with selected subchannel %p",
|
597
|
-
p->selected_->subchannel());
|
598
|
-
}
|
599
|
-
GRPC_CLOSURE_SCHED(pick->on_complete, GRPC_ERROR_NONE);
|
600
|
-
}
|
601
457
|
}
|
602
458
|
|
603
459
|
void PickFirst::PickFirstSubchannelData::
|
604
460
|
CheckConnectivityStateAndStartWatchingLocked() {
|
605
461
|
PickFirst* p = static_cast<PickFirst*>(subchannel_list()->policy());
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
// We must process the READY subchannel before we start watching it.
|
610
|
-
// Otherwise, we won't know it's READY because we will be waiting for its
|
611
|
-
// connectivity state to change from READY.
|
612
|
-
ProcessUnselectedReadyLocked();
|
613
|
-
}
|
614
|
-
GRPC_ERROR_UNREF(error);
|
462
|
+
// Check current state.
|
463
|
+
grpc_connectivity_state current_state = CheckConnectivityStateLocked();
|
464
|
+
// Start watch.
|
615
465
|
StartConnectivityWatchLocked();
|
466
|
+
// If current state is READY, select the subchannel now, since we started
|
467
|
+
// watching from this state and will not get a notification of it
|
468
|
+
// transitioning into this state.
|
469
|
+
// If the current state is not READY, attempt to connect.
|
470
|
+
if (current_state == GRPC_CHANNEL_READY) {
|
471
|
+
if (p->selected_ != this) ProcessUnselectedReadyLocked();
|
472
|
+
} else {
|
473
|
+
subchannel()->AttemptToConnect();
|
474
|
+
}
|
616
475
|
}
|
617
476
|
|
477
|
+
class ParsedPickFirstConfig : public LoadBalancingPolicy::Config {
|
478
|
+
public:
|
479
|
+
const char* name() const override { return kPickFirst; }
|
480
|
+
};
|
481
|
+
|
618
482
|
//
|
619
483
|
// factory
|
620
484
|
//
|
@@ -622,11 +486,20 @@ void PickFirst::PickFirstSubchannelData::
|
|
622
486
|
class PickFirstFactory : public LoadBalancingPolicyFactory {
|
623
487
|
public:
|
624
488
|
OrphanablePtr<LoadBalancingPolicy> CreateLoadBalancingPolicy(
|
625
|
-
|
626
|
-
return OrphanablePtr<LoadBalancingPolicy>(New<PickFirst>(args));
|
489
|
+
LoadBalancingPolicy::Args args) const override {
|
490
|
+
return OrphanablePtr<LoadBalancingPolicy>(New<PickFirst>(std::move(args)));
|
627
491
|
}
|
628
492
|
|
629
493
|
const char* name() const override { return kPickFirst; }
|
494
|
+
|
495
|
+
RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
|
496
|
+
const grpc_json* json, grpc_error** error) const override {
|
497
|
+
if (json != nullptr) {
|
498
|
+
GPR_DEBUG_ASSERT(strcmp(json->key, name()) == 0);
|
499
|
+
}
|
500
|
+
return RefCountedPtr<LoadBalancingPolicy::Config>(
|
501
|
+
New<ParsedPickFirstConfig>());
|
502
|
+
}
|
630
503
|
};
|
631
504
|
|
632
505
|
} // namespace
|