grpc 1.27.0 → 1.30.2
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 +8023 -11435
- data/include/grpc/grpc.h +2 -2
- data/include/grpc/grpc_security.h +30 -9
- data/include/grpc/grpc_security_constants.h +1 -0
- data/include/grpc/impl/codegen/grpc_types.h +24 -21
- data/include/grpc/impl/codegen/port_platform.h +13 -2
- data/include/grpc/impl/codegen/sync.h +5 -3
- data/include/grpc/impl/codegen/sync_abseil.h +36 -0
- data/include/grpc/module.modulemap +25 -37
- data/include/grpc/support/sync_abseil.h +26 -0
- data/src/core/ext/filters/client_channel/backend_metric.cc +7 -4
- data/src/core/ext/filters/client_channel/client_channel.cc +282 -269
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +31 -47
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +1 -3
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +3 -2
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +7 -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 +1 -1
- data/src/core/ext/filters/client_channel/http_proxy.cc +21 -11
- data/src/core/ext/filters/client_channel/lb_policy.cc +19 -18
- data/src/core/ext/filters/client_channel/lb_policy.h +42 -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 +297 -0
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +83 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +286 -495
- 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/pick_first/pick_first.cc +18 -21
- 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 +10 -14
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +5 -11
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +734 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +148 -98
- 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 +834 -0
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +49 -77
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +1 -1
- 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 +129 -128
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +35 -35
- 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 +17 -21
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +5 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +72 -117
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +186 -135
- 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 +42 -45
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +94 -103
- 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 +5 -5
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +61 -10
- data/src/core/ext/filters/client_channel/resolver_factory.h +2 -2
- data/src/core/ext/filters/client_channel/resolver_registry.cc +6 -3
- data/src/core/ext/filters/client_channel/resolver_registry.h +8 -8
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +242 -300
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +21 -18
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +56 -206
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +11 -14
- 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 +144 -253
- data/src/core/ext/filters/client_channel/service_config.h +32 -109
- data/src/core/ext/filters/client_channel/service_config_call_data.h +68 -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 +54 -24
- data/src/core/ext/filters/client_channel/subchannel.h +35 -11
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +1381 -301
- data/src/core/ext/filters/client_channel/xds/xds_api.h +211 -152
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +214 -359
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +28 -44
- data/src/core/ext/filters/client_channel/xds/xds_channel.h +3 -1
- data/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +16 -11
- data/src/core/ext/filters/client_channel/xds/xds_client.cc +1118 -472
- data/src/core/ext/filters/client_channel/xds/xds_client.h +116 -45
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.cc +59 -135
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +122 -137
- data/src/core/ext/filters/http/client/http_client_filter.cc +23 -28
- data/src/core/ext/filters/http/client_authority_filter.cc +4 -4
- data/src/core/ext/filters/http/http_filters_plugin.cc +27 -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 +358 -0
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.h +29 -0
- data/src/core/ext/filters/message_size/message_size_filter.cc +38 -44
- data/src/core/ext/filters/message_size/message_size_filter.h +5 -5
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +7 -10
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +4 -6
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +26 -27
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -3
- 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.h +2 -3
- 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 +14 -21
- data/src/core/ext/transport/chttp2/transport/stream_map.h +2 -3
- data/src/core/ext/transport/chttp2/transport/writing.cc +16 -9
- data/src/core/ext/transport/inproc/inproc_transport.cc +41 -42
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.c +17 -0
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +30 -0
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +27 -0
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +54 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +5 -205
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +5 -788
- 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 +418 -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 +197 -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 +378 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +5 -362
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +14 -1337
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +403 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +1447 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +30 -8
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +60 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +2 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +2 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +7 -4
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +6 -2
- 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 +78 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +87 -23
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +262 -62
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +20 -15
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +46 -32
- 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 +72 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +27 -4
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +70 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +46 -25
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +98 -25
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +2 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +77 -21
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +201 -4
- 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 +89 -0
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +2 -0
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +8 -68
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +14 -201
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +92 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +240 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +2 -71
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +3 -228
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +91 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +266 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +2 -0
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.c +31 -0
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +53 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +109 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +399 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +18 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +33 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +145 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +527 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +43 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +112 -0
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.c +30 -0
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +53 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +63 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +199 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +18 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +33 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +815 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +3032 -0
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +59 -0
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +134 -0
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.c +28 -0
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +53 -0
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +228 -0
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +725 -0
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +316 -0
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +1132 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.c +33 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +65 -0
- 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/load_stats/v2/lrs.upb.c +4 -2
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +4 -0
- data/src/core/ext/upb-generated/envoy/type/http.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +63 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +144 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +53 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +133 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +88 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +258 -0
- data/src/core/ext/upb-generated/envoy/type/percent.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/range.upb.c +12 -0
- data/src/core/ext/upb-generated/envoy/type/range.upb.h +27 -0
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.c +29 -0
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +62 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +89 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +249 -0
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +9 -8
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +30 -24
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +30 -27
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +64 -52
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +48 -0
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +104 -0
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c +17 -0
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +30 -0
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +28 -0
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +65 -0
- data/src/core/ext/upb-generated/validate/validate.upb.c +44 -39
- data/src/core/ext/upb-generated/validate/validate.upb.h +155 -119
- 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 +32 -41
- data/src/core/lib/channel/channel_trace.h +3 -3
- data/src/core/lib/channel/channelz.cc +163 -254
- data/src/core/lib/channel/channelz.h +15 -17
- data/src/core/lib/channel/channelz_registry.cc +52 -77
- data/src/core/lib/channel/channelz_registry.h +4 -4
- 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/spinlock.h +2 -3
- data/src/core/lib/gpr/string.cc +2 -26
- data/src/core/lib/gpr/string.h +0 -16
- data/src/core/lib/gpr/sync_abseil.cc +116 -0
- data/src/core/lib/gpr/sync_posix.cc +8 -5
- data/src/core/lib/gpr/sync_windows.cc +4 -2
- 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/host_port.cc +30 -36
- data/src/core/lib/gprpp/host_port.h +14 -17
- data/src/core/lib/gprpp/map.h +5 -11
- data/src/core/lib/gprpp/memory.h +2 -6
- data/src/core/lib/gprpp/ref_counted_ptr.h +5 -0
- data/src/core/lib/gprpp/sync.h +9 -0
- data/src/core/lib/http/format_request.cc +46 -65
- data/src/core/lib/http/httpcli.cc +2 -3
- data/src/core/lib/http/httpcli.h +2 -3
- data/src/core/lib/http/httpcli_security_connector.cc +5 -5
- data/src/core/lib/http/parser.h +2 -3
- data/src/core/lib/iomgr/buffer_list.cc +36 -35
- 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 +3 -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/error.cc +6 -9
- data/src/core/lib/iomgr/error.h +4 -5
- 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 +20 -23
- data/src/core/lib/iomgr/ev_epollex_linux.cc +14 -7
- data/src/core/lib/iomgr/ev_poll_posix.cc +3 -3
- data/src/core/lib/iomgr/ev_posix.cc +2 -3
- data/src/core/lib/iomgr/exec_ctx.h +14 -2
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +84 -20
- data/src/core/lib/iomgr/load_file.cc +1 -0
- data/src/core/lib/iomgr/pollset_set_custom.cc +10 -10
- data/src/core/lib/iomgr/pollset_uv.h +32 -0
- data/src/core/lib/iomgr/port.h +1 -0
- 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 +29 -39
- 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 +8 -17
- data/src/core/lib/iomgr/resource_quota.cc +4 -6
- data/src/core/lib/iomgr/sockaddr_utils.cc +23 -29
- data/src/core/lib/iomgr/sockaddr_utils.h +9 -14
- 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 +7 -26
- data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +5 -7
- data/src/core/lib/iomgr/tcp_client_posix.cc +25 -22
- data/src/core/lib/iomgr/tcp_client_posix.h +6 -6
- data/src/core/lib/iomgr/tcp_client_windows.cc +2 -3
- data/src/core/lib/iomgr/tcp_custom.cc +2 -3
- data/src/core/lib/iomgr/tcp_posix.cc +2 -1
- data/src/core/lib/iomgr/tcp_server_custom.cc +5 -9
- data/src/core/lib/iomgr/tcp_server_posix.cc +5 -4
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -4
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +8 -11
- 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 +2 -3
- data/src/core/lib/iomgr/timer_generic.h +39 -0
- data/src/core/lib/iomgr/timer_heap.h +2 -3
- data/src/core/lib/iomgr/udp_server.cc +9 -14
- data/src/core/lib/iomgr/work_serializer.cc +155 -0
- data/src/core/lib/iomgr/work_serializer.h +65 -0
- data/src/core/lib/json/json.h +210 -79
- data/src/core/lib/json/json_reader.cc +469 -455
- data/src/core/lib/json/json_writer.cc +174 -169
- data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +1 -1
- 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 +8 -59
- data/src/core/lib/security/credentials/fake/fake_credentials.h +4 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +9 -12
- 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 +26 -56
- data/src/core/lib/security/credentials/jwt/json_token.h +4 -6
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +8 -18
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +12 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +151 -168
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +4 -6
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +91 -60
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +10 -4
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +13 -0
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -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 +40 -12
- 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 +7 -7
- 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 +6 -8
- data/src/core/lib/security/security_connector/security_connector.h +1 -1
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +20 -37
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +4 -6
- data/src/core/lib/security/security_connector/ssl_utils.cc +62 -13
- data/src/core/lib/security/security_connector/ssl_utils.h +12 -11
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +101 -52
- data/src/core/lib/security/security_connector/tls/tls_security_connector.h +32 -6
- data/src/core/lib/security/transport/auth_filters.h +0 -5
- data/src/core/lib/security/transport/client_auth_filter.cc +1 -2
- data/src/core/lib/security/transport/security_handshaker.cc +2 -2
- data/src/core/lib/security/util/json_util.cc +22 -15
- data/src/core/lib/security/util/json_util.h +2 -2
- data/src/core/lib/slice/slice_intern.cc +2 -3
- data/src/core/lib/slice/slice_internal.h +14 -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 +2 -3
- 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 +33 -33
- 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_secure.cc +1 -4
- data/src/core/lib/surface/server.cc +570 -369
- data/src/core/lib/surface/server.h +32 -0
- 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 +3 -2
- data/src/core/lib/transport/transport_op_string.cc +61 -102
- data/src/core/lib/uri/uri_parser.h +2 -3
- data/src/core/plugin_registry/grpc_plugin_registry.cc +20 -4
- data/src/core/tsi/alts/crypt/aes_gcm.cc +0 -2
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +9 -2
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +8 -4
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +33 -3
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +9 -1
- 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_boringssl.cc +1 -1
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +0 -2
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +1 -1
- data/src/core/tsi/ssl_transport_security.cc +54 -40
- data/src/core/tsi/ssl_transport_security.h +8 -8
- 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 +3 -3
- data/src/ruby/ext/grpc/rb_call.c +9 -1
- data/src/ruby/ext/grpc/rb_call_credentials.c +3 -2
- 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 +4 -4
- 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/base/attributes.h +1 -1
- data/third_party/abseil-cpp/absl/base/config.h +10 -4
- data/third_party/abseil-cpp/absl/base/internal/atomic_hook.h +30 -9
- data/third_party/abseil-cpp/absl/base/internal/errno_saver.h +43 -0
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +7 -5
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +2 -1
- data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +2 -2
- data/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc +2 -3
- data/third_party/abseil-cpp/absl/base/internal/spinlock_posix.inc +3 -3
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +37 -0
- data/third_party/abseil-cpp/absl/base/options.h +2 -10
- data/third_party/abseil-cpp/absl/strings/charconv.cc +0 -1
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +388 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +432 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +245 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +209 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h +326 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +51 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +415 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +493 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.h +23 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/output.cc +72 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/output.h +104 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc +334 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +333 -0
- data/third_party/abseil-cpp/absl/strings/str_format.h +537 -0
- data/third_party/abseil-cpp/absl/strings/string_view.h +19 -11
- 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/{src/boringssl → third_party/boringssl-with-bazel}/err_data.c +329 -297
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_bitstr.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_bool.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_d2i_fp.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_dup.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_enum.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_gentm.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_i2d_fp.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_int.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_mbstr.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_object.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_octet.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_print.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_strnid.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_time.c +3 -4
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_type.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_utctm.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_utf8.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn1_lib.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn1_locl.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn1_par.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn_pack.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/f_enum.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/f_int.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/f_string.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_dec.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_enc.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_fre.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_new.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_typ.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_utl.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/time_support.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/base64/base64.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/bio.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/bio_mem.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/connect.c +3 -4
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/fd.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/file.c +5 -6
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/hexdump.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/pair.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/printf.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/socket.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/socket_helper.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bn_extra/bn_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bn_extra/convert.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/buf/buf.c +10 -69
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/asn1_compat.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/ber.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/cbb.c +41 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/cbs.c +60 -3
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/unicode.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/chacha/chacha.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/chacha/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/cipher_extra.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/derive_key.c +1 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_aesccm.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_aesctrhmac.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_aesgcmsiv.c +8 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_chacha20poly1305.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_null.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_rc2.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_rc4.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_tls.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/tls_cbc.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cmac/cmac.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/conf/conf.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/conf/conf_def.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/conf/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-aarch64-fuchsia.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-aarch64-linux.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-arm-linux.c +7 -6
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-arm-linux.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-arm.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-intel.c +13 -4
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-ppc64le.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/crypto.c +11 -0
- data/third_party/{boringssl/third_party/fiat → boringssl-with-bazel/src/crypto/curve25519}/curve25519.c +18 -26
- data/third_party/{boringssl/third_party/fiat → boringssl-with-bazel/src/crypto/curve25519}/curve25519_tables.h +13 -21
- data/third_party/{boringssl/third_party/fiat → boringssl-with-bazel/src/crypto/curve25519}/internal.h +14 -22
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/curve25519/spake25519.c +1 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/check.c +3 -3
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/dh.c +16 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/dh_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/params.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/digest_extra/digest_extra.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dsa/dsa.c +10 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dsa/dsa_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ec_extra/ec_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ec_extra/ec_derive.c +2 -3
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +425 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +78 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ecdh_extra/ecdh_extra.c +2 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ecdsa_extra/ecdsa_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/engine/engine.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/err/err.c +39 -38
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/err/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/digestsign.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/evp.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/evp_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/evp_ctx.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_dsa_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_ec.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_ec_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_ed25519.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_ed25519_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_rsa.c +14 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_rsa_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_x25519.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_x25519_asn1.c +1 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/pbkdf.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/print.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/scrypt.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/sign.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ex_data.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes.c +108 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes_nohw.c +1282 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/aes/internal.h +5 -7
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/aes/key_wrap.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/aes/mode_wrappers.c +0 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bcm.c +4 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/add.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/asm/x86_64-gcc.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/bn.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/bytes.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/cmp.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/ctx.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/div.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/div_extra.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/exponentiation.c +3 -3
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/gcd.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/gcd_extra.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/generic.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/internal.h +14 -11
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/jacobi.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/montgomery.c +8 -8
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/montgomery_inv.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/mul.c +30 -154
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/prime.c +11 -12
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/random.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/rsaz_exp.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/rsaz_exp.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/shift.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/sqrt.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/aead.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/cipher.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/e_aes.c +3 -5
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/e_des.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/delocate.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/des/des.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/des/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/digest/digest.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/digest/digests.c +16 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/digest/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/digest/md32_common.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/ec.c +289 -117
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/ec_key.c +14 -28
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/ec_montgomery.c +96 -55
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/felem.c +25 -7
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/internal.h +432 -160
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/oct.c +63 -71
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/p224-64.c +5 -14
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64-table.h +9497 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/p256-x86_64.c +80 -99
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/p256-x86_64.h +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +736 -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 +175 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/simple.c +125 -148
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +270 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/util.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/wnaf.c +61 -18
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ecdh/ecdh.c +2 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ecdsa/ecdsa.c +20 -5
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/fips_shared_support.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/hmac/hmac.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/is_fips.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/md4/md4.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/md5/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/md5/md5.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/cbc.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/cfb.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/ctr.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/gcm.c +45 -193
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm_nohw.c +304 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/internal.h +8 -18
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/ofb.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/polyval.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rand/ctrdrbg.c +0 -0
- 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 → boringssl-with-bazel/src}/crypto/fipsmodule/rand/internal.h +41 -5
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rand/rand.c +32 -17
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rand/urandom.c +24 -114
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/blinding.c +4 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/internal.h +1 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/padding.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/rsa.c +58 -39
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/rsa_impl.c +72 -49
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/self_check/self_check.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/sha1-altivec.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/sha1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/sha256.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/sha512.c +44 -35
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/tls/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/tls/kdf.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/hkdf/hkdf.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/hrss/hrss.c +210 -311
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/hrss/internal.h +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/internal.h +21 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/lhash/lhash.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/mem.c +99 -12
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/obj/obj.c +16 -21
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/obj/obj_dat.h +41 -6
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/obj/obj_xref.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_all.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_info.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_lib.c +7 -7
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_oth.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_pk8.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_pkey.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_x509.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_xaux.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs7/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs7/pkcs7.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs7/pkcs7_x509.c +1 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs8/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs8/p5_pbev2.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs8/pkcs8.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs8/pkcs8_x509.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/poly1305/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/poly1305/poly1305.c +2 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/poly1305/poly1305_arm.c +21 -20
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/poly1305/poly1305_vec.c +34 -17
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pool/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pool/pool.c +1 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/deterministic.c +6 -10
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/forkunsafe.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/fuchsia.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/rand_extra.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/windows.c +16 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rc4/rc4.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/refcount_c11.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/refcount_lock.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rsa_extra/rsa_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rsa_extra/rsa_print.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/siphash/siphash.c +3 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/stack/stack.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/thread.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/thread_none.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/thread_pthread.c +4 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/thread_win.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +278 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +1474 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +720 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_digest.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_sign.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_strex.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_verify.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/algorithm.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/asn1_gen.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/by_dir.c +1 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/by_file.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/charmap.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/i2d_pr.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/rsa_pss.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/t_crl.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/t_req.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/t_x509.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/t_x509a.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/vpm_int.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_att.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_cmp.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_d2.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_def.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_ext.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_lu.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_obj.c +1 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_r2x.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_req.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_set.c +16 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_trs.c +1 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_txt.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_v3.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_vfy.c +5 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_vpm.c +3 -4
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509cset.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509name.c +4 -3
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509rset.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509spki.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_algor.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_all.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_attrib.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_crl.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_exten.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_info.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_name.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_pkey.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_pubkey.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_req.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_sig.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_spki.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_val.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_x509.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_x509a.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/ext_dat.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_cache.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_data.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_int.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_lib.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_map.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_node.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_tree.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_akey.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_akeya.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_alt.c +3 -3
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_bcons.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_bitst.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_conf.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_cpols.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_crld.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_enum.c +2 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_extku.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_genn.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_ia5.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_info.c +4 -5
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_int.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_lib.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_ncons.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_ocsp.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pci.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pcia.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pcons.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pku.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pmaps.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_prn.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_purp.c +2 -3
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_skey.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_sxnet.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_utl.c +11 -12
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/aead.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/aes.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/arm_arch.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/asn1.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/asn1_mac.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/asn1t.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/base.h +5 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/base64.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/bio.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/blowfish.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/bn.h +32 -20
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/buf.h +9 -9
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/buffer.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/bytestring.h +34 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/cast.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/chacha.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/cipher.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/cmac.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/conf.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/cpu.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/crypto.h +9 -4
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/curve25519.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/des.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/dh.h +20 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/digest.h +1 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/dsa.h +16 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/dtls1.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/e_os2.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ec.h +11 -4
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ec_key.h +4 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ecdh.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ecdsa.h +6 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/engine.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/err.h +13 -9
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/evp.h +20 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ex_data.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/hkdf.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/hmac.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/hrss.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/is_boringssl.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/lhash.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/md4.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/md5.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/mem.h +17 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/nid.h +14 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/obj.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/obj_mac.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/objects.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/opensslconf.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/opensslv.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ossl_typ.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pem.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pkcs12.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pkcs7.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pkcs8.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/poly1305.h +5 -7
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pool.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/rand.h +3 -17
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/rc4.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ripemd.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/rsa.h +31 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/safestack.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/sha.h +26 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/siphash.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/span.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/srtp.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ssl.h +182 -97
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ssl3.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/stack.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/thread.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/tls1.h +1 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +291 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/type_check.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/x509.h +5 -3
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/x509_vfy.h +1 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/x509v3.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/bio_ssl.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/d1_both.cc +0 -5
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/d1_lib.cc +3 -3
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/d1_pkt.cc +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/d1_srtp.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/dtls_method.cc +13 -5
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/dtls_record.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/handoff.cc +237 -51
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/handshake.cc +19 -7
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/handshake_client.cc +51 -32
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/handshake_server.cc +12 -8
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/internal.h +94 -71
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/s3_both.cc +10 -10
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/s3_lib.cc +4 -5
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/s3_pkt.cc +21 -22
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_aead_ctx.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_asn1.cc +30 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_buffer.cc +34 -15
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_cert.cc +4 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_cipher.cc +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_file.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_key_share.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_lib.cc +19 -15
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_privkey.cc +13 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_session.cc +66 -6
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_stat.cc +6 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_transcript.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_versions.cc +1 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_x509.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/t1_enc.cc +6 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/t1_lib.cc +53 -219
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls13_both.cc +1 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls13_client.cc +101 -31
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls13_enc.cc +28 -76
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls13_server.cc +111 -104
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls_method.cc +64 -26
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls_record.cc +7 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/curve25519_32.h +245 -175
- data/third_party/{boringssl → 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 +3147 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/p256_64.h +512 -503
- metadata +648 -499
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +0 -1917
- data/src/core/lib/gprpp/inlined_vector.h +0 -246
- data/src/core/lib/gprpp/optional.h +0 -74
- data/src/core/lib/gprpp/string_view.h +0 -169
- data/src/core/lib/iomgr/logical_thread.cc +0 -103
- data/src/core/lib/iomgr/logical_thread.h +0 -52
- data/src/core/lib/json/json.cc +0 -94
- data/src/core/tsi/grpc_shadow_boringssl.h +0 -3297
- data/third_party/boringssl/crypto/fipsmodule/aes/aes.c +0 -860
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64-table.h +0 -9501
- data/third_party/boringssl/crypto/fipsmodule/ec/scalar.c +0 -96
- data/third_party/boringssl/crypto/fipsmodule/ec/simple_mul.c +0 -84
- data/third_party/boringssl/third_party/fiat/p256.c +0 -1063
- data/third_party/boringssl/third_party/fiat/p256_32.h +0 -3226
@@ -19,11 +19,14 @@
|
|
19
19
|
|
20
20
|
#include <grpc/support/port_platform.h>
|
21
21
|
|
22
|
+
#include <memory>
|
23
|
+
#include <string>
|
22
24
|
#include <vector>
|
23
25
|
|
26
|
+
#include "absl/container/inlined_vector.h"
|
27
|
+
|
24
28
|
#include <grpc/impl/codegen/slice.h>
|
25
29
|
|
26
|
-
#include "src/core/lib/gprpp/inlined_vector.h"
|
27
30
|
#include "src/core/lib/gprpp/map.h"
|
28
31
|
#include "src/core/lib/gprpp/memory.h"
|
29
32
|
#include "src/core/lib/iomgr/error.h"
|
@@ -31,45 +34,37 @@
|
|
31
34
|
|
32
35
|
namespace grpc_core {
|
33
36
|
|
37
|
+
class XdsClient;
|
38
|
+
|
34
39
|
class XdsBootstrap {
|
35
40
|
public:
|
36
|
-
struct MetadataValue {
|
37
|
-
enum class Type { MD_NULL, DOUBLE, STRING, BOOL, STRUCT, LIST };
|
38
|
-
Type type = Type::MD_NULL;
|
39
|
-
// TODO(roth): Once we can use C++17, these can be in a std::variant.
|
40
|
-
double double_value;
|
41
|
-
const char* string_value;
|
42
|
-
bool bool_value;
|
43
|
-
std::map<const char*, MetadataValue, StringLess> struct_value;
|
44
|
-
std::vector<MetadataValue> list_value;
|
45
|
-
};
|
46
|
-
|
47
41
|
struct Node {
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
42
|
+
std::string id;
|
43
|
+
std::string cluster;
|
44
|
+
std::string locality_region;
|
45
|
+
std::string locality_zone;
|
46
|
+
std::string locality_subzone;
|
47
|
+
Json metadata;
|
54
48
|
};
|
55
49
|
|
56
50
|
struct ChannelCreds {
|
57
|
-
|
58
|
-
|
51
|
+
std::string type;
|
52
|
+
Json config;
|
59
53
|
};
|
60
54
|
|
61
55
|
struct XdsServer {
|
62
|
-
|
63
|
-
InlinedVector<ChannelCreds, 1> channel_creds;
|
56
|
+
std::string server_uri;
|
57
|
+
absl::InlinedVector<ChannelCreds, 1> channel_creds;
|
64
58
|
};
|
65
59
|
|
66
60
|
// If *error is not GRPC_ERROR_NONE after returning, then there was an
|
67
61
|
// error reading the file.
|
68
|
-
static std::unique_ptr<XdsBootstrap> ReadFromFile(
|
62
|
+
static std::unique_ptr<XdsBootstrap> ReadFromFile(XdsClient* client,
|
63
|
+
TraceFlag* tracer,
|
64
|
+
grpc_error** error);
|
69
65
|
|
70
66
|
// Do not instantiate directly -- use ReadFromFile() above instead.
|
71
|
-
XdsBootstrap(
|
72
|
-
~XdsBootstrap();
|
67
|
+
XdsBootstrap(Json json, grpc_error** error);
|
73
68
|
|
74
69
|
// TODO(roth): We currently support only one server. Fix this when we
|
75
70
|
// add support for fallback for the xds channel.
|
@@ -77,25 +72,14 @@ class XdsBootstrap {
|
|
77
72
|
const Node* node() const { return node_.get(); }
|
78
73
|
|
79
74
|
private:
|
80
|
-
grpc_error* ParseXdsServerList(
|
81
|
-
grpc_error* ParseXdsServer(
|
82
|
-
grpc_error* ParseChannelCredsArray(
|
83
|
-
grpc_error* ParseChannelCreds(
|
84
|
-
grpc_error* ParseNode(
|
85
|
-
grpc_error* ParseLocality(
|
86
|
-
|
87
|
-
InlinedVector<
|
88
|
-
grpc_json* json,
|
89
|
-
std::map<const char*, MetadataValue, StringLess>* result);
|
90
|
-
InlinedVector<grpc_error*, 1> ParseMetadataList(
|
91
|
-
grpc_json* json, std::vector<MetadataValue>* result);
|
92
|
-
grpc_error* ParseMetadataValue(grpc_json* json, size_t idx,
|
93
|
-
MetadataValue* result);
|
94
|
-
|
95
|
-
grpc_slice contents_;
|
96
|
-
grpc_json* tree_ = nullptr;
|
97
|
-
|
98
|
-
InlinedVector<XdsServer, 1> servers_;
|
75
|
+
grpc_error* ParseXdsServerList(Json* json);
|
76
|
+
grpc_error* ParseXdsServer(Json* json, size_t idx);
|
77
|
+
grpc_error* ParseChannelCredsArray(Json* json, XdsServer* server);
|
78
|
+
grpc_error* ParseChannelCreds(Json* json, size_t idx, XdsServer* server);
|
79
|
+
grpc_error* ParseNode(Json* json);
|
80
|
+
grpc_error* ParseLocality(Json* json);
|
81
|
+
|
82
|
+
absl::InlinedVector<XdsServer, 1> servers_;
|
99
83
|
std::unique_ptr<Node> node_;
|
100
84
|
};
|
101
85
|
|
@@ -24,6 +24,7 @@
|
|
24
24
|
#include <grpc/impl/codegen/grpc_types.h>
|
25
25
|
|
26
26
|
#include "src/core/ext/filters/client_channel/xds/xds_bootstrap.h"
|
27
|
+
#include "src/core/lib/iomgr/error.h"
|
27
28
|
|
28
29
|
namespace grpc_core {
|
29
30
|
|
@@ -36,7 +37,8 @@ namespace grpc_core {
|
|
36
37
|
grpc_channel_args* ModifyXdsChannelArgs(grpc_channel_args* args);
|
37
38
|
|
38
39
|
grpc_channel* CreateXdsChannel(const XdsBootstrap& bootstrap,
|
39
|
-
const grpc_channel_args& args
|
40
|
+
const grpc_channel_args& args,
|
41
|
+
grpc_error** error);
|
40
42
|
|
41
43
|
} // namespace grpc_core
|
42
44
|
|
@@ -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.
|
@@ -64,36 +66,39 @@ grpc_channel_args* ModifyXdsChannelArgs(grpc_channel_args* args) {
|
|
64
66
|
}
|
65
67
|
|
66
68
|
grpc_channel* CreateXdsChannel(const XdsBootstrap& bootstrap,
|
67
|
-
const grpc_channel_args& args
|
69
|
+
const grpc_channel_args& args,
|
70
|
+
grpc_error** error) {
|
68
71
|
grpc_channel_credentials* creds = nullptr;
|
69
72
|
RefCountedPtr<grpc_channel_credentials> creds_to_unref;
|
70
73
|
if (!bootstrap.server().channel_creds.empty()) {
|
71
74
|
for (size_t i = 0; i < bootstrap.server().channel_creds.size(); ++i) {
|
72
|
-
if (
|
73
|
-
0) {
|
75
|
+
if (bootstrap.server().channel_creds[i].type == "google_default") {
|
74
76
|
creds = grpc_google_default_credentials_create();
|
75
77
|
break;
|
76
|
-
} else if (
|
77
|
-
0) {
|
78
|
+
} else if (bootstrap.server().channel_creds[i].type == "fake") {
|
78
79
|
creds = grpc_fake_transport_security_credentials_create();
|
79
80
|
break;
|
80
81
|
}
|
81
82
|
}
|
82
|
-
if (creds == nullptr)
|
83
|
+
if (creds == nullptr) {
|
84
|
+
*error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
85
|
+
"no supported credential types found");
|
86
|
+
return nullptr;
|
87
|
+
}
|
83
88
|
creds_to_unref.reset(creds);
|
84
89
|
} else {
|
85
90
|
creds = grpc_channel_credentials_find_in_args(&args);
|
86
91
|
if (creds == nullptr) {
|
87
92
|
// Built with security but parent channel is insecure.
|
88
|
-
return grpc_insecure_channel_create(bootstrap.server().server_uri,
|
89
|
-
nullptr);
|
93
|
+
return grpc_insecure_channel_create(bootstrap.server().server_uri.c_str(),
|
94
|
+
&args, nullptr);
|
90
95
|
}
|
91
96
|
}
|
92
97
|
const char* arg_to_remove = GRPC_ARG_CHANNEL_CREDENTIALS;
|
93
98
|
grpc_channel_args* new_args =
|
94
99
|
grpc_channel_args_copy_and_remove(&args, &arg_to_remove, 1);
|
95
100
|
grpc_channel* channel = grpc_secure_channel_create(
|
96
|
-
creds, bootstrap.server().server_uri, new_args, nullptr);
|
101
|
+
creds, bootstrap.server().server_uri.c_str(), new_args, nullptr);
|
97
102
|
grpc_channel_args_destroy(new_args);
|
98
103
|
return channel;
|
99
104
|
}
|
@@ -22,6 +22,11 @@
|
|
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"
|
27
|
+
#include "absl/strings/str_join.h"
|
28
|
+
#include "absl/strings/string_view.h"
|
29
|
+
|
25
30
|
#include <grpc/byte_buffer_reader.h>
|
26
31
|
#include <grpc/grpc.h>
|
27
32
|
#include <grpc/support/alloc.h>
|
@@ -46,10 +51,10 @@
|
|
46
51
|
#include "src/core/lib/gprpp/orphanable.h"
|
47
52
|
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
48
53
|
#include "src/core/lib/gprpp/sync.h"
|
49
|
-
#include "src/core/lib/iomgr/combiner.h"
|
50
54
|
#include "src/core/lib/iomgr/sockaddr.h"
|
51
55
|
#include "src/core/lib/iomgr/sockaddr_utils.h"
|
52
56
|
#include "src/core/lib/iomgr/timer.h"
|
57
|
+
#include "src/core/lib/iomgr/work_serializer.h"
|
53
58
|
#include "src/core/lib/slice/slice_hash_table.h"
|
54
59
|
#include "src/core/lib/slice/slice_internal.h"
|
55
60
|
#include "src/core/lib/slice/slice_string_helpers.h"
|
@@ -93,7 +98,7 @@ class XdsClient::ChannelState::RetryableCall
|
|
93
98
|
void StartNewCallLocked();
|
94
99
|
void StartRetryTimerLocked();
|
95
100
|
static void OnRetryTimer(void* arg, grpc_error* error);
|
96
|
-
|
101
|
+
void OnRetryTimerLocked(grpc_error* error);
|
97
102
|
|
98
103
|
// The wrapped xds call that talks to the xds server. It's instantiated
|
99
104
|
// every time we start a new call. It's null during call retry backoff.
|
@@ -125,41 +130,138 @@ class XdsClient::ChannelState::AdsCallState
|
|
125
130
|
XdsClient* xds_client() const { return chand()->xds_client(); }
|
126
131
|
bool seen_response() const { return seen_response_; }
|
127
132
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
const std::string& nonce_for_unsupported_type,
|
134
|
-
grpc_error* error_for_unsupported_type,
|
135
|
-
bool is_first_message);
|
133
|
+
void Subscribe(const std::string& type_url, const std::string& name);
|
134
|
+
void Unsubscribe(const std::string& type_url, const std::string& name,
|
135
|
+
bool delay_unsubscription);
|
136
|
+
|
137
|
+
bool HasSubscribedResources() const;
|
136
138
|
|
137
139
|
private:
|
138
|
-
|
139
|
-
|
140
|
-
|
140
|
+
class ResourceState : public InternallyRefCounted<ResourceState> {
|
141
|
+
public:
|
142
|
+
ResourceState(const std::string& type_url, const std::string& name)
|
143
|
+
: type_url_(type_url), name_(name) {
|
144
|
+
GRPC_CLOSURE_INIT(&timer_callback_, OnTimer, this,
|
145
|
+
grpc_schedule_on_exec_ctx);
|
146
|
+
}
|
147
|
+
|
148
|
+
void Orphan() override {
|
149
|
+
Finish();
|
150
|
+
Unref();
|
151
|
+
}
|
152
|
+
|
153
|
+
void Start(RefCountedPtr<AdsCallState> ads_calld) {
|
154
|
+
if (sent_) return;
|
155
|
+
sent_ = true;
|
156
|
+
ads_calld_ = std::move(ads_calld);
|
157
|
+
Ref().release();
|
158
|
+
timer_pending_ = true;
|
159
|
+
grpc_timer_init(
|
160
|
+
&timer_,
|
161
|
+
ExecCtx::Get()->Now() + ads_calld_->xds_client()->request_timeout_,
|
162
|
+
&timer_callback_);
|
163
|
+
}
|
164
|
+
|
165
|
+
void Finish() {
|
166
|
+
if (timer_pending_) {
|
167
|
+
grpc_timer_cancel(&timer_);
|
168
|
+
timer_pending_ = false;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
172
|
+
private:
|
173
|
+
static void OnTimer(void* arg, grpc_error* error) {
|
174
|
+
ResourceState* self = static_cast<ResourceState*>(arg);
|
175
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
176
|
+
self->ads_calld_->xds_client()->work_serializer_->Run(
|
177
|
+
[self, error]() { self->OnTimerLocked(error); }, DEBUG_LOCATION);
|
178
|
+
}
|
179
|
+
|
180
|
+
void OnTimerLocked(grpc_error* error) {
|
181
|
+
if (error == GRPC_ERROR_NONE && timer_pending_) {
|
182
|
+
timer_pending_ = false;
|
183
|
+
char* msg;
|
184
|
+
gpr_asprintf(
|
185
|
+
&msg,
|
186
|
+
"timeout obtaining resource {type=%s name=%s} from xds server",
|
187
|
+
type_url_.c_str(), name_.c_str());
|
188
|
+
grpc_error* watcher_error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
189
|
+
gpr_free(msg);
|
190
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
191
|
+
gpr_log(GPR_INFO, "[xds_client %p] %s", ads_calld_->xds_client(),
|
192
|
+
grpc_error_string(watcher_error));
|
193
|
+
}
|
194
|
+
if (type_url_ == XdsApi::kLdsTypeUrl ||
|
195
|
+
type_url_ == XdsApi::kRdsTypeUrl) {
|
196
|
+
ads_calld_->xds_client()->service_config_watcher_->OnError(
|
197
|
+
watcher_error);
|
198
|
+
} else if (type_url_ == XdsApi::kCdsTypeUrl) {
|
199
|
+
ClusterState& state = ads_calld_->xds_client()->cluster_map_[name_];
|
200
|
+
for (const auto& p : state.watchers) {
|
201
|
+
p.first->OnError(GRPC_ERROR_REF(watcher_error));
|
202
|
+
}
|
203
|
+
GRPC_ERROR_UNREF(watcher_error);
|
204
|
+
} else if (type_url_ == XdsApi::kEdsTypeUrl) {
|
205
|
+
EndpointState& state = ads_calld_->xds_client()->endpoint_map_[name_];
|
206
|
+
for (const auto& p : state.watchers) {
|
207
|
+
p.first->OnError(GRPC_ERROR_REF(watcher_error));
|
208
|
+
}
|
209
|
+
GRPC_ERROR_UNREF(watcher_error);
|
210
|
+
} else {
|
211
|
+
GPR_UNREACHABLE_CODE(return );
|
212
|
+
}
|
213
|
+
}
|
214
|
+
ads_calld_.reset();
|
215
|
+
Unref();
|
216
|
+
GRPC_ERROR_UNREF(error);
|
217
|
+
}
|
218
|
+
|
219
|
+
const std::string type_url_;
|
220
|
+
const std::string name_;
|
221
|
+
|
222
|
+
RefCountedPtr<AdsCallState> ads_calld_;
|
223
|
+
bool sent_ = false;
|
224
|
+
bool timer_pending_ = false;
|
225
|
+
grpc_timer timer_;
|
226
|
+
grpc_closure timer_callback_;
|
227
|
+
};
|
228
|
+
|
229
|
+
struct ResourceTypeState {
|
230
|
+
~ResourceTypeState() { GRPC_ERROR_UNREF(error); }
|
141
231
|
|
142
|
-
//
|
143
|
-
|
144
|
-
|
232
|
+
// Version, nonce, and error for this resource type.
|
233
|
+
std::string version;
|
234
|
+
std::string nonce;
|
235
|
+
grpc_error* error = GRPC_ERROR_NONE;
|
145
236
|
|
146
|
-
|
237
|
+
// Subscribed resources of this type.
|
238
|
+
std::map<std::string /* name */, OrphanablePtr<ResourceState>>
|
239
|
+
subscribed_resources;
|
147
240
|
};
|
148
241
|
|
149
|
-
void
|
150
|
-
|
242
|
+
void SendMessageLocked(const std::string& type_url);
|
243
|
+
|
244
|
+
void AcceptLdsUpdate(absl::optional<XdsApi::LdsUpdate> lds_update);
|
245
|
+
void AcceptRdsUpdate(absl::optional<XdsApi::RdsUpdate> rds_update);
|
246
|
+
void AcceptCdsUpdate(XdsApi::CdsUpdateMap cds_update_map);
|
247
|
+
void AcceptEdsUpdate(XdsApi::EdsUpdateMap eds_update_map);
|
151
248
|
|
152
249
|
static void OnRequestSent(void* arg, grpc_error* error);
|
153
|
-
|
250
|
+
void OnRequestSentLocked(grpc_error* error);
|
154
251
|
static void OnResponseReceived(void* arg, grpc_error* error);
|
155
|
-
|
252
|
+
void OnResponseReceivedLocked();
|
156
253
|
static void OnStatusReceived(void* arg, grpc_error* error);
|
157
|
-
|
254
|
+
void OnStatusReceivedLocked(grpc_error* error);
|
158
255
|
|
159
256
|
bool IsCurrentCallOnChannel() const;
|
160
257
|
|
258
|
+
std::set<absl::string_view> ResourceNamesForRequest(
|
259
|
+
const std::string& type_url);
|
260
|
+
|
161
261
|
// The owning RetryableCall<>.
|
162
262
|
RefCountedPtr<RetryableCall<AdsCallState>> parent_;
|
263
|
+
|
264
|
+
bool sent_initial_message_ = false;
|
163
265
|
bool seen_response_ = false;
|
164
266
|
|
165
267
|
// Always non-NULL.
|
@@ -182,13 +284,11 @@ class XdsClient::ChannelState::AdsCallState
|
|
182
284
|
grpc_slice status_details_;
|
183
285
|
grpc_closure on_status_received_;
|
184
286
|
|
185
|
-
//
|
186
|
-
|
187
|
-
VersionState eds_version_;
|
287
|
+
// Resource types for which requests need to be sent.
|
288
|
+
std::set<std::string /*type_url*/> buffered_requests_;
|
188
289
|
|
189
|
-
//
|
190
|
-
std::map<std::string /*type_url*/,
|
191
|
-
buffered_request_map_;
|
290
|
+
// State for each resource type.
|
291
|
+
std::map<std::string /*type_url*/, ResourceTypeState> state_map_;
|
192
292
|
};
|
193
293
|
|
194
294
|
// Contains an LRS call to the xds server.
|
@@ -202,7 +302,6 @@ class XdsClient::ChannelState::LrsCallState
|
|
202
302
|
void Orphan() override;
|
203
303
|
|
204
304
|
void MaybeStartReportingLocked();
|
205
|
-
bool ShouldSendLoadReports(const StringView& cluster_name) const;
|
206
305
|
|
207
306
|
RetryableCall<LrsCallState>* parent() { return parent_.get(); }
|
208
307
|
ChannelState* chand() const { return parent_->chand(); }
|
@@ -215,6 +314,10 @@ class XdsClient::ChannelState::LrsCallState
|
|
215
314
|
public:
|
216
315
|
Reporter(RefCountedPtr<LrsCallState> parent, grpc_millis report_interval)
|
217
316
|
: parent_(std::move(parent)), report_interval_(report_interval) {
|
317
|
+
GRPC_CLOSURE_INIT(&on_next_report_timer_, OnNextReportTimer, this,
|
318
|
+
grpc_schedule_on_exec_ctx);
|
319
|
+
GRPC_CLOSURE_INIT(&on_report_done_, OnReportDone, this,
|
320
|
+
grpc_schedule_on_exec_ctx);
|
218
321
|
ScheduleNextReportLocked();
|
219
322
|
}
|
220
323
|
|
@@ -223,10 +326,10 @@ class XdsClient::ChannelState::LrsCallState
|
|
223
326
|
private:
|
224
327
|
void ScheduleNextReportLocked();
|
225
328
|
static void OnNextReportTimer(void* arg, grpc_error* error);
|
226
|
-
|
329
|
+
void OnNextReportTimerLocked(grpc_error* error);
|
227
330
|
void SendReportLocked();
|
228
331
|
static void OnReportDone(void* arg, grpc_error* error);
|
229
|
-
|
332
|
+
void OnReportDoneLocked(grpc_error* error);
|
230
333
|
|
231
334
|
bool IsCurrentReporterOnCall() const {
|
232
335
|
return this == parent_->reporter_.get();
|
@@ -246,11 +349,11 @@ class XdsClient::ChannelState::LrsCallState
|
|
246
349
|
};
|
247
350
|
|
248
351
|
static void OnInitialRequestSent(void* arg, grpc_error* error);
|
352
|
+
void OnInitialRequestSentLocked();
|
249
353
|
static void OnResponseReceived(void* arg, grpc_error* error);
|
354
|
+
void OnResponseReceivedLocked();
|
250
355
|
static void OnStatusReceived(void* arg, grpc_error* error);
|
251
|
-
|
252
|
-
static void OnResponseReceivedLocked(void* arg, grpc_error* error);
|
253
|
-
static void OnStatusReceivedLocked(void* arg, grpc_error* error);
|
356
|
+
void OnStatusReceivedLocked(grpc_error* error);
|
254
357
|
|
255
358
|
bool IsCurrentCallOnChannel() const;
|
256
359
|
|
@@ -279,6 +382,7 @@ class XdsClient::ChannelState::LrsCallState
|
|
279
382
|
grpc_closure on_status_received_;
|
280
383
|
|
281
384
|
// Load reporting state.
|
385
|
+
bool send_all_clusters_ = false;
|
282
386
|
std::set<std::string> cluster_names_; // Asked for by the LRS server.
|
283
387
|
grpc_millis load_reporting_interval_ = 0;
|
284
388
|
OrphanablePtr<Reporter> reporter_;
|
@@ -292,7 +396,8 @@ class XdsClient::ChannelState::StateWatcher
|
|
292
396
|
: public AsyncConnectivityStateWatcherInterface {
|
293
397
|
public:
|
294
398
|
explicit StateWatcher(RefCountedPtr<ChannelState> parent)
|
295
|
-
: AsyncConnectivityStateWatcherInterface(
|
399
|
+
: AsyncConnectivityStateWatcherInterface(
|
400
|
+
parent->xds_client()->work_serializer_),
|
296
401
|
parent_(std::move(parent)) {}
|
297
402
|
|
298
403
|
private:
|
@@ -341,9 +446,14 @@ grpc_channel_args* BuildXdsChannelArgs(const grpc_channel_args& args) {
|
|
341
446
|
// Don't want to pass down channelz node from parent; the balancer
|
342
447
|
// channel will get its own.
|
343
448
|
GRPC_ARG_CHANNELZ_CHANNEL_NODE,
|
449
|
+
// Keepalive interval. We are explicitly setting our own value below.
|
450
|
+
GRPC_ARG_KEEPALIVE_TIME_MS,
|
344
451
|
};
|
345
452
|
// Channel args to add.
|
346
|
-
InlinedVector<grpc_arg,
|
453
|
+
absl::InlinedVector<grpc_arg, 3> args_to_add;
|
454
|
+
// Keepalive interval.
|
455
|
+
args_to_add.emplace_back(grpc_channel_arg_integer_create(
|
456
|
+
const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS), 5000));
|
347
457
|
// A channel arg indicating that the target is an xds server.
|
348
458
|
// TODO(roth): Once we figure out our fallback and credentials story, decide
|
349
459
|
// whether this is actually needed. Note that it's currently used by the
|
@@ -371,12 +481,10 @@ grpc_channel_args* BuildXdsChannelArgs(const grpc_channel_args& args) {
|
|
371
481
|
} // namespace
|
372
482
|
|
373
483
|
XdsClient::ChannelState::ChannelState(RefCountedPtr<XdsClient> xds_client,
|
374
|
-
|
484
|
+
grpc_channel* channel)
|
375
485
|
: InternallyRefCounted<ChannelState>(&grpc_xds_client_trace),
|
376
|
-
xds_client_(std::move(xds_client))
|
377
|
-
|
378
|
-
channel_ = CreateXdsChannel(*xds_client_->bootstrap_, *new_args);
|
379
|
-
grpc_channel_args_destroy(new_args);
|
486
|
+
xds_client_(std::move(xds_client)),
|
487
|
+
channel_(channel) {
|
380
488
|
GPR_ASSERT(channel_ != nullptr);
|
381
489
|
StartConnectivityWatchLocked();
|
382
490
|
}
|
@@ -436,31 +544,31 @@ void XdsClient::ChannelState::CancelConnectivityWatchLocked() {
|
|
436
544
|
grpc_client_channel_stop_connectivity_watch(client_channel_elem, watcher_);
|
437
545
|
}
|
438
546
|
|
439
|
-
void XdsClient::ChannelState::
|
440
|
-
|
547
|
+
void XdsClient::ChannelState::Subscribe(const std::string& type_url,
|
548
|
+
const std::string& name) {
|
441
549
|
if (ads_calld_ == nullptr) {
|
442
550
|
// Start the ADS call if this is the first request.
|
443
551
|
ads_calld_.reset(new RetryableCall<AdsCallState>(
|
444
552
|
Ref(DEBUG_LOCATION, "ChannelState+ads")));
|
445
|
-
// Note: AdsCallState's ctor will automatically
|
446
|
-
// we can
|
553
|
+
// Note: AdsCallState's ctor will automatically subscribe to all
|
554
|
+
// resources that the XdsClient already has watchers for, so we can
|
555
|
+
// return here.
|
447
556
|
return;
|
448
557
|
}
|
449
558
|
// If the ADS call is in backoff state, we don't need to do anything now
|
450
559
|
// because when the call is restarted it will resend all necessary requests.
|
451
560
|
if (ads_calld() == nullptr) return;
|
452
|
-
//
|
453
|
-
ads_calld()->
|
561
|
+
// Subscribe to this resource if the ADS call is active.
|
562
|
+
ads_calld()->Subscribe(type_url, name);
|
454
563
|
}
|
455
564
|
|
456
|
-
void XdsClient::ChannelState::
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
565
|
+
void XdsClient::ChannelState::Unsubscribe(const std::string& type_url,
|
566
|
+
const std::string& name,
|
567
|
+
bool delay_unsubscription) {
|
568
|
+
if (ads_calld_ != nullptr) {
|
569
|
+
ads_calld_->calld()->Unsubscribe(type_url, name, delay_unsubscription);
|
570
|
+
if (!ads_calld_->calld()->HasSubscribedResources()) ads_calld_.reset();
|
461
571
|
}
|
462
|
-
if (!xds_client()->endpoint_map_.empty()) return;
|
463
|
-
ads_calld_.reset();
|
464
572
|
}
|
465
573
|
|
466
574
|
//
|
@@ -478,6 +586,9 @@ XdsClient::ChannelState::RetryableCall
|
|
478
586
|
.set_multiplier(GRPC_XDS_RECONNECT_BACKOFF_MULTIPLIER)
|
479
587
|
.set_jitter(GRPC_XDS_RECONNECT_JITTER)
|
480
588
|
.set_max_backoff(GRPC_XDS_RECONNECT_MAX_BACKOFF_SECONDS * 1000)) {
|
589
|
+
// Closure Initialization
|
590
|
+
GRPC_CLOSURE_INIT(&on_retry_timer_, OnRetryTimer, this,
|
591
|
+
grpc_schedule_on_exec_ctx);
|
481
592
|
StartNewCallLocked();
|
482
593
|
}
|
483
594
|
|
@@ -531,8 +642,6 @@ void XdsClient::ChannelState::RetryableCall
|
|
531
642
|
chand()->xds_client(), chand(), timeout);
|
532
643
|
}
|
533
644
|
this->Ref(DEBUG_LOCATION, "RetryableCall+retry_timer_start").release();
|
534
|
-
GRPC_CLOSURE_INIT(&on_retry_timer_, OnRetryTimer, this,
|
535
|
-
grpc_schedule_on_exec_ctx);
|
536
645
|
grpc_timer_init(&retry_timer_, next_attempt_time, &on_retry_timer_);
|
537
646
|
retry_timer_callback_pending_ = true;
|
538
647
|
}
|
@@ -541,27 +650,26 @@ template
|
|
541
650
|
void XdsClient::ChannelState::RetryableCall<T>::OnRetryTimer(
|
542
651
|
void* arg, grpc_error* error) {
|
543
652
|
RetryableCall* calld = static_cast<RetryableCall*>(arg);
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
GRPC_ERROR_REF(error));
|
653
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
654
|
+
calld->chand_->xds_client()->work_serializer_->Run(
|
655
|
+
[calld, error]() { calld->OnRetryTimerLocked(error); }, DEBUG_LOCATION);
|
548
656
|
}
|
549
657
|
|
550
658
|
template <typename T>
|
551
659
|
void XdsClient::ChannelState::RetryableCall<T>::OnRetryTimerLocked(
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
if (!calld->shutting_down_ && error == GRPC_ERROR_NONE) {
|
660
|
+
grpc_error* error) {
|
661
|
+
retry_timer_callback_pending_ = false;
|
662
|
+
if (!shutting_down_ && error == GRPC_ERROR_NONE) {
|
556
663
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
557
664
|
gpr_log(
|
558
665
|
GPR_INFO,
|
559
666
|
"[xds_client %p] Retry timer fires (chand: %p, retryable call: %p)",
|
560
|
-
|
667
|
+
chand()->xds_client(), chand(), this);
|
561
668
|
}
|
562
|
-
|
669
|
+
StartNewCallLocked();
|
563
670
|
}
|
564
|
-
|
671
|
+
this->Unref(DEBUG_LOCATION, "RetryableCall+retry_timer_done");
|
672
|
+
GRPC_ERROR_UNREF(error);
|
565
673
|
}
|
566
674
|
|
567
675
|
//
|
@@ -602,7 +710,8 @@ XdsClient::ChannelState::AdsCallState::AdsCallState(
|
|
602
710
|
grpc_op* op = ops;
|
603
711
|
op->op = GRPC_OP_SEND_INITIAL_METADATA;
|
604
712
|
op->data.send_initial_metadata.count = 0;
|
605
|
-
op->flags =
|
713
|
+
op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY |
|
714
|
+
GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET;
|
606
715
|
op->reserved = nullptr;
|
607
716
|
op++;
|
608
717
|
call_error = grpc_call_start_batch_and_execute(call_, ops, (size_t)(op - ops),
|
@@ -611,13 +720,19 @@ XdsClient::ChannelState::AdsCallState::AdsCallState(
|
|
611
720
|
// Op: send request message.
|
612
721
|
GRPC_CLOSURE_INIT(&on_request_sent_, OnRequestSent, this,
|
613
722
|
grpc_schedule_on_exec_ctx);
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
723
|
+
if (xds_client()->service_config_watcher_ != nullptr) {
|
724
|
+
Subscribe(XdsApi::kLdsTypeUrl, xds_client()->server_name_);
|
725
|
+
if (xds_client()->lds_result_.has_value() &&
|
726
|
+
!xds_client()->lds_result_->route_config_name.empty()) {
|
727
|
+
Subscribe(XdsApi::kRdsTypeUrl,
|
728
|
+
xds_client()->lds_result_->route_config_name);
|
729
|
+
}
|
730
|
+
}
|
731
|
+
for (const auto& p : xds_client()->cluster_map_) {
|
732
|
+
Subscribe(XdsApi::kCdsTypeUrl, std::string(p.first));
|
618
733
|
}
|
619
|
-
|
620
|
-
|
734
|
+
for (const auto& p : xds_client()->endpoint_map_) {
|
735
|
+
Subscribe(XdsApi::kEdsTypeUrl, std::string(p.first));
|
621
736
|
}
|
622
737
|
// Op: recv initial metadata.
|
623
738
|
op = ops;
|
@@ -675,40 +790,40 @@ void XdsClient::ChannelState::AdsCallState::Orphan() {
|
|
675
790
|
// we are here because xds_client has to orphan a failed call, then the
|
676
791
|
// following cancellation will be a no-op.
|
677
792
|
grpc_call_cancel(call_, nullptr);
|
793
|
+
state_map_.clear();
|
678
794
|
// Note that the initial ref is hold by on_status_received_. So the
|
679
795
|
// corresponding unref happens in on_status_received_ instead of here.
|
680
796
|
}
|
681
797
|
|
682
798
|
void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
|
683
|
-
const std::string& type_url
|
684
|
-
grpc_error* error_for_unsupported_type, bool is_first_message) {
|
799
|
+
const std::string& type_url) {
|
685
800
|
// Buffer message sending if an existing message is in flight.
|
686
801
|
if (send_message_payload_ != nullptr) {
|
687
|
-
|
688
|
-
nonce_for_unsupported_type, error_for_unsupported_type));
|
802
|
+
buffered_requests_.insert(type_url);
|
689
803
|
return;
|
690
804
|
}
|
805
|
+
auto& state = state_map_[type_url];
|
691
806
|
grpc_slice request_payload_slice;
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
request_payload_slice = XdsUnsupportedTypeNackRequestCreateAndEncode(
|
710
|
-
type_url, nonce_for_unsupported_type, error_for_unsupported_type);
|
807
|
+
std::set<absl::string_view> resource_names =
|
808
|
+
ResourceNamesForRequest(type_url);
|
809
|
+
request_payload_slice = xds_client()->api_.CreateAdsRequest(
|
810
|
+
type_url, resource_names, state.version, state.nonce,
|
811
|
+
GRPC_ERROR_REF(state.error), !sent_initial_message_);
|
812
|
+
if (type_url != XdsApi::kLdsTypeUrl && type_url != XdsApi::kRdsTypeUrl &&
|
813
|
+
type_url != XdsApi::kCdsTypeUrl && type_url != XdsApi::kEdsTypeUrl) {
|
814
|
+
state_map_.erase(type_url);
|
815
|
+
}
|
816
|
+
sent_initial_message_ = true;
|
817
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
818
|
+
gpr_log(GPR_INFO,
|
819
|
+
"[xds_client %p] sending ADS request: type=%s version=%s nonce=%s "
|
820
|
+
"error=%s resources=%s",
|
821
|
+
xds_client(), type_url.c_str(), state.version.c_str(),
|
822
|
+
state.nonce.c_str(), grpc_error_string(state.error),
|
823
|
+
absl::StrJoin(resource_names, " ").c_str());
|
711
824
|
}
|
825
|
+
GRPC_ERROR_UNREF(state.error);
|
826
|
+
state.error = GRPC_ERROR_NONE;
|
712
827
|
// Create message payload.
|
713
828
|
send_message_payload_ =
|
714
829
|
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
|
@@ -731,29 +846,182 @@ void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
|
|
731
846
|
}
|
732
847
|
}
|
733
848
|
|
849
|
+
void XdsClient::ChannelState::AdsCallState::Subscribe(
|
850
|
+
const std::string& type_url, const std::string& name) {
|
851
|
+
auto& state = state_map_[type_url].subscribed_resources[name];
|
852
|
+
if (state == nullptr) {
|
853
|
+
state = MakeOrphanable<ResourceState>(type_url, name);
|
854
|
+
SendMessageLocked(type_url);
|
855
|
+
}
|
856
|
+
}
|
857
|
+
|
858
|
+
void XdsClient::ChannelState::AdsCallState::Unsubscribe(
|
859
|
+
const std::string& type_url, const std::string& name,
|
860
|
+
bool delay_unsubscription) {
|
861
|
+
state_map_[type_url].subscribed_resources.erase(name);
|
862
|
+
if (!delay_unsubscription) SendMessageLocked(type_url);
|
863
|
+
}
|
864
|
+
|
865
|
+
bool XdsClient::ChannelState::AdsCallState::HasSubscribedResources() const {
|
866
|
+
for (const auto& p : state_map_) {
|
867
|
+
if (!p.second.subscribed_resources.empty()) return true;
|
868
|
+
}
|
869
|
+
return false;
|
870
|
+
}
|
871
|
+
|
872
|
+
void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate(
|
873
|
+
absl::optional<XdsApi::LdsUpdate> lds_update) {
|
874
|
+
if (!lds_update.has_value()) {
|
875
|
+
gpr_log(GPR_INFO,
|
876
|
+
"[xds_client %p] LDS update does not include requested resource",
|
877
|
+
xds_client());
|
878
|
+
if (xds_client()->lds_result_.has_value() &&
|
879
|
+
!xds_client()->lds_result_->route_config_name.empty()) {
|
880
|
+
Unsubscribe(XdsApi::kRdsTypeUrl,
|
881
|
+
xds_client()->lds_result_->route_config_name,
|
882
|
+
/*delay_unsubscription=*/false);
|
883
|
+
xds_client()->rds_result_.reset();
|
884
|
+
}
|
885
|
+
xds_client()->lds_result_.reset();
|
886
|
+
xds_client()->service_config_watcher_->OnResourceDoesNotExist();
|
887
|
+
return;
|
888
|
+
}
|
889
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
890
|
+
gpr_log(GPR_INFO,
|
891
|
+
"[xds_client %p] LDS update received: route_config_name=%s",
|
892
|
+
xds_client(),
|
893
|
+
(!lds_update->route_config_name.empty()
|
894
|
+
? lds_update->route_config_name.c_str()
|
895
|
+
: "<inlined>"));
|
896
|
+
if (lds_update->rds_update.has_value()) {
|
897
|
+
gpr_log(GPR_INFO, " RouteConfiguration contains %" PRIuPTR " routes",
|
898
|
+
lds_update->rds_update.value().routes.size());
|
899
|
+
for (const auto& route : lds_update->rds_update.value().routes) {
|
900
|
+
gpr_log(GPR_INFO,
|
901
|
+
" route: { service=\"%s\", "
|
902
|
+
"method=\"%s\" }, cluster=\"%s\" }",
|
903
|
+
route.service.c_str(), route.method.c_str(),
|
904
|
+
route.cluster_name.c_str());
|
905
|
+
}
|
906
|
+
}
|
907
|
+
}
|
908
|
+
auto& lds_state = state_map_[XdsApi::kLdsTypeUrl];
|
909
|
+
auto& state = lds_state.subscribed_resources[xds_client()->server_name_];
|
910
|
+
if (state != nullptr) state->Finish();
|
911
|
+
// Ignore identical update.
|
912
|
+
if (xds_client()->lds_result_ == lds_update) {
|
913
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
914
|
+
gpr_log(GPR_INFO,
|
915
|
+
"[xds_client %p] LDS update identical to current, ignoring.",
|
916
|
+
xds_client());
|
917
|
+
}
|
918
|
+
return;
|
919
|
+
}
|
920
|
+
if (xds_client()->lds_result_.has_value() &&
|
921
|
+
!xds_client()->lds_result_->route_config_name.empty()) {
|
922
|
+
Unsubscribe(
|
923
|
+
XdsApi::kRdsTypeUrl, xds_client()->lds_result_->route_config_name,
|
924
|
+
/*delay_unsubscription=*/!lds_update->route_config_name.empty());
|
925
|
+
xds_client()->rds_result_.reset();
|
926
|
+
}
|
927
|
+
xds_client()->lds_result_ = std::move(lds_update);
|
928
|
+
if (xds_client()->lds_result_->rds_update.has_value()) {
|
929
|
+
// If the RouteConfiguration was found inlined in LDS response, notify
|
930
|
+
// the watcher immediately.
|
931
|
+
RefCountedPtr<ServiceConfig> service_config;
|
932
|
+
grpc_error* error = xds_client()->CreateServiceConfig(
|
933
|
+
xds_client()->lds_result_->rds_update.value(), &service_config);
|
934
|
+
if (error == GRPC_ERROR_NONE) {
|
935
|
+
xds_client()->service_config_watcher_->OnServiceConfigChanged(
|
936
|
+
std::move(service_config));
|
937
|
+
} else {
|
938
|
+
xds_client()->service_config_watcher_->OnError(error);
|
939
|
+
}
|
940
|
+
} else {
|
941
|
+
// Send RDS request for dynamic resolution.
|
942
|
+
Subscribe(XdsApi::kRdsTypeUrl,
|
943
|
+
xds_client()->lds_result_->route_config_name);
|
944
|
+
}
|
945
|
+
}
|
946
|
+
|
947
|
+
void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdate(
|
948
|
+
absl::optional<XdsApi::RdsUpdate> rds_update) {
|
949
|
+
if (!rds_update.has_value()) {
|
950
|
+
gpr_log(GPR_INFO,
|
951
|
+
"[xds_client %p] RDS update does not include requested resource",
|
952
|
+
xds_client());
|
953
|
+
xds_client()->rds_result_.reset();
|
954
|
+
xds_client()->service_config_watcher_->OnResourceDoesNotExist();
|
955
|
+
return;
|
956
|
+
}
|
957
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
958
|
+
gpr_log(GPR_INFO,
|
959
|
+
"[xds_client %p] RDS update received; RouteConfiguration contains "
|
960
|
+
"%" PRIuPTR " routes",
|
961
|
+
this, rds_update.value().routes.size());
|
962
|
+
for (const auto& route : rds_update.value().routes) {
|
963
|
+
gpr_log(GPR_INFO,
|
964
|
+
" route: { service=\"%s\", "
|
965
|
+
"method=\"%s\" }, cluster=\"%s\" }",
|
966
|
+
route.service.c_str(), route.method.c_str(),
|
967
|
+
route.cluster_name.c_str());
|
968
|
+
}
|
969
|
+
}
|
970
|
+
auto& rds_state = state_map_[XdsApi::kRdsTypeUrl];
|
971
|
+
auto& state =
|
972
|
+
rds_state
|
973
|
+
.subscribed_resources[xds_client()->lds_result_->route_config_name];
|
974
|
+
if (state != nullptr) state->Finish();
|
975
|
+
// Ignore identical update.
|
976
|
+
if (xds_client()->rds_result_ == rds_update) {
|
977
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
978
|
+
gpr_log(GPR_INFO,
|
979
|
+
"[xds_client %p] RDS update identical to current, ignoring.",
|
980
|
+
xds_client());
|
981
|
+
}
|
982
|
+
return;
|
983
|
+
}
|
984
|
+
xds_client()->rds_result_ = std::move(rds_update);
|
985
|
+
// Notify the watcher.
|
986
|
+
RefCountedPtr<ServiceConfig> service_config;
|
987
|
+
grpc_error* error = xds_client()->CreateServiceConfig(
|
988
|
+
xds_client()->rds_result_.value(), &service_config);
|
989
|
+
if (error == GRPC_ERROR_NONE) {
|
990
|
+
xds_client()->service_config_watcher_->OnServiceConfigChanged(
|
991
|
+
std::move(service_config));
|
992
|
+
} else {
|
993
|
+
xds_client()->service_config_watcher_->OnError(error);
|
994
|
+
}
|
995
|
+
}
|
996
|
+
|
734
997
|
void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
|
735
|
-
CdsUpdateMap cds_update_map
|
998
|
+
XdsApi::CdsUpdateMap cds_update_map) {
|
999
|
+
auto& cds_state = state_map_[XdsApi::kCdsTypeUrl];
|
1000
|
+
std::set<std::string> eds_resource_names_seen;
|
736
1001
|
for (auto& p : cds_update_map) {
|
737
1002
|
const char* cluster_name = p.first.c_str();
|
738
|
-
CdsUpdate& cds_update = p.second;
|
1003
|
+
XdsApi::CdsUpdate& cds_update = p.second;
|
1004
|
+
auto& state = cds_state.subscribed_resources[cluster_name];
|
1005
|
+
if (state != nullptr) state->Finish();
|
739
1006
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
740
1007
|
gpr_log(GPR_INFO,
|
741
1008
|
"[xds_client %p] CDS update (cluster=%s) received: "
|
742
|
-
"eds_service_name=%s, "
|
743
|
-
"lrs_load_reporting_server_name=%s",
|
1009
|
+
"eds_service_name=%s, lrs_load_reporting_server_name=%s",
|
744
1010
|
xds_client(), cluster_name, cds_update.eds_service_name.c_str(),
|
745
1011
|
cds_update.lrs_load_reporting_server_name.has_value()
|
746
1012
|
? cds_update.lrs_load_reporting_server_name.value().c_str()
|
747
1013
|
: "(N/A)");
|
748
1014
|
}
|
749
|
-
|
1015
|
+
// Record the EDS resource names seen.
|
1016
|
+
eds_resource_names_seen.insert(cds_update.eds_service_name.empty()
|
1017
|
+
? cluster_name
|
1018
|
+
: cds_update.eds_service_name);
|
750
1019
|
// Ignore identical update.
|
1020
|
+
ClusterState& cluster_state = xds_client()->cluster_map_[cluster_name];
|
751
1021
|
if (cluster_state.update.has_value() &&
|
752
|
-
cds_update.eds_service_name ==
|
753
|
-
|
754
|
-
|
755
|
-
cluster_state.update.value()
|
756
|
-
.lrs_load_reporting_server_name.value()) {
|
1022
|
+
cds_update.eds_service_name == cluster_state.update->eds_service_name &&
|
1023
|
+
cds_update.lrs_load_reporting_server_name ==
|
1024
|
+
cluster_state.update->lrs_load_reporting_server_name) {
|
757
1025
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
758
1026
|
gpr_log(GPR_INFO,
|
759
1027
|
"[xds_client %p] CDS update identical to current, ignoring.",
|
@@ -762,20 +1030,50 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
|
|
762
1030
|
continue;
|
763
1031
|
}
|
764
1032
|
// Update the cluster state.
|
765
|
-
cluster_state.update
|
1033
|
+
cluster_state.update = std::move(cds_update);
|
766
1034
|
// Notify all watchers.
|
767
1035
|
for (const auto& p : cluster_state.watchers) {
|
768
1036
|
p.first->OnClusterChanged(cluster_state.update.value());
|
769
1037
|
}
|
770
1038
|
}
|
771
|
-
|
1039
|
+
// For any subscribed resource that is not present in the update,
|
1040
|
+
// remove it from the cache and notify watchers that it does not exist.
|
1041
|
+
for (const auto& p : cds_state.subscribed_resources) {
|
1042
|
+
const std::string& cluster_name = p.first;
|
1043
|
+
if (cds_update_map.find(cluster_name) == cds_update_map.end()) {
|
1044
|
+
ClusterState& cluster_state = xds_client()->cluster_map_[cluster_name];
|
1045
|
+
cluster_state.update.reset();
|
1046
|
+
for (const auto& p : cluster_state.watchers) {
|
1047
|
+
p.first->OnResourceDoesNotExist();
|
1048
|
+
}
|
1049
|
+
}
|
1050
|
+
}
|
1051
|
+
// For any EDS resource that is no longer referred to by any CDS
|
1052
|
+
// resources, remove it from the cache and notify watchers that it
|
1053
|
+
// does not exist.
|
1054
|
+
auto& eds_state = state_map_[XdsApi::kEdsTypeUrl];
|
1055
|
+
for (const auto& p : eds_state.subscribed_resources) {
|
1056
|
+
const std::string& eds_resource_name = p.first;
|
1057
|
+
if (eds_resource_names_seen.find(eds_resource_name) ==
|
1058
|
+
eds_resource_names_seen.end()) {
|
1059
|
+
EndpointState& endpoint_state =
|
1060
|
+
xds_client()->endpoint_map_[eds_resource_name];
|
1061
|
+
endpoint_state.update.reset();
|
1062
|
+
for (const auto& p : endpoint_state.watchers) {
|
1063
|
+
p.first->OnResourceDoesNotExist();
|
1064
|
+
}
|
1065
|
+
}
|
1066
|
+
}
|
772
1067
|
}
|
773
1068
|
|
774
1069
|
void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
|
775
|
-
EdsUpdateMap eds_update_map
|
1070
|
+
XdsApi::EdsUpdateMap eds_update_map) {
|
1071
|
+
auto& eds_state = state_map_[XdsApi::kEdsTypeUrl];
|
776
1072
|
for (auto& p : eds_update_map) {
|
777
1073
|
const char* eds_service_name = p.first.c_str();
|
778
|
-
EdsUpdate& eds_update = p.second;
|
1074
|
+
XdsApi::EdsUpdate& eds_update = p.second;
|
1075
|
+
auto& state = eds_state.subscribed_resources[eds_service_name];
|
1076
|
+
if (state != nullptr) state->Finish();
|
779
1077
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
780
1078
|
gpr_log(GPR_INFO,
|
781
1079
|
"[xds_client %p] EDS response with %" PRIuPTR
|
@@ -783,7 +1081,7 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
|
|
783
1081
|
" drop categories received (drop_all=%d)",
|
784
1082
|
xds_client(), eds_update.priority_list_update.size(),
|
785
1083
|
eds_update.drop_config->drop_category_list().size(),
|
786
|
-
eds_update.drop_all);
|
1084
|
+
eds_update.drop_config->drop_all());
|
787
1085
|
for (size_t priority = 0;
|
788
1086
|
priority < eds_update.priority_list_update.size(); ++priority) {
|
789
1087
|
const auto* locality_map_update = eds_update.priority_list_update.Find(
|
@@ -797,27 +1095,25 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
|
|
797
1095
|
const auto& locality = p.second;
|
798
1096
|
gpr_log(GPR_INFO,
|
799
1097
|
"[xds_client %p] Priority %" PRIuPTR ", locality %" PRIuPTR
|
800
|
-
" %s contains %" PRIuPTR " server addresses",
|
1098
|
+
" %s has weight %d, contains %" PRIuPTR " server addresses",
|
801
1099
|
xds_client(), priority, locality_count,
|
802
|
-
locality.name->AsHumanReadableString(),
|
1100
|
+
locality.name->AsHumanReadableString(), locality.lb_weight,
|
803
1101
|
locality.serverlist.size());
|
804
1102
|
for (size_t i = 0; i < locality.serverlist.size(); ++i) {
|
805
|
-
|
806
|
-
|
807
|
-
false);
|
1103
|
+
std::string ipport = grpc_sockaddr_to_string(
|
1104
|
+
&locality.serverlist[i].address(), false);
|
808
1105
|
gpr_log(GPR_INFO,
|
809
1106
|
"[xds_client %p] Priority %" PRIuPTR ", locality %" PRIuPTR
|
810
1107
|
" %s, server address %" PRIuPTR ": %s",
|
811
1108
|
xds_client(), priority, locality_count,
|
812
|
-
locality.name->AsHumanReadableString(), i, ipport);
|
813
|
-
gpr_free(ipport);
|
1109
|
+
locality.name->AsHumanReadableString(), i, ipport.c_str());
|
814
1110
|
}
|
815
1111
|
++locality_count;
|
816
1112
|
}
|
817
1113
|
}
|
818
1114
|
for (size_t i = 0;
|
819
1115
|
i < eds_update.drop_config->drop_category_list().size(); ++i) {
|
820
|
-
const
|
1116
|
+
const XdsApi::DropConfig::DropCategory& drop_category =
|
821
1117
|
eds_update.drop_config->drop_category_list()[i];
|
822
1118
|
gpr_log(GPR_INFO,
|
823
1119
|
"[xds_client %p] Drop category %s has drop rate %d per million",
|
@@ -828,95 +1124,85 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
|
|
828
1124
|
EndpointState& endpoint_state =
|
829
1125
|
xds_client()->endpoint_map_[eds_service_name];
|
830
1126
|
// Ignore identical update.
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
if (
|
839
|
-
|
840
|
-
|
841
|
-
|
1127
|
+
if (endpoint_state.update.has_value()) {
|
1128
|
+
const XdsApi::EdsUpdate& prev_update = endpoint_state.update.value();
|
1129
|
+
const bool priority_list_changed =
|
1130
|
+
prev_update.priority_list_update != eds_update.priority_list_update;
|
1131
|
+
const bool drop_config_changed =
|
1132
|
+
prev_update.drop_config == nullptr ||
|
1133
|
+
*prev_update.drop_config != *eds_update.drop_config;
|
1134
|
+
if (!priority_list_changed && !drop_config_changed) {
|
1135
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1136
|
+
gpr_log(GPR_INFO,
|
1137
|
+
"[xds_client %p] EDS update identical to current, ignoring.",
|
1138
|
+
xds_client());
|
1139
|
+
}
|
1140
|
+
continue;
|
842
1141
|
}
|
843
|
-
continue;
|
844
1142
|
}
|
845
1143
|
// Update the cluster state.
|
846
1144
|
endpoint_state.update = std::move(eds_update);
|
847
1145
|
// Notify all watchers.
|
848
1146
|
for (const auto& p : endpoint_state.watchers) {
|
849
|
-
p.first->OnEndpointChanged(endpoint_state.update);
|
1147
|
+
p.first->OnEndpointChanged(endpoint_state.update.value());
|
850
1148
|
}
|
851
1149
|
}
|
852
|
-
eds_version_.version_info = std::move(new_version);
|
853
1150
|
}
|
854
1151
|
|
855
1152
|
void XdsClient::ChannelState::AdsCallState::OnRequestSent(void* arg,
|
856
1153
|
grpc_error* error) {
|
857
1154
|
AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
1155
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
1156
|
+
ads_calld->xds_client()->work_serializer_->Run(
|
1157
|
+
[ads_calld, error]() { ads_calld->OnRequestSentLocked(error); },
|
1158
|
+
DEBUG_LOCATION);
|
862
1159
|
}
|
863
1160
|
|
864
1161
|
void XdsClient::ChannelState::AdsCallState::OnRequestSentLocked(
|
865
|
-
|
866
|
-
|
867
|
-
if (self->IsCurrentCallOnChannel() && error == GRPC_ERROR_NONE) {
|
1162
|
+
grpc_error* error) {
|
1163
|
+
if (IsCurrentCallOnChannel() && error == GRPC_ERROR_NONE) {
|
868
1164
|
// Clean up the sent message.
|
869
|
-
grpc_byte_buffer_destroy(
|
870
|
-
|
1165
|
+
grpc_byte_buffer_destroy(send_message_payload_);
|
1166
|
+
send_message_payload_ = nullptr;
|
871
1167
|
// Continue to send another pending message if any.
|
872
1168
|
// TODO(roth): The current code to handle buffered messages has the
|
873
|
-
// advantage of sending only the most recent list of resource names for
|
874
|
-
// resource type (no matter how many times that resource type has
|
875
|
-
// requested to send while the current message sending is still
|
876
|
-
// But its disadvantage is that we send the requests in fixed
|
877
|
-
// resource types. We need to fix this if we are seeing some
|
878
|
-
// type(s) starved due to frequent requests of other resource
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
buffered_request->error, false);
|
885
|
-
buffered_request->error = GRPC_ERROR_NONE;
|
886
|
-
buffered_request.reset();
|
887
|
-
break;
|
888
|
-
}
|
1169
|
+
// advantage of sending only the most recent list of resource names for
|
1170
|
+
// each resource type (no matter how many times that resource type has
|
1171
|
+
// been requested to send while the current message sending is still
|
1172
|
+
// pending). But its disadvantage is that we send the requests in fixed
|
1173
|
+
// order of resource types. We need to fix this if we are seeing some
|
1174
|
+
// resource type(s) starved due to frequent requests of other resource
|
1175
|
+
// type(s).
|
1176
|
+
auto it = buffered_requests_.begin();
|
1177
|
+
if (it != buffered_requests_.end()) {
|
1178
|
+
SendMessageLocked(*it);
|
1179
|
+
buffered_requests_.erase(it);
|
889
1180
|
}
|
890
1181
|
}
|
891
|
-
|
1182
|
+
Unref(DEBUG_LOCATION, "ADS+OnRequestSentLocked");
|
1183
|
+
GRPC_ERROR_UNREF(error);
|
892
1184
|
}
|
893
1185
|
|
894
1186
|
void XdsClient::ChannelState::AdsCallState::OnResponseReceived(
|
895
|
-
void* arg, grpc_error* error) {
|
1187
|
+
void* arg, grpc_error* /* error */) {
|
896
1188
|
AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
|
897
|
-
ads_calld->xds_client()->
|
898
|
-
|
899
|
-
OnResponseReceivedLocked, ads_calld, nullptr),
|
900
|
-
GRPC_ERROR_REF(error));
|
1189
|
+
ads_calld->xds_client()->work_serializer_->Run(
|
1190
|
+
[ads_calld]() { ads_calld->OnResponseReceivedLocked(); }, DEBUG_LOCATION);
|
901
1191
|
}
|
902
1192
|
|
903
|
-
void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked(
|
904
|
-
void* arg, grpc_error* /*error*/) {
|
905
|
-
AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
|
906
|
-
XdsClient* xds_client = ads_calld->xds_client();
|
1193
|
+
void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
|
907
1194
|
// Empty payload means the call was cancelled.
|
908
|
-
if (!
|
909
|
-
|
910
|
-
ads_calld->Unref(DEBUG_LOCATION, "ADS+OnResponseReceivedLocked");
|
1195
|
+
if (!IsCurrentCallOnChannel() || recv_message_payload_ == nullptr) {
|
1196
|
+
Unref(DEBUG_LOCATION, "ADS+OnResponseReceivedLocked");
|
911
1197
|
return;
|
912
1198
|
}
|
913
1199
|
// Read the response.
|
914
1200
|
grpc_byte_buffer_reader bbr;
|
915
|
-
grpc_byte_buffer_reader_init(&bbr,
|
1201
|
+
grpc_byte_buffer_reader_init(&bbr, recv_message_payload_);
|
916
1202
|
grpc_slice response_slice = grpc_byte_buffer_reader_readall(&bbr);
|
917
1203
|
grpc_byte_buffer_reader_destroy(&bbr);
|
918
|
-
grpc_byte_buffer_destroy(
|
919
|
-
|
1204
|
+
grpc_byte_buffer_destroy(recv_message_payload_);
|
1205
|
+
recv_message_payload_ = nullptr;
|
920
1206
|
// TODO(juanlishen): When we convert this to use the xds protocol, the
|
921
1207
|
// balancer will send us a fallback timeout such that we should go into
|
922
1208
|
// fallback mode if we have lost contact with the balancer after a certain
|
@@ -926,113 +1212,113 @@ void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked(
|
|
926
1212
|
// mode. We will also need to cancel the timer when we receive a serverlist
|
927
1213
|
// from the balancer.
|
928
1214
|
// Parse the response.
|
929
|
-
|
930
|
-
|
1215
|
+
absl::optional<XdsApi::LdsUpdate> lds_update;
|
1216
|
+
absl::optional<XdsApi::RdsUpdate> rds_update;
|
1217
|
+
XdsApi::CdsUpdateMap cds_update_map;
|
1218
|
+
XdsApi::EdsUpdateMap eds_update_map;
|
931
1219
|
std::string version;
|
932
1220
|
std::string nonce;
|
933
1221
|
std::string type_url;
|
934
|
-
// Note that
|
935
|
-
grpc_error* parse_error =
|
936
|
-
response_slice, xds_client
|
937
|
-
|
1222
|
+
// Note that ParseAdsResponse() also validates the response.
|
1223
|
+
grpc_error* parse_error = xds_client()->api_.ParseAdsResponse(
|
1224
|
+
response_slice, xds_client()->server_name_,
|
1225
|
+
ResourceNamesForRequest(XdsApi::kRdsTypeUrl),
|
1226
|
+
ResourceNamesForRequest(XdsApi::kCdsTypeUrl),
|
1227
|
+
ResourceNamesForRequest(XdsApi::kEdsTypeUrl), &lds_update, &rds_update,
|
1228
|
+
&cds_update_map, &eds_update_map, &version, &nonce, &type_url);
|
938
1229
|
grpc_slice_unref_internal(response_slice);
|
939
1230
|
if (type_url.empty()) {
|
940
1231
|
// Ignore unparsable response.
|
941
|
-
gpr_log(GPR_ERROR,
|
942
|
-
xds_client
|
1232
|
+
gpr_log(GPR_ERROR,
|
1233
|
+
"[xds_client %p] Error parsing ADS response (%s) -- ignoring",
|
1234
|
+
xds_client(), grpc_error_string(parse_error));
|
943
1235
|
GRPC_ERROR_UNREF(parse_error);
|
944
1236
|
} else {
|
945
|
-
// Update nonce
|
946
|
-
|
947
|
-
|
948
|
-
GRPC_ERROR_UNREF(ads_calld->cds_version_.error);
|
949
|
-
ads_calld->cds_version_.error = GRPC_ERROR_REF(parse_error);
|
950
|
-
} else if (type_url == kEdsTypeUrl) {
|
951
|
-
ads_calld->eds_version_.nonce = nonce;
|
952
|
-
GRPC_ERROR_UNREF(ads_calld->eds_version_.error);
|
953
|
-
ads_calld->eds_version_.error = GRPC_ERROR_REF(parse_error);
|
954
|
-
}
|
1237
|
+
// Update nonce.
|
1238
|
+
auto& state = state_map_[type_url];
|
1239
|
+
state.nonce = std::move(nonce);
|
955
1240
|
// NACK or ACK the response.
|
956
1241
|
if (parse_error != GRPC_ERROR_NONE) {
|
1242
|
+
GRPC_ERROR_UNREF(state.error);
|
1243
|
+
state.error = parse_error;
|
957
1244
|
// NACK unacceptable update.
|
958
|
-
gpr_log(
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
1245
|
+
gpr_log(GPR_ERROR,
|
1246
|
+
"[xds_client %p] ADS response invalid for resource type %s "
|
1247
|
+
"version %s, will NACK: nonce=%s error=%s",
|
1248
|
+
xds_client(), type_url.c_str(), version.c_str(),
|
1249
|
+
state.nonce.c_str(), grpc_error_string(parse_error));
|
1250
|
+
SendMessageLocked(type_url);
|
963
1251
|
} else {
|
964
|
-
|
965
|
-
// Accept the
|
966
|
-
if (type_url ==
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
1252
|
+
seen_response_ = true;
|
1253
|
+
// Accept the ADS response according to the type_url.
|
1254
|
+
if (type_url == XdsApi::kLdsTypeUrl) {
|
1255
|
+
AcceptLdsUpdate(std::move(lds_update));
|
1256
|
+
} else if (type_url == XdsApi::kRdsTypeUrl) {
|
1257
|
+
AcceptRdsUpdate(std::move(rds_update));
|
1258
|
+
} else if (type_url == XdsApi::kCdsTypeUrl) {
|
1259
|
+
AcceptCdsUpdate(std::move(cds_update_map));
|
1260
|
+
} else if (type_url == XdsApi::kEdsTypeUrl) {
|
1261
|
+
AcceptEdsUpdate(std::move(eds_update_map));
|
972
1262
|
}
|
1263
|
+
state.version = std::move(version);
|
973
1264
|
// ACK the update.
|
974
|
-
|
1265
|
+
SendMessageLocked(type_url);
|
975
1266
|
// Start load reporting if needed.
|
976
|
-
auto& lrs_call =
|
1267
|
+
auto& lrs_call = chand()->lrs_calld_;
|
977
1268
|
if (lrs_call != nullptr) {
|
978
1269
|
LrsCallState* lrs_calld = lrs_call->calld();
|
979
1270
|
if (lrs_calld != nullptr) lrs_calld->MaybeStartReportingLocked();
|
980
1271
|
}
|
981
1272
|
}
|
982
1273
|
}
|
983
|
-
if (xds_client->shutting_down_) {
|
984
|
-
|
985
|
-
"ADS+OnResponseReceivedLocked+xds_shutdown");
|
1274
|
+
if (xds_client()->shutting_down_) {
|
1275
|
+
Unref(DEBUG_LOCATION, "ADS+OnResponseReceivedLocked+xds_shutdown");
|
986
1276
|
return;
|
987
1277
|
}
|
988
1278
|
// Keep listening for updates.
|
989
1279
|
grpc_op op;
|
990
1280
|
memset(&op, 0, sizeof(op));
|
991
1281
|
op.op = GRPC_OP_RECV_MESSAGE;
|
992
|
-
op.data.recv_message.recv_message = &
|
1282
|
+
op.data.recv_message.recv_message = &recv_message_payload_;
|
993
1283
|
op.flags = 0;
|
994
1284
|
op.reserved = nullptr;
|
995
|
-
GPR_ASSERT(
|
1285
|
+
GPR_ASSERT(call_ != nullptr);
|
996
1286
|
// Reuse the "ADS+OnResponseReceivedLocked" ref taken in ctor.
|
997
|
-
|
998
|
-
|
999
|
-
const grpc_call_error call_error = grpc_call_start_batch_and_execute(
|
1000
|
-
ads_calld->call_, &op, 1, &ads_calld->on_response_received_);
|
1287
|
+
const grpc_call_error call_error =
|
1288
|
+
grpc_call_start_batch_and_execute(call_, &op, 1, &on_response_received_);
|
1001
1289
|
GPR_ASSERT(GRPC_CALL_OK == call_error);
|
1002
1290
|
}
|
1003
1291
|
|
1004
1292
|
void XdsClient::ChannelState::AdsCallState::OnStatusReceived(
|
1005
1293
|
void* arg, grpc_error* error) {
|
1006
1294
|
AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1295
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
1296
|
+
ads_calld->xds_client()->work_serializer_->Run(
|
1297
|
+
[ads_calld, error]() { ads_calld->OnStatusReceivedLocked(error); },
|
1298
|
+
DEBUG_LOCATION);
|
1011
1299
|
}
|
1012
1300
|
|
1013
1301
|
void XdsClient::ChannelState::AdsCallState::OnStatusReceivedLocked(
|
1014
|
-
|
1015
|
-
AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
|
1016
|
-
ChannelState* chand = ads_calld->chand();
|
1017
|
-
XdsClient* xds_client = ads_calld->xds_client();
|
1302
|
+
grpc_error* error) {
|
1018
1303
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1019
|
-
char* status_details = grpc_slice_to_c_string(
|
1304
|
+
char* status_details = grpc_slice_to_c_string(status_details_);
|
1020
1305
|
gpr_log(GPR_INFO,
|
1021
1306
|
"[xds_client %p] ADS call status received. Status = %d, details "
|
1022
1307
|
"= '%s', (chand: %p, ads_calld: %p, call: %p), error '%s'",
|
1023
|
-
xds_client,
|
1024
|
-
|
1308
|
+
xds_client(), status_code_, status_details, chand(), this, call_,
|
1309
|
+
grpc_error_string(error));
|
1025
1310
|
gpr_free(status_details);
|
1026
1311
|
}
|
1027
1312
|
// Ignore status from a stale call.
|
1028
|
-
if (
|
1313
|
+
if (IsCurrentCallOnChannel()) {
|
1029
1314
|
// Try to restart the call.
|
1030
|
-
|
1315
|
+
parent_->OnCallFinishedLocked();
|
1031
1316
|
// Send error to all watchers.
|
1032
|
-
xds_client->NotifyOnError(
|
1317
|
+
xds_client()->NotifyOnError(
|
1033
1318
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("xds call failed"));
|
1034
1319
|
}
|
1035
|
-
|
1320
|
+
Unref(DEBUG_LOCATION, "ADS+OnStatusReceivedLocked");
|
1321
|
+
GRPC_ERROR_UNREF(error);
|
1036
1322
|
}
|
1037
1323
|
|
1038
1324
|
bool XdsClient::ChannelState::AdsCallState::IsCurrentCallOnChannel() const {
|
@@ -1042,6 +1328,21 @@ bool XdsClient::ChannelState::AdsCallState::IsCurrentCallOnChannel() const {
|
|
1042
1328
|
return this == chand()->ads_calld_->calld();
|
1043
1329
|
}
|
1044
1330
|
|
1331
|
+
std::set<absl::string_view>
|
1332
|
+
XdsClient::ChannelState::AdsCallState::ResourceNamesForRequest(
|
1333
|
+
const std::string& type_url) {
|
1334
|
+
std::set<absl::string_view> resource_names;
|
1335
|
+
auto it = state_map_.find(type_url);
|
1336
|
+
if (it != state_map_.end()) {
|
1337
|
+
for (auto& p : it->second.subscribed_resources) {
|
1338
|
+
resource_names.insert(p.first);
|
1339
|
+
OrphanablePtr<ResourceState>& state = p.second;
|
1340
|
+
state->Start(Ref());
|
1341
|
+
}
|
1342
|
+
}
|
1343
|
+
return resource_names;
|
1344
|
+
}
|
1345
|
+
|
1045
1346
|
//
|
1046
1347
|
// XdsClient::ChannelState::LrsCallState::Reporter
|
1047
1348
|
//
|
@@ -1055,8 +1356,6 @@ void XdsClient::ChannelState::LrsCallState::Reporter::Orphan() {
|
|
1055
1356
|
void XdsClient::ChannelState::LrsCallState::Reporter::
|
1056
1357
|
ScheduleNextReportLocked() {
|
1057
1358
|
const grpc_millis next_report_time = ExecCtx::Get()->Now() + report_interval_;
|
1058
|
-
GRPC_CLOSURE_INIT(&on_next_report_timer_, OnNextReportTimer, this,
|
1059
|
-
grpc_schedule_on_exec_ctx);
|
1060
1359
|
grpc_timer_init(&next_report_timer_, next_report_time,
|
1061
1360
|
&on_next_report_timer_);
|
1062
1361
|
next_report_timer_callback_pending_ = true;
|
@@ -1065,36 +1364,56 @@ void XdsClient::ChannelState::LrsCallState::Reporter::
|
|
1065
1364
|
void XdsClient::ChannelState::LrsCallState::Reporter::OnNextReportTimer(
|
1066
1365
|
void* arg, grpc_error* error) {
|
1067
1366
|
Reporter* self = static_cast<Reporter*>(arg);
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1367
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
1368
|
+
self->xds_client()->work_serializer_->Run(
|
1369
|
+
[self, error]() { self->OnNextReportTimerLocked(error); },
|
1370
|
+
DEBUG_LOCATION);
|
1072
1371
|
}
|
1073
1372
|
|
1074
1373
|
void XdsClient::ChannelState::LrsCallState::Reporter::OnNextReportTimerLocked(
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1374
|
+
grpc_error* error) {
|
1375
|
+
next_report_timer_callback_pending_ = false;
|
1376
|
+
if (error != GRPC_ERROR_NONE || !IsCurrentReporterOnCall()) {
|
1377
|
+
Unref(DEBUG_LOCATION, "Reporter+timer");
|
1378
|
+
} else {
|
1379
|
+
SendReportLocked();
|
1380
|
+
}
|
1381
|
+
GRPC_ERROR_UNREF(error);
|
1382
|
+
}
|
1383
|
+
|
1384
|
+
namespace {
|
1385
|
+
|
1386
|
+
bool LoadReportCountersAreZero(const XdsApi::ClusterLoadReportMap& snapshot) {
|
1387
|
+
for (const auto& p : snapshot) {
|
1388
|
+
const XdsApi::ClusterLoadReport& cluster_snapshot = p.second;
|
1389
|
+
for (const auto& q : cluster_snapshot.dropped_requests) {
|
1390
|
+
if (q.second > 0) return false;
|
1391
|
+
}
|
1392
|
+
for (const auto& q : cluster_snapshot.locality_stats) {
|
1393
|
+
const XdsClusterLocalityStats::Snapshot& locality_snapshot = q.second;
|
1394
|
+
if (!locality_snapshot.IsZero()) return false;
|
1395
|
+
}
|
1081
1396
|
}
|
1082
|
-
|
1397
|
+
return true;
|
1083
1398
|
}
|
1084
1399
|
|
1400
|
+
} // namespace
|
1401
|
+
|
1085
1402
|
void XdsClient::ChannelState::LrsCallState::Reporter::SendReportLocked() {
|
1086
|
-
//
|
1087
|
-
|
1088
|
-
|
1403
|
+
// Construct snapshot from all reported stats.
|
1404
|
+
XdsApi::ClusterLoadReportMap snapshot = xds_client()->BuildLoadReportSnapshot(
|
1405
|
+
parent_->send_all_clusters_, parent_->cluster_names_);
|
1089
1406
|
// Skip client load report if the counters were all zero in the last
|
1090
1407
|
// report and they are still zero in this one.
|
1091
1408
|
const bool old_val = last_report_counters_were_zero_;
|
1092
|
-
last_report_counters_were_zero_ =
|
1093
|
-
grpc_slice_eq(request_payload_slice, grpc_empty_slice()));
|
1409
|
+
last_report_counters_were_zero_ = LoadReportCountersAreZero(snapshot);
|
1094
1410
|
if (old_val && last_report_counters_were_zero_) {
|
1095
1411
|
ScheduleNextReportLocked();
|
1096
1412
|
return;
|
1097
1413
|
}
|
1414
|
+
// Create a request that contains the snapshot.
|
1415
|
+
grpc_slice request_payload_slice =
|
1416
|
+
xds_client()->api_.CreateLrsRequest(std::move(snapshot));
|
1098
1417
|
parent_->send_message_payload_ =
|
1099
1418
|
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
|
1100
1419
|
grpc_slice_unref_internal(request_payload_slice);
|
@@ -1103,8 +1422,6 @@ void XdsClient::ChannelState::LrsCallState::Reporter::SendReportLocked() {
|
|
1103
1422
|
memset(&op, 0, sizeof(op));
|
1104
1423
|
op.op = GRPC_OP_SEND_MESSAGE;
|
1105
1424
|
op.data.send_message.send_message = parent_->send_message_payload_;
|
1106
|
-
GRPC_CLOSURE_INIT(&on_report_done_, OnReportDone, this,
|
1107
|
-
grpc_schedule_on_exec_ctx);
|
1108
1425
|
grpc_call_error call_error = grpc_call_start_batch_and_execute(
|
1109
1426
|
parent_->call_, &op, 1, &on_report_done_);
|
1110
1427
|
if (GPR_UNLIKELY(call_error != GRPC_CALL_OK)) {
|
@@ -1118,27 +1435,32 @@ void XdsClient::ChannelState::LrsCallState::Reporter::SendReportLocked() {
|
|
1118
1435
|
void XdsClient::ChannelState::LrsCallState::Reporter::OnReportDone(
|
1119
1436
|
void* arg, grpc_error* error) {
|
1120
1437
|
Reporter* self = static_cast<Reporter*>(arg);
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
GRPC_ERROR_REF(error));
|
1438
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
1439
|
+
self->xds_client()->work_serializer_->Run(
|
1440
|
+
[self, error]() { self->OnReportDoneLocked(error); }, DEBUG_LOCATION);
|
1125
1441
|
}
|
1126
1442
|
|
1127
1443
|
void XdsClient::ChannelState::LrsCallState::Reporter::OnReportDoneLocked(
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
if (
|
1444
|
+
grpc_error* error) {
|
1445
|
+
grpc_byte_buffer_destroy(parent_->send_message_payload_);
|
1446
|
+
parent_->send_message_payload_ = nullptr;
|
1447
|
+
// If there are no more registered stats to report, cancel the call.
|
1448
|
+
if (xds_client()->load_report_map_.empty()) {
|
1449
|
+
parent_->chand()->StopLrsCall();
|
1450
|
+
Unref(DEBUG_LOCATION, "Reporter+report_done+no_more_reporters");
|
1451
|
+
return;
|
1452
|
+
}
|
1453
|
+
if (error != GRPC_ERROR_NONE || !IsCurrentReporterOnCall()) {
|
1133
1454
|
// If this reporter is no longer the current one on the call, the reason
|
1134
1455
|
// might be that it was orphaned for a new one due to config update.
|
1135
|
-
if (!
|
1136
|
-
|
1456
|
+
if (!IsCurrentReporterOnCall()) {
|
1457
|
+
parent_->MaybeStartReportingLocked();
|
1137
1458
|
}
|
1138
|
-
|
1139
|
-
|
1459
|
+
Unref(DEBUG_LOCATION, "Reporter+report_done");
|
1460
|
+
} else {
|
1461
|
+
ScheduleNextReportLocked();
|
1140
1462
|
}
|
1141
|
-
|
1463
|
+
GRPC_ERROR_UNREF(error);
|
1142
1464
|
}
|
1143
1465
|
|
1144
1466
|
//
|
@@ -1161,9 +1483,8 @@ XdsClient::ChannelState::LrsCallState::LrsCallState(
|
|
1161
1483
|
nullptr, GRPC_MILLIS_INF_FUTURE, nullptr);
|
1162
1484
|
GPR_ASSERT(call_ != nullptr);
|
1163
1485
|
// Init the request payload.
|
1164
|
-
grpc_slice request_payload_slice =
|
1165
|
-
xds_client()->
|
1166
|
-
xds_client()->build_version_.get());
|
1486
|
+
grpc_slice request_payload_slice =
|
1487
|
+
xds_client()->api_.CreateLrsInitialRequest(xds_client()->server_name_);
|
1167
1488
|
send_message_payload_ =
|
1168
1489
|
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
|
1169
1490
|
grpc_slice_unref_internal(request_payload_slice);
|
@@ -1185,7 +1506,8 @@ XdsClient::ChannelState::LrsCallState::LrsCallState(
|
|
1185
1506
|
grpc_op* op = ops;
|
1186
1507
|
op->op = GRPC_OP_SEND_INITIAL_METADATA;
|
1187
1508
|
op->data.send_initial_metadata.count = 0;
|
1188
|
-
op->flags =
|
1509
|
+
op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY |
|
1510
|
+
GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET;
|
1189
1511
|
op->reserved = nullptr;
|
1190
1512
|
op++;
|
1191
1513
|
// Op: send request message.
|
@@ -1273,95 +1595,81 @@ void XdsClient::ChannelState::LrsCallState::MaybeStartReportingLocked() {
|
|
1273
1595
|
// Don't start if the ADS call hasn't received any valid response. Note that
|
1274
1596
|
// this must be the first channel because it is the current channel but its
|
1275
1597
|
// ADS call hasn't seen any response.
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
for (auto* client_stats : p.second.client_stats) {
|
1281
|
-
client_stats->MaybeInitLastReportTime();
|
1282
|
-
}
|
1598
|
+
if (chand()->ads_calld_ == nullptr ||
|
1599
|
+
chand()->ads_calld_->calld() == nullptr ||
|
1600
|
+
!chand()->ads_calld_->calld()->seen_response()) {
|
1601
|
+
return;
|
1283
1602
|
}
|
1603
|
+
// Start reporting.
|
1284
1604
|
reporter_ = MakeOrphanable<Reporter>(
|
1285
1605
|
Ref(DEBUG_LOCATION, "LRS+load_report+start"), load_reporting_interval_);
|
1286
1606
|
}
|
1287
1607
|
|
1288
|
-
bool XdsClient::ChannelState::LrsCallState::ShouldSendLoadReports(
|
1289
|
-
const StringView& cluster_name) const {
|
1290
|
-
// Only send load reports for the clusters that are asked for by the LRS
|
1291
|
-
// server.
|
1292
|
-
return cluster_names_.find(std::string(cluster_name)) != cluster_names_.end();
|
1293
|
-
}
|
1294
|
-
|
1295
1608
|
void XdsClient::ChannelState::LrsCallState::OnInitialRequestSent(
|
1296
|
-
void* arg, grpc_error* error) {
|
1609
|
+
void* arg, grpc_error* /*error*/) {
|
1297
1610
|
LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
|
1298
|
-
lrs_calld->xds_client()->
|
1299
|
-
|
1300
|
-
|
1301
|
-
GRPC_ERROR_REF(error));
|
1611
|
+
lrs_calld->xds_client()->work_serializer_->Run(
|
1612
|
+
[lrs_calld]() { lrs_calld->OnInitialRequestSentLocked(); },
|
1613
|
+
DEBUG_LOCATION);
|
1302
1614
|
}
|
1303
1615
|
|
1304
|
-
void XdsClient::ChannelState::LrsCallState::OnInitialRequestSentLocked(
|
1305
|
-
void* arg, grpc_error* /*error*/) {
|
1306
|
-
LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
|
1616
|
+
void XdsClient::ChannelState::LrsCallState::OnInitialRequestSentLocked() {
|
1307
1617
|
// Clear the send_message_payload_.
|
1308
|
-
grpc_byte_buffer_destroy(
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1618
|
+
grpc_byte_buffer_destroy(send_message_payload_);
|
1619
|
+
send_message_payload_ = nullptr;
|
1620
|
+
MaybeStartReportingLocked();
|
1621
|
+
Unref(DEBUG_LOCATION, "LRS+OnInitialRequestSentLocked");
|
1312
1622
|
}
|
1313
1623
|
|
1314
1624
|
void XdsClient::ChannelState::LrsCallState::OnResponseReceived(
|
1315
|
-
void* arg, grpc_error* error) {
|
1625
|
+
void* arg, grpc_error* /*error*/) {
|
1316
1626
|
LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
|
1317
|
-
lrs_calld->xds_client()->
|
1318
|
-
|
1319
|
-
OnResponseReceivedLocked, lrs_calld, nullptr),
|
1320
|
-
GRPC_ERROR_REF(error));
|
1627
|
+
lrs_calld->xds_client()->work_serializer_->Run(
|
1628
|
+
[lrs_calld]() { lrs_calld->OnResponseReceivedLocked(); }, DEBUG_LOCATION);
|
1321
1629
|
}
|
1322
1630
|
|
1323
|
-
void XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked(
|
1324
|
-
void* arg, grpc_error* /*error*/) {
|
1325
|
-
LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
|
1326
|
-
XdsClient* xds_client = lrs_calld->xds_client();
|
1631
|
+
void XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked() {
|
1327
1632
|
// Empty payload means the call was cancelled.
|
1328
|
-
if (!
|
1329
|
-
|
1330
|
-
lrs_calld->Unref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked");
|
1633
|
+
if (!IsCurrentCallOnChannel() || recv_message_payload_ == nullptr) {
|
1634
|
+
Unref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked");
|
1331
1635
|
return;
|
1332
1636
|
}
|
1333
1637
|
// Read the response.
|
1334
1638
|
grpc_byte_buffer_reader bbr;
|
1335
|
-
grpc_byte_buffer_reader_init(&bbr,
|
1639
|
+
grpc_byte_buffer_reader_init(&bbr, recv_message_payload_);
|
1336
1640
|
grpc_slice response_slice = grpc_byte_buffer_reader_readall(&bbr);
|
1337
1641
|
grpc_byte_buffer_reader_destroy(&bbr);
|
1338
|
-
grpc_byte_buffer_destroy(
|
1339
|
-
|
1642
|
+
grpc_byte_buffer_destroy(recv_message_payload_);
|
1643
|
+
recv_message_payload_ = nullptr;
|
1340
1644
|
// This anonymous lambda is a hack to avoid the usage of goto.
|
1341
1645
|
[&]() {
|
1342
1646
|
// Parse the response.
|
1647
|
+
bool send_all_clusters = false;
|
1343
1648
|
std::set<std::string> new_cluster_names;
|
1344
1649
|
grpc_millis new_load_reporting_interval;
|
1345
|
-
grpc_error* parse_error =
|
1346
|
-
response_slice, &
|
1650
|
+
grpc_error* parse_error = xds_client()->api_.ParseLrsResponse(
|
1651
|
+
response_slice, &send_all_clusters, &new_cluster_names,
|
1652
|
+
&new_load_reporting_interval);
|
1347
1653
|
if (parse_error != GRPC_ERROR_NONE) {
|
1348
1654
|
gpr_log(GPR_ERROR,
|
1349
1655
|
"[xds_client %p] LRS response parsing failed. error=%s",
|
1350
|
-
xds_client, grpc_error_string(parse_error));
|
1656
|
+
xds_client(), grpc_error_string(parse_error));
|
1351
1657
|
GRPC_ERROR_UNREF(parse_error);
|
1352
1658
|
return;
|
1353
1659
|
}
|
1354
|
-
|
1660
|
+
seen_response_ = true;
|
1355
1661
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1356
|
-
gpr_log(
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1662
|
+
gpr_log(
|
1663
|
+
GPR_INFO,
|
1664
|
+
"[xds_client %p] LRS response received, %" PRIuPTR
|
1665
|
+
" cluster names, send_all_clusters=%d, load_report_interval=%" PRId64
|
1666
|
+
"ms",
|
1667
|
+
xds_client(), new_cluster_names.size(), send_all_clusters,
|
1668
|
+
new_load_reporting_interval);
|
1361
1669
|
size_t i = 0;
|
1362
1670
|
for (const auto& name : new_cluster_names) {
|
1363
1671
|
gpr_log(GPR_INFO, "[xds_client %p] cluster_name %" PRIuPTR ": %s",
|
1364
|
-
xds_client, i++, name.c_str());
|
1672
|
+
xds_client(), i++, name.c_str());
|
1365
1673
|
}
|
1366
1674
|
}
|
1367
1675
|
if (new_load_reporting_interval <
|
@@ -1372,81 +1680,78 @@ void XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked(
|
|
1372
1680
|
gpr_log(GPR_INFO,
|
1373
1681
|
"[xds_client %p] Increased load_report_interval to minimum "
|
1374
1682
|
"value %dms",
|
1375
|
-
xds_client, GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS);
|
1683
|
+
xds_client(), GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS);
|
1376
1684
|
}
|
1377
1685
|
}
|
1378
1686
|
// Ignore identical update.
|
1379
|
-
if (
|
1380
|
-
|
1687
|
+
if (send_all_clusters == send_all_clusters_ &&
|
1688
|
+
cluster_names_ == new_cluster_names &&
|
1689
|
+
load_reporting_interval_ == new_load_reporting_interval) {
|
1381
1690
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1382
1691
|
gpr_log(GPR_INFO,
|
1383
1692
|
"[xds_client %p] Incoming LRS response identical to current, "
|
1384
1693
|
"ignoring.",
|
1385
|
-
xds_client);
|
1694
|
+
xds_client());
|
1386
1695
|
}
|
1387
1696
|
return;
|
1388
1697
|
}
|
1389
1698
|
// Stop current load reporting (if any) to adopt the new config.
|
1390
|
-
|
1699
|
+
reporter_.reset();
|
1391
1700
|
// Record the new config.
|
1392
|
-
|
1393
|
-
|
1701
|
+
send_all_clusters_ = send_all_clusters;
|
1702
|
+
cluster_names_ = std::move(new_cluster_names);
|
1703
|
+
load_reporting_interval_ = new_load_reporting_interval;
|
1394
1704
|
// Try starting sending load report.
|
1395
|
-
|
1705
|
+
MaybeStartReportingLocked();
|
1396
1706
|
}();
|
1397
1707
|
grpc_slice_unref_internal(response_slice);
|
1398
|
-
if (xds_client->shutting_down_) {
|
1399
|
-
|
1400
|
-
"LRS+OnResponseReceivedLocked+xds_shutdown");
|
1708
|
+
if (xds_client()->shutting_down_) {
|
1709
|
+
Unref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked+xds_shutdown");
|
1401
1710
|
return;
|
1402
1711
|
}
|
1403
1712
|
// Keep listening for LRS config updates.
|
1404
1713
|
grpc_op op;
|
1405
1714
|
memset(&op, 0, sizeof(op));
|
1406
1715
|
op.op = GRPC_OP_RECV_MESSAGE;
|
1407
|
-
op.data.recv_message.recv_message = &
|
1716
|
+
op.data.recv_message.recv_message = &recv_message_payload_;
|
1408
1717
|
op.flags = 0;
|
1409
1718
|
op.reserved = nullptr;
|
1410
|
-
GPR_ASSERT(
|
1719
|
+
GPR_ASSERT(call_ != nullptr);
|
1411
1720
|
// Reuse the "OnResponseReceivedLocked" ref taken in ctor.
|
1412
|
-
|
1413
|
-
|
1414
|
-
const grpc_call_error call_error = grpc_call_start_batch_and_execute(
|
1415
|
-
lrs_calld->call_, &op, 1, &lrs_calld->on_response_received_);
|
1721
|
+
const grpc_call_error call_error =
|
1722
|
+
grpc_call_start_batch_and_execute(call_, &op, 1, &on_response_received_);
|
1416
1723
|
GPR_ASSERT(GRPC_CALL_OK == call_error);
|
1417
1724
|
}
|
1418
1725
|
|
1419
1726
|
void XdsClient::ChannelState::LrsCallState::OnStatusReceived(
|
1420
1727
|
void* arg, grpc_error* error) {
|
1421
1728
|
LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1729
|
+
GRPC_ERROR_REF(error); // ref owned by lambda
|
1730
|
+
lrs_calld->xds_client()->work_serializer_->Run(
|
1731
|
+
[lrs_calld, error]() { lrs_calld->OnStatusReceivedLocked(error); },
|
1732
|
+
DEBUG_LOCATION);
|
1426
1733
|
}
|
1427
1734
|
|
1428
1735
|
void XdsClient::ChannelState::LrsCallState::OnStatusReceivedLocked(
|
1429
|
-
|
1430
|
-
|
1431
|
-
XdsClient* xds_client = lrs_calld->xds_client();
|
1432
|
-
ChannelState* chand = lrs_calld->chand();
|
1433
|
-
GPR_ASSERT(lrs_calld->call_ != nullptr);
|
1736
|
+
grpc_error* error) {
|
1737
|
+
GPR_ASSERT(call_ != nullptr);
|
1434
1738
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1435
|
-
char* status_details = grpc_slice_to_c_string(
|
1739
|
+
char* status_details = grpc_slice_to_c_string(status_details_);
|
1436
1740
|
gpr_log(GPR_INFO,
|
1437
1741
|
"[xds_client %p] LRS call status received. Status = %d, details "
|
1438
1742
|
"= '%s', (chand: %p, calld: %p, call: %p), error '%s'",
|
1439
|
-
xds_client,
|
1440
|
-
|
1743
|
+
xds_client(), status_code_, status_details, chand(), this, call_,
|
1744
|
+
grpc_error_string(error));
|
1441
1745
|
gpr_free(status_details);
|
1442
1746
|
}
|
1443
1747
|
// Ignore status from a stale call.
|
1444
|
-
if (
|
1445
|
-
GPR_ASSERT(!xds_client->shutting_down_);
|
1748
|
+
if (IsCurrentCallOnChannel()) {
|
1749
|
+
GPR_ASSERT(!xds_client()->shutting_down_);
|
1446
1750
|
// Try to restart the call.
|
1447
|
-
|
1751
|
+
parent_->OnCallFinishedLocked();
|
1448
1752
|
}
|
1449
|
-
|
1753
|
+
Unref(DEBUG_LOCATION, "LRS+OnStatusReceivedLocked");
|
1754
|
+
GRPC_ERROR_UNREF(error);
|
1450
1755
|
}
|
1451
1756
|
|
1452
1757
|
bool XdsClient::ChannelState::LrsCallState::IsCurrentCallOnChannel() const {
|
@@ -1462,143 +1767,240 @@ bool XdsClient::ChannelState::LrsCallState::IsCurrentCallOnChannel() const {
|
|
1462
1767
|
|
1463
1768
|
namespace {
|
1464
1769
|
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
return grpc_core::UniquePtr<char>(build_version_str);
|
1770
|
+
grpc_millis GetRequestTimeout(const grpc_channel_args& args) {
|
1771
|
+
return grpc_channel_args_find_integer(
|
1772
|
+
&args, GRPC_ARG_XDS_RESOURCE_DOES_NOT_EXIST_TIMEOUT_MS,
|
1773
|
+
{15000, 0, INT_MAX});
|
1470
1774
|
}
|
1471
1775
|
|
1472
1776
|
} // namespace
|
1473
1777
|
|
1474
|
-
XdsClient::XdsClient(
|
1475
|
-
|
1778
|
+
XdsClient::XdsClient(std::shared_ptr<WorkSerializer> work_serializer,
|
1779
|
+
grpc_pollset_set* interested_parties,
|
1780
|
+
absl::string_view server_name,
|
1476
1781
|
std::unique_ptr<ServiceConfigWatcherInterface> watcher,
|
1477
1782
|
const grpc_channel_args& channel_args, grpc_error** error)
|
1478
1783
|
: InternallyRefCounted<XdsClient>(&grpc_xds_client_trace),
|
1479
|
-
|
1480
|
-
|
1784
|
+
request_timeout_(GetRequestTimeout(channel_args)),
|
1785
|
+
work_serializer_(std::move(work_serializer)),
|
1481
1786
|
interested_parties_(interested_parties),
|
1482
|
-
bootstrap_(
|
1787
|
+
bootstrap_(
|
1788
|
+
XdsBootstrap::ReadFromFile(this, &grpc_xds_client_trace, error)),
|
1789
|
+
api_(this, &grpc_xds_client_trace,
|
1790
|
+
bootstrap_ == nullptr ? nullptr : bootstrap_->node()),
|
1483
1791
|
server_name_(server_name),
|
1484
1792
|
service_config_watcher_(std::move(watcher)) {
|
1793
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1794
|
+
gpr_log(GPR_INFO, "[xds_client %p] creating xds client", this);
|
1795
|
+
}
|
1485
1796
|
if (*error != GRPC_ERROR_NONE) {
|
1486
|
-
|
1487
|
-
|
1488
|
-
this, grpc_error_string(*error));
|
1489
|
-
}
|
1797
|
+
gpr_log(GPR_ERROR, "[xds_client %p] failed to read bootstrap file: %s",
|
1798
|
+
this, grpc_error_string(*error));
|
1490
1799
|
return;
|
1491
1800
|
}
|
1492
1801
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1493
|
-
gpr_log(GPR_INFO, "[xds_client %p
|
1494
|
-
bootstrap_->server().server_uri);
|
1802
|
+
gpr_log(GPR_INFO, "[xds_client %p] creating channel to %s", this,
|
1803
|
+
bootstrap_->server().server_uri.c_str());
|
1804
|
+
}
|
1805
|
+
grpc_channel_args* new_args = BuildXdsChannelArgs(channel_args);
|
1806
|
+
grpc_channel* channel = CreateXdsChannel(*bootstrap_, *new_args, error);
|
1807
|
+
grpc_channel_args_destroy(new_args);
|
1808
|
+
if (*error != GRPC_ERROR_NONE) {
|
1809
|
+
gpr_log(GPR_ERROR, "[xds_client %p] failed to create xds channel: %s", this,
|
1810
|
+
grpc_error_string(*error));
|
1811
|
+
return;
|
1495
1812
|
}
|
1496
1813
|
chand_ = MakeOrphanable<ChannelState>(
|
1497
|
-
Ref(DEBUG_LOCATION, "XdsClient+ChannelState"),
|
1814
|
+
Ref(DEBUG_LOCATION, "XdsClient+ChannelState"), channel);
|
1498
1815
|
if (service_config_watcher_ != nullptr) {
|
1499
|
-
|
1500
|
-
// until we get the first LDS response.
|
1501
|
-
GRPC_CLOSURE_INIT(&service_config_notify_, NotifyOnServiceConfig,
|
1502
|
-
Ref().release(), nullptr);
|
1503
|
-
combiner_->Run(&service_config_notify_, GRPC_ERROR_NONE);
|
1816
|
+
chand_->Subscribe(XdsApi::kLdsTypeUrl, std::string(server_name));
|
1504
1817
|
}
|
1505
1818
|
}
|
1506
1819
|
|
1507
|
-
XdsClient::~XdsClient() {
|
1820
|
+
XdsClient::~XdsClient() {
|
1821
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1822
|
+
gpr_log(GPR_INFO, "[xds_client %p] destroying xds client", this);
|
1823
|
+
}
|
1824
|
+
}
|
1508
1825
|
|
1509
1826
|
void XdsClient::Orphan() {
|
1827
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1828
|
+
gpr_log(GPR_INFO, "[xds_client %p] shutting down xds client", this);
|
1829
|
+
}
|
1510
1830
|
shutting_down_ = true;
|
1511
1831
|
chand_.reset();
|
1512
|
-
cluster_map_
|
1513
|
-
|
1832
|
+
// We do not clear cluster_map_ and endpoint_map_ if the xds client was
|
1833
|
+
// created by the XdsResolver because the maps contain refs for watchers which
|
1834
|
+
// in turn hold refs to the loadbalancing policies. At this point, it is
|
1835
|
+
// possible for ADS calls to be in progress. Unreffing the loadbalancing
|
1836
|
+
// policies before those calls are done would lead to issues such as
|
1837
|
+
// https://github.com/grpc/grpc/issues/20928.
|
1838
|
+
if (service_config_watcher_ != nullptr) {
|
1839
|
+
cluster_map_.clear();
|
1840
|
+
endpoint_map_.clear();
|
1841
|
+
}
|
1514
1842
|
Unref(DEBUG_LOCATION, "XdsClient::Orphan()");
|
1515
1843
|
}
|
1516
1844
|
|
1517
1845
|
void XdsClient::WatchClusterData(
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1846
|
+
absl::string_view cluster_name,
|
1847
|
+
std::unique_ptr<ClusterWatcherInterface> watcher) {
|
1848
|
+
std::string cluster_name_str = std::string(cluster_name);
|
1849
|
+
ClusterState& cluster_state = cluster_map_[cluster_name_str];
|
1521
1850
|
ClusterWatcherInterface* w = watcher.get();
|
1522
1851
|
cluster_state.watchers[w] = std::move(watcher);
|
1523
1852
|
// If we've already received an CDS update, notify the new watcher
|
1524
1853
|
// immediately.
|
1525
1854
|
if (cluster_state.update.has_value()) {
|
1855
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1856
|
+
gpr_log(GPR_INFO, "[xds_client %p] returning cached cluster data for %s",
|
1857
|
+
this, cluster_name_str.c_str());
|
1858
|
+
}
|
1526
1859
|
w->OnClusterChanged(cluster_state.update.value());
|
1527
1860
|
}
|
1528
|
-
|
1861
|
+
chand_->Subscribe(XdsApi::kCdsTypeUrl, cluster_name_str);
|
1529
1862
|
}
|
1530
1863
|
|
1531
|
-
void XdsClient::CancelClusterDataWatch(
|
1532
|
-
ClusterWatcherInterface* watcher
|
1864
|
+
void XdsClient::CancelClusterDataWatch(absl::string_view cluster_name,
|
1865
|
+
ClusterWatcherInterface* watcher,
|
1866
|
+
bool delay_unsubscription) {
|
1533
1867
|
if (shutting_down_) return;
|
1534
|
-
|
1868
|
+
std::string cluster_name_str = std::string(cluster_name);
|
1869
|
+
ClusterState& cluster_state = cluster_map_[cluster_name_str];
|
1535
1870
|
auto it = cluster_state.watchers.find(watcher);
|
1536
1871
|
if (it != cluster_state.watchers.end()) {
|
1537
1872
|
cluster_state.watchers.erase(it);
|
1538
1873
|
if (cluster_state.watchers.empty()) {
|
1539
|
-
cluster_map_.erase(
|
1540
|
-
chand_->
|
1874
|
+
cluster_map_.erase(cluster_name_str);
|
1875
|
+
chand_->Unsubscribe(XdsApi::kCdsTypeUrl, cluster_name_str,
|
1876
|
+
delay_unsubscription);
|
1541
1877
|
}
|
1542
1878
|
}
|
1543
|
-
chand_->OnWatcherRemoved();
|
1544
1879
|
}
|
1545
1880
|
|
1546
1881
|
void XdsClient::WatchEndpointData(
|
1547
|
-
|
1882
|
+
absl::string_view eds_service_name,
|
1548
1883
|
std::unique_ptr<EndpointWatcherInterface> watcher) {
|
1549
|
-
|
1550
|
-
|
1551
|
-
EndpointState& endpoint_state = endpoint_map_[eds_service_name];
|
1884
|
+
std::string eds_service_name_str = std::string(eds_service_name);
|
1885
|
+
EndpointState& endpoint_state = endpoint_map_[eds_service_name_str];
|
1552
1886
|
EndpointWatcherInterface* w = watcher.get();
|
1553
1887
|
endpoint_state.watchers[w] = std::move(watcher);
|
1554
1888
|
// If we've already received an EDS update, notify the new watcher
|
1555
1889
|
// immediately.
|
1556
|
-
if (
|
1557
|
-
|
1890
|
+
if (endpoint_state.update.has_value()) {
|
1891
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1892
|
+
gpr_log(GPR_INFO, "[xds_client %p] returning cached endpoint data for %s",
|
1893
|
+
this, eds_service_name_str.c_str());
|
1894
|
+
}
|
1895
|
+
w->OnEndpointChanged(endpoint_state.update.value());
|
1558
1896
|
}
|
1559
|
-
|
1897
|
+
chand_->Subscribe(XdsApi::kEdsTypeUrl, eds_service_name_str);
|
1560
1898
|
}
|
1561
1899
|
|
1562
|
-
void XdsClient::CancelEndpointDataWatch(
|
1563
|
-
EndpointWatcherInterface* watcher
|
1900
|
+
void XdsClient::CancelEndpointDataWatch(absl::string_view eds_service_name,
|
1901
|
+
EndpointWatcherInterface* watcher,
|
1902
|
+
bool delay_unsubscription) {
|
1564
1903
|
if (shutting_down_) return;
|
1565
|
-
|
1904
|
+
std::string eds_service_name_str = std::string(eds_service_name);
|
1905
|
+
EndpointState& endpoint_state = endpoint_map_[eds_service_name_str];
|
1566
1906
|
auto it = endpoint_state.watchers.find(watcher);
|
1567
1907
|
if (it != endpoint_state.watchers.end()) {
|
1568
1908
|
endpoint_state.watchers.erase(it);
|
1569
1909
|
if (endpoint_state.watchers.empty()) {
|
1570
|
-
endpoint_map_.erase(
|
1571
|
-
chand_->
|
1910
|
+
endpoint_map_.erase(eds_service_name_str);
|
1911
|
+
chand_->Unsubscribe(XdsApi::kEdsTypeUrl, eds_service_name_str,
|
1912
|
+
delay_unsubscription);
|
1572
1913
|
}
|
1573
1914
|
}
|
1574
|
-
chand_->OnWatcherRemoved();
|
1575
1915
|
}
|
1576
1916
|
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
EndpointState& endpoint_state = endpoint_map_[cluster_name];
|
1917
|
+
RefCountedPtr<XdsClusterDropStats> XdsClient::AddClusterDropStats(
|
1918
|
+
absl::string_view lrs_server, absl::string_view cluster_name,
|
1919
|
+
absl::string_view eds_service_name) {
|
1581
1920
|
// TODO(roth): When we add support for direct federation, use the
|
1582
1921
|
// server name specified in lrs_server.
|
1583
|
-
|
1922
|
+
auto key =
|
1923
|
+
std::make_pair(std::string(cluster_name), std::string(eds_service_name));
|
1924
|
+
// We jump through some hoops here to make sure that the absl::string_views
|
1925
|
+
// stored in the XdsClusterDropStats object point to the strings
|
1926
|
+
// in the load_report_map_ key, so that they have the same lifetime.
|
1927
|
+
auto it = load_report_map_
|
1928
|
+
.emplace(std::make_pair(std::move(key), LoadReportState()))
|
1929
|
+
.first;
|
1930
|
+
auto cluster_drop_stats = MakeRefCounted<XdsClusterDropStats>(
|
1931
|
+
Ref(DEBUG_LOCATION, "DropStats"), lrs_server,
|
1932
|
+
it->first.first /*cluster_name*/, it->first.second /*eds_service_name*/);
|
1933
|
+
it->second.drop_stats.insert(cluster_drop_stats.get());
|
1584
1934
|
chand_->MaybeStartLrsCall();
|
1935
|
+
return cluster_drop_stats;
|
1585
1936
|
}
|
1586
1937
|
|
1587
|
-
void XdsClient::
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1938
|
+
void XdsClient::RemoveClusterDropStats(
|
1939
|
+
absl::string_view /*lrs_server*/, absl::string_view cluster_name,
|
1940
|
+
absl::string_view eds_service_name,
|
1941
|
+
XdsClusterDropStats* cluster_drop_stats) {
|
1942
|
+
auto load_report_it = load_report_map_.find(
|
1943
|
+
std::make_pair(std::string(cluster_name), std::string(eds_service_name)));
|
1944
|
+
if (load_report_it == load_report_map_.end()) return;
|
1945
|
+
LoadReportState& load_report_state = load_report_it->second;
|
1591
1946
|
// TODO(roth): When we add support for direct federation, use the
|
1592
1947
|
// server name specified in lrs_server.
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1948
|
+
auto it = load_report_state.drop_stats.find(cluster_drop_stats);
|
1949
|
+
if (it != load_report_state.drop_stats.end()) {
|
1950
|
+
// Record final drop stats in deleted_drop_stats, which will be
|
1951
|
+
// added to the next load report.
|
1952
|
+
for (const auto& p : cluster_drop_stats->GetSnapshotAndReset()) {
|
1953
|
+
load_report_state.deleted_drop_stats[p.first] += p.second;
|
1954
|
+
}
|
1955
|
+
load_report_state.drop_stats.erase(it);
|
1599
1956
|
}
|
1600
|
-
|
1601
|
-
|
1957
|
+
}
|
1958
|
+
|
1959
|
+
RefCountedPtr<XdsClusterLocalityStats> XdsClient::AddClusterLocalityStats(
|
1960
|
+
absl::string_view lrs_server, absl::string_view cluster_name,
|
1961
|
+
absl::string_view eds_service_name,
|
1962
|
+
RefCountedPtr<XdsLocalityName> locality) {
|
1963
|
+
// TODO(roth): When we add support for direct federation, use the
|
1964
|
+
// server name specified in lrs_server.
|
1965
|
+
auto key =
|
1966
|
+
std::make_pair(std::string(cluster_name), std::string(eds_service_name));
|
1967
|
+
// We jump through some hoops here to make sure that the absl::string_views
|
1968
|
+
// stored in the XdsClusterLocalityStats object point to the strings
|
1969
|
+
// in the load_report_map_ key, so that they have the same lifetime.
|
1970
|
+
auto it = load_report_map_
|
1971
|
+
.emplace(std::make_pair(std::move(key), LoadReportState()))
|
1972
|
+
.first;
|
1973
|
+
auto cluster_locality_stats = MakeRefCounted<XdsClusterLocalityStats>(
|
1974
|
+
Ref(DEBUG_LOCATION, "LocalityStats"), lrs_server,
|
1975
|
+
it->first.first /*cluster_name*/, it->first.second /*eds_service_name*/,
|
1976
|
+
locality);
|
1977
|
+
it->second.locality_stats[std::move(locality)].locality_stats.insert(
|
1978
|
+
cluster_locality_stats.get());
|
1979
|
+
chand_->MaybeStartLrsCall();
|
1980
|
+
return cluster_locality_stats;
|
1981
|
+
}
|
1982
|
+
|
1983
|
+
void XdsClient::RemoveClusterLocalityStats(
|
1984
|
+
absl::string_view /*lrs_server*/, absl::string_view cluster_name,
|
1985
|
+
absl::string_view eds_service_name,
|
1986
|
+
const RefCountedPtr<XdsLocalityName>& locality,
|
1987
|
+
XdsClusterLocalityStats* cluster_locality_stats) {
|
1988
|
+
auto load_report_it = load_report_map_.find(
|
1989
|
+
std::make_pair(std::string(cluster_name), std::string(eds_service_name)));
|
1990
|
+
if (load_report_it == load_report_map_.end()) return;
|
1991
|
+
LoadReportState& load_report_state = load_report_it->second;
|
1992
|
+
// TODO(roth): When we add support for direct federation, use the
|
1993
|
+
// server name specified in lrs_server.
|
1994
|
+
auto locality_it = load_report_state.locality_stats.find(locality);
|
1995
|
+
if (locality_it == load_report_state.locality_stats.end()) return;
|
1996
|
+
auto& locality_set = locality_it->second.locality_stats;
|
1997
|
+
auto it = locality_set.find(cluster_locality_stats);
|
1998
|
+
if (it != locality_set.end()) {
|
1999
|
+
// Record final snapshot in deleted_locality_stats, which will be
|
2000
|
+
// added to the next load report.
|
2001
|
+
locality_it->second.deleted_locality_stats.emplace_back(
|
2002
|
+
cluster_locality_stats->GetSnapshotAndReset());
|
2003
|
+
locality_set.erase(it);
|
1602
2004
|
}
|
1603
2005
|
}
|
1604
2006
|
|
@@ -1608,38 +2010,302 @@ void XdsClient::ResetBackoff() {
|
|
1608
2010
|
}
|
1609
2011
|
}
|
1610
2012
|
|
1611
|
-
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
2013
|
+
namespace {
|
2014
|
+
std::string CreateServiceConfigActionCluster(const std::string& cluster_name) {
|
2015
|
+
return absl::StrFormat(
|
2016
|
+
" \"cds:%s\":{\n"
|
2017
|
+
" \"childPolicy\":[ {\n"
|
2018
|
+
" \"cds_experimental\":{\n"
|
2019
|
+
" \"cluster\": \"%s\"\n"
|
2020
|
+
" }\n"
|
2021
|
+
" } ]\n"
|
2022
|
+
" }",
|
2023
|
+
cluster_name, cluster_name);
|
2024
|
+
}
|
2025
|
+
|
2026
|
+
std::string CreateServiceConfigRoute(const std::string& action_name,
|
2027
|
+
const std::string& service,
|
2028
|
+
const std::string& method) {
|
2029
|
+
return absl::StrFormat(
|
2030
|
+
" { \n"
|
2031
|
+
" \"methodName\": {\n"
|
2032
|
+
" \"service\": \"%s\",\n"
|
2033
|
+
" \"method\": \"%s\"\n"
|
2034
|
+
" },\n"
|
2035
|
+
" \"action\": \"%s\"\n"
|
2036
|
+
" }",
|
2037
|
+
service, method, action_name);
|
2038
|
+
}
|
2039
|
+
|
2040
|
+
// Create the service config for one weighted cluster.
|
2041
|
+
std::string CreateServiceConfigActionWeightedCluster(
|
2042
|
+
const std::string& name,
|
2043
|
+
const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>& clusters) {
|
2044
|
+
std::vector<std::string> config_parts;
|
2045
|
+
config_parts.push_back(
|
2046
|
+
absl::StrFormat(" \"weighted:%s\":{\n"
|
2047
|
+
" \"childPolicy\":[ {\n"
|
2048
|
+
" \"weighted_target_experimental\":{\n"
|
2049
|
+
" \"targets\":{\n",
|
2050
|
+
name));
|
2051
|
+
std::vector<std::string> weighted_targets;
|
2052
|
+
weighted_targets.reserve(clusters.size());
|
2053
|
+
for (const auto& cluster_weight : clusters) {
|
2054
|
+
weighted_targets.push_back(absl::StrFormat(
|
2055
|
+
" \"%s\":{\n"
|
2056
|
+
" \"weight\":%d,\n"
|
2057
|
+
" \"childPolicy\":[ {\n"
|
2058
|
+
" \"cds_experimental\":{\n"
|
2059
|
+
" \"cluster\": \"%s\"\n"
|
2060
|
+
" }\n"
|
2061
|
+
" } ]\n"
|
2062
|
+
" }",
|
2063
|
+
cluster_weight.name, cluster_weight.weight, cluster_weight.name));
|
1619
2064
|
}
|
1620
|
-
|
1621
|
-
|
2065
|
+
config_parts.push_back(absl::StrJoin(weighted_targets, ",\n"));
|
2066
|
+
config_parts.push_back(
|
2067
|
+
" }\n"
|
2068
|
+
" }\n"
|
2069
|
+
" } ]\n"
|
2070
|
+
" }");
|
2071
|
+
return absl::StrJoin(config_parts, "");
|
2072
|
+
}
|
2073
|
+
|
2074
|
+
struct WeightedClustersKeys {
|
2075
|
+
std::string cluster_names_key;
|
2076
|
+
std::string cluster_weights_key;
|
2077
|
+
};
|
1622
2078
|
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
2079
|
+
// Returns the cluster names and weights key or the cluster names only key.
|
2080
|
+
WeightedClustersKeys GetWeightedClustersKey(
|
2081
|
+
const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>&
|
2082
|
+
weighted_clusters) {
|
2083
|
+
std::set<std::string> cluster_names;
|
2084
|
+
std::set<std::string> cluster_weights;
|
2085
|
+
for (const auto& cluster_weight : weighted_clusters) {
|
2086
|
+
cluster_names.emplace(absl::StrFormat("%s", cluster_weight.name));
|
2087
|
+
cluster_weights.emplace(
|
2088
|
+
absl::StrFormat("%s_%d", cluster_weight.name, cluster_weight.weight));
|
1628
2089
|
}
|
1629
|
-
return
|
2090
|
+
return {absl::StrJoin(cluster_names, "_"),
|
2091
|
+
absl::StrJoin(cluster_weights, "_")};
|
1630
2092
|
}
|
1631
2093
|
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
2094
|
+
} // namespace
|
2095
|
+
|
2096
|
+
std::string XdsClient::WeightedClustersActionName(
|
2097
|
+
const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>&
|
2098
|
+
weighted_clusters) {
|
2099
|
+
WeightedClustersKeys keys = GetWeightedClustersKey(weighted_clusters);
|
2100
|
+
auto cluster_names_map_it =
|
2101
|
+
weighted_cluster_index_map_.find(keys.cluster_names_key);
|
2102
|
+
GPR_ASSERT(cluster_names_map_it != weighted_cluster_index_map_.end());
|
2103
|
+
const auto& cluster_weights_map =
|
2104
|
+
cluster_names_map_it->second.cluster_weights_map;
|
2105
|
+
auto cluster_weights_map_it =
|
2106
|
+
cluster_weights_map.find(keys.cluster_weights_key);
|
2107
|
+
GPR_ASSERT(cluster_weights_map_it != cluster_weights_map.end());
|
2108
|
+
return absl::StrFormat("%s_%d", keys.cluster_names_key,
|
2109
|
+
cluster_weights_map_it->second);
|
2110
|
+
}
|
2111
|
+
|
2112
|
+
void XdsClient::UpdateWeightedClusterIndexMap(
|
2113
|
+
const XdsApi::RdsUpdate& rds_update) {
|
2114
|
+
// Construct a list of unique WeightedCluster
|
2115
|
+
// actions which we need to process: to find action names
|
2116
|
+
std::map<std::string /* cluster_weights_key */,
|
2117
|
+
std::string /* cluster_names_key */>
|
2118
|
+
actions_to_process;
|
2119
|
+
for (const auto& route : rds_update.routes) {
|
2120
|
+
if (!route.weighted_clusters.empty()) {
|
2121
|
+
WeightedClustersKeys keys =
|
2122
|
+
GetWeightedClustersKey(route.weighted_clusters);
|
2123
|
+
auto action_it = actions_to_process.find(keys.cluster_weights_key);
|
2124
|
+
if (action_it == actions_to_process.end()) {
|
2125
|
+
actions_to_process[std::move(keys.cluster_weights_key)] =
|
2126
|
+
std::move(keys.cluster_names_key);
|
2127
|
+
}
|
2128
|
+
}
|
2129
|
+
}
|
2130
|
+
// First pass of all unique WeightedCluster actions: if the exact same
|
2131
|
+
// weighted target policy (same clusters and weights) appears in the old map,
|
2132
|
+
// then that old action name is taken again and should be moved to the new
|
2133
|
+
// map; any other action names from the old set of actions are candidates for
|
2134
|
+
// reuse.
|
2135
|
+
XdsClient::WeightedClusterIndexMap new_weighted_cluster_index_map;
|
2136
|
+
for (auto action_it = actions_to_process.begin();
|
2137
|
+
action_it != actions_to_process.end();) {
|
2138
|
+
const std::string& cluster_names_key = action_it->second;
|
2139
|
+
const std::string& cluster_weights_key = action_it->first;
|
2140
|
+
auto old_cluster_names_map_it =
|
2141
|
+
weighted_cluster_index_map_.find(cluster_names_key);
|
2142
|
+
if (old_cluster_names_map_it != weighted_cluster_index_map_.end()) {
|
2143
|
+
// Add cluster_names_key to the new map and copy next_index.
|
2144
|
+
auto& new_cluster_names_info =
|
2145
|
+
new_weighted_cluster_index_map[cluster_names_key];
|
2146
|
+
new_cluster_names_info.next_index =
|
2147
|
+
old_cluster_names_map_it->second.next_index;
|
2148
|
+
// Lookup cluster_weights_key in old map.
|
2149
|
+
auto& old_cluster_weights_map =
|
2150
|
+
old_cluster_names_map_it->second.cluster_weights_map;
|
2151
|
+
auto old_cluster_weights_map_it =
|
2152
|
+
old_cluster_weights_map.find(cluster_weights_key);
|
2153
|
+
if (old_cluster_weights_map_it != old_cluster_weights_map.end()) {
|
2154
|
+
// same policy found, move from old map to new map.
|
2155
|
+
new_cluster_names_info.cluster_weights_map[cluster_weights_key] =
|
2156
|
+
old_cluster_weights_map_it->second;
|
2157
|
+
old_cluster_weights_map.erase(old_cluster_weights_map_it);
|
2158
|
+
// This action has been added to new map, so no need to process it
|
2159
|
+
// again.
|
2160
|
+
action_it = actions_to_process.erase(action_it);
|
2161
|
+
continue;
|
2162
|
+
}
|
1640
2163
|
}
|
2164
|
+
++action_it;
|
1641
2165
|
}
|
1642
|
-
|
2166
|
+
// Second pass of all remaining unique WeightedCluster actions: if clusters
|
2167
|
+
// for a new action are the same as an old unused action, reuse the name. If
|
2168
|
+
// clusters differ, use a brand new name.
|
2169
|
+
for (const auto& action : actions_to_process) {
|
2170
|
+
const std::string& cluster_names_key = action.second;
|
2171
|
+
const std::string& cluster_weights_key = action.first;
|
2172
|
+
auto& new_cluster_names_info =
|
2173
|
+
new_weighted_cluster_index_map[cluster_names_key];
|
2174
|
+
auto& old_cluster_weights_map =
|
2175
|
+
weighted_cluster_index_map_[cluster_names_key].cluster_weights_map;
|
2176
|
+
auto old_cluster_weights_it = old_cluster_weights_map.begin();
|
2177
|
+
if (old_cluster_weights_it != old_cluster_weights_map.end()) {
|
2178
|
+
// There is something to reuse: this action uses the same set
|
2179
|
+
// of clusters as a previous action and that action name is not
|
2180
|
+
// already taken.
|
2181
|
+
new_cluster_names_info.cluster_weights_map[cluster_weights_key] =
|
2182
|
+
old_cluster_weights_it->second;
|
2183
|
+
// Remove the name from being able to reuse again.
|
2184
|
+
old_cluster_weights_map.erase(old_cluster_weights_it);
|
2185
|
+
} else {
|
2186
|
+
// There is nothing to reuse, take the next index to use and
|
2187
|
+
// increment.
|
2188
|
+
new_cluster_names_info.cluster_weights_map[cluster_weights_key] =
|
2189
|
+
new_cluster_names_info.next_index++;
|
2190
|
+
}
|
2191
|
+
}
|
2192
|
+
weighted_cluster_index_map_ = std::move(new_weighted_cluster_index_map);
|
2193
|
+
}
|
2194
|
+
|
2195
|
+
grpc_error* XdsClient::CreateServiceConfig(
|
2196
|
+
const XdsApi::RdsUpdate& rds_update,
|
2197
|
+
RefCountedPtr<ServiceConfig>* service_config) {
|
2198
|
+
UpdateWeightedClusterIndexMap(rds_update);
|
2199
|
+
std::vector<std::string> actions_vector;
|
2200
|
+
std::vector<std::string> route_table;
|
2201
|
+
std::set<std::string> actions_set;
|
2202
|
+
for (const auto& route : rds_update.routes) {
|
2203
|
+
const std::string action_name =
|
2204
|
+
route.weighted_clusters.empty()
|
2205
|
+
? route.cluster_name
|
2206
|
+
: WeightedClustersActionName(route.weighted_clusters);
|
2207
|
+
if (actions_set.find(action_name) == actions_set.end()) {
|
2208
|
+
actions_set.emplace(action_name);
|
2209
|
+
actions_vector.push_back(
|
2210
|
+
route.weighted_clusters.empty()
|
2211
|
+
? CreateServiceConfigActionCluster(action_name)
|
2212
|
+
: CreateServiceConfigActionWeightedCluster(
|
2213
|
+
action_name, route.weighted_clusters));
|
2214
|
+
}
|
2215
|
+
route_table.push_back(CreateServiceConfigRoute(
|
2216
|
+
absl::StrFormat("%s:%s",
|
2217
|
+
route.weighted_clusters.empty() ? "cds" : "weighted",
|
2218
|
+
action_name),
|
2219
|
+
route.service, route.method));
|
2220
|
+
}
|
2221
|
+
std::vector<std::string> config_parts;
|
2222
|
+
config_parts.push_back(
|
2223
|
+
"{\n"
|
2224
|
+
" \"loadBalancingConfig\":[\n"
|
2225
|
+
" { \"xds_routing_experimental\":{\n"
|
2226
|
+
" \"actions\":{\n");
|
2227
|
+
config_parts.push_back(absl::StrJoin(actions_vector, ",\n"));
|
2228
|
+
config_parts.push_back(
|
2229
|
+
" },\n"
|
2230
|
+
" \"routes\":[\n");
|
2231
|
+
config_parts.push_back(absl::StrJoin(route_table, ",\n"));
|
2232
|
+
config_parts.push_back(
|
2233
|
+
" ]\n"
|
2234
|
+
" } }\n"
|
2235
|
+
" ]\n"
|
2236
|
+
"}");
|
2237
|
+
std::string json = absl::StrJoin(config_parts, "");
|
2238
|
+
grpc_error* error = GRPC_ERROR_NONE;
|
2239
|
+
*service_config = ServiceConfig::Create(json.c_str(), &error);
|
2240
|
+
return error;
|
2241
|
+
}
|
2242
|
+
|
2243
|
+
XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshot(
|
2244
|
+
bool send_all_clusters, const std::set<std::string>& clusters) {
|
2245
|
+
XdsApi::ClusterLoadReportMap snapshot_map;
|
2246
|
+
for (auto load_report_it = load_report_map_.begin();
|
2247
|
+
load_report_it != load_report_map_.end();) {
|
2248
|
+
// Cluster key is cluster and EDS service name.
|
2249
|
+
const auto& cluster_key = load_report_it->first;
|
2250
|
+
LoadReportState& load_report = load_report_it->second;
|
2251
|
+
// If the CDS response for a cluster indicates to use LRS but the
|
2252
|
+
// LRS server does not say that it wants reports for this cluster,
|
2253
|
+
// then we'll have stats objects here whose data we're not going to
|
2254
|
+
// include in the load report. However, we still need to clear out
|
2255
|
+
// the data from the stats objects, so that if the LRS server starts
|
2256
|
+
// asking for the data in the future, we don't incorrectly include
|
2257
|
+
// data from previous reporting intervals in that future report.
|
2258
|
+
const bool record_stats =
|
2259
|
+
send_all_clusters || clusters.find(cluster_key.first) != clusters.end();
|
2260
|
+
XdsApi::ClusterLoadReport snapshot;
|
2261
|
+
// Aggregate drop stats.
|
2262
|
+
snapshot.dropped_requests = std::move(load_report.deleted_drop_stats);
|
2263
|
+
for (auto& drop_stats : load_report.drop_stats) {
|
2264
|
+
for (const auto& p : drop_stats->GetSnapshotAndReset()) {
|
2265
|
+
snapshot.dropped_requests[p.first] += p.second;
|
2266
|
+
}
|
2267
|
+
}
|
2268
|
+
// Aggregate locality stats.
|
2269
|
+
for (auto it = load_report.locality_stats.begin();
|
2270
|
+
it != load_report.locality_stats.end();) {
|
2271
|
+
const RefCountedPtr<XdsLocalityName>& locality_name = it->first;
|
2272
|
+
auto& locality_state = it->second;
|
2273
|
+
XdsClusterLocalityStats::Snapshot& locality_snapshot =
|
2274
|
+
snapshot.locality_stats[locality_name];
|
2275
|
+
for (auto& locality_stats : locality_state.locality_stats) {
|
2276
|
+
locality_snapshot += locality_stats->GetSnapshotAndReset();
|
2277
|
+
}
|
2278
|
+
// Add final snapshots from recently deleted locality stats objects.
|
2279
|
+
for (auto& deleted_locality_stats :
|
2280
|
+
locality_state.deleted_locality_stats) {
|
2281
|
+
locality_snapshot += deleted_locality_stats;
|
2282
|
+
}
|
2283
|
+
locality_state.deleted_locality_stats.clear();
|
2284
|
+
// If the only thing left in this entry was final snapshots from
|
2285
|
+
// deleted locality stats objects, remove the entry.
|
2286
|
+
if (locality_state.locality_stats.empty()) {
|
2287
|
+
it = load_report.locality_stats.erase(it);
|
2288
|
+
} else {
|
2289
|
+
++it;
|
2290
|
+
}
|
2291
|
+
}
|
2292
|
+
if (record_stats) {
|
2293
|
+
// Compute load report interval.
|
2294
|
+
const grpc_millis now = ExecCtx::Get()->Now();
|
2295
|
+
snapshot.load_report_interval = now - load_report.last_report_time;
|
2296
|
+
load_report.last_report_time = now;
|
2297
|
+
// Record snapshot.
|
2298
|
+
snapshot_map[cluster_key] = std::move(snapshot);
|
2299
|
+
}
|
2300
|
+
// If the only thing left in this entry was final snapshots from
|
2301
|
+
// deleted stats objects, remove the entry.
|
2302
|
+
if (load_report.locality_stats.empty() && load_report.drop_stats.empty()) {
|
2303
|
+
load_report_it = load_report_map_.erase(load_report_it);
|
2304
|
+
} else {
|
2305
|
+
++load_report_it;
|
2306
|
+
}
|
2307
|
+
}
|
2308
|
+
return snapshot_map;
|
1643
2309
|
}
|
1644
2310
|
|
1645
2311
|
void XdsClient::NotifyOnError(grpc_error* error) {
|
@@ -1661,41 +2327,15 @@ void XdsClient::NotifyOnError(grpc_error* error) {
|
|
1661
2327
|
GRPC_ERROR_UNREF(error);
|
1662
2328
|
}
|
1663
2329
|
|
1664
|
-
void XdsClient::NotifyOnServiceConfig(void* arg, grpc_error* error) {
|
1665
|
-
XdsClient* self = static_cast<XdsClient*>(arg);
|
1666
|
-
// TODO(roth): When we add support for WeightedClusters, select the
|
1667
|
-
// LB policy based on that functionality.
|
1668
|
-
char* json;
|
1669
|
-
gpr_asprintf(&json,
|
1670
|
-
"{\n"
|
1671
|
-
" \"loadBalancingConfig\":[\n"
|
1672
|
-
" { \"cds_experimental\":{\n"
|
1673
|
-
" \"cluster\": \"%s\"\n"
|
1674
|
-
" } }\n"
|
1675
|
-
" ]\n"
|
1676
|
-
"}",
|
1677
|
-
self->server_name_.c_str());
|
1678
|
-
RefCountedPtr<ServiceConfig> service_config =
|
1679
|
-
ServiceConfig::Create(json, &error);
|
1680
|
-
gpr_free(json);
|
1681
|
-
if (error != GRPC_ERROR_NONE) {
|
1682
|
-
self->service_config_watcher_->OnError(error);
|
1683
|
-
} else {
|
1684
|
-
self->service_config_watcher_->OnServiceConfigChanged(
|
1685
|
-
std::move(service_config));
|
1686
|
-
}
|
1687
|
-
self->Unref();
|
1688
|
-
}
|
1689
|
-
|
1690
2330
|
void* XdsClient::ChannelArgCopy(void* p) {
|
1691
2331
|
XdsClient* xds_client = static_cast<XdsClient*>(p);
|
1692
|
-
xds_client->Ref().release();
|
2332
|
+
xds_client->Ref(DEBUG_LOCATION, "channel arg").release();
|
1693
2333
|
return p;
|
1694
2334
|
}
|
1695
2335
|
|
1696
2336
|
void XdsClient::ChannelArgDestroy(void* p) {
|
1697
2337
|
XdsClient* xds_client = static_cast<XdsClient*>(p);
|
1698
|
-
xds_client->Unref();
|
2338
|
+
xds_client->Unref(DEBUG_LOCATION, "channel arg");
|
1699
2339
|
}
|
1700
2340
|
|
1701
2341
|
int XdsClient::ChannelArgCmp(void* p, void* q) { return GPR_ICMP(p, q); }
|
@@ -1718,4 +2358,10 @@ RefCountedPtr
|
|
1718
2358
|
return nullptr;
|
1719
2359
|
}
|
1720
2360
|
|
2361
|
+
grpc_channel_args* XdsClient::RemoveFromChannelArgs(
|
2362
|
+
const grpc_channel_args& args) {
|
2363
|
+
const char* arg_name = GRPC_ARG_XDS_CLIENT;
|
2364
|
+
return grpc_channel_args_copy_and_remove(&args, &arg_name, 1);
|
2365
|
+
}
|
2366
|
+
|
1721
2367
|
} // namespace grpc_core
|