grpc 1.28.0 → 1.31.0.pre2
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 +8314 -11869
- data/include/grpc/grpc.h +2 -2
- data/include/grpc/grpc_security.h +30 -9
- data/include/grpc/grpc_security_constants.h +4 -0
- data/include/grpc/impl/codegen/grpc_types.h +23 -23
- data/include/grpc/impl/codegen/port_platform.h +6 -34
- data/include/grpc/module.modulemap +24 -39
- data/src/core/ext/filters/client_channel/backend_metric.cc +18 -12
- data/src/core/ext/filters/client_channel/client_channel.cc +591 -479
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +3 -2
- data/src/core/ext/filters/client_channel/config_selector.cc +62 -0
- data/src/core/ext/filters/client_channel/config_selector.h +93 -0
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +24 -2
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +9 -22
- data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +6 -5
- data/src/core/ext/filters/client_channel/http_proxy.cc +23 -14
- data/src/core/ext/filters/client_channel/lb_policy.cc +19 -18
- data/src/core/ext/filters/client_channel/lb_policy.h +44 -33
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +83 -0
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +99 -0
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +10 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +279 -324
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +89 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +40 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +11 -9
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +3 -2
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +871 -0
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +9 -17
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +733 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +84 -37
- data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +938 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/lrs.cc +528 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +1 -2
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +1143 -0
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +10 -7
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +2 -1
- data/src/core/ext/filters/client_channel/parse_address.cc +22 -21
- data/src/core/ext/filters/client_channel/resolver.cc +5 -8
- data/src/core/ext/filters/client_channel/resolver.h +12 -14
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +78 -61
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +41 -40
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +8 -7
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +22 -24
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +12 -10
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +79 -122
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +199 -163
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +5 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +7 -4
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +46 -45
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +93 -102
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +0 -4
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +38 -8
- data/src/core/ext/filters/client_channel/resolver_factory.h +2 -2
- data/src/core/ext/filters/client_channel/resolver_registry.cc +19 -17
- data/src/core/ext/filters/client_channel/resolver_registry.h +8 -8
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +21 -22
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +19 -16
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +49 -55
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +43 -23
- data/src/core/ext/filters/client_channel/server_address.cc +6 -9
- data/src/core/ext/filters/client_channel/server_address.h +6 -12
- data/src/core/ext/filters/client_channel/service_config.cc +104 -144
- data/src/core/ext/filters/client_channel/service_config.h +28 -98
- data/src/core/ext/filters/client_channel/service_config_call_data.h +68 -0
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +142 -0
- data/src/core/ext/filters/client_channel/service_config_parser.cc +87 -0
- data/src/core/ext/filters/client_channel/service_config_parser.h +89 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +55 -25
- data/src/core/ext/filters/client_channel/subchannel.h +35 -11
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +565 -234
- data/src/core/ext/filters/client_channel/xds/xds_api.h +102 -37
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +55 -71
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +4 -3
- data/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +4 -2
- data/src/core/ext/filters/client_channel/xds/xds_client.cc +619 -347
- data/src/core/ext/filters/client_channel/xds/xds_client.h +57 -22
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.cc +11 -12
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +40 -28
- data/src/core/ext/filters/http/client/http_client_filter.cc +28 -33
- data/src/core/ext/filters/http/client_authority_filter.cc +4 -4
- data/src/core/ext/filters/http/http_filters_plugin.cc +28 -12
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +258 -221
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +399 -0
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.h +31 -0
- data/src/core/ext/filters/message_size/message_size_filter.cc +61 -88
- data/src/core/ext/filters/message_size/message_size_filter.h +10 -4
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +386 -350
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +6 -2
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +1 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +7 -13
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +7 -8
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +4 -6
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +42 -26
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +25 -30
- data/src/core/ext/transport/chttp2/transport/flow_control.h +14 -16
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +9 -12
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +4 -6
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -6
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +12 -13
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +6 -7
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +9 -12
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +29 -16
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +25 -29
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +13 -17
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +2 -2
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +4 -5
- data/src/core/ext/transport/chttp2/transport/huffsyms.h +2 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +27 -21
- data/src/core/ext/transport/chttp2/transport/parsing.cc +33 -43
- data/src/core/ext/transport/chttp2/transport/stream_map.h +2 -3
- data/src/core/ext/transport/chttp2/transport/writing.cc +24 -22
- data/src/core/ext/transport/inproc/inproc_transport.cc +54 -15
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +3 -4
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +4 -229
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +5 -876
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.c +114 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +429 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.c +72 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +198 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.c +105 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +388 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +23 -10
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +352 -310
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +42 -34
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +7 -7
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +79 -61
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +2 -1
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +55 -49
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +79 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +48 -27
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +258 -214
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +51 -45
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +71 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +2 -1
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +107 -100
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +24 -20
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +157 -122
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +9 -9
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +38 -18
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +173 -73
- data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +88 -0
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +2 -1
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +95 -101
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +2 -1
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +49 -65
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +9 -6
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +53 -38
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +70 -62
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +15 -10
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +95 -63
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +3 -2
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +91 -80
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +9 -10
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +36 -31
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +68 -46
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +770 -722
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +16 -15
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +2 -1
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +95 -88
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +48 -28
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +305 -210
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +5 -5
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.c +51 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +125 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +4 -2
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +22 -16
- data/src/core/ext/upb-generated/envoy/type/http.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/http.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +16 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +48 -11
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +14 -14
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +23 -23
- data/src/core/ext/upb-generated/envoy/type/percent.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/percent.upb.h +8 -9
- data/src/core/ext/upb-generated/envoy/type/range.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/range.upb.h +15 -16
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +7 -8
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +36 -35
- data/src/core/ext/upb-generated/gogoproto/gogo.upb.h +0 -1
- data/src/core/ext/upb-generated/google/api/annotations.upb.h +0 -1
- data/src/core/ext/upb-generated/google/api/http.upb.h +29 -28
- data/src/core/ext/upb-generated/google/protobuf/any.upb.h +5 -6
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +12 -11
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +421 -389
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +5 -6
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +1 -2
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +33 -54
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +5 -6
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +27 -28
- data/src/core/ext/upb-generated/google/rpc/status.upb.h +8 -8
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +1 -1
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +32 -45
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +4 -4
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +157 -178
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +14 -13
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +6 -7
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +59 -56
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +11 -12
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +0 -1
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +28 -0
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +64 -0
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +6 -6
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +41 -68
- data/src/core/ext/upb-generated/validate/validate.upb.c +21 -20
- data/src/core/ext/upb-generated/validate/validate.upb.h +569 -562
- data/src/core/lib/channel/channel_args.cc +15 -14
- data/src/core/lib/channel/channel_args.h +3 -1
- data/src/core/lib/channel/channel_stack.h +20 -13
- data/src/core/lib/channel/channel_trace.cc +2 -6
- data/src/core/lib/channel/channelz.cc +10 -21
- data/src/core/lib/channel/channelz.h +3 -2
- data/src/core/lib/channel/channelz_registry.cc +5 -3
- data/src/core/lib/channel/connected_channel.cc +7 -5
- data/src/core/lib/channel/context.h +1 -1
- data/src/core/lib/channel/handshaker.cc +11 -13
- data/src/core/lib/channel/handshaker.h +4 -2
- data/src/core/lib/channel/handshaker_registry.cc +5 -17
- data/src/core/lib/channel/status_util.cc +2 -3
- data/src/core/lib/compression/message_compress.cc +5 -1
- data/src/core/lib/debug/stats.cc +21 -27
- data/src/core/lib/debug/stats.h +3 -1
- data/src/core/lib/gpr/log_linux.cc +6 -8
- data/src/core/lib/gpr/log_posix.cc +6 -8
- data/src/core/lib/gpr/spinlock.h +2 -3
- data/src/core/lib/gpr/string.cc +10 -33
- data/src/core/lib/gpr/string.h +4 -18
- data/src/core/lib/gpr/sync_abseil.cc +2 -0
- data/src/core/lib/gpr/time.cc +4 -0
- data/src/core/lib/gpr/time_posix.cc +1 -1
- data/src/core/lib/gprpp/atomic.h +6 -6
- data/src/core/lib/gprpp/fork.cc +1 -1
- data/src/core/lib/gprpp/global_config_env.cc +8 -6
- data/src/core/lib/gprpp/host_port.cc +29 -35
- data/src/core/lib/gprpp/host_port.h +14 -17
- data/src/core/lib/gprpp/map.h +5 -11
- data/src/core/lib/gprpp/ref_counted_ptr.h +5 -0
- data/src/core/lib/http/format_request.cc +46 -65
- data/src/core/lib/http/httpcli.cc +15 -13
- data/src/core/lib/http/httpcli.h +2 -3
- data/src/core/lib/http/httpcli_security_connector.cc +10 -10
- data/src/core/lib/http/parser.h +2 -3
- data/src/core/lib/iomgr/buffer_list.h +22 -21
- data/src/core/lib/iomgr/call_combiner.h +3 -2
- data/src/core/lib/iomgr/cfstream_handle.cc +4 -2
- data/src/core/lib/iomgr/closure.h +2 -3
- data/src/core/lib/iomgr/dualstack_socket_posix.cc +47 -0
- data/src/core/lib/iomgr/endpoint_cfstream.cc +2 -3
- data/src/core/lib/iomgr/endpoint_pair.h +2 -3
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +10 -10
- data/src/core/lib/iomgr/error.cc +6 -9
- data/src/core/lib/iomgr/error.h +0 -1
- data/src/core/lib/iomgr/error_cfstream.cc +9 -8
- data/src/core/lib/iomgr/ev_apple.cc +356 -0
- data/src/core/lib/iomgr/ev_apple.h +43 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +25 -29
- data/src/core/lib/iomgr/ev_epollex_linux.cc +17 -24
- data/src/core/lib/iomgr/ev_poll_posix.cc +9 -8
- data/src/core/lib/iomgr/ev_posix.cc +4 -3
- data/src/core/lib/iomgr/exec_ctx.h +14 -2
- data/src/core/lib/iomgr/iomgr.cc +10 -0
- data/src/core/lib/iomgr/iomgr.h +10 -0
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +84 -20
- data/src/core/lib/iomgr/is_epollexclusive_available.cc +14 -0
- data/src/core/lib/iomgr/pollset_set_custom.cc +10 -10
- data/src/core/lib/{gprpp/optional.h → iomgr/pollset_uv.h} +11 -12
- data/src/core/lib/iomgr/port.h +2 -21
- data/src/core/lib/iomgr/python_util.h +46 -0
- data/src/core/lib/iomgr/resolve_address.h +4 -6
- data/src/core/lib/iomgr/resolve_address_custom.cc +42 -57
- data/src/core/lib/iomgr/resolve_address_custom.h +4 -2
- data/src/core/lib/iomgr/resolve_address_posix.cc +10 -11
- data/src/core/lib/iomgr/resolve_address_windows.cc +16 -25
- data/src/core/lib/iomgr/resource_quota.cc +38 -37
- data/src/core/lib/iomgr/sockaddr_utils.cc +29 -33
- data/src/core/lib/iomgr/sockaddr_utils.h +10 -15
- data/src/core/lib/iomgr/socket_factory_posix.h +2 -3
- data/src/core/lib/iomgr/socket_mutator.h +2 -3
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +102 -81
- data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
- data/src/core/lib/iomgr/socket_windows.cc +4 -5
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +14 -18
- data/src/core/lib/iomgr/tcp_client_custom.cc +6 -9
- data/src/core/lib/iomgr/tcp_client_posix.cc +30 -36
- data/src/core/lib/iomgr/tcp_client_windows.cc +10 -11
- data/src/core/lib/iomgr/tcp_custom.cc +3 -4
- data/src/core/lib/iomgr/tcp_custom.h +1 -1
- data/src/core/lib/iomgr/tcp_server.cc +3 -4
- data/src/core/lib/iomgr/tcp_server.h +7 -5
- data/src/core/lib/iomgr/tcp_server_custom.cc +11 -23
- data/src/core/lib/iomgr/tcp_server_posix.cc +38 -44
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -4
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +7 -8
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +10 -18
- data/src/core/lib/iomgr/tcp_server_windows.cc +16 -16
- data/src/core/lib/iomgr/tcp_uv.cc +3 -2
- data/src/core/lib/iomgr/time_averaged_stats.h +2 -3
- data/src/core/lib/iomgr/timer_generic.cc +15 -15
- data/src/core/lib/{gprpp/inlined_vector.h → iomgr/timer_generic.h} +19 -17
- data/src/core/lib/iomgr/timer_heap.h +2 -3
- data/src/core/lib/iomgr/udp_server.cc +32 -36
- data/src/core/lib/iomgr/udp_server.h +5 -2
- data/src/core/lib/iomgr/unix_sockets_posix.cc +9 -14
- data/src/core/lib/iomgr/unix_sockets_posix.h +3 -1
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +5 -2
- data/src/core/lib/json/json.h +3 -2
- data/src/core/lib/json/json_reader.cc +25 -26
- data/src/core/lib/json/json_writer.cc +13 -12
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +12 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.h +6 -3
- data/src/core/lib/security/credentials/credentials.cc +0 -84
- data/src/core/lib/security/credentials/credentials.h +13 -62
- data/src/core/lib/security/credentials/fake/fake_credentials.h +4 -0
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +8 -6
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +15 -17
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +8 -6
- data/src/core/lib/security/credentials/iam/iam_credentials.h +4 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
- data/src/core/lib/security/credentials/jwt/json_token.h +2 -5
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +7 -4
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +12 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +8 -15
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -3
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +73 -54
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +9 -3
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +19 -6
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +20 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +10 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +23 -13
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +48 -11
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +21 -6
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +17 -17
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +3 -2
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +1 -1
- data/src/core/lib/security/security_connector/security_connector.cc +2 -0
- data/src/core/lib/security/security_connector/security_connector.h +2 -2
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +38 -36
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +8 -5
- data/src/core/lib/security/security_connector/ssl_utils.cc +89 -21
- data/src/core/lib/security/security_connector/ssl_utils.h +18 -12
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +101 -72
- data/src/core/lib/security/security_connector/tls/tls_security_connector.h +27 -5
- data/src/core/lib/security/transport/auth_filters.h +0 -5
- data/src/core/lib/security/transport/client_auth_filter.cc +11 -11
- data/src/core/lib/security/util/json_util.cc +12 -13
- data/src/core/lib/slice/slice.cc +38 -1
- data/src/core/lib/slice/slice_intern.cc +2 -3
- data/src/core/lib/slice/slice_internal.h +15 -0
- data/src/core/lib/slice/slice_utils.h +9 -0
- data/src/core/lib/surface/byte_buffer_reader.cc +2 -47
- data/src/core/lib/surface/call.cc +42 -44
- data/src/core/lib/surface/call_log_batch.cc +50 -58
- data/src/core/lib/surface/channel.cc +53 -31
- data/src/core/lib/surface/channel.h +35 -4
- data/src/core/lib/surface/channel_ping.cc +2 -3
- data/src/core/lib/surface/completion_queue.cc +304 -47
- data/src/core/lib/surface/completion_queue.h +8 -0
- data/src/core/lib/surface/event_string.cc +18 -25
- data/src/core/lib/surface/event_string.h +3 -1
- data/src/core/lib/surface/init.cc +2 -0
- data/src/core/lib/surface/init_secure.cc +1 -4
- data/src/core/lib/surface/server.cc +971 -837
- data/src/core/lib/surface/server.h +66 -12
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/byte_stream.h +7 -2
- data/src/core/lib/transport/connectivity_state.cc +7 -6
- data/src/core/lib/transport/connectivity_state.h +5 -3
- data/src/core/lib/transport/metadata.cc +3 -3
- data/src/core/lib/transport/metadata_batch.h +2 -3
- data/src/core/lib/transport/static_metadata.h +1 -1
- data/src/core/lib/transport/status_conversion.cc +6 -14
- data/src/core/lib/transport/transport.cc +2 -3
- data/src/core/lib/transport/transport.h +9 -2
- data/src/core/lib/transport/transport_op_string.cc +61 -102
- data/src/core/lib/uri/uri_parser.cc +8 -15
- data/src/core/lib/uri/uri_parser.h +2 -3
- data/src/core/plugin_registry/grpc_plugin_registry.cc +24 -4
- data/src/core/tsi/alts/crypt/aes_gcm.cc +0 -2
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +31 -14
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +8 -4
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +34 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +9 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +2 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h +2 -3
- data/src/core/tsi/fake_transport_security.cc +10 -15
- data/src/core/tsi/ssl/session_cache/ssl_session.h +0 -2
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +0 -2
- data/src/core/tsi/ssl_transport_security.cc +154 -50
- data/src/core/tsi/ssl_transport_security.h +22 -10
- data/src/core/tsi/ssl_types.h +0 -2
- data/src/core/tsi/transport_security.h +6 -9
- data/src/core/tsi/transport_security_grpc.h +2 -3
- data/src/core/tsi/transport_security_interface.h +8 -3
- data/src/ruby/ext/grpc/extconf.rb +5 -2
- data/src/ruby/ext/grpc/rb_call.c +12 -3
- data/src/ruby/ext/grpc/rb_call.h +4 -0
- data/src/ruby/ext/grpc/rb_call_credentials.c +57 -12
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
- data/src/ruby/lib/grpc/errors.rb +103 -42
- data/src/ruby/lib/grpc/generic/active_call.rb +2 -3
- data/src/ruby/lib/grpc/generic/interceptors.rb +5 -5
- data/src/ruby/lib/grpc/generic/rpc_server.rb +9 -10
- data/src/ruby/lib/grpc/generic/service.rb +5 -4
- data/src/ruby/lib/grpc/structs.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/generate_proto_ruby.sh +5 -3
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +11 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +16 -0
- data/src/ruby/spec/debug_message_spec.rb +134 -0
- data/src/ruby/spec/generic/service_spec.rb +2 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import2.proto +23 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +7 -0
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +7 -1
- data/src/ruby/spec/support/services.rb +10 -4
- data/src/ruby/spec/testdata/ca.pem +18 -13
- data/src/ruby/spec/testdata/client.key +26 -14
- data/src/ruby/spec/testdata/client.pem +18 -12
- data/src/ruby/spec/testdata/server1.key +26 -14
- data/src/ruby/spec/testdata/server1.pem +20 -14
- data/third_party/abseil-cpp/absl/time/civil_time.cc +175 -0
- data/third_party/abseil-cpp/absl/time/civil_time.h +538 -0
- data/third_party/abseil-cpp/absl/time/clock.cc +569 -0
- data/third_party/abseil-cpp/absl/time/clock.h +74 -0
- data/third_party/abseil-cpp/absl/time/duration.cc +922 -0
- data/third_party/abseil-cpp/absl/time/format.cc +153 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time.h +332 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +622 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +384 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/zone_info_source.h +102 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc +94 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc +140 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.h +52 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +922 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc +45 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h +76 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc +121 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h +93 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +958 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h +138 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +308 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h +55 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +187 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc +159 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.h +132 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +122 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +115 -0
- data/third_party/abseil-cpp/absl/time/internal/get_current_time_chrono.inc +31 -0
- data/third_party/abseil-cpp/absl/time/internal/get_current_time_posix.inc +24 -0
- data/third_party/abseil-cpp/absl/time/time.cc +499 -0
- data/third_party/abseil-cpp/absl/time/time.h +1584 -0
- data/third_party/boringssl-with-bazel/err_data.c +335 -297
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bitstr.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_enum.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_int.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_type.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn_pack.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_enum.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_int.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_string.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/derive_key.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/tls_cbc.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu-arm-linux.c +7 -5
- data/third_party/boringssl-with-bazel/src/crypto/cpu-intel.c +13 -4
- data/third_party/boringssl-with-bazel/src/crypto/crypto.c +11 -0
- data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/curve25519.c +18 -26
- data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/curve25519_tables.h +13 -21
- data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/internal.h +14 -22
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/spake25519.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/dh/dh.c +15 -0
- data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +10 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +385 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +56 -0
- data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/ecdh_extra.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/err/err.c +33 -32
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +143 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes_nohw.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/mode_wrappers.c +17 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/exponentiation.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +25 -12
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.c +8 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/mul.c +30 -154
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digests.c +16 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +289 -117
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +13 -27
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +96 -55
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/felem.c +25 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +434 -161
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +63 -71
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +18 -25
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64-table.h +9481 -9485
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64.c +104 -122
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +740 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +297 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +90 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +125 -148
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +189 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/util.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +61 -18
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +20 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +137 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.h +49 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/getrandom_fillin.h +64 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +41 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +32 -17
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +24 -114
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/blinding.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +51 -38
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +15 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +62 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +44 -35
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +47 -16
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +15 -1
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +7 -0
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +36 -5
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +6 -10
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +16 -0
- data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/thread_win.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +249 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +1227 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +682 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/a_strex.c +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/algorithm.c +8 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.c +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509.c +0 -67
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +13 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +10 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +57 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +4 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +33 -9
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +25 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +4 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +35 -13
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +0 -154
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +28 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +74 -35
- data/third_party/boringssl-with-bazel/src/include/openssl/aes.h +16 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +22 -22
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +6 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +9 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +20 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +1 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +16 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +6 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/err.h +2 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +69 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +5 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +3 -17
- data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +31 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/sha.h +26 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +191 -79
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +1 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +282 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +791 -715
- data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +1 -0
- data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +0 -4
- data/third_party/boringssl-with-bazel/src/ssl/d1_lib.cc +3 -3
- data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +13 -4
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +146 -57
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +23 -5
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +30 -22
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +21 -4
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +74 -54
- data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +10 -10
- data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +21 -21
- data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +29 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +4 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +34 -1
- data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +13 -2
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +44 -5
- data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +6 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +5 -5
- data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +51 -26
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +47 -53
- data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +1 -1
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +129 -48
- data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +23 -75
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +55 -22
- data/third_party/boringssl-with-bazel/src/ssl/tls_method.cc +63 -25
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_32.h +245 -175
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64.h +135 -75
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_32.h +1593 -1672
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64.h +512 -503
- data/third_party/re2/re2/bitmap256.h +117 -0
- data/third_party/re2/re2/bitstate.cc +385 -0
- data/third_party/re2/re2/compile.cc +1279 -0
- data/third_party/re2/re2/dfa.cc +2130 -0
- data/third_party/re2/re2/filtered_re2.cc +121 -0
- data/third_party/re2/re2/filtered_re2.h +109 -0
- data/third_party/re2/re2/mimics_pcre.cc +197 -0
- data/third_party/re2/re2/nfa.cc +713 -0
- data/third_party/re2/re2/onepass.cc +623 -0
- data/third_party/re2/re2/parse.cc +2464 -0
- data/third_party/re2/re2/perl_groups.cc +119 -0
- data/third_party/re2/re2/pod_array.h +55 -0
- data/third_party/re2/re2/prefilter.cc +710 -0
- data/third_party/re2/re2/prefilter.h +108 -0
- data/third_party/re2/re2/prefilter_tree.cc +407 -0
- data/third_party/re2/re2/prefilter_tree.h +139 -0
- data/third_party/re2/re2/prog.cc +988 -0
- data/third_party/re2/re2/prog.h +436 -0
- data/third_party/re2/re2/re2.cc +1362 -0
- data/third_party/re2/re2/re2.h +1002 -0
- data/third_party/re2/re2/regexp.cc +980 -0
- data/third_party/re2/re2/regexp.h +659 -0
- data/third_party/re2/re2/set.cc +154 -0
- data/third_party/re2/re2/set.h +80 -0
- data/third_party/re2/re2/simplify.cc +657 -0
- data/third_party/re2/re2/sparse_array.h +392 -0
- data/third_party/re2/re2/sparse_set.h +264 -0
- data/third_party/re2/re2/stringpiece.cc +65 -0
- data/third_party/re2/re2/stringpiece.h +210 -0
- data/third_party/re2/re2/tostring.cc +351 -0
- data/third_party/re2/re2/unicode_casefold.cc +582 -0
- data/third_party/re2/re2/unicode_casefold.h +78 -0
- data/third_party/re2/re2/unicode_groups.cc +6269 -0
- data/third_party/re2/re2/unicode_groups.h +67 -0
- data/third_party/re2/re2/walker-inl.h +246 -0
- data/third_party/re2/util/benchmark.h +156 -0
- data/third_party/re2/util/flags.h +26 -0
- data/third_party/re2/util/logging.h +109 -0
- data/third_party/re2/util/malloc_counter.h +19 -0
- data/third_party/re2/util/mix.h +41 -0
- data/third_party/re2/util/mutex.h +148 -0
- data/third_party/re2/util/pcre.cc +1025 -0
- data/third_party/re2/util/pcre.h +681 -0
- data/third_party/re2/util/rune.cc +260 -0
- data/third_party/re2/util/strutil.cc +149 -0
- data/third_party/re2/util/strutil.h +21 -0
- data/third_party/re2/util/test.h +50 -0
- data/third_party/re2/util/utf.h +44 -0
- data/third_party/re2/util/util.h +42 -0
- data/third_party/upb/upb/decode.c +467 -504
- data/third_party/upb/upb/encode.c +163 -121
- data/third_party/upb/upb/msg.c +130 -64
- data/third_party/upb/upb/msg.h +418 -14
- data/third_party/upb/upb/port_def.inc +35 -6
- data/third_party/upb/upb/port_undef.inc +8 -1
- data/third_party/upb/upb/table.c +53 -75
- data/third_party/upb/upb/table.int.h +11 -43
- data/third_party/upb/upb/upb.c +148 -124
- data/third_party/upb/upb/upb.h +65 -147
- data/third_party/upb/upb/upb.hpp +86 -0
- metadata +175 -47
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +0 -1754
- data/src/core/lib/gprpp/string_view.h +0 -60
- data/src/core/tsi/grpc_shadow_boringssl.h +0 -3311
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256.c +0 -1063
- data/third_party/upb/upb/generated_util.h +0 -105
@@ -22,6 +22,8 @@
|
|
22
22
|
|
23
23
|
#include <string.h>
|
24
24
|
|
25
|
+
#include "absl/container/inlined_vector.h"
|
26
|
+
|
25
27
|
#include <grpc/grpc_security.h>
|
26
28
|
#include <grpc/support/alloc.h>
|
27
29
|
#include <grpc/support/string_util.h>
|
@@ -39,8 +41,8 @@
|
|
39
41
|
namespace grpc_core {
|
40
42
|
|
41
43
|
grpc_channel_args* ModifyXdsChannelArgs(grpc_channel_args* args) {
|
42
|
-
InlinedVector<const char*, 1> args_to_remove;
|
43
|
-
InlinedVector<grpc_arg, 2> args_to_add;
|
44
|
+
absl::InlinedVector<const char*, 1> args_to_remove;
|
45
|
+
absl::InlinedVector<grpc_arg, 2> args_to_add;
|
44
46
|
// Substitute the channel credentials with a version without call
|
45
47
|
// credentials: the load balancer is not necessarily trusted to handle
|
46
48
|
// bearer token credentials.
|
@@ -22,12 +22,14 @@
|
|
22
22
|
#include <limits.h>
|
23
23
|
#include <string.h>
|
24
24
|
|
25
|
+
#include "absl/container/inlined_vector.h"
|
26
|
+
#include "absl/strings/str_format.h"
|
25
27
|
#include "absl/strings/str_join.h"
|
28
|
+
#include "absl/strings/string_view.h"
|
26
29
|
|
27
30
|
#include <grpc/byte_buffer_reader.h>
|
28
31
|
#include <grpc/grpc.h>
|
29
32
|
#include <grpc/support/alloc.h>
|
30
|
-
#include <grpc/support/string_util.h>
|
31
33
|
#include <grpc/support/time.h>
|
32
34
|
|
33
35
|
#include "src/core/ext/filters/client_channel/client_channel.h"
|
@@ -48,10 +50,10 @@
|
|
48
50
|
#include "src/core/lib/gprpp/orphanable.h"
|
49
51
|
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
50
52
|
#include "src/core/lib/gprpp/sync.h"
|
51
|
-
#include "src/core/lib/iomgr/combiner.h"
|
52
53
|
#include "src/core/lib/iomgr/sockaddr.h"
|
53
54
|
#include "src/core/lib/iomgr/sockaddr_utils.h"
|
54
55
|
#include "src/core/lib/iomgr/timer.h"
|
56
|
+
#include "src/core/lib/iomgr/work_serializer.h"
|
55
57
|
#include "src/core/lib/slice/slice_hash_table.h"
|
56
58
|
#include "src/core/lib/slice/slice_internal.h"
|
57
59
|
#include "src/core/lib/slice/slice_string_helpers.h"
|
@@ -95,7 +97,7 @@ class XdsClient::ChannelState::RetryableCall
|
|
95
97
|
void StartNewCallLocked();
|
96
98
|
void StartRetryTimerLocked();
|
97
99
|
static void OnRetryTimer(void* arg, grpc_error* error);
|
98
|
-
|
100
|
+
void OnRetryTimerLocked(grpc_error* error);
|
99
101
|
|
100
102
|
// The wrapped xds call that talks to the xds server. It's instantiated
|
101
103
|
// every time we start a new call. It's null during call retry backoff.
|
@@ -169,51 +171,46 @@ class XdsClient::ChannelState::AdsCallState
|
|
169
171
|
private:
|
170
172
|
static void OnTimer(void* arg, grpc_error* error) {
|
171
173
|
ResourceState* self = static_cast<ResourceState*>(arg);
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
GRPC_ERROR_REF(error));
|
174
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
175
|
+
self->ads_calld_->xds_client()->work_serializer_->Run(
|
176
|
+
[self, error]() { self->OnTimerLocked(error); }, DEBUG_LOCATION);
|
176
177
|
}
|
177
178
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
self->type_url_.c_str(), self->name_.c_str());
|
187
|
-
grpc_error* error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
188
|
-
gpr_free(msg);
|
179
|
+
void OnTimerLocked(grpc_error* error) {
|
180
|
+
if (error == GRPC_ERROR_NONE && timer_pending_) {
|
181
|
+
timer_pending_ = false;
|
182
|
+
grpc_error* watcher_error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
183
|
+
absl::StrFormat(
|
184
|
+
"timeout obtaining resource {type=%s name=%s} from xds server",
|
185
|
+
type_url_, name_)
|
186
|
+
.c_str());
|
189
187
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
190
|
-
gpr_log(GPR_INFO, "[xds_client %p] %s",
|
191
|
-
|
188
|
+
gpr_log(GPR_INFO, "[xds_client %p] %s", ads_calld_->xds_client(),
|
189
|
+
grpc_error_string(watcher_error));
|
192
190
|
}
|
193
|
-
if (
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
} else if (
|
198
|
-
ClusterState& state =
|
199
|
-
self->ads_calld_->xds_client()->cluster_map_[self->name_];
|
191
|
+
if (type_url_ == XdsApi::kLdsTypeUrl ||
|
192
|
+
type_url_ == XdsApi::kRdsTypeUrl) {
|
193
|
+
ads_calld_->xds_client()->service_config_watcher_->OnError(
|
194
|
+
watcher_error);
|
195
|
+
} else if (type_url_ == XdsApi::kCdsTypeUrl) {
|
196
|
+
ClusterState& state = ads_calld_->xds_client()->cluster_map_[name_];
|
200
197
|
for (const auto& p : state.watchers) {
|
201
|
-
p.first->OnError(GRPC_ERROR_REF(
|
198
|
+
p.first->OnError(GRPC_ERROR_REF(watcher_error));
|
202
199
|
}
|
203
|
-
GRPC_ERROR_UNREF(
|
204
|
-
} else if (
|
205
|
-
EndpointState& state =
|
206
|
-
self->ads_calld_->xds_client()->endpoint_map_[self->name_];
|
200
|
+
GRPC_ERROR_UNREF(watcher_error);
|
201
|
+
} else if (type_url_ == XdsApi::kEdsTypeUrl) {
|
202
|
+
EndpointState& state = ads_calld_->xds_client()->endpoint_map_[name_];
|
207
203
|
for (const auto& p : state.watchers) {
|
208
|
-
p.first->OnError(GRPC_ERROR_REF(
|
204
|
+
p.first->OnError(GRPC_ERROR_REF(watcher_error));
|
209
205
|
}
|
210
|
-
GRPC_ERROR_UNREF(
|
206
|
+
GRPC_ERROR_UNREF(watcher_error);
|
211
207
|
} else {
|
212
208
|
GPR_UNREACHABLE_CODE(return );
|
213
209
|
}
|
214
210
|
}
|
215
|
-
|
216
|
-
|
211
|
+
ads_calld_.reset();
|
212
|
+
Unref();
|
213
|
+
GRPC_ERROR_UNREF(error);
|
217
214
|
}
|
218
215
|
|
219
216
|
const std::string type_url_;
|
@@ -247,16 +244,16 @@ class XdsClient::ChannelState::AdsCallState
|
|
247
244
|
void AcceptEdsUpdate(XdsApi::EdsUpdateMap eds_update_map);
|
248
245
|
|
249
246
|
static void OnRequestSent(void* arg, grpc_error* error);
|
250
|
-
|
247
|
+
void OnRequestSentLocked(grpc_error* error);
|
251
248
|
static void OnResponseReceived(void* arg, grpc_error* error);
|
252
|
-
|
249
|
+
void OnResponseReceivedLocked();
|
253
250
|
static void OnStatusReceived(void* arg, grpc_error* error);
|
254
|
-
|
251
|
+
void OnStatusReceivedLocked(grpc_error* error);
|
255
252
|
|
256
253
|
bool IsCurrentCallOnChannel() const;
|
257
254
|
|
258
|
-
std::set<
|
259
|
-
|
255
|
+
std::set<absl::string_view> ResourceNamesForRequest(
|
256
|
+
const std::string& type_url);
|
260
257
|
|
261
258
|
// The owning RetryableCall<>.
|
262
259
|
RefCountedPtr<RetryableCall<AdsCallState>> parent_;
|
@@ -314,6 +311,10 @@ class XdsClient::ChannelState::LrsCallState
|
|
314
311
|
public:
|
315
312
|
Reporter(RefCountedPtr<LrsCallState> parent, grpc_millis report_interval)
|
316
313
|
: parent_(std::move(parent)), report_interval_(report_interval) {
|
314
|
+
GRPC_CLOSURE_INIT(&on_next_report_timer_, OnNextReportTimer, this,
|
315
|
+
grpc_schedule_on_exec_ctx);
|
316
|
+
GRPC_CLOSURE_INIT(&on_report_done_, OnReportDone, this,
|
317
|
+
grpc_schedule_on_exec_ctx);
|
317
318
|
ScheduleNextReportLocked();
|
318
319
|
}
|
319
320
|
|
@@ -322,10 +323,10 @@ class XdsClient::ChannelState::LrsCallState
|
|
322
323
|
private:
|
323
324
|
void ScheduleNextReportLocked();
|
324
325
|
static void OnNextReportTimer(void* arg, grpc_error* error);
|
325
|
-
|
326
|
+
void OnNextReportTimerLocked(grpc_error* error);
|
326
327
|
void SendReportLocked();
|
327
328
|
static void OnReportDone(void* arg, grpc_error* error);
|
328
|
-
|
329
|
+
void OnReportDoneLocked(grpc_error* error);
|
329
330
|
|
330
331
|
bool IsCurrentReporterOnCall() const {
|
331
332
|
return this == parent_->reporter_.get();
|
@@ -345,11 +346,11 @@ class XdsClient::ChannelState::LrsCallState
|
|
345
346
|
};
|
346
347
|
|
347
348
|
static void OnInitialRequestSent(void* arg, grpc_error* error);
|
349
|
+
void OnInitialRequestSentLocked();
|
348
350
|
static void OnResponseReceived(void* arg, grpc_error* error);
|
351
|
+
void OnResponseReceivedLocked();
|
349
352
|
static void OnStatusReceived(void* arg, grpc_error* error);
|
350
|
-
|
351
|
-
static void OnResponseReceivedLocked(void* arg, grpc_error* error);
|
352
|
-
static void OnStatusReceivedLocked(void* arg, grpc_error* error);
|
353
|
+
void OnStatusReceivedLocked(grpc_error* error);
|
353
354
|
|
354
355
|
bool IsCurrentCallOnChannel() const;
|
355
356
|
|
@@ -378,6 +379,7 @@ class XdsClient::ChannelState::LrsCallState
|
|
378
379
|
grpc_closure on_status_received_;
|
379
380
|
|
380
381
|
// Load reporting state.
|
382
|
+
bool send_all_clusters_ = false;
|
381
383
|
std::set<std::string> cluster_names_; // Asked for by the LRS server.
|
382
384
|
grpc_millis load_reporting_interval_ = 0;
|
383
385
|
OrphanablePtr<Reporter> reporter_;
|
@@ -391,7 +393,8 @@ class XdsClient::ChannelState::StateWatcher
|
|
391
393
|
: public AsyncConnectivityStateWatcherInterface {
|
392
394
|
public:
|
393
395
|
explicit StateWatcher(RefCountedPtr<ChannelState> parent)
|
394
|
-
: AsyncConnectivityStateWatcherInterface(
|
396
|
+
: AsyncConnectivityStateWatcherInterface(
|
397
|
+
parent->xds_client()->work_serializer_),
|
395
398
|
parent_(std::move(parent)) {}
|
396
399
|
|
397
400
|
private:
|
@@ -444,7 +447,7 @@ grpc_channel_args* BuildXdsChannelArgs(const grpc_channel_args& args) {
|
|
444
447
|
GRPC_ARG_KEEPALIVE_TIME_MS,
|
445
448
|
};
|
446
449
|
// Channel args to add.
|
447
|
-
InlinedVector<grpc_arg, 3> args_to_add;
|
450
|
+
absl::InlinedVector<grpc_arg, 3> args_to_add;
|
448
451
|
// Keepalive interval.
|
449
452
|
args_to_add.emplace_back(grpc_channel_arg_integer_create(
|
450
453
|
const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS), 5000));
|
@@ -580,6 +583,9 @@ XdsClient::ChannelState::RetryableCall<T>::RetryableCall(
|
|
580
583
|
.set_multiplier(GRPC_XDS_RECONNECT_BACKOFF_MULTIPLIER)
|
581
584
|
.set_jitter(GRPC_XDS_RECONNECT_JITTER)
|
582
585
|
.set_max_backoff(GRPC_XDS_RECONNECT_MAX_BACKOFF_SECONDS * 1000)) {
|
586
|
+
// Closure Initialization
|
587
|
+
GRPC_CLOSURE_INIT(&on_retry_timer_, OnRetryTimer, this,
|
588
|
+
grpc_schedule_on_exec_ctx);
|
583
589
|
StartNewCallLocked();
|
584
590
|
}
|
585
591
|
|
@@ -633,8 +639,6 @@ void XdsClient::ChannelState::RetryableCall<T>::StartRetryTimerLocked() {
|
|
633
639
|
chand()->xds_client(), chand(), timeout);
|
634
640
|
}
|
635
641
|
this->Ref(DEBUG_LOCATION, "RetryableCall+retry_timer_start").release();
|
636
|
-
GRPC_CLOSURE_INIT(&on_retry_timer_, OnRetryTimer, this,
|
637
|
-
grpc_schedule_on_exec_ctx);
|
638
642
|
grpc_timer_init(&retry_timer_, next_attempt_time, &on_retry_timer_);
|
639
643
|
retry_timer_callback_pending_ = true;
|
640
644
|
}
|
@@ -643,27 +647,26 @@ template <typename T>
|
|
643
647
|
void XdsClient::ChannelState::RetryableCall<T>::OnRetryTimer(
|
644
648
|
void* arg, grpc_error* error) {
|
645
649
|
RetryableCall* calld = static_cast<RetryableCall*>(arg);
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
GRPC_ERROR_REF(error));
|
650
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
651
|
+
calld->chand_->xds_client()->work_serializer_->Run(
|
652
|
+
[calld, error]() { calld->OnRetryTimerLocked(error); }, DEBUG_LOCATION);
|
650
653
|
}
|
651
654
|
|
652
655
|
template <typename T>
|
653
656
|
void XdsClient::ChannelState::RetryableCall<T>::OnRetryTimerLocked(
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
if (!calld->shutting_down_ && error == GRPC_ERROR_NONE) {
|
657
|
+
grpc_error* error) {
|
658
|
+
retry_timer_callback_pending_ = false;
|
659
|
+
if (!shutting_down_ && error == GRPC_ERROR_NONE) {
|
658
660
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
659
661
|
gpr_log(
|
660
662
|
GPR_INFO,
|
661
663
|
"[xds_client %p] Retry timer fires (chand: %p, retryable call: %p)",
|
662
|
-
|
664
|
+
chand()->xds_client(), chand(), this);
|
663
665
|
}
|
664
|
-
|
666
|
+
StartNewCallLocked();
|
665
667
|
}
|
666
|
-
|
668
|
+
this->Unref(DEBUG_LOCATION, "RetryableCall+retry_timer_done");
|
669
|
+
GRPC_ERROR_UNREF(error);
|
667
670
|
}
|
668
671
|
|
669
672
|
//
|
@@ -798,33 +801,13 @@ void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
|
|
798
801
|
}
|
799
802
|
auto& state = state_map_[type_url];
|
800
803
|
grpc_slice request_payload_slice;
|
801
|
-
std::set<
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
} else if (type_url == XdsApi::kRdsTypeUrl) {
|
809
|
-
resource_names.insert(xds_client()->lds_result_->route_config_name);
|
810
|
-
request_payload_slice = xds_client()->api_.CreateRdsRequest(
|
811
|
-
xds_client()->lds_result_->route_config_name, state.version,
|
812
|
-
state.nonce, GRPC_ERROR_REF(state.error), !sent_initial_message_);
|
813
|
-
state.subscribed_resources[xds_client()->lds_result_->route_config_name]
|
814
|
-
->Start(Ref());
|
815
|
-
} else if (type_url == XdsApi::kCdsTypeUrl) {
|
816
|
-
resource_names = ClusterNamesForRequest();
|
817
|
-
request_payload_slice = xds_client()->api_.CreateCdsRequest(
|
818
|
-
resource_names, state.version, state.nonce, GRPC_ERROR_REF(state.error),
|
819
|
-
!sent_initial_message_);
|
820
|
-
} else if (type_url == XdsApi::kEdsTypeUrl) {
|
821
|
-
resource_names = EdsServiceNamesForRequest();
|
822
|
-
request_payload_slice = xds_client()->api_.CreateEdsRequest(
|
823
|
-
resource_names, state.version, state.nonce, GRPC_ERROR_REF(state.error),
|
824
|
-
!sent_initial_message_);
|
825
|
-
} else {
|
826
|
-
request_payload_slice = xds_client()->api_.CreateUnsupportedTypeNackRequest(
|
827
|
-
type_url, state.nonce, GRPC_ERROR_REF(state.error));
|
804
|
+
std::set<absl::string_view> resource_names =
|
805
|
+
ResourceNamesForRequest(type_url);
|
806
|
+
request_payload_slice = xds_client()->api_.CreateAdsRequest(
|
807
|
+
type_url, resource_names, state.version, state.nonce,
|
808
|
+
GRPC_ERROR_REF(state.error), !sent_initial_message_);
|
809
|
+
if (type_url != XdsApi::kLdsTypeUrl && type_url != XdsApi::kRdsTypeUrl &&
|
810
|
+
type_url != XdsApi::kCdsTypeUrl && type_url != XdsApi::kEdsTypeUrl) {
|
828
811
|
state_map_.erase(type_url);
|
829
812
|
}
|
830
813
|
sent_initial_message_ = true;
|
@@ -889,22 +872,33 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate(
|
|
889
872
|
gpr_log(GPR_INFO,
|
890
873
|
"[xds_client %p] LDS update does not include requested resource",
|
891
874
|
xds_client());
|
892
|
-
xds_client()->
|
893
|
-
|
894
|
-
|
875
|
+
if (xds_client()->lds_result_.has_value() &&
|
876
|
+
!xds_client()->lds_result_->route_config_name.empty()) {
|
877
|
+
Unsubscribe(XdsApi::kRdsTypeUrl,
|
878
|
+
xds_client()->lds_result_->route_config_name,
|
879
|
+
/*delay_unsubscription=*/false);
|
880
|
+
xds_client()->rds_result_.reset();
|
881
|
+
}
|
882
|
+
xds_client()->lds_result_.reset();
|
883
|
+
xds_client()->service_config_watcher_->OnResourceDoesNotExist();
|
895
884
|
return;
|
896
885
|
}
|
897
886
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
898
887
|
gpr_log(GPR_INFO,
|
899
|
-
"[xds_client %p] LDS update received: route_config_name=%s,
|
900
|
-
"cluster_name=%s",
|
888
|
+
"[xds_client %p] LDS update received: route_config_name=%s",
|
901
889
|
xds_client(),
|
902
890
|
(!lds_update->route_config_name.empty()
|
903
891
|
? lds_update->route_config_name.c_str()
|
904
|
-
: "<inlined>")
|
905
|
-
|
906
|
-
|
907
|
-
|
892
|
+
: "<inlined>"));
|
893
|
+
if (lds_update->rds_update.has_value()) {
|
894
|
+
gpr_log(GPR_INFO, "RouteConfiguration contains %" PRIuPTR " routes",
|
895
|
+
lds_update->rds_update.value().routes.size());
|
896
|
+
for (size_t i = 0; i < lds_update->rds_update.value().routes.size();
|
897
|
+
++i) {
|
898
|
+
gpr_log(GPR_INFO, "Route %" PRIuPTR ":\n%s", i,
|
899
|
+
lds_update->rds_update.value().routes[i].ToString().c_str());
|
900
|
+
}
|
901
|
+
}
|
908
902
|
}
|
909
903
|
auto& lds_state = state_map_[XdsApi::kLdsTypeUrl];
|
910
904
|
auto& state = lds_state.subscribed_resources[xds_client()->server_name_];
|
@@ -923,6 +917,7 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate(
|
|
923
917
|
Unsubscribe(
|
924
918
|
XdsApi::kRdsTypeUrl, xds_client()->lds_result_->route_config_name,
|
925
919
|
/*delay_unsubscription=*/!lds_update->route_config_name.empty());
|
920
|
+
xds_client()->rds_result_.reset();
|
926
921
|
}
|
927
922
|
xds_client()->lds_result_ = std::move(lds_update);
|
928
923
|
if (xds_client()->lds_result_->rds_update.has_value()) {
|
@@ -930,7 +925,7 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate(
|
|
930
925
|
// the watcher immediately.
|
931
926
|
RefCountedPtr<ServiceConfig> service_config;
|
932
927
|
grpc_error* error = xds_client()->CreateServiceConfig(
|
933
|
-
xds_client()->lds_result_->rds_update
|
928
|
+
xds_client()->lds_result_->rds_update.value(), &service_config);
|
934
929
|
if (error == GRPC_ERROR_NONE) {
|
935
930
|
xds_client()->service_config_watcher_->OnServiceConfigChanged(
|
936
931
|
std::move(service_config));
|
@@ -950,14 +945,19 @@ void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdate(
|
|
950
945
|
gpr_log(GPR_INFO,
|
951
946
|
"[xds_client %p] RDS update does not include requested resource",
|
952
947
|
xds_client());
|
953
|
-
xds_client()->
|
954
|
-
|
955
|
-
"RDS update does not include requested resource"));
|
948
|
+
xds_client()->rds_result_.reset();
|
949
|
+
xds_client()->service_config_watcher_->OnResourceDoesNotExist();
|
956
950
|
return;
|
957
951
|
}
|
958
952
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
959
|
-
gpr_log(GPR_INFO,
|
960
|
-
xds_client
|
953
|
+
gpr_log(GPR_INFO,
|
954
|
+
"[xds_client %p] RDS update received; RouteConfiguration contains "
|
955
|
+
"%" PRIuPTR " routes",
|
956
|
+
this, rds_update.value().routes.size());
|
957
|
+
for (size_t i = 0; i < rds_update.value().routes.size(); ++i) {
|
958
|
+
gpr_log(GPR_INFO, "Route %" PRIuPTR ":\n%s", i,
|
959
|
+
rds_update.value().routes[i].ToString().c_str());
|
960
|
+
}
|
961
961
|
}
|
962
962
|
auto& rds_state = state_map_[XdsApi::kRdsTypeUrl];
|
963
963
|
auto& state =
|
@@ -977,7 +977,7 @@ void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdate(
|
|
977
977
|
// Notify the watcher.
|
978
978
|
RefCountedPtr<ServiceConfig> service_config;
|
979
979
|
grpc_error* error = xds_client()->CreateServiceConfig(
|
980
|
-
xds_client()->rds_result_
|
980
|
+
xds_client()->rds_result_.value(), &service_config);
|
981
981
|
if (error == GRPC_ERROR_NONE) {
|
982
982
|
xds_client()->service_config_watcher_->OnServiceConfigChanged(
|
983
983
|
std::move(service_config));
|
@@ -1029,20 +1029,20 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
|
|
1029
1029
|
}
|
1030
1030
|
}
|
1031
1031
|
// For any subscribed resource that is not present in the update,
|
1032
|
-
// remove it from the cache and notify watchers
|
1032
|
+
// remove it from the cache and notify watchers that it does not exist.
|
1033
1033
|
for (const auto& p : cds_state.subscribed_resources) {
|
1034
1034
|
const std::string& cluster_name = p.first;
|
1035
1035
|
if (cds_update_map.find(cluster_name) == cds_update_map.end()) {
|
1036
1036
|
ClusterState& cluster_state = xds_client()->cluster_map_[cluster_name];
|
1037
1037
|
cluster_state.update.reset();
|
1038
1038
|
for (const auto& p : cluster_state.watchers) {
|
1039
|
-
p.first->
|
1040
|
-
"Cluster not present in CDS update"));
|
1039
|
+
p.first->OnResourceDoesNotExist();
|
1041
1040
|
}
|
1042
1041
|
}
|
1043
1042
|
}
|
1044
|
-
//
|
1045
|
-
// resources
|
1043
|
+
// For any EDS resource that is no longer referred to by any CDS
|
1044
|
+
// resources, remove it from the cache and notify watchers that it
|
1045
|
+
// does not exist.
|
1046
1046
|
auto& eds_state = state_map_[XdsApi::kEdsTypeUrl];
|
1047
1047
|
for (const auto& p : eds_state.subscribed_resources) {
|
1048
1048
|
const std::string& eds_resource_name = p.first;
|
@@ -1052,8 +1052,7 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
|
|
1052
1052
|
xds_client()->endpoint_map_[eds_resource_name];
|
1053
1053
|
endpoint_state.update.reset();
|
1054
1054
|
for (const auto& p : endpoint_state.watchers) {
|
1055
|
-
p.first->
|
1056
|
-
"ClusterLoadAssignment resource removed due to CDS update"));
|
1055
|
+
p.first->OnResourceDoesNotExist();
|
1057
1056
|
}
|
1058
1057
|
}
|
1059
1058
|
}
|
@@ -1090,18 +1089,17 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
|
|
1090
1089
|
"[xds_client %p] Priority %" PRIuPTR ", locality %" PRIuPTR
|
1091
1090
|
" %s has weight %d, contains %" PRIuPTR " server addresses",
|
1092
1091
|
xds_client(), priority, locality_count,
|
1093
|
-
locality.name->AsHumanReadableString()
|
1094
|
-
locality.serverlist.size());
|
1092
|
+
locality.name->AsHumanReadableString().c_str(),
|
1093
|
+
locality.lb_weight, locality.serverlist.size());
|
1095
1094
|
for (size_t i = 0; i < locality.serverlist.size(); ++i) {
|
1096
|
-
|
1097
|
-
|
1098
|
-
false);
|
1095
|
+
std::string ipport = grpc_sockaddr_to_string(
|
1096
|
+
&locality.serverlist[i].address(), false);
|
1099
1097
|
gpr_log(GPR_INFO,
|
1100
1098
|
"[xds_client %p] Priority %" PRIuPTR ", locality %" PRIuPTR
|
1101
1099
|
" %s, server address %" PRIuPTR ": %s",
|
1102
1100
|
xds_client(), priority, locality_count,
|
1103
|
-
locality.name->AsHumanReadableString(), i,
|
1104
|
-
|
1101
|
+
locality.name->AsHumanReadableString().c_str(), i,
|
1102
|
+
ipport.c_str());
|
1105
1103
|
}
|
1106
1104
|
++locality_count;
|
1107
1105
|
}
|
@@ -1147,19 +1145,18 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
|
|
1147
1145
|
void XdsClient::ChannelState::AdsCallState::OnRequestSent(void* arg,
|
1148
1146
|
grpc_error* error) {
|
1149
1147
|
AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1148
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
1149
|
+
ads_calld->xds_client()->work_serializer_->Run(
|
1150
|
+
[ads_calld, error]() { ads_calld->OnRequestSentLocked(error); },
|
1151
|
+
DEBUG_LOCATION);
|
1154
1152
|
}
|
1155
1153
|
|
1156
1154
|
void XdsClient::ChannelState::AdsCallState::OnRequestSentLocked(
|
1157
|
-
|
1158
|
-
|
1159
|
-
if (self->IsCurrentCallOnChannel() && error == GRPC_ERROR_NONE) {
|
1155
|
+
grpc_error* error) {
|
1156
|
+
if (IsCurrentCallOnChannel() && error == GRPC_ERROR_NONE) {
|
1160
1157
|
// Clean up the sent message.
|
1161
|
-
grpc_byte_buffer_destroy(
|
1162
|
-
|
1158
|
+
grpc_byte_buffer_destroy(send_message_payload_);
|
1159
|
+
send_message_payload_ = nullptr;
|
1163
1160
|
// Continue to send another pending message if any.
|
1164
1161
|
// TODO(roth): The current code to handle buffered messages has the
|
1165
1162
|
// advantage of sending only the most recent list of resource names for
|
@@ -1169,41 +1166,36 @@ void XdsClient::ChannelState::AdsCallState::OnRequestSentLocked(
|
|
1169
1166
|
// order of resource types. We need to fix this if we are seeing some
|
1170
1167
|
// resource type(s) starved due to frequent requests of other resource
|
1171
1168
|
// type(s).
|
1172
|
-
auto it =
|
1173
|
-
if (it !=
|
1174
|
-
|
1175
|
-
|
1169
|
+
auto it = buffered_requests_.begin();
|
1170
|
+
if (it != buffered_requests_.end()) {
|
1171
|
+
SendMessageLocked(*it);
|
1172
|
+
buffered_requests_.erase(it);
|
1176
1173
|
}
|
1177
1174
|
}
|
1178
|
-
|
1175
|
+
Unref(DEBUG_LOCATION, "ADS+OnRequestSentLocked");
|
1176
|
+
GRPC_ERROR_UNREF(error);
|
1179
1177
|
}
|
1180
1178
|
|
1181
1179
|
void XdsClient::ChannelState::AdsCallState::OnResponseReceived(
|
1182
|
-
void* arg, grpc_error* error) {
|
1180
|
+
void* arg, grpc_error* /* error */) {
|
1183
1181
|
AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
|
1184
|
-
ads_calld->xds_client()->
|
1185
|
-
|
1186
|
-
OnResponseReceivedLocked, ads_calld, nullptr),
|
1187
|
-
GRPC_ERROR_REF(error));
|
1182
|
+
ads_calld->xds_client()->work_serializer_->Run(
|
1183
|
+
[ads_calld]() { ads_calld->OnResponseReceivedLocked(); }, DEBUG_LOCATION);
|
1188
1184
|
}
|
1189
1185
|
|
1190
|
-
void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked(
|
1191
|
-
void* arg, grpc_error* /*error*/) {
|
1192
|
-
AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
|
1193
|
-
XdsClient* xds_client = ads_calld->xds_client();
|
1186
|
+
void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
|
1194
1187
|
// Empty payload means the call was cancelled.
|
1195
|
-
if (!
|
1196
|
-
|
1197
|
-
ads_calld->Unref(DEBUG_LOCATION, "ADS+OnResponseReceivedLocked");
|
1188
|
+
if (!IsCurrentCallOnChannel() || recv_message_payload_ == nullptr) {
|
1189
|
+
Unref(DEBUG_LOCATION, "ADS+OnResponseReceivedLocked");
|
1198
1190
|
return;
|
1199
1191
|
}
|
1200
1192
|
// Read the response.
|
1201
1193
|
grpc_byte_buffer_reader bbr;
|
1202
|
-
grpc_byte_buffer_reader_init(&bbr,
|
1194
|
+
grpc_byte_buffer_reader_init(&bbr, recv_message_payload_);
|
1203
1195
|
grpc_slice response_slice = grpc_byte_buffer_reader_readall(&bbr);
|
1204
1196
|
grpc_byte_buffer_reader_destroy(&bbr);
|
1205
|
-
grpc_byte_buffer_destroy(
|
1206
|
-
|
1197
|
+
grpc_byte_buffer_destroy(recv_message_payload_);
|
1198
|
+
recv_message_payload_ = nullptr;
|
1207
1199
|
// TODO(juanlishen): When we convert this to use the xds protocol, the
|
1208
1200
|
// balancer will send us a fallback timeout such that we should go into
|
1209
1201
|
// fallback mode if we have lost contact with the balancer after a certain
|
@@ -1221,24 +1213,22 @@ void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked(
|
|
1221
1213
|
std::string nonce;
|
1222
1214
|
std::string type_url;
|
1223
1215
|
// Note that ParseAdsResponse() also validates the response.
|
1224
|
-
grpc_error* parse_error = xds_client->api_.ParseAdsResponse(
|
1225
|
-
response_slice, xds_client->server_name_,
|
1226
|
-
(
|
1227
|
-
|
1228
|
-
|
1229
|
-
ads_calld->ClusterNamesForRequest(),
|
1230
|
-
ads_calld->EdsServiceNamesForRequest(), &lds_update, &rds_update,
|
1216
|
+
grpc_error* parse_error = xds_client()->api_.ParseAdsResponse(
|
1217
|
+
response_slice, xds_client()->server_name_,
|
1218
|
+
ResourceNamesForRequest(XdsApi::kRdsTypeUrl),
|
1219
|
+
ResourceNamesForRequest(XdsApi::kCdsTypeUrl),
|
1220
|
+
ResourceNamesForRequest(XdsApi::kEdsTypeUrl), &lds_update, &rds_update,
|
1231
1221
|
&cds_update_map, &eds_update_map, &version, &nonce, &type_url);
|
1232
1222
|
grpc_slice_unref_internal(response_slice);
|
1233
1223
|
if (type_url.empty()) {
|
1234
1224
|
// Ignore unparsable response.
|
1235
1225
|
gpr_log(GPR_ERROR,
|
1236
1226
|
"[xds_client %p] Error parsing ADS response (%s) -- ignoring",
|
1237
|
-
xds_client, grpc_error_string(parse_error));
|
1227
|
+
xds_client(), grpc_error_string(parse_error));
|
1238
1228
|
GRPC_ERROR_UNREF(parse_error);
|
1239
1229
|
} else {
|
1240
1230
|
// Update nonce.
|
1241
|
-
auto& state =
|
1231
|
+
auto& state = state_map_[type_url];
|
1242
1232
|
state.nonce = std::move(nonce);
|
1243
1233
|
// NACK or ACK the response.
|
1244
1234
|
if (parse_error != GRPC_ERROR_NONE) {
|
@@ -1248,85 +1238,80 @@ void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked(
|
|
1248
1238
|
gpr_log(GPR_ERROR,
|
1249
1239
|
"[xds_client %p] ADS response invalid for resource type %s "
|
1250
1240
|
"version %s, will NACK: nonce=%s error=%s",
|
1251
|
-
xds_client, type_url.c_str(), version.c_str(),
|
1241
|
+
xds_client(), type_url.c_str(), version.c_str(),
|
1252
1242
|
state.nonce.c_str(), grpc_error_string(parse_error));
|
1253
|
-
|
1243
|
+
SendMessageLocked(type_url);
|
1254
1244
|
} else {
|
1255
|
-
|
1245
|
+
seen_response_ = true;
|
1256
1246
|
// Accept the ADS response according to the type_url.
|
1257
1247
|
if (type_url == XdsApi::kLdsTypeUrl) {
|
1258
|
-
|
1248
|
+
AcceptLdsUpdate(std::move(lds_update));
|
1259
1249
|
} else if (type_url == XdsApi::kRdsTypeUrl) {
|
1260
|
-
|
1250
|
+
AcceptRdsUpdate(std::move(rds_update));
|
1261
1251
|
} else if (type_url == XdsApi::kCdsTypeUrl) {
|
1262
|
-
|
1252
|
+
AcceptCdsUpdate(std::move(cds_update_map));
|
1263
1253
|
} else if (type_url == XdsApi::kEdsTypeUrl) {
|
1264
|
-
|
1254
|
+
AcceptEdsUpdate(std::move(eds_update_map));
|
1265
1255
|
}
|
1266
1256
|
state.version = std::move(version);
|
1267
1257
|
// ACK the update.
|
1268
|
-
|
1258
|
+
SendMessageLocked(type_url);
|
1269
1259
|
// Start load reporting if needed.
|
1270
|
-
auto& lrs_call =
|
1260
|
+
auto& lrs_call = chand()->lrs_calld_;
|
1271
1261
|
if (lrs_call != nullptr) {
|
1272
1262
|
LrsCallState* lrs_calld = lrs_call->calld();
|
1273
1263
|
if (lrs_calld != nullptr) lrs_calld->MaybeStartReportingLocked();
|
1274
1264
|
}
|
1275
1265
|
}
|
1276
1266
|
}
|
1277
|
-
if (xds_client->shutting_down_) {
|
1278
|
-
|
1279
|
-
"ADS+OnResponseReceivedLocked+xds_shutdown");
|
1267
|
+
if (xds_client()->shutting_down_) {
|
1268
|
+
Unref(DEBUG_LOCATION, "ADS+OnResponseReceivedLocked+xds_shutdown");
|
1280
1269
|
return;
|
1281
1270
|
}
|
1282
1271
|
// Keep listening for updates.
|
1283
1272
|
grpc_op op;
|
1284
1273
|
memset(&op, 0, sizeof(op));
|
1285
1274
|
op.op = GRPC_OP_RECV_MESSAGE;
|
1286
|
-
op.data.recv_message.recv_message = &
|
1275
|
+
op.data.recv_message.recv_message = &recv_message_payload_;
|
1287
1276
|
op.flags = 0;
|
1288
1277
|
op.reserved = nullptr;
|
1289
|
-
GPR_ASSERT(
|
1278
|
+
GPR_ASSERT(call_ != nullptr);
|
1290
1279
|
// Reuse the "ADS+OnResponseReceivedLocked" ref taken in ctor.
|
1291
|
-
|
1292
|
-
|
1293
|
-
const grpc_call_error call_error = grpc_call_start_batch_and_execute(
|
1294
|
-
ads_calld->call_, &op, 1, &ads_calld->on_response_received_);
|
1280
|
+
const grpc_call_error call_error =
|
1281
|
+
grpc_call_start_batch_and_execute(call_, &op, 1, &on_response_received_);
|
1295
1282
|
GPR_ASSERT(GRPC_CALL_OK == call_error);
|
1296
1283
|
}
|
1297
1284
|
|
1298
1285
|
void XdsClient::ChannelState::AdsCallState::OnStatusReceived(
|
1299
1286
|
void* arg, grpc_error* error) {
|
1300
1287
|
AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1288
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
1289
|
+
ads_calld->xds_client()->work_serializer_->Run(
|
1290
|
+
[ads_calld, error]() { ads_calld->OnStatusReceivedLocked(error); },
|
1291
|
+
DEBUG_LOCATION);
|
1305
1292
|
}
|
1306
1293
|
|
1307
1294
|
void XdsClient::ChannelState::AdsCallState::OnStatusReceivedLocked(
|
1308
|
-
|
1309
|
-
AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
|
1310
|
-
ChannelState* chand = ads_calld->chand();
|
1311
|
-
XdsClient* xds_client = ads_calld->xds_client();
|
1295
|
+
grpc_error* error) {
|
1312
1296
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1313
|
-
char* status_details = grpc_slice_to_c_string(
|
1297
|
+
char* status_details = grpc_slice_to_c_string(status_details_);
|
1314
1298
|
gpr_log(GPR_INFO,
|
1315
1299
|
"[xds_client %p] ADS call status received. Status = %d, details "
|
1316
1300
|
"= '%s', (chand: %p, ads_calld: %p, call: %p), error '%s'",
|
1317
|
-
xds_client,
|
1318
|
-
|
1301
|
+
xds_client(), status_code_, status_details, chand(), this, call_,
|
1302
|
+
grpc_error_string(error));
|
1319
1303
|
gpr_free(status_details);
|
1320
1304
|
}
|
1321
1305
|
// Ignore status from a stale call.
|
1322
|
-
if (
|
1306
|
+
if (IsCurrentCallOnChannel()) {
|
1323
1307
|
// Try to restart the call.
|
1324
|
-
|
1308
|
+
parent_->OnCallFinishedLocked();
|
1325
1309
|
// Send error to all watchers.
|
1326
|
-
xds_client->NotifyOnError(
|
1310
|
+
xds_client()->NotifyOnError(
|
1327
1311
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("xds call failed"));
|
1328
1312
|
}
|
1329
|
-
|
1313
|
+
Unref(DEBUG_LOCATION, "ADS+OnStatusReceivedLocked");
|
1314
|
+
GRPC_ERROR_UNREF(error);
|
1330
1315
|
}
|
1331
1316
|
|
1332
1317
|
bool XdsClient::ChannelState::AdsCallState::IsCurrentCallOnChannel() const {
|
@@ -1336,26 +1321,19 @@ bool XdsClient::ChannelState::AdsCallState::IsCurrentCallOnChannel() const {
|
|
1336
1321
|
return this == chand()->ads_calld_->calld();
|
1337
1322
|
}
|
1338
1323
|
|
1339
|
-
std::set<
|
1340
|
-
XdsClient::ChannelState::AdsCallState::
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
std::set<StringView>
|
1351
|
-
XdsClient::ChannelState::AdsCallState::EdsServiceNamesForRequest() {
|
1352
|
-
std::set<StringView> eds_names;
|
1353
|
-
for (auto& p : state_map_[XdsApi::kEdsTypeUrl].subscribed_resources) {
|
1354
|
-
eds_names.insert(p.first);
|
1355
|
-
OrphanablePtr<ResourceState>& state = p.second;
|
1356
|
-
state->Start(Ref());
|
1324
|
+
std::set<absl::string_view>
|
1325
|
+
XdsClient::ChannelState::AdsCallState::ResourceNamesForRequest(
|
1326
|
+
const std::string& type_url) {
|
1327
|
+
std::set<absl::string_view> resource_names;
|
1328
|
+
auto it = state_map_.find(type_url);
|
1329
|
+
if (it != state_map_.end()) {
|
1330
|
+
for (auto& p : it->second.subscribed_resources) {
|
1331
|
+
resource_names.insert(p.first);
|
1332
|
+
OrphanablePtr<ResourceState>& state = p.second;
|
1333
|
+
state->Start(Ref());
|
1334
|
+
}
|
1357
1335
|
}
|
1358
|
-
return
|
1336
|
+
return resource_names;
|
1359
1337
|
}
|
1360
1338
|
|
1361
1339
|
//
|
@@ -1371,8 +1349,6 @@ void XdsClient::ChannelState::LrsCallState::Reporter::Orphan() {
|
|
1371
1349
|
void XdsClient::ChannelState::LrsCallState::Reporter::
|
1372
1350
|
ScheduleNextReportLocked() {
|
1373
1351
|
const grpc_millis next_report_time = ExecCtx::Get()->Now() + report_interval_;
|
1374
|
-
GRPC_CLOSURE_INIT(&on_next_report_timer_, OnNextReportTimer, this,
|
1375
|
-
grpc_schedule_on_exec_ctx);
|
1376
1352
|
grpc_timer_init(&next_report_timer_, next_report_time,
|
1377
1353
|
&on_next_report_timer_);
|
1378
1354
|
next_report_timer_callback_pending_ = true;
|
@@ -1381,21 +1357,21 @@ void XdsClient::ChannelState::LrsCallState::Reporter::
|
|
1381
1357
|
void XdsClient::ChannelState::LrsCallState::Reporter::OnNextReportTimer(
|
1382
1358
|
void* arg, grpc_error* error) {
|
1383
1359
|
Reporter* self = static_cast<Reporter*>(arg);
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1360
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
1361
|
+
self->xds_client()->work_serializer_->Run(
|
1362
|
+
[self, error]() { self->OnNextReportTimerLocked(error); },
|
1363
|
+
DEBUG_LOCATION);
|
1388
1364
|
}
|
1389
1365
|
|
1390
1366
|
void XdsClient::ChannelState::LrsCallState::Reporter::OnNextReportTimerLocked(
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1367
|
+
grpc_error* error) {
|
1368
|
+
next_report_timer_callback_pending_ = false;
|
1369
|
+
if (error != GRPC_ERROR_NONE || !IsCurrentReporterOnCall()) {
|
1370
|
+
Unref(DEBUG_LOCATION, "Reporter+timer");
|
1371
|
+
} else {
|
1372
|
+
SendReportLocked();
|
1397
1373
|
}
|
1398
|
-
|
1374
|
+
GRPC_ERROR_UNREF(error);
|
1399
1375
|
}
|
1400
1376
|
|
1401
1377
|
namespace {
|
@@ -1418,8 +1394,8 @@ bool LoadReportCountersAreZero(const XdsApi::ClusterLoadReportMap& snapshot) {
|
|
1418
1394
|
|
1419
1395
|
void XdsClient::ChannelState::LrsCallState::Reporter::SendReportLocked() {
|
1420
1396
|
// Construct snapshot from all reported stats.
|
1421
|
-
XdsApi::ClusterLoadReportMap snapshot =
|
1422
|
-
|
1397
|
+
XdsApi::ClusterLoadReportMap snapshot = xds_client()->BuildLoadReportSnapshot(
|
1398
|
+
parent_->send_all_clusters_, parent_->cluster_names_);
|
1423
1399
|
// Skip client load report if the counters were all zero in the last
|
1424
1400
|
// report and they are still zero in this one.
|
1425
1401
|
const bool old_val = last_report_counters_were_zero_;
|
@@ -1439,8 +1415,6 @@ void XdsClient::ChannelState::LrsCallState::Reporter::SendReportLocked() {
|
|
1439
1415
|
memset(&op, 0, sizeof(op));
|
1440
1416
|
op.op = GRPC_OP_SEND_MESSAGE;
|
1441
1417
|
op.data.send_message.send_message = parent_->send_message_payload_;
|
1442
|
-
GRPC_CLOSURE_INIT(&on_report_done_, OnReportDone, this,
|
1443
|
-
grpc_schedule_on_exec_ctx);
|
1444
1418
|
grpc_call_error call_error = grpc_call_start_batch_and_execute(
|
1445
1419
|
parent_->call_, &op, 1, &on_report_done_);
|
1446
1420
|
if (GPR_UNLIKELY(call_error != GRPC_CALL_OK)) {
|
@@ -1454,33 +1428,32 @@ void XdsClient::ChannelState::LrsCallState::Reporter::SendReportLocked() {
|
|
1454
1428
|
void XdsClient::ChannelState::LrsCallState::Reporter::OnReportDone(
|
1455
1429
|
void* arg, grpc_error* error) {
|
1456
1430
|
Reporter* self = static_cast<Reporter*>(arg);
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
GRPC_ERROR_REF(error));
|
1431
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
1432
|
+
self->xds_client()->work_serializer_->Run(
|
1433
|
+
[self, error]() { self->OnReportDoneLocked(error); }, DEBUG_LOCATION);
|
1461
1434
|
}
|
1462
1435
|
|
1463
1436
|
void XdsClient::ChannelState::LrsCallState::Reporter::OnReportDoneLocked(
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
self->parent_->send_message_payload_ = nullptr;
|
1437
|
+
grpc_error* error) {
|
1438
|
+
grpc_byte_buffer_destroy(parent_->send_message_payload_);
|
1439
|
+
parent_->send_message_payload_ = nullptr;
|
1468
1440
|
// If there are no more registered stats to report, cancel the call.
|
1469
|
-
if (
|
1470
|
-
|
1471
|
-
|
1441
|
+
if (xds_client()->load_report_map_.empty()) {
|
1442
|
+
parent_->chand()->StopLrsCall();
|
1443
|
+
Unref(DEBUG_LOCATION, "Reporter+report_done+no_more_reporters");
|
1472
1444
|
return;
|
1473
1445
|
}
|
1474
|
-
if (error != GRPC_ERROR_NONE || !
|
1446
|
+
if (error != GRPC_ERROR_NONE || !IsCurrentReporterOnCall()) {
|
1475
1447
|
// If this reporter is no longer the current one on the call, the reason
|
1476
1448
|
// might be that it was orphaned for a new one due to config update.
|
1477
|
-
if (!
|
1478
|
-
|
1449
|
+
if (!IsCurrentReporterOnCall()) {
|
1450
|
+
parent_->MaybeStartReportingLocked();
|
1479
1451
|
}
|
1480
|
-
|
1481
|
-
|
1452
|
+
Unref(DEBUG_LOCATION, "Reporter+report_done");
|
1453
|
+
} else {
|
1454
|
+
ScheduleNextReportLocked();
|
1482
1455
|
}
|
1483
|
-
|
1456
|
+
GRPC_ERROR_UNREF(error);
|
1484
1457
|
}
|
1485
1458
|
|
1486
1459
|
//
|
@@ -1626,75 +1599,70 @@ void XdsClient::ChannelState::LrsCallState::MaybeStartReportingLocked() {
|
|
1626
1599
|
}
|
1627
1600
|
|
1628
1601
|
void XdsClient::ChannelState::LrsCallState::OnInitialRequestSent(
|
1629
|
-
void* arg, grpc_error* error) {
|
1602
|
+
void* arg, grpc_error* /*error*/) {
|
1630
1603
|
LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
|
1631
|
-
lrs_calld->xds_client()->
|
1632
|
-
|
1633
|
-
|
1634
|
-
GRPC_ERROR_REF(error));
|
1604
|
+
lrs_calld->xds_client()->work_serializer_->Run(
|
1605
|
+
[lrs_calld]() { lrs_calld->OnInitialRequestSentLocked(); },
|
1606
|
+
DEBUG_LOCATION);
|
1635
1607
|
}
|
1636
1608
|
|
1637
|
-
void XdsClient::ChannelState::LrsCallState::OnInitialRequestSentLocked(
|
1638
|
-
void* arg, grpc_error* /*error*/) {
|
1639
|
-
LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
|
1609
|
+
void XdsClient::ChannelState::LrsCallState::OnInitialRequestSentLocked() {
|
1640
1610
|
// Clear the send_message_payload_.
|
1641
|
-
grpc_byte_buffer_destroy(
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1611
|
+
grpc_byte_buffer_destroy(send_message_payload_);
|
1612
|
+
send_message_payload_ = nullptr;
|
1613
|
+
MaybeStartReportingLocked();
|
1614
|
+
Unref(DEBUG_LOCATION, "LRS+OnInitialRequestSentLocked");
|
1645
1615
|
}
|
1646
1616
|
|
1647
1617
|
void XdsClient::ChannelState::LrsCallState::OnResponseReceived(
|
1648
|
-
void* arg, grpc_error* error) {
|
1618
|
+
void* arg, grpc_error* /*error*/) {
|
1649
1619
|
LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
|
1650
|
-
lrs_calld->xds_client()->
|
1651
|
-
|
1652
|
-
OnResponseReceivedLocked, lrs_calld, nullptr),
|
1653
|
-
GRPC_ERROR_REF(error));
|
1620
|
+
lrs_calld->xds_client()->work_serializer_->Run(
|
1621
|
+
[lrs_calld]() { lrs_calld->OnResponseReceivedLocked(); }, DEBUG_LOCATION);
|
1654
1622
|
}
|
1655
1623
|
|
1656
|
-
void XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked(
|
1657
|
-
void* arg, grpc_error* /*error*/) {
|
1658
|
-
LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
|
1659
|
-
XdsClient* xds_client = lrs_calld->xds_client();
|
1624
|
+
void XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked() {
|
1660
1625
|
// Empty payload means the call was cancelled.
|
1661
|
-
if (!
|
1662
|
-
|
1663
|
-
lrs_calld->Unref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked");
|
1626
|
+
if (!IsCurrentCallOnChannel() || recv_message_payload_ == nullptr) {
|
1627
|
+
Unref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked");
|
1664
1628
|
return;
|
1665
1629
|
}
|
1666
1630
|
// Read the response.
|
1667
1631
|
grpc_byte_buffer_reader bbr;
|
1668
|
-
grpc_byte_buffer_reader_init(&bbr,
|
1632
|
+
grpc_byte_buffer_reader_init(&bbr, recv_message_payload_);
|
1669
1633
|
grpc_slice response_slice = grpc_byte_buffer_reader_readall(&bbr);
|
1670
1634
|
grpc_byte_buffer_reader_destroy(&bbr);
|
1671
|
-
grpc_byte_buffer_destroy(
|
1672
|
-
|
1635
|
+
grpc_byte_buffer_destroy(recv_message_payload_);
|
1636
|
+
recv_message_payload_ = nullptr;
|
1673
1637
|
// This anonymous lambda is a hack to avoid the usage of goto.
|
1674
1638
|
[&]() {
|
1675
1639
|
// Parse the response.
|
1640
|
+
bool send_all_clusters = false;
|
1676
1641
|
std::set<std::string> new_cluster_names;
|
1677
1642
|
grpc_millis new_load_reporting_interval;
|
1678
|
-
grpc_error* parse_error = xds_client->api_.ParseLrsResponse(
|
1679
|
-
response_slice, &
|
1643
|
+
grpc_error* parse_error = xds_client()->api_.ParseLrsResponse(
|
1644
|
+
response_slice, &send_all_clusters, &new_cluster_names,
|
1645
|
+
&new_load_reporting_interval);
|
1680
1646
|
if (parse_error != GRPC_ERROR_NONE) {
|
1681
1647
|
gpr_log(GPR_ERROR,
|
1682
1648
|
"[xds_client %p] LRS response parsing failed. error=%s",
|
1683
|
-
xds_client, grpc_error_string(parse_error));
|
1649
|
+
xds_client(), grpc_error_string(parse_error));
|
1684
1650
|
GRPC_ERROR_UNREF(parse_error);
|
1685
1651
|
return;
|
1686
1652
|
}
|
1687
|
-
|
1653
|
+
seen_response_ = true;
|
1688
1654
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1689
|
-
gpr_log(
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1655
|
+
gpr_log(
|
1656
|
+
GPR_INFO,
|
1657
|
+
"[xds_client %p] LRS response received, %" PRIuPTR
|
1658
|
+
" cluster names, send_all_clusters=%d, load_report_interval=%" PRId64
|
1659
|
+
"ms",
|
1660
|
+
xds_client(), new_cluster_names.size(), send_all_clusters,
|
1661
|
+
new_load_reporting_interval);
|
1694
1662
|
size_t i = 0;
|
1695
1663
|
for (const auto& name : new_cluster_names) {
|
1696
1664
|
gpr_log(GPR_INFO, "[xds_client %p] cluster_name %" PRIuPTR ": %s",
|
1697
|
-
xds_client, i++, name.c_str());
|
1665
|
+
xds_client(), i++, name.c_str());
|
1698
1666
|
}
|
1699
1667
|
}
|
1700
1668
|
if (new_load_reporting_interval <
|
@@ -1705,81 +1673,78 @@ void XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked(
|
|
1705
1673
|
gpr_log(GPR_INFO,
|
1706
1674
|
"[xds_client %p] Increased load_report_interval to minimum "
|
1707
1675
|
"value %dms",
|
1708
|
-
xds_client, GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS);
|
1676
|
+
xds_client(), GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS);
|
1709
1677
|
}
|
1710
1678
|
}
|
1711
1679
|
// Ignore identical update.
|
1712
|
-
if (
|
1713
|
-
|
1680
|
+
if (send_all_clusters == send_all_clusters_ &&
|
1681
|
+
cluster_names_ == new_cluster_names &&
|
1682
|
+
load_reporting_interval_ == new_load_reporting_interval) {
|
1714
1683
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1715
1684
|
gpr_log(GPR_INFO,
|
1716
1685
|
"[xds_client %p] Incoming LRS response identical to current, "
|
1717
1686
|
"ignoring.",
|
1718
|
-
xds_client);
|
1687
|
+
xds_client());
|
1719
1688
|
}
|
1720
1689
|
return;
|
1721
1690
|
}
|
1722
1691
|
// Stop current load reporting (if any) to adopt the new config.
|
1723
|
-
|
1692
|
+
reporter_.reset();
|
1724
1693
|
// Record the new config.
|
1725
|
-
|
1726
|
-
|
1694
|
+
send_all_clusters_ = send_all_clusters;
|
1695
|
+
cluster_names_ = std::move(new_cluster_names);
|
1696
|
+
load_reporting_interval_ = new_load_reporting_interval;
|
1727
1697
|
// Try starting sending load report.
|
1728
|
-
|
1698
|
+
MaybeStartReportingLocked();
|
1729
1699
|
}();
|
1730
1700
|
grpc_slice_unref_internal(response_slice);
|
1731
|
-
if (xds_client->shutting_down_) {
|
1732
|
-
|
1733
|
-
"LRS+OnResponseReceivedLocked+xds_shutdown");
|
1701
|
+
if (xds_client()->shutting_down_) {
|
1702
|
+
Unref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked+xds_shutdown");
|
1734
1703
|
return;
|
1735
1704
|
}
|
1736
1705
|
// Keep listening for LRS config updates.
|
1737
1706
|
grpc_op op;
|
1738
1707
|
memset(&op, 0, sizeof(op));
|
1739
1708
|
op.op = GRPC_OP_RECV_MESSAGE;
|
1740
|
-
op.data.recv_message.recv_message = &
|
1709
|
+
op.data.recv_message.recv_message = &recv_message_payload_;
|
1741
1710
|
op.flags = 0;
|
1742
1711
|
op.reserved = nullptr;
|
1743
|
-
GPR_ASSERT(
|
1712
|
+
GPR_ASSERT(call_ != nullptr);
|
1744
1713
|
// Reuse the "OnResponseReceivedLocked" ref taken in ctor.
|
1745
|
-
|
1746
|
-
|
1747
|
-
const grpc_call_error call_error = grpc_call_start_batch_and_execute(
|
1748
|
-
lrs_calld->call_, &op, 1, &lrs_calld->on_response_received_);
|
1714
|
+
const grpc_call_error call_error =
|
1715
|
+
grpc_call_start_batch_and_execute(call_, &op, 1, &on_response_received_);
|
1749
1716
|
GPR_ASSERT(GRPC_CALL_OK == call_error);
|
1750
1717
|
}
|
1751
1718
|
|
1752
1719
|
void XdsClient::ChannelState::LrsCallState::OnStatusReceived(
|
1753
1720
|
void* arg, grpc_error* error) {
|
1754
1721
|
LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1722
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
1723
|
+
lrs_calld->xds_client()->work_serializer_->Run(
|
1724
|
+
[lrs_calld, error]() { lrs_calld->OnStatusReceivedLocked(error); },
|
1725
|
+
DEBUG_LOCATION);
|
1759
1726
|
}
|
1760
1727
|
|
1761
1728
|
void XdsClient::ChannelState::LrsCallState::OnStatusReceivedLocked(
|
1762
|
-
|
1763
|
-
|
1764
|
-
XdsClient* xds_client = lrs_calld->xds_client();
|
1765
|
-
ChannelState* chand = lrs_calld->chand();
|
1766
|
-
GPR_ASSERT(lrs_calld->call_ != nullptr);
|
1729
|
+
grpc_error* error) {
|
1730
|
+
GPR_ASSERT(call_ != nullptr);
|
1767
1731
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1768
|
-
char* status_details = grpc_slice_to_c_string(
|
1732
|
+
char* status_details = grpc_slice_to_c_string(status_details_);
|
1769
1733
|
gpr_log(GPR_INFO,
|
1770
1734
|
"[xds_client %p] LRS call status received. Status = %d, details "
|
1771
1735
|
"= '%s', (chand: %p, calld: %p, call: %p), error '%s'",
|
1772
|
-
xds_client,
|
1773
|
-
|
1736
|
+
xds_client(), status_code_, status_details, chand(), this, call_,
|
1737
|
+
grpc_error_string(error));
|
1774
1738
|
gpr_free(status_details);
|
1775
1739
|
}
|
1776
1740
|
// Ignore status from a stale call.
|
1777
|
-
if (
|
1778
|
-
GPR_ASSERT(!xds_client->shutting_down_);
|
1741
|
+
if (IsCurrentCallOnChannel()) {
|
1742
|
+
GPR_ASSERT(!xds_client()->shutting_down_);
|
1779
1743
|
// Try to restart the call.
|
1780
|
-
|
1744
|
+
parent_->OnCallFinishedLocked();
|
1781
1745
|
}
|
1782
|
-
|
1746
|
+
Unref(DEBUG_LOCATION, "LRS+OnStatusReceivedLocked");
|
1747
|
+
GRPC_ERROR_UNREF(error);
|
1783
1748
|
}
|
1784
1749
|
|
1785
1750
|
bool XdsClient::ChannelState::LrsCallState::IsCurrentCallOnChannel() const {
|
@@ -1803,13 +1768,14 @@ grpc_millis GetRequestTimeout(const grpc_channel_args& args) {
|
|
1803
1768
|
|
1804
1769
|
} // namespace
|
1805
1770
|
|
1806
|
-
XdsClient::XdsClient(
|
1807
|
-
|
1771
|
+
XdsClient::XdsClient(std::shared_ptr<WorkSerializer> work_serializer,
|
1772
|
+
grpc_pollset_set* interested_parties,
|
1773
|
+
absl::string_view server_name,
|
1808
1774
|
std::unique_ptr<ServiceConfigWatcherInterface> watcher,
|
1809
1775
|
const grpc_channel_args& channel_args, grpc_error** error)
|
1810
1776
|
: InternallyRefCounted<XdsClient>(&grpc_xds_client_trace),
|
1811
1777
|
request_timeout_(GetRequestTimeout(channel_args)),
|
1812
|
-
|
1778
|
+
work_serializer_(std::move(work_serializer)),
|
1813
1779
|
interested_parties_(interested_parties),
|
1814
1780
|
bootstrap_(
|
1815
1781
|
XdsBootstrap::ReadFromFile(this, &grpc_xds_client_trace, error)),
|
@@ -1848,7 +1814,6 @@ XdsClient::~XdsClient() {
|
|
1848
1814
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1849
1815
|
gpr_log(GPR_INFO, "[xds_client %p] destroying xds client", this);
|
1850
1816
|
}
|
1851
|
-
GRPC_COMBINER_UNREF(combiner_, "xds_client");
|
1852
1817
|
}
|
1853
1818
|
|
1854
1819
|
void XdsClient::Orphan() {
|
@@ -1871,7 +1836,8 @@ void XdsClient::Orphan() {
|
|
1871
1836
|
}
|
1872
1837
|
|
1873
1838
|
void XdsClient::WatchClusterData(
|
1874
|
-
|
1839
|
+
absl::string_view cluster_name,
|
1840
|
+
std::unique_ptr<ClusterWatcherInterface> watcher) {
|
1875
1841
|
std::string cluster_name_str = std::string(cluster_name);
|
1876
1842
|
ClusterState& cluster_state = cluster_map_[cluster_name_str];
|
1877
1843
|
ClusterWatcherInterface* w = watcher.get();
|
@@ -1881,14 +1847,14 @@ void XdsClient::WatchClusterData(
|
|
1881
1847
|
if (cluster_state.update.has_value()) {
|
1882
1848
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1883
1849
|
gpr_log(GPR_INFO, "[xds_client %p] returning cached cluster data for %s",
|
1884
|
-
this,
|
1850
|
+
this, cluster_name_str.c_str());
|
1885
1851
|
}
|
1886
1852
|
w->OnClusterChanged(cluster_state.update.value());
|
1887
1853
|
}
|
1888
1854
|
chand_->Subscribe(XdsApi::kCdsTypeUrl, cluster_name_str);
|
1889
1855
|
}
|
1890
1856
|
|
1891
|
-
void XdsClient::CancelClusterDataWatch(
|
1857
|
+
void XdsClient::CancelClusterDataWatch(absl::string_view cluster_name,
|
1892
1858
|
ClusterWatcherInterface* watcher,
|
1893
1859
|
bool delay_unsubscription) {
|
1894
1860
|
if (shutting_down_) return;
|
@@ -1906,7 +1872,7 @@ void XdsClient::CancelClusterDataWatch(StringView cluster_name,
|
|
1906
1872
|
}
|
1907
1873
|
|
1908
1874
|
void XdsClient::WatchEndpointData(
|
1909
|
-
|
1875
|
+
absl::string_view eds_service_name,
|
1910
1876
|
std::unique_ptr<EndpointWatcherInterface> watcher) {
|
1911
1877
|
std::string eds_service_name_str = std::string(eds_service_name);
|
1912
1878
|
EndpointState& endpoint_state = endpoint_map_[eds_service_name_str];
|
@@ -1917,14 +1883,14 @@ void XdsClient::WatchEndpointData(
|
|
1917
1883
|
if (endpoint_state.update.has_value()) {
|
1918
1884
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1919
1885
|
gpr_log(GPR_INFO, "[xds_client %p] returning cached endpoint data for %s",
|
1920
|
-
this,
|
1886
|
+
this, eds_service_name_str.c_str());
|
1921
1887
|
}
|
1922
1888
|
w->OnEndpointChanged(endpoint_state.update.value());
|
1923
1889
|
}
|
1924
1890
|
chand_->Subscribe(XdsApi::kEdsTypeUrl, eds_service_name_str);
|
1925
1891
|
}
|
1926
1892
|
|
1927
|
-
void XdsClient::CancelEndpointDataWatch(
|
1893
|
+
void XdsClient::CancelEndpointDataWatch(absl::string_view eds_service_name,
|
1928
1894
|
EndpointWatcherInterface* watcher,
|
1929
1895
|
bool delay_unsubscription) {
|
1930
1896
|
if (shutting_down_) return;
|
@@ -1942,13 +1908,13 @@ void XdsClient::CancelEndpointDataWatch(StringView eds_service_name,
|
|
1942
1908
|
}
|
1943
1909
|
|
1944
1910
|
RefCountedPtr<XdsClusterDropStats> XdsClient::AddClusterDropStats(
|
1945
|
-
|
1946
|
-
|
1911
|
+
absl::string_view lrs_server, absl::string_view cluster_name,
|
1912
|
+
absl::string_view eds_service_name) {
|
1947
1913
|
// TODO(roth): When we add support for direct federation, use the
|
1948
1914
|
// server name specified in lrs_server.
|
1949
1915
|
auto key =
|
1950
1916
|
std::make_pair(std::string(cluster_name), std::string(eds_service_name));
|
1951
|
-
// We jump through some hoops here to make sure that the
|
1917
|
+
// We jump through some hoops here to make sure that the absl::string_views
|
1952
1918
|
// stored in the XdsClusterDropStats object point to the strings
|
1953
1919
|
// in the load_report_map_ key, so that they have the same lifetime.
|
1954
1920
|
auto it = load_report_map_
|
@@ -1963,8 +1929,9 @@ RefCountedPtr<XdsClusterDropStats> XdsClient::AddClusterDropStats(
|
|
1963
1929
|
}
|
1964
1930
|
|
1965
1931
|
void XdsClient::RemoveClusterDropStats(
|
1966
|
-
|
1967
|
-
|
1932
|
+
absl::string_view /*lrs_server*/, absl::string_view cluster_name,
|
1933
|
+
absl::string_view eds_service_name,
|
1934
|
+
XdsClusterDropStats* cluster_drop_stats) {
|
1968
1935
|
auto load_report_it = load_report_map_.find(
|
1969
1936
|
std::make_pair(std::string(cluster_name), std::string(eds_service_name)));
|
1970
1937
|
if (load_report_it == load_report_map_.end()) return;
|
@@ -1983,13 +1950,14 @@ void XdsClient::RemoveClusterDropStats(
|
|
1983
1950
|
}
|
1984
1951
|
|
1985
1952
|
RefCountedPtr<XdsClusterLocalityStats> XdsClient::AddClusterLocalityStats(
|
1986
|
-
|
1953
|
+
absl::string_view lrs_server, absl::string_view cluster_name,
|
1954
|
+
absl::string_view eds_service_name,
|
1987
1955
|
RefCountedPtr<XdsLocalityName> locality) {
|
1988
1956
|
// TODO(roth): When we add support for direct federation, use the
|
1989
1957
|
// server name specified in lrs_server.
|
1990
1958
|
auto key =
|
1991
1959
|
std::make_pair(std::string(cluster_name), std::string(eds_service_name));
|
1992
|
-
// We jump through some hoops here to make sure that the
|
1960
|
+
// We jump through some hoops here to make sure that the absl::string_views
|
1993
1961
|
// stored in the XdsClusterLocalityStats object point to the strings
|
1994
1962
|
// in the load_report_map_ key, so that they have the same lifetime.
|
1995
1963
|
auto it = load_report_map_
|
@@ -2006,8 +1974,9 @@ RefCountedPtr<XdsClusterLocalityStats> XdsClient::AddClusterLocalityStats(
|
|
2006
1974
|
}
|
2007
1975
|
|
2008
1976
|
void XdsClient::RemoveClusterLocalityStats(
|
2009
|
-
|
2010
|
-
|
1977
|
+
absl::string_view /*lrs_server*/, absl::string_view cluster_name,
|
1978
|
+
absl::string_view eds_service_name,
|
1979
|
+
const RefCountedPtr<XdsLocalityName>& locality,
|
2011
1980
|
XdsClusterLocalityStats* cluster_locality_stats) {
|
2012
1981
|
auto load_report_it = load_report_map_.find(
|
2013
1982
|
std::make_pair(std::string(cluster_name), std::string(eds_service_name)));
|
@@ -2034,27 +2003,324 @@ void XdsClient::ResetBackoff() {
|
|
2034
2003
|
}
|
2035
2004
|
}
|
2036
2005
|
|
2006
|
+
namespace {
|
2007
|
+
std::string CreateServiceConfigActionCluster(const std::string& cluster_name) {
|
2008
|
+
return absl::StrFormat(
|
2009
|
+
" \"cds:%s\":{\n"
|
2010
|
+
" \"childPolicy\":[ {\n"
|
2011
|
+
" \"cds_experimental\":{\n"
|
2012
|
+
" \"cluster\": \"%s\"\n"
|
2013
|
+
" }\n"
|
2014
|
+
" } ]\n"
|
2015
|
+
" }",
|
2016
|
+
cluster_name, cluster_name);
|
2017
|
+
}
|
2018
|
+
|
2019
|
+
std::string CreateServiceConfigRoute(const std::string& action_name,
|
2020
|
+
const XdsApi::RdsUpdate::RdsRoute& route) {
|
2021
|
+
std::vector<std::string> headers;
|
2022
|
+
for (const auto& header : route.matchers.header_matchers) {
|
2023
|
+
std::string header_matcher;
|
2024
|
+
switch (header.type) {
|
2025
|
+
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::
|
2026
|
+
HeaderMatcherType::EXACT:
|
2027
|
+
header_matcher = absl::StrFormat(" \"exact_match\": \"%s\"",
|
2028
|
+
header.string_matcher);
|
2029
|
+
break;
|
2030
|
+
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::
|
2031
|
+
HeaderMatcherType::REGEX:
|
2032
|
+
header_matcher = absl::StrFormat(" \"regex_match\": \"%s\"",
|
2033
|
+
header.regex_match->pattern());
|
2034
|
+
break;
|
2035
|
+
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::
|
2036
|
+
HeaderMatcherType::RANGE:
|
2037
|
+
header_matcher = absl::StrFormat(
|
2038
|
+
" \"range_match\":{\n"
|
2039
|
+
" \"start\":%d,\n"
|
2040
|
+
" \"end\":%d\n"
|
2041
|
+
" }",
|
2042
|
+
header.range_start, header.range_end);
|
2043
|
+
break;
|
2044
|
+
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::
|
2045
|
+
HeaderMatcherType::PRESENT:
|
2046
|
+
header_matcher =
|
2047
|
+
absl::StrFormat(" \"present_match\": %s",
|
2048
|
+
header.present_match ? "true" : "false");
|
2049
|
+
break;
|
2050
|
+
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::
|
2051
|
+
HeaderMatcherType::PREFIX:
|
2052
|
+
header_matcher = absl::StrFormat(
|
2053
|
+
" \"prefix_match\": \"%s\"", header.string_matcher);
|
2054
|
+
break;
|
2055
|
+
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::
|
2056
|
+
HeaderMatcherType::SUFFIX:
|
2057
|
+
header_matcher = absl::StrFormat(
|
2058
|
+
" \"suffix_match\": \"%s\"", header.string_matcher);
|
2059
|
+
break;
|
2060
|
+
default:
|
2061
|
+
break;
|
2062
|
+
}
|
2063
|
+
std::vector<std::string> header_parts;
|
2064
|
+
header_parts.push_back(
|
2065
|
+
absl::StrFormat(" { \n"
|
2066
|
+
" \"name\": \"%s\",\n",
|
2067
|
+
header.name));
|
2068
|
+
header_parts.push_back(header_matcher);
|
2069
|
+
if (header.invert_match) {
|
2070
|
+
header_parts.push_back(
|
2071
|
+
absl::StrFormat(",\n"
|
2072
|
+
" \"invert_match\": true"));
|
2073
|
+
}
|
2074
|
+
header_parts.push_back(
|
2075
|
+
absl::StrFormat("\n"
|
2076
|
+
" }"));
|
2077
|
+
headers.push_back(absl::StrJoin(header_parts, ""));
|
2078
|
+
}
|
2079
|
+
std::vector<std::string> headers_service_config;
|
2080
|
+
if (!headers.empty()) {
|
2081
|
+
headers_service_config.push_back("\"headers\":[\n");
|
2082
|
+
headers_service_config.push_back(absl::StrJoin(headers, ","));
|
2083
|
+
headers_service_config.push_back(" ],\n");
|
2084
|
+
}
|
2085
|
+
std::string path_match_str;
|
2086
|
+
switch (route.matchers.path_matcher.type) {
|
2087
|
+
case XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::PathMatcherType::
|
2088
|
+
PREFIX:
|
2089
|
+
path_match_str = absl::StrFormat(
|
2090
|
+
"\"prefix\": \"%s\",\n", route.matchers.path_matcher.string_matcher);
|
2091
|
+
break;
|
2092
|
+
case XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::PathMatcherType::
|
2093
|
+
PATH:
|
2094
|
+
path_match_str = absl::StrFormat(
|
2095
|
+
"\"path\": \"%s\",\n", route.matchers.path_matcher.string_matcher);
|
2096
|
+
break;
|
2097
|
+
case XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::PathMatcherType::
|
2098
|
+
REGEX:
|
2099
|
+
path_match_str =
|
2100
|
+
absl::StrFormat("\"regex\": \"%s\",\n",
|
2101
|
+
route.matchers.path_matcher.regex_matcher->pattern());
|
2102
|
+
break;
|
2103
|
+
}
|
2104
|
+
return absl::StrFormat(
|
2105
|
+
" { \n"
|
2106
|
+
" %s"
|
2107
|
+
" %s"
|
2108
|
+
" %s"
|
2109
|
+
" \"action\": \"%s\"\n"
|
2110
|
+
" }",
|
2111
|
+
path_match_str, absl::StrJoin(headers_service_config, ""),
|
2112
|
+
route.matchers.fraction_per_million.has_value()
|
2113
|
+
? absl::StrFormat("\"match_fraction\":%d,\n",
|
2114
|
+
route.matchers.fraction_per_million.value())
|
2115
|
+
: "",
|
2116
|
+
action_name);
|
2117
|
+
}
|
2118
|
+
|
2119
|
+
// Create the service config for one weighted cluster.
|
2120
|
+
std::string CreateServiceConfigActionWeightedCluster(
|
2121
|
+
const std::string& name,
|
2122
|
+
const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>& clusters) {
|
2123
|
+
std::vector<std::string> config_parts;
|
2124
|
+
config_parts.push_back(
|
2125
|
+
absl::StrFormat(" \"weighted:%s\":{\n"
|
2126
|
+
" \"childPolicy\":[ {\n"
|
2127
|
+
" \"weighted_target_experimental\":{\n"
|
2128
|
+
" \"targets\":{\n",
|
2129
|
+
name));
|
2130
|
+
std::vector<std::string> weighted_targets;
|
2131
|
+
weighted_targets.reserve(clusters.size());
|
2132
|
+
for (const auto& cluster_weight : clusters) {
|
2133
|
+
weighted_targets.push_back(absl::StrFormat(
|
2134
|
+
" \"%s\":{\n"
|
2135
|
+
" \"weight\":%d,\n"
|
2136
|
+
" \"childPolicy\":[ {\n"
|
2137
|
+
" \"cds_experimental\":{\n"
|
2138
|
+
" \"cluster\": \"%s\"\n"
|
2139
|
+
" }\n"
|
2140
|
+
" } ]\n"
|
2141
|
+
" }",
|
2142
|
+
cluster_weight.name, cluster_weight.weight, cluster_weight.name));
|
2143
|
+
}
|
2144
|
+
config_parts.push_back(absl::StrJoin(weighted_targets, ",\n"));
|
2145
|
+
config_parts.push_back(
|
2146
|
+
" }\n"
|
2147
|
+
" }\n"
|
2148
|
+
" } ]\n"
|
2149
|
+
" }");
|
2150
|
+
return absl::StrJoin(config_parts, "");
|
2151
|
+
}
|
2152
|
+
|
2153
|
+
struct WeightedClustersKeys {
|
2154
|
+
std::string cluster_names_key;
|
2155
|
+
std::string cluster_weights_key;
|
2156
|
+
};
|
2157
|
+
|
2158
|
+
// Returns the cluster names and weights key or the cluster names only key.
|
2159
|
+
WeightedClustersKeys GetWeightedClustersKey(
|
2160
|
+
const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>&
|
2161
|
+
weighted_clusters) {
|
2162
|
+
std::set<std::string> cluster_names;
|
2163
|
+
std::set<std::string> cluster_weights;
|
2164
|
+
for (const auto& cluster_weight : weighted_clusters) {
|
2165
|
+
cluster_names.emplace(absl::StrFormat("%s", cluster_weight.name));
|
2166
|
+
cluster_weights.emplace(
|
2167
|
+
absl::StrFormat("%s_%d", cluster_weight.name, cluster_weight.weight));
|
2168
|
+
}
|
2169
|
+
return {absl::StrJoin(cluster_names, "_"),
|
2170
|
+
absl::StrJoin(cluster_weights, "_")};
|
2171
|
+
}
|
2172
|
+
|
2173
|
+
} // namespace
|
2174
|
+
|
2175
|
+
std::string XdsClient::WeightedClustersActionName(
|
2176
|
+
const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>&
|
2177
|
+
weighted_clusters) {
|
2178
|
+
WeightedClustersKeys keys = GetWeightedClustersKey(weighted_clusters);
|
2179
|
+
auto cluster_names_map_it =
|
2180
|
+
weighted_cluster_index_map_.find(keys.cluster_names_key);
|
2181
|
+
GPR_ASSERT(cluster_names_map_it != weighted_cluster_index_map_.end());
|
2182
|
+
const auto& cluster_weights_map =
|
2183
|
+
cluster_names_map_it->second.cluster_weights_map;
|
2184
|
+
auto cluster_weights_map_it =
|
2185
|
+
cluster_weights_map.find(keys.cluster_weights_key);
|
2186
|
+
GPR_ASSERT(cluster_weights_map_it != cluster_weights_map.end());
|
2187
|
+
return absl::StrFormat("%s_%d", keys.cluster_names_key,
|
2188
|
+
cluster_weights_map_it->second);
|
2189
|
+
}
|
2190
|
+
|
2191
|
+
void XdsClient::UpdateWeightedClusterIndexMap(
|
2192
|
+
const XdsApi::RdsUpdate& rds_update) {
|
2193
|
+
// Construct a list of unique WeightedCluster
|
2194
|
+
// actions which we need to process: to find action names
|
2195
|
+
std::map<std::string /* cluster_weights_key */,
|
2196
|
+
std::string /* cluster_names_key */>
|
2197
|
+
actions_to_process;
|
2198
|
+
for (const auto& route : rds_update.routes) {
|
2199
|
+
if (!route.weighted_clusters.empty()) {
|
2200
|
+
WeightedClustersKeys keys =
|
2201
|
+
GetWeightedClustersKey(route.weighted_clusters);
|
2202
|
+
auto action_it = actions_to_process.find(keys.cluster_weights_key);
|
2203
|
+
if (action_it == actions_to_process.end()) {
|
2204
|
+
actions_to_process[std::move(keys.cluster_weights_key)] =
|
2205
|
+
std::move(keys.cluster_names_key);
|
2206
|
+
}
|
2207
|
+
}
|
2208
|
+
}
|
2209
|
+
// First pass of all unique WeightedCluster actions: if the exact same
|
2210
|
+
// weighted target policy (same clusters and weights) appears in the old map,
|
2211
|
+
// then that old action name is taken again and should be moved to the new
|
2212
|
+
// map; any other action names from the old set of actions are candidates for
|
2213
|
+
// reuse.
|
2214
|
+
XdsClient::WeightedClusterIndexMap new_weighted_cluster_index_map;
|
2215
|
+
for (auto action_it = actions_to_process.begin();
|
2216
|
+
action_it != actions_to_process.end();) {
|
2217
|
+
const std::string& cluster_names_key = action_it->second;
|
2218
|
+
const std::string& cluster_weights_key = action_it->first;
|
2219
|
+
auto old_cluster_names_map_it =
|
2220
|
+
weighted_cluster_index_map_.find(cluster_names_key);
|
2221
|
+
if (old_cluster_names_map_it != weighted_cluster_index_map_.end()) {
|
2222
|
+
// Add cluster_names_key to the new map and copy next_index.
|
2223
|
+
auto& new_cluster_names_info =
|
2224
|
+
new_weighted_cluster_index_map[cluster_names_key];
|
2225
|
+
new_cluster_names_info.next_index =
|
2226
|
+
old_cluster_names_map_it->second.next_index;
|
2227
|
+
// Lookup cluster_weights_key in old map.
|
2228
|
+
auto& old_cluster_weights_map =
|
2229
|
+
old_cluster_names_map_it->second.cluster_weights_map;
|
2230
|
+
auto old_cluster_weights_map_it =
|
2231
|
+
old_cluster_weights_map.find(cluster_weights_key);
|
2232
|
+
if (old_cluster_weights_map_it != old_cluster_weights_map.end()) {
|
2233
|
+
// same policy found, move from old map to new map.
|
2234
|
+
new_cluster_names_info.cluster_weights_map[cluster_weights_key] =
|
2235
|
+
old_cluster_weights_map_it->second;
|
2236
|
+
old_cluster_weights_map.erase(old_cluster_weights_map_it);
|
2237
|
+
// This action has been added to new map, so no need to process it
|
2238
|
+
// again.
|
2239
|
+
action_it = actions_to_process.erase(action_it);
|
2240
|
+
continue;
|
2241
|
+
}
|
2242
|
+
}
|
2243
|
+
++action_it;
|
2244
|
+
}
|
2245
|
+
// Second pass of all remaining unique WeightedCluster actions: if clusters
|
2246
|
+
// for a new action are the same as an old unused action, reuse the name. If
|
2247
|
+
// clusters differ, use a brand new name.
|
2248
|
+
for (const auto& action : actions_to_process) {
|
2249
|
+
const std::string& cluster_names_key = action.second;
|
2250
|
+
const std::string& cluster_weights_key = action.first;
|
2251
|
+
auto& new_cluster_names_info =
|
2252
|
+
new_weighted_cluster_index_map[cluster_names_key];
|
2253
|
+
auto& old_cluster_weights_map =
|
2254
|
+
weighted_cluster_index_map_[cluster_names_key].cluster_weights_map;
|
2255
|
+
auto old_cluster_weights_it = old_cluster_weights_map.begin();
|
2256
|
+
if (old_cluster_weights_it != old_cluster_weights_map.end()) {
|
2257
|
+
// There is something to reuse: this action uses the same set
|
2258
|
+
// of clusters as a previous action and that action name is not
|
2259
|
+
// already taken.
|
2260
|
+
new_cluster_names_info.cluster_weights_map[cluster_weights_key] =
|
2261
|
+
old_cluster_weights_it->second;
|
2262
|
+
// Remove the name from being able to reuse again.
|
2263
|
+
old_cluster_weights_map.erase(old_cluster_weights_it);
|
2264
|
+
} else {
|
2265
|
+
// There is nothing to reuse, take the next index to use and
|
2266
|
+
// increment.
|
2267
|
+
new_cluster_names_info.cluster_weights_map[cluster_weights_key] =
|
2268
|
+
new_cluster_names_info.next_index++;
|
2269
|
+
}
|
2270
|
+
}
|
2271
|
+
weighted_cluster_index_map_ = std::move(new_weighted_cluster_index_map);
|
2272
|
+
}
|
2273
|
+
|
2037
2274
|
grpc_error* XdsClient::CreateServiceConfig(
|
2038
|
-
const
|
2039
|
-
RefCountedPtr<ServiceConfig>* service_config)
|
2040
|
-
|
2041
|
-
|
2042
|
-
|
2043
|
-
|
2044
|
-
|
2045
|
-
|
2046
|
-
|
2047
|
-
|
2048
|
-
|
2049
|
-
|
2275
|
+
const XdsApi::RdsUpdate& rds_update,
|
2276
|
+
RefCountedPtr<ServiceConfig>* service_config) {
|
2277
|
+
UpdateWeightedClusterIndexMap(rds_update);
|
2278
|
+
std::vector<std::string> actions_vector;
|
2279
|
+
std::vector<std::string> route_table;
|
2280
|
+
std::set<std::string> actions_set;
|
2281
|
+
for (const auto& route : rds_update.routes) {
|
2282
|
+
const std::string action_name =
|
2283
|
+
route.weighted_clusters.empty()
|
2284
|
+
? route.cluster_name
|
2285
|
+
: WeightedClustersActionName(route.weighted_clusters);
|
2286
|
+
if (actions_set.find(action_name) == actions_set.end()) {
|
2287
|
+
actions_set.emplace(action_name);
|
2288
|
+
actions_vector.push_back(
|
2289
|
+
route.weighted_clusters.empty()
|
2290
|
+
? CreateServiceConfigActionCluster(action_name)
|
2291
|
+
: CreateServiceConfigActionWeightedCluster(
|
2292
|
+
action_name, route.weighted_clusters));
|
2293
|
+
}
|
2294
|
+
route_table.push_back(CreateServiceConfigRoute(
|
2295
|
+
absl::StrFormat("%s:%s",
|
2296
|
+
route.weighted_clusters.empty() ? "cds" : "weighted",
|
2297
|
+
action_name),
|
2298
|
+
route));
|
2299
|
+
}
|
2300
|
+
std::vector<std::string> config_parts;
|
2301
|
+
config_parts.push_back(
|
2302
|
+
"{\n"
|
2303
|
+
" \"loadBalancingConfig\":[\n"
|
2304
|
+
" { \"xds_routing_experimental\":{\n"
|
2305
|
+
" \"actions\":{\n");
|
2306
|
+
config_parts.push_back(absl::StrJoin(actions_vector, ",\n"));
|
2307
|
+
config_parts.push_back(
|
2308
|
+
" },\n"
|
2309
|
+
" \"routes\":[\n");
|
2310
|
+
config_parts.push_back(absl::StrJoin(route_table, ",\n"));
|
2311
|
+
config_parts.push_back(
|
2312
|
+
" ]\n"
|
2313
|
+
" } }\n"
|
2314
|
+
" ]\n"
|
2315
|
+
"}");
|
2316
|
+
std::string json = absl::StrJoin(config_parts, "");
|
2050
2317
|
grpc_error* error = GRPC_ERROR_NONE;
|
2051
|
-
*service_config = ServiceConfig::Create(json, &error);
|
2052
|
-
gpr_free(json);
|
2318
|
+
*service_config = ServiceConfig::Create(json.c_str(), &error);
|
2053
2319
|
return error;
|
2054
2320
|
}
|
2055
2321
|
|
2056
2322
|
XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshot(
|
2057
|
-
const std::set<std::string>& clusters) {
|
2323
|
+
bool send_all_clusters, const std::set<std::string>& clusters) {
|
2058
2324
|
XdsApi::ClusterLoadReportMap snapshot_map;
|
2059
2325
|
for (auto load_report_it = load_report_map_.begin();
|
2060
2326
|
load_report_it != load_report_map_.end();) {
|
@@ -2069,7 +2335,7 @@ XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshot(
|
|
2069
2335
|
// asking for the data in the future, we don't incorrectly include
|
2070
2336
|
// data from previous reporting intervals in that future report.
|
2071
2337
|
const bool record_stats =
|
2072
|
-
clusters.find(cluster_key.first) != clusters.end();
|
2338
|
+
send_all_clusters || clusters.find(cluster_key.first) != clusters.end();
|
2073
2339
|
XdsApi::ClusterLoadReport snapshot;
|
2074
2340
|
// Aggregate drop stats.
|
2075
2341
|
snapshot.dropped_requests = std::move(load_report.deleted_drop_stats);
|
@@ -2171,4 +2437,10 @@ RefCountedPtr<XdsClient> XdsClient::GetFromChannelArgs(
|
|
2171
2437
|
return nullptr;
|
2172
2438
|
}
|
2173
2439
|
|
2440
|
+
grpc_channel_args* XdsClient::RemoveFromChannelArgs(
|
2441
|
+
const grpc_channel_args& args) {
|
2442
|
+
const char* arg_name = GRPC_ARG_XDS_CLIENT;
|
2443
|
+
return grpc_channel_args_copy_and_remove(&args, &arg_name, 1);
|
2444
|
+
}
|
2445
|
+
|
2174
2446
|
} // namespace grpc_core
|