grpc 1.31.1 → 1.32.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +595 -15723
- data/include/grpc/grpc_security.h +31 -14
- data/include/grpc/impl/codegen/README.md +22 -0
- data/include/grpc/impl/codegen/port_platform.h +6 -1
- data/src/core/ext/filters/client_channel/backup_poller.cc +3 -2
- data/src/core/ext/filters/client_channel/client_channel.cc +64 -20
- data/src/core/ext/filters/client_channel/client_channel.h +1 -1
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +0 -3
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +6 -1
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +2 -3
- data/src/core/ext/filters/client_channel/lb_policy.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +6 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +20 -13
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +0 -13
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +0 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +1 -37
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +19 -13
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +29 -10
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +5 -4
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +20 -9
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +18 -12
- data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +22 -14
- data/src/core/ext/filters/client_channel/lb_policy/xds/lrs.cc +18 -9
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +54 -56
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +3 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +363 -14
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +0 -1
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +5 -4
- data/src/core/ext/filters/client_channel/server_address.cc +40 -7
- data/src/core/ext/filters/client_channel/server_address.h +42 -4
- data/src/core/ext/filters/client_channel/subchannel.cc +64 -23
- data/src/core/ext/filters/client_channel/subchannel.h +16 -4
- data/src/core/ext/filters/max_age/max_age_filter.cc +2 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +87 -31
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +18 -1
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +10 -35
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +19 -25
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +2 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +2 -2
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +6 -6
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +239 -277
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/internal.h +5 -1
- data/src/core/ext/transport/chttp2/transport/parsing.cc +1 -28
- data/src/core/ext/transport/chttp2/transport/writing.cc +6 -5
- data/src/core/ext/transport/inproc/inproc_transport.cc +12 -12
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +224 -0
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +700 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +74 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +226 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +380 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +1378 -0
- data/src/core/ext/upb-generated/envoy/{api/v2/cluster → config/cluster/v3}/filter.upb.c +8 -8
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +69 -0
- data/src/core/ext/upb-generated/envoy/{api/v2/cluster → config/cluster/v3}/outlier_detection.upb.c +8 -8
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +323 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +112 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +334 -0
- data/src/core/ext/upb-generated/envoy/{api/v2/core → config/core/v3}/backoff.upb.c +8 -8
- data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +79 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +309 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +869 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +96 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +328 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +71 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +195 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +634 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +170 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +684 -0
- data/src/core/ext/upb-generated/envoy/{api/v2/core → config/core/v3}/http_uri.upb.c +8 -8
- data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +80 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +152 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +536 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +28 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +58 -0
- data/src/core/ext/upb-generated/envoy/{api/v2/core → config/core/v3}/socket_option.upb.c +6 -6
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +88 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +91 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +220 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +91 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +273 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +112 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +332 -0
- data/src/core/ext/upb-generated/envoy/config/listener/{v2 → v3}/api_listener.upb.c +8 -8
- data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +65 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +108 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +401 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +138 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +490 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +41 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +94 -0
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +174 -0
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +599 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +63 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +204 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +773 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +2855 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +59 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +135 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +50 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +108 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +312 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +1125 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +20 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +34 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +111 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +401 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +72 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +198 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +105 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +388 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/cluster/v3}/cds.upb.c +5 -6
- data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.h +49 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/{v2 → v3}/ads.upb.c +5 -4
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +49 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +129 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +386 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/endpoint/v3}/eds.upb.c +5 -6
- data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.h +49 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/listener/v3}/lds.upb.c +5 -6
- data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.h +49 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +55 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +136 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/route/v3}/rds.upb.c +5 -6
- data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.h +49 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/route/v3}/srds.upb.c +5 -6
- data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.h +49 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +47 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +114 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +77 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +71 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +64 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +145 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +53 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +127 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +63 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +188 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +88 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +258 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +90 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +250 -0
- data/src/core/ext/upb-generated/envoy/type/{http.upb.c → v3/http.upb.c} +2 -2
- data/src/core/ext/upb-generated/envoy/type/{http.upb.h → v3/http.upb.h} +8 -8
- data/src/core/ext/upb-generated/envoy/type/{percent.upb.c → v3/percent.upb.c} +9 -8
- data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +86 -0
- data/src/core/ext/upb-generated/envoy/type/{range.upb.c → v3/range.upb.c} +12 -11
- data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +111 -0
- data/src/core/ext/upb-generated/envoy/type/{semantic_version.upb.c → v3/semantic_version.upb.c} +6 -5
- data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +61 -0
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +234 -0
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +759 -0
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +36 -36
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +1 -1
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +27 -0
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +53 -0
- data/src/core/ext/upb-generated/validate/validate.upb.c +11 -11
- data/src/core/ext/upb-generated/validate/validate.upb.h +1 -1
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_api.cc +1045 -767
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_api.h +114 -99
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_bootstrap.cc +44 -2
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_bootstrap.h +8 -3
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_channel.h +4 -4
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_channel_args.h +3 -3
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_channel_secure.cc +2 -5
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_client.cc +85 -417
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_client.h +12 -45
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_client_stats.cc +2 -2
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_client_stats.h +3 -3
- data/src/core/lib/channel/channelz.cc +14 -15
- data/src/core/lib/channel/channelz.h +1 -1
- data/src/core/lib/channel/channelz_registry.cc +3 -1
- data/src/core/lib/gpr/sync_posix.cc +2 -8
- data/src/core/lib/iomgr/endpoint.cc +5 -1
- data/src/core/lib/iomgr/endpoint.h +7 -3
- data/src/core/lib/iomgr/endpoint_cfstream.cc +32 -11
- data/src/core/lib/iomgr/ev_posix.cc +0 -2
- data/src/core/lib/iomgr/iomgr.cc +0 -10
- data/src/core/lib/iomgr/iomgr.h +0 -10
- data/src/core/{ext/filters/client_channel → lib/iomgr}/parse_address.cc +1 -1
- data/src/core/{ext/filters/client_channel → lib/iomgr}/parse_address.h +3 -3
- data/src/core/lib/iomgr/sockaddr_utils.cc +2 -1
- data/src/core/lib/iomgr/sockaddr_utils.h +2 -1
- data/src/core/lib/iomgr/tcp_custom.cc +32 -16
- data/src/core/lib/iomgr/tcp_posix.cc +31 -13
- data/src/core/lib/iomgr/tcp_windows.cc +26 -10
- data/src/core/lib/security/authorization/authorization_engine.cc +177 -0
- data/src/core/lib/security/authorization/authorization_engine.h +84 -0
- data/src/core/lib/security/authorization/evaluate_args.cc +153 -0
- data/src/core/lib/security/authorization/evaluate_args.h +59 -0
- data/src/core/lib/security/authorization/mock_cel/activation.h +57 -0
- data/src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h +42 -0
- data/src/core/lib/security/authorization/mock_cel/cel_expression.h +68 -0
- data/src/core/lib/security/authorization/mock_cel/cel_value.h +93 -0
- data/src/core/lib/security/authorization/mock_cel/evaluator_core.h +67 -0
- data/src/core/lib/security/authorization/mock_cel/flat_expr_builder.h +56 -0
- data/src/core/lib/security/authorization/mock_cel/statusor.h +50 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +56 -38
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +1 -2
- data/src/core/lib/security/transport/secure_endpoint.cc +7 -1
- data/src/core/lib/surface/call.cc +12 -12
- data/src/core/lib/surface/call.h +2 -1
- data/src/core/lib/surface/channel.cc +28 -20
- data/src/core/lib/surface/channel.h +12 -2
- data/src/core/lib/surface/completion_queue.cc +10 -272
- data/src/core/lib/surface/completion_queue.h +0 -8
- data/src/core/lib/surface/init.cc +1 -3
- data/src/core/lib/surface/server.cc +1066 -1244
- data/src/core/lib/surface/server.h +363 -87
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/authority_override.cc +38 -0
- data/src/core/lib/transport/authority_override.h +32 -0
- data/src/core/lib/transport/connectivity_state.cc +18 -13
- data/src/core/lib/transport/connectivity_state.h +18 -6
- data/src/core/lib/transport/error_utils.cc +13 -0
- data/src/core/lib/transport/error_utils.h +6 -0
- data/src/core/lib/transport/static_metadata.cc +295 -276
- data/src/core/lib/transport/static_metadata.h +80 -73
- data/src/core/lib/transport/transport.h +7 -0
- data/src/core/lib/uri/uri_parser.cc +23 -21
- data/src/core/lib/uri/uri_parser.h +3 -1
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +22 -0
- data/src/core/tsi/ssl_transport_security.cc +3 -9
- data/src/ruby/ext/grpc/rb_channel_credentials.c +9 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +4 -4
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/channel_credentials_spec.rb +10 -0
- data/src/ruby/spec/generic/active_call_spec.rb +19 -8
- data/third_party/abseil-cpp/absl/algorithm/container.h +1727 -0
- data/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +161 -0
- data/third_party/abseil-cpp/absl/base/internal/exponential_biased.cc +93 -0
- data/third_party/abseil-cpp/absl/base/internal/exponential_biased.h +130 -0
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +620 -0
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.h +126 -0
- data/third_party/abseil-cpp/absl/container/fixed_array.h +515 -0
- data/third_party/abseil-cpp/absl/container/flat_hash_set.h +503 -0
- data/third_party/abseil-cpp/absl/container/internal/common.h +202 -0
- data/third_party/abseil-cpp/absl/container/internal/container_memory.h +440 -0
- data/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h +146 -0
- data/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h +191 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtable_debug_hooks.h +85 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +269 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +297 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc +30 -0
- data/third_party/abseil-cpp/absl/container/internal/have_sse.h +49 -0
- data/third_party/abseil-cpp/absl/container/internal/layout.h +741 -0
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +48 -0
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +1882 -0
- data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc +138 -0
- data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.h +32 -0
- data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +1895 -0
- data/third_party/abseil-cpp/absl/debugging/internal/demangle.h +71 -0
- data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc +382 -0
- data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h +134 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +192 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_arm-inl.inc +125 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h +70 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc +99 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +248 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_unimplemented-inl.inc +24 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_win32-inl.inc +85 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +346 -0
- data/third_party/abseil-cpp/absl/debugging/internal/symbolize.h +128 -0
- data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc +194 -0
- data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.h +158 -0
- data/third_party/abseil-cpp/absl/debugging/stacktrace.cc +140 -0
- data/third_party/abseil-cpp/absl/debugging/stacktrace.h +231 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize.cc +25 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize.h +99 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +1480 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize_unimplemented.inc +40 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc +81 -0
- data/third_party/abseil-cpp/absl/functional/function_ref.h +139 -0
- data/third_party/abseil-cpp/absl/functional/internal/function_ref.h +106 -0
- data/third_party/abseil-cpp/absl/hash/hash.h +324 -0
- data/third_party/abseil-cpp/absl/hash/internal/city.cc +346 -0
- data/third_party/abseil-cpp/absl/hash/internal/city.h +96 -0
- data/third_party/abseil-cpp/absl/hash/internal/hash.cc +55 -0
- data/third_party/abseil-cpp/absl/hash/internal/hash.h +988 -0
- data/third_party/abseil-cpp/absl/status/status.cc +447 -0
- data/third_party/abseil-cpp/absl/status/status.h +428 -0
- data/third_party/abseil-cpp/absl/status/status_payload_printer.cc +43 -0
- data/third_party/abseil-cpp/absl/status/status_payload_printer.h +51 -0
- data/third_party/abseil-cpp/absl/strings/cord.cc +2019 -0
- data/third_party/abseil-cpp/absl/strings/cord.h +1121 -0
- data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +151 -0
- data/third_party/abseil-cpp/absl/synchronization/barrier.cc +52 -0
- data/third_party/abseil-cpp/absl/synchronization/barrier.h +79 -0
- data/third_party/abseil-cpp/absl/synchronization/blocking_counter.cc +57 -0
- data/third_party/abseil-cpp/absl/synchronization/blocking_counter.h +99 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc +140 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.h +60 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +697 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.h +141 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +155 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/mutex_nonprod.inc +261 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc +106 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.h +115 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc +484 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter.h +159 -0
- data/third_party/abseil-cpp/absl/synchronization/mutex.cc +2728 -0
- data/third_party/abseil-cpp/absl/synchronization/mutex.h +1056 -0
- data/third_party/abseil-cpp/absl/synchronization/notification.cc +78 -0
- data/third_party/abseil-cpp/absl/synchronization/notification.h +123 -0
- data/third_party/abseil-cpp/absl/types/bad_variant_access.cc +64 -0
- data/third_party/abseil-cpp/absl/types/bad_variant_access.h +82 -0
- data/third_party/abseil-cpp/absl/types/internal/variant.h +1646 -0
- data/third_party/abseil-cpp/absl/types/variant.h +861 -0
- data/third_party/boringssl-with-bazel/err_data.c +263 -257
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +16 -0
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +456 -0
- data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +192 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_sig.c +20 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +52 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +39 -7
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +2 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +11 -0
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +4 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +3 -6
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +10 -0
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +34 -9
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +5 -0
- data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +5 -3
- data/third_party/upb/upb/decode.c +64 -15
- data/third_party/upb/upb/encode.c +2 -2
- data/third_party/upb/upb/msg.h +2 -2
- data/third_party/upb/upb/port_def.inc +1 -1
- data/third_party/upb/upb/table.c +0 -11
- data/third_party/upb/upb/table.int.h +0 -9
- data/third_party/upb/upb/upb.c +16 -14
- data/third_party/upb/upb/upb.h +26 -0
- data/third_party/upb/upb/upb.hpp +2 -0
- metadata +257 -155
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +0 -21
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +0 -34
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.c +0 -114
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +0 -429
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.c +0 -72
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +0 -198
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.c +0 -105
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +0 -388
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +0 -52
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +0 -403
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +0 -1453
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +0 -74
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +0 -226
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +0 -69
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +0 -323
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +0 -112
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +0 -334
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +0 -79
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +0 -313
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +0 -891
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +0 -96
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +0 -328
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.c +0 -34
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +0 -71
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +0 -197
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +0 -649
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +0 -172
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +0 -693
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +0 -80
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +0 -152
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +0 -536
- data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +0 -88
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +0 -129
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +0 -386
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +0 -52
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +0 -92
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +0 -224
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +0 -18
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +0 -32
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +0 -91
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +0 -273
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +0 -112
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +0 -332
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +0 -52
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +0 -109
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +0 -415
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +0 -18
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +0 -32
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +0 -145
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +0 -538
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +0 -43
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +0 -111
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +0 -52
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +0 -63
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +0 -204
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +0 -18
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +0 -32
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +0 -815
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +0 -2984
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +0 -59
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +0 -135
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +0 -52
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +0 -228
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +0 -732
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +0 -316
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +0 -1167
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +0 -65
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.c +0 -51
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +0 -125
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +0 -49
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +0 -54
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +0 -136
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +0 -63
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +0 -145
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +0 -53
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +0 -133
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +0 -88
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +0 -258
- data/src/core/ext/upb-generated/envoy/type/percent.upb.h +0 -86
- data/src/core/ext/upb-generated/envoy/type/range.upb.h +0 -111
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +0 -61
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +0 -89
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +0 -250
- data/src/core/lib/security/transport/target_authority_table.cc +0 -75
- data/src/core/lib/security/transport/target_authority_table.h +0 -40
- data/src/core/lib/slice/slice_hash_table.h +0 -199
- data/src/core/lib/slice/slice_weak_hash_table.h +0 -102
@@ -33,14 +33,12 @@
|
|
33
33
|
#include <grpc/support/time.h>
|
34
34
|
|
35
35
|
#include "src/core/ext/filters/client_channel/client_channel.h"
|
36
|
-
#include "src/core/ext/filters/client_channel/parse_address.h"
|
37
|
-
#include "src/core/ext/filters/client_channel/server_address.h"
|
38
36
|
#include "src/core/ext/filters/client_channel/service_config.h"
|
39
|
-
#include "src/core/ext/
|
40
|
-
#include "src/core/ext/
|
41
|
-
#include "src/core/ext/
|
42
|
-
#include "src/core/ext/
|
43
|
-
#include "src/core/ext/
|
37
|
+
#include "src/core/ext/xds/xds_api.h"
|
38
|
+
#include "src/core/ext/xds/xds_channel.h"
|
39
|
+
#include "src/core/ext/xds/xds_channel_args.h"
|
40
|
+
#include "src/core/ext/xds/xds_client.h"
|
41
|
+
#include "src/core/ext/xds/xds_client_stats.h"
|
44
42
|
#include "src/core/lib/backoff/backoff.h"
|
45
43
|
#include "src/core/lib/channel/channel_args.h"
|
46
44
|
#include "src/core/lib/channel/channel_stack.h"
|
@@ -54,7 +52,6 @@
|
|
54
52
|
#include "src/core/lib/iomgr/sockaddr_utils.h"
|
55
53
|
#include "src/core/lib/iomgr/timer.h"
|
56
54
|
#include "src/core/lib/iomgr/work_serializer.h"
|
57
|
-
#include "src/core/lib/slice/slice_hash_table.h"
|
58
55
|
#include "src/core/lib/slice/slice_internal.h"
|
59
56
|
#include "src/core/lib/slice/slice_string_helpers.h"
|
60
57
|
#include "src/core/lib/surface/call.h"
|
@@ -190,8 +187,7 @@ class XdsClient::ChannelState::AdsCallState
|
|
190
187
|
}
|
191
188
|
if (type_url_ == XdsApi::kLdsTypeUrl ||
|
192
189
|
type_url_ == XdsApi::kRdsTypeUrl) {
|
193
|
-
ads_calld_->xds_client()->
|
194
|
-
watcher_error);
|
190
|
+
ads_calld_->xds_client()->listener_watcher_->OnError(watcher_error);
|
195
191
|
} else if (type_url_ == XdsApi::kCdsTypeUrl) {
|
196
192
|
ClusterState& state = ads_calld_->xds_client()->cluster_map_[name_];
|
197
193
|
for (const auto& p : state.watchers) {
|
@@ -398,13 +394,15 @@ class XdsClient::ChannelState::StateWatcher
|
|
398
394
|
parent_(std::move(parent)) {}
|
399
395
|
|
400
396
|
private:
|
401
|
-
void OnConnectivityStateChange(grpc_connectivity_state new_state
|
397
|
+
void OnConnectivityStateChange(grpc_connectivity_state new_state,
|
398
|
+
const absl::Status& status) override {
|
402
399
|
if (!parent_->shutting_down_ &&
|
403
400
|
new_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
|
404
401
|
// In TRANSIENT_FAILURE. Notify all watchers of error.
|
405
402
|
gpr_log(GPR_INFO,
|
406
|
-
"[xds_client %p] xds channel in state
|
407
|
-
|
403
|
+
"[xds_client %p] xds channel in state:TRANSIENT_FAILURE "
|
404
|
+
"status_message:(%s)",
|
405
|
+
parent_->xds_client(), status.ToString().c_str());
|
408
406
|
parent_->xds_client()->NotifyOnError(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
409
407
|
"xds channel in TRANSIENT_FAILURE"));
|
410
408
|
}
|
@@ -683,11 +681,14 @@ XdsClient::ChannelState::AdsCallState::AdsCallState(
|
|
683
681
|
GPR_ASSERT(xds_client() != nullptr);
|
684
682
|
GPR_ASSERT(!xds_client()->server_name_.empty());
|
685
683
|
// Create a call with the specified method name.
|
684
|
+
const auto& method =
|
685
|
+
xds_client()->bootstrap_->server().ShouldUseV3()
|
686
|
+
? GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V3_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES
|
687
|
+
: GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V2_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES;
|
686
688
|
call_ = grpc_channel_create_pollset_set_call(
|
687
689
|
chand()->channel_, nullptr, GRPC_PROPAGATE_DEFAULTS,
|
688
|
-
xds_client()->interested_parties_,
|
689
|
-
|
690
|
-
nullptr, GRPC_MILLIS_INF_FUTURE, nullptr);
|
690
|
+
xds_client()->interested_parties_, method, nullptr,
|
691
|
+
GRPC_MILLIS_INF_FUTURE, nullptr);
|
691
692
|
GPR_ASSERT(call_ != nullptr);
|
692
693
|
// Init data associated with the call.
|
693
694
|
grpc_metadata_array_init(&initial_metadata_recv_);
|
@@ -717,7 +718,7 @@ XdsClient::ChannelState::AdsCallState::AdsCallState(
|
|
717
718
|
// Op: send request message.
|
718
719
|
GRPC_CLOSURE_INIT(&on_request_sent_, OnRequestSent, this,
|
719
720
|
grpc_schedule_on_exec_ctx);
|
720
|
-
if (xds_client()->
|
721
|
+
if (xds_client()->listener_watcher_ != nullptr) {
|
721
722
|
Subscribe(XdsApi::kLdsTypeUrl, xds_client()->server_name_);
|
722
723
|
if (xds_client()->lds_result_.has_value() &&
|
723
724
|
!xds_client()->lds_result_->route_config_name.empty()) {
|
@@ -786,7 +787,7 @@ void XdsClient::ChannelState::AdsCallState::Orphan() {
|
|
786
787
|
// on_status_received_ will complete the cancellation and clean up. Otherwise,
|
787
788
|
// we are here because xds_client has to orphan a failed call, then the
|
788
789
|
// following cancellation will be a no-op.
|
789
|
-
|
790
|
+
grpc_call_cancel_internal(call_);
|
790
791
|
state_map_.clear();
|
791
792
|
// Note that the initial ref is hold by on_status_received_. So the
|
792
793
|
// corresponding unref happens in on_status_received_ instead of here.
|
@@ -880,7 +881,7 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate(
|
|
880
881
|
xds_client()->rds_result_.reset();
|
881
882
|
}
|
882
883
|
xds_client()->lds_result_.reset();
|
883
|
-
xds_client()->
|
884
|
+
xds_client()->listener_watcher_->OnResourceDoesNotExist();
|
884
885
|
return;
|
885
886
|
}
|
886
887
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
@@ -891,13 +892,8 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate(
|
|
891
892
|
? lds_update->route_config_name.c_str()
|
892
893
|
: "<inlined>"));
|
893
894
|
if (lds_update->rds_update.has_value()) {
|
894
|
-
gpr_log(GPR_INFO, "RouteConfiguration
|
895
|
-
lds_update->rds_update
|
896
|
-
for (size_t i = 0; i < lds_update->rds_update.value().routes.size();
|
897
|
-
++i) {
|
898
|
-
gpr_log(GPR_INFO, "Route %" PRIuPTR ":\n%s", i,
|
899
|
-
lds_update->rds_update.value().routes[i].ToString().c_str());
|
900
|
-
}
|
895
|
+
gpr_log(GPR_INFO, "RouteConfiguration: %s",
|
896
|
+
lds_update->rds_update->ToString().c_str());
|
901
897
|
}
|
902
898
|
}
|
903
899
|
auto& lds_state = state_map_[XdsApi::kLdsTypeUrl];
|
@@ -923,14 +919,15 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate(
|
|
923
919
|
if (xds_client()->lds_result_->rds_update.has_value()) {
|
924
920
|
// If the RouteConfiguration was found inlined in LDS response, notify
|
925
921
|
// the watcher immediately.
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
if (
|
930
|
-
xds_client()->
|
931
|
-
|
922
|
+
const XdsApi::RdsUpdate::VirtualHost* vhost =
|
923
|
+
xds_client()->lds_result_->rds_update->FindVirtualHostForDomain(
|
924
|
+
xds_client()->server_name_);
|
925
|
+
if (vhost == nullptr) {
|
926
|
+
xds_client()->listener_watcher_->OnError(
|
927
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
928
|
+
"no VirtualHost found for domain"));
|
932
929
|
} else {
|
933
|
-
xds_client()->
|
930
|
+
xds_client()->listener_watcher_->OnListenerChanged(vhost->routes);
|
934
931
|
}
|
935
932
|
} else {
|
936
933
|
// Send RDS request for dynamic resolution.
|
@@ -946,18 +943,12 @@ void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdate(
|
|
946
943
|
"[xds_client %p] RDS update does not include requested resource",
|
947
944
|
xds_client());
|
948
945
|
xds_client()->rds_result_.reset();
|
949
|
-
xds_client()->
|
946
|
+
xds_client()->listener_watcher_->OnResourceDoesNotExist();
|
950
947
|
return;
|
951
948
|
}
|
952
949
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
953
|
-
gpr_log(GPR_INFO,
|
954
|
-
|
955
|
-
"%" PRIuPTR " routes",
|
956
|
-
this, rds_update.value().routes.size());
|
957
|
-
for (size_t i = 0; i < rds_update.value().routes.size(); ++i) {
|
958
|
-
gpr_log(GPR_INFO, "Route %" PRIuPTR ":\n%s", i,
|
959
|
-
rds_update.value().routes[i].ToString().c_str());
|
960
|
-
}
|
950
|
+
gpr_log(GPR_INFO, "[xds_client %p] RDS update received:\n%s", xds_client(),
|
951
|
+
rds_update->ToString().c_str());
|
961
952
|
}
|
962
953
|
auto& rds_state = state_map_[XdsApi::kRdsTypeUrl];
|
963
954
|
auto& state =
|
@@ -975,14 +966,15 @@ void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdate(
|
|
975
966
|
}
|
976
967
|
xds_client()->rds_result_ = std::move(rds_update);
|
977
968
|
// Notify the watcher.
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
if (
|
982
|
-
xds_client()->
|
983
|
-
|
969
|
+
const XdsApi::RdsUpdate::VirtualHost* vhost =
|
970
|
+
xds_client()->rds_result_->FindVirtualHostForDomain(
|
971
|
+
xds_client()->server_name_);
|
972
|
+
if (vhost == nullptr) {
|
973
|
+
xds_client()->listener_watcher_->OnError(
|
974
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
975
|
+
"no VirtualHost found for domain"));
|
984
976
|
} else {
|
985
|
-
xds_client()->
|
977
|
+
xds_client()->listener_watcher_->OnListenerChanged(vhost->routes);
|
986
978
|
}
|
987
979
|
}
|
988
980
|
|
@@ -1034,6 +1026,13 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
|
|
1034
1026
|
const std::string& cluster_name = p.first;
|
1035
1027
|
if (cds_update_map.find(cluster_name) == cds_update_map.end()) {
|
1036
1028
|
ClusterState& cluster_state = xds_client()->cluster_map_[cluster_name];
|
1029
|
+
// If the resource was newly requested but has not yet been received,
|
1030
|
+
// we don't want to generate an error for the watchers, because this CDS
|
1031
|
+
// response may be in reaction to an earlier request that did not yet
|
1032
|
+
// request the new resource, so its absence from the response does not
|
1033
|
+
// necessarily indicate that the resource does not exist.
|
1034
|
+
// For that case, we rely on the request timeout instead.
|
1035
|
+
if (!cluster_state.update.has_value()) continue;
|
1037
1036
|
cluster_state.update.reset();
|
1038
1037
|
for (const auto& p : cluster_state.watchers) {
|
1039
1038
|
p.first->OnResourceDoesNotExist();
|
@@ -1196,66 +1195,49 @@ void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
|
|
1196
1195
|
grpc_byte_buffer_reader_destroy(&bbr);
|
1197
1196
|
grpc_byte_buffer_destroy(recv_message_payload_);
|
1198
1197
|
recv_message_payload_ = nullptr;
|
1199
|
-
//
|
1200
|
-
|
1201
|
-
// fallback mode if we have lost contact with the balancer after a certain
|
1202
|
-
// period of time. We will need to save the timeout value here, and then
|
1203
|
-
// when the balancer call ends, we will need to start a timer for the
|
1204
|
-
// specified period of time, and if the timer fires, we go into fallback
|
1205
|
-
// mode. We will also need to cancel the timer when we receive a serverlist
|
1206
|
-
// from the balancer.
|
1207
|
-
// Parse the response.
|
1208
|
-
absl::optional<XdsApi::LdsUpdate> lds_update;
|
1209
|
-
absl::optional<XdsApi::RdsUpdate> rds_update;
|
1210
|
-
XdsApi::CdsUpdateMap cds_update_map;
|
1211
|
-
XdsApi::EdsUpdateMap eds_update_map;
|
1212
|
-
std::string version;
|
1213
|
-
std::string nonce;
|
1214
|
-
std::string type_url;
|
1215
|
-
// Note that ParseAdsResponse() also validates the response.
|
1216
|
-
grpc_error* parse_error = xds_client()->api_.ParseAdsResponse(
|
1198
|
+
// Parse and validate the response.
|
1199
|
+
XdsApi::AdsParseResult result = xds_client()->api_.ParseAdsResponse(
|
1217
1200
|
response_slice, xds_client()->server_name_,
|
1218
1201
|
ResourceNamesForRequest(XdsApi::kRdsTypeUrl),
|
1219
1202
|
ResourceNamesForRequest(XdsApi::kCdsTypeUrl),
|
1220
|
-
ResourceNamesForRequest(XdsApi::kEdsTypeUrl)
|
1221
|
-
&cds_update_map, &eds_update_map, &version, &nonce, &type_url);
|
1203
|
+
ResourceNamesForRequest(XdsApi::kEdsTypeUrl));
|
1222
1204
|
grpc_slice_unref_internal(response_slice);
|
1223
|
-
if (type_url.empty()) {
|
1205
|
+
if (result.type_url.empty()) {
|
1224
1206
|
// Ignore unparsable response.
|
1225
1207
|
gpr_log(GPR_ERROR,
|
1226
1208
|
"[xds_client %p] Error parsing ADS response (%s) -- ignoring",
|
1227
|
-
xds_client(), grpc_error_string(parse_error));
|
1228
|
-
GRPC_ERROR_UNREF(parse_error);
|
1209
|
+
xds_client(), grpc_error_string(result.parse_error));
|
1210
|
+
GRPC_ERROR_UNREF(result.parse_error);
|
1229
1211
|
} else {
|
1230
1212
|
// Update nonce.
|
1231
|
-
auto& state = state_map_[type_url];
|
1232
|
-
state.nonce = std::move(nonce);
|
1213
|
+
auto& state = state_map_[result.type_url];
|
1214
|
+
state.nonce = std::move(result.nonce);
|
1233
1215
|
// NACK or ACK the response.
|
1234
|
-
if (parse_error != GRPC_ERROR_NONE) {
|
1216
|
+
if (result.parse_error != GRPC_ERROR_NONE) {
|
1235
1217
|
GRPC_ERROR_UNREF(state.error);
|
1236
|
-
state.error = parse_error;
|
1218
|
+
state.error = result.parse_error;
|
1237
1219
|
// NACK unacceptable update.
|
1238
1220
|
gpr_log(GPR_ERROR,
|
1239
1221
|
"[xds_client %p] ADS response invalid for resource type %s "
|
1240
1222
|
"version %s, will NACK: nonce=%s error=%s",
|
1241
|
-
xds_client(), type_url.c_str(), version.c_str(),
|
1242
|
-
state.nonce.c_str(), grpc_error_string(parse_error));
|
1243
|
-
SendMessageLocked(type_url);
|
1223
|
+
xds_client(), result.type_url.c_str(), result.version.c_str(),
|
1224
|
+
state.nonce.c_str(), grpc_error_string(result.parse_error));
|
1225
|
+
SendMessageLocked(result.type_url);
|
1244
1226
|
} else {
|
1245
1227
|
seen_response_ = true;
|
1246
1228
|
// Accept the ADS response according to the type_url.
|
1247
|
-
if (type_url == XdsApi::kLdsTypeUrl) {
|
1248
|
-
AcceptLdsUpdate(std::move(lds_update));
|
1249
|
-
} else if (type_url == XdsApi::kRdsTypeUrl) {
|
1250
|
-
AcceptRdsUpdate(std::move(rds_update));
|
1251
|
-
} else if (type_url == XdsApi::kCdsTypeUrl) {
|
1252
|
-
AcceptCdsUpdate(std::move(cds_update_map));
|
1253
|
-
} else if (type_url == XdsApi::kEdsTypeUrl) {
|
1254
|
-
AcceptEdsUpdate(std::move(eds_update_map));
|
1229
|
+
if (result.type_url == XdsApi::kLdsTypeUrl) {
|
1230
|
+
AcceptLdsUpdate(std::move(result.lds_update));
|
1231
|
+
} else if (result.type_url == XdsApi::kRdsTypeUrl) {
|
1232
|
+
AcceptRdsUpdate(std::move(result.rds_update));
|
1233
|
+
} else if (result.type_url == XdsApi::kCdsTypeUrl) {
|
1234
|
+
AcceptCdsUpdate(std::move(result.cds_update_map));
|
1235
|
+
} else if (result.type_url == XdsApi::kEdsTypeUrl) {
|
1236
|
+
AcceptEdsUpdate(std::move(result.eds_update_map));
|
1255
1237
|
}
|
1256
|
-
state.version = std::move(version);
|
1238
|
+
state.version = std::move(result.version);
|
1257
1239
|
// ACK the update.
|
1258
|
-
SendMessageLocked(type_url);
|
1240
|
+
SendMessageLocked(result.type_url);
|
1259
1241
|
// Start load reporting if needed.
|
1260
1242
|
auto& lrs_call = chand()->lrs_calld_;
|
1261
1243
|
if (lrs_call != nullptr) {
|
@@ -1469,11 +1451,14 @@ XdsClient::ChannelState::LrsCallState::LrsCallState(
|
|
1469
1451
|
// the polling entities from client_channel.
|
1470
1452
|
GPR_ASSERT(xds_client() != nullptr);
|
1471
1453
|
GPR_ASSERT(!xds_client()->server_name_.empty());
|
1454
|
+
const auto& method =
|
1455
|
+
xds_client()->bootstrap_->server().ShouldUseV3()
|
1456
|
+
? GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V3_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS
|
1457
|
+
: GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V2_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS;
|
1472
1458
|
call_ = grpc_channel_create_pollset_set_call(
|
1473
1459
|
chand()->channel_, nullptr, GRPC_PROPAGATE_DEFAULTS,
|
1474
|
-
xds_client()->interested_parties_,
|
1475
|
-
|
1476
|
-
nullptr, GRPC_MILLIS_INF_FUTURE, nullptr);
|
1460
|
+
xds_client()->interested_parties_, method, nullptr,
|
1461
|
+
GRPC_MILLIS_INF_FUTURE, nullptr);
|
1477
1462
|
GPR_ASSERT(call_ != nullptr);
|
1478
1463
|
// Init the request payload.
|
1479
1464
|
grpc_slice request_payload_slice =
|
@@ -1572,7 +1557,7 @@ void XdsClient::ChannelState::LrsCallState::Orphan() {
|
|
1572
1557
|
// on_status_received_ will complete the cancellation and clean up. Otherwise,
|
1573
1558
|
// we are here because xds_client has to orphan a failed call, then the
|
1574
1559
|
// following cancellation will be a no-op.
|
1575
|
-
|
1560
|
+
grpc_call_cancel_internal(call_);
|
1576
1561
|
// Note that the initial ref is hold by on_status_received_. So the
|
1577
1562
|
// corresponding unref happens in on_status_received_ instead of here.
|
1578
1563
|
}
|
@@ -1771,7 +1756,7 @@ grpc_millis GetRequestTimeout(const grpc_channel_args& args) {
|
|
1771
1756
|
XdsClient::XdsClient(std::shared_ptr<WorkSerializer> work_serializer,
|
1772
1757
|
grpc_pollset_set* interested_parties,
|
1773
1758
|
absl::string_view server_name,
|
1774
|
-
std::unique_ptr<
|
1759
|
+
std::unique_ptr<ListenerWatcherInterface> watcher,
|
1775
1760
|
const grpc_channel_args& channel_args, grpc_error** error)
|
1776
1761
|
: InternallyRefCounted<XdsClient>(&grpc_xds_client_trace),
|
1777
1762
|
request_timeout_(GetRequestTimeout(channel_args)),
|
@@ -1779,10 +1764,9 @@ XdsClient::XdsClient(std::shared_ptr<WorkSerializer> work_serializer,
|
|
1779
1764
|
interested_parties_(interested_parties),
|
1780
1765
|
bootstrap_(
|
1781
1766
|
XdsBootstrap::ReadFromFile(this, &grpc_xds_client_trace, error)),
|
1782
|
-
api_(this, &grpc_xds_client_trace,
|
1783
|
-
bootstrap_ == nullptr ? nullptr : bootstrap_->node()),
|
1767
|
+
api_(this, &grpc_xds_client_trace, bootstrap_.get()),
|
1784
1768
|
server_name_(server_name),
|
1785
|
-
|
1769
|
+
listener_watcher_(std::move(watcher)) {
|
1786
1770
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
1787
1771
|
gpr_log(GPR_INFO, "[xds_client %p] creating xds client", this);
|
1788
1772
|
}
|
@@ -1805,7 +1789,7 @@ XdsClient::XdsClient(std::shared_ptr<WorkSerializer> work_serializer,
|
|
1805
1789
|
}
|
1806
1790
|
chand_ = MakeOrphanable<ChannelState>(
|
1807
1791
|
Ref(DEBUG_LOCATION, "XdsClient+ChannelState"), channel);
|
1808
|
-
if (
|
1792
|
+
if (listener_watcher_ != nullptr) {
|
1809
1793
|
chand_->Subscribe(XdsApi::kLdsTypeUrl, std::string(server_name));
|
1810
1794
|
}
|
1811
1795
|
}
|
@@ -1828,7 +1812,7 @@ void XdsClient::Orphan() {
|
|
1828
1812
|
// possible for ADS calls to be in progress. Unreffing the loadbalancing
|
1829
1813
|
// policies before those calls are done would lead to issues such as
|
1830
1814
|
// https://github.com/grpc/grpc/issues/20928.
|
1831
|
-
if (
|
1815
|
+
if (listener_watcher_ != nullptr) {
|
1832
1816
|
cluster_map_.clear();
|
1833
1817
|
endpoint_map_.clear();
|
1834
1818
|
}
|
@@ -2003,322 +1987,6 @@ void XdsClient::ResetBackoff() {
|
|
2003
1987
|
}
|
2004
1988
|
}
|
2005
1989
|
|
2006
|
-
namespace {
|
2007
|
-
std::string CreateServiceConfigActionCluster(const std::string& cluster_name) {
|
2008
|
-
return absl::StrFormat(
|
2009
|
-
" \"cds:%s\":{\n"
|
2010
|
-
" \"childPolicy\":[ {\n"
|
2011
|
-
" \"cds_experimental\":{\n"
|
2012
|
-
" \"cluster\": \"%s\"\n"
|
2013
|
-
" }\n"
|
2014
|
-
" } ]\n"
|
2015
|
-
" }",
|
2016
|
-
cluster_name, cluster_name);
|
2017
|
-
}
|
2018
|
-
|
2019
|
-
std::string CreateServiceConfigRoute(const std::string& action_name,
|
2020
|
-
const XdsApi::RdsUpdate::RdsRoute& route) {
|
2021
|
-
std::vector<std::string> headers;
|
2022
|
-
for (const auto& header : route.matchers.header_matchers) {
|
2023
|
-
std::string header_matcher;
|
2024
|
-
switch (header.type) {
|
2025
|
-
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::
|
2026
|
-
HeaderMatcherType::EXACT:
|
2027
|
-
header_matcher = absl::StrFormat(" \"exact_match\": \"%s\"",
|
2028
|
-
header.string_matcher);
|
2029
|
-
break;
|
2030
|
-
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::
|
2031
|
-
HeaderMatcherType::REGEX:
|
2032
|
-
header_matcher = absl::StrFormat(" \"regex_match\": \"%s\"",
|
2033
|
-
header.regex_match->pattern());
|
2034
|
-
break;
|
2035
|
-
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::
|
2036
|
-
HeaderMatcherType::RANGE:
|
2037
|
-
header_matcher = absl::StrFormat(
|
2038
|
-
" \"range_match\":{\n"
|
2039
|
-
" \"start\":%d,\n"
|
2040
|
-
" \"end\":%d\n"
|
2041
|
-
" }",
|
2042
|
-
header.range_start, header.range_end);
|
2043
|
-
break;
|
2044
|
-
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::
|
2045
|
-
HeaderMatcherType::PRESENT:
|
2046
|
-
header_matcher =
|
2047
|
-
absl::StrFormat(" \"present_match\": %s",
|
2048
|
-
header.present_match ? "true" : "false");
|
2049
|
-
break;
|
2050
|
-
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::
|
2051
|
-
HeaderMatcherType::PREFIX:
|
2052
|
-
header_matcher = absl::StrFormat(
|
2053
|
-
" \"prefix_match\": \"%s\"", header.string_matcher);
|
2054
|
-
break;
|
2055
|
-
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::
|
2056
|
-
HeaderMatcherType::SUFFIX:
|
2057
|
-
header_matcher = absl::StrFormat(
|
2058
|
-
" \"suffix_match\": \"%s\"", header.string_matcher);
|
2059
|
-
break;
|
2060
|
-
default:
|
2061
|
-
break;
|
2062
|
-
}
|
2063
|
-
std::vector<std::string> header_parts;
|
2064
|
-
header_parts.push_back(
|
2065
|
-
absl::StrFormat(" { \n"
|
2066
|
-
" \"name\": \"%s\",\n",
|
2067
|
-
header.name));
|
2068
|
-
header_parts.push_back(header_matcher);
|
2069
|
-
if (header.invert_match) {
|
2070
|
-
header_parts.push_back(
|
2071
|
-
absl::StrFormat(",\n"
|
2072
|
-
" \"invert_match\": true"));
|
2073
|
-
}
|
2074
|
-
header_parts.push_back(
|
2075
|
-
absl::StrFormat("\n"
|
2076
|
-
" }"));
|
2077
|
-
headers.push_back(absl::StrJoin(header_parts, ""));
|
2078
|
-
}
|
2079
|
-
std::vector<std::string> headers_service_config;
|
2080
|
-
if (!headers.empty()) {
|
2081
|
-
headers_service_config.push_back("\"headers\":[\n");
|
2082
|
-
headers_service_config.push_back(absl::StrJoin(headers, ","));
|
2083
|
-
headers_service_config.push_back(" ],\n");
|
2084
|
-
}
|
2085
|
-
std::string path_match_str;
|
2086
|
-
switch (route.matchers.path_matcher.type) {
|
2087
|
-
case XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::PathMatcherType::
|
2088
|
-
PREFIX:
|
2089
|
-
path_match_str = absl::StrFormat(
|
2090
|
-
"\"prefix\": \"%s\",\n", route.matchers.path_matcher.string_matcher);
|
2091
|
-
break;
|
2092
|
-
case XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::PathMatcherType::
|
2093
|
-
PATH:
|
2094
|
-
path_match_str = absl::StrFormat(
|
2095
|
-
"\"path\": \"%s\",\n", route.matchers.path_matcher.string_matcher);
|
2096
|
-
break;
|
2097
|
-
case XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::PathMatcherType::
|
2098
|
-
REGEX:
|
2099
|
-
path_match_str =
|
2100
|
-
absl::StrFormat("\"regex\": \"%s\",\n",
|
2101
|
-
route.matchers.path_matcher.regex_matcher->pattern());
|
2102
|
-
break;
|
2103
|
-
}
|
2104
|
-
return absl::StrFormat(
|
2105
|
-
" { \n"
|
2106
|
-
" %s"
|
2107
|
-
" %s"
|
2108
|
-
" %s"
|
2109
|
-
" \"action\": \"%s\"\n"
|
2110
|
-
" }",
|
2111
|
-
path_match_str, absl::StrJoin(headers_service_config, ""),
|
2112
|
-
route.matchers.fraction_per_million.has_value()
|
2113
|
-
? absl::StrFormat("\"match_fraction\":%d,\n",
|
2114
|
-
route.matchers.fraction_per_million.value())
|
2115
|
-
: "",
|
2116
|
-
action_name);
|
2117
|
-
}
|
2118
|
-
|
2119
|
-
// Create the service config for one weighted cluster.
|
2120
|
-
std::string CreateServiceConfigActionWeightedCluster(
|
2121
|
-
const std::string& name,
|
2122
|
-
const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>& clusters) {
|
2123
|
-
std::vector<std::string> config_parts;
|
2124
|
-
config_parts.push_back(
|
2125
|
-
absl::StrFormat(" \"weighted:%s\":{\n"
|
2126
|
-
" \"childPolicy\":[ {\n"
|
2127
|
-
" \"weighted_target_experimental\":{\n"
|
2128
|
-
" \"targets\":{\n",
|
2129
|
-
name));
|
2130
|
-
std::vector<std::string> weighted_targets;
|
2131
|
-
weighted_targets.reserve(clusters.size());
|
2132
|
-
for (const auto& cluster_weight : clusters) {
|
2133
|
-
weighted_targets.push_back(absl::StrFormat(
|
2134
|
-
" \"%s\":{\n"
|
2135
|
-
" \"weight\":%d,\n"
|
2136
|
-
" \"childPolicy\":[ {\n"
|
2137
|
-
" \"cds_experimental\":{\n"
|
2138
|
-
" \"cluster\": \"%s\"\n"
|
2139
|
-
" }\n"
|
2140
|
-
" } ]\n"
|
2141
|
-
" }",
|
2142
|
-
cluster_weight.name, cluster_weight.weight, cluster_weight.name));
|
2143
|
-
}
|
2144
|
-
config_parts.push_back(absl::StrJoin(weighted_targets, ",\n"));
|
2145
|
-
config_parts.push_back(
|
2146
|
-
" }\n"
|
2147
|
-
" }\n"
|
2148
|
-
" } ]\n"
|
2149
|
-
" }");
|
2150
|
-
return absl::StrJoin(config_parts, "");
|
2151
|
-
}
|
2152
|
-
|
2153
|
-
struct WeightedClustersKeys {
|
2154
|
-
std::string cluster_names_key;
|
2155
|
-
std::string cluster_weights_key;
|
2156
|
-
};
|
2157
|
-
|
2158
|
-
// Returns the cluster names and weights key or the cluster names only key.
|
2159
|
-
WeightedClustersKeys GetWeightedClustersKey(
|
2160
|
-
const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>&
|
2161
|
-
weighted_clusters) {
|
2162
|
-
std::set<std::string> cluster_names;
|
2163
|
-
std::set<std::string> cluster_weights;
|
2164
|
-
for (const auto& cluster_weight : weighted_clusters) {
|
2165
|
-
cluster_names.emplace(absl::StrFormat("%s", cluster_weight.name));
|
2166
|
-
cluster_weights.emplace(
|
2167
|
-
absl::StrFormat("%s_%d", cluster_weight.name, cluster_weight.weight));
|
2168
|
-
}
|
2169
|
-
return {absl::StrJoin(cluster_names, "_"),
|
2170
|
-
absl::StrJoin(cluster_weights, "_")};
|
2171
|
-
}
|
2172
|
-
|
2173
|
-
} // namespace
|
2174
|
-
|
2175
|
-
std::string XdsClient::WeightedClustersActionName(
|
2176
|
-
const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>&
|
2177
|
-
weighted_clusters) {
|
2178
|
-
WeightedClustersKeys keys = GetWeightedClustersKey(weighted_clusters);
|
2179
|
-
auto cluster_names_map_it =
|
2180
|
-
weighted_cluster_index_map_.find(keys.cluster_names_key);
|
2181
|
-
GPR_ASSERT(cluster_names_map_it != weighted_cluster_index_map_.end());
|
2182
|
-
const auto& cluster_weights_map =
|
2183
|
-
cluster_names_map_it->second.cluster_weights_map;
|
2184
|
-
auto cluster_weights_map_it =
|
2185
|
-
cluster_weights_map.find(keys.cluster_weights_key);
|
2186
|
-
GPR_ASSERT(cluster_weights_map_it != cluster_weights_map.end());
|
2187
|
-
return absl::StrFormat("%s_%d", keys.cluster_names_key,
|
2188
|
-
cluster_weights_map_it->second);
|
2189
|
-
}
|
2190
|
-
|
2191
|
-
void XdsClient::UpdateWeightedClusterIndexMap(
|
2192
|
-
const XdsApi::RdsUpdate& rds_update) {
|
2193
|
-
// Construct a list of unique WeightedCluster
|
2194
|
-
// actions which we need to process: to find action names
|
2195
|
-
std::map<std::string /* cluster_weights_key */,
|
2196
|
-
std::string /* cluster_names_key */>
|
2197
|
-
actions_to_process;
|
2198
|
-
for (const auto& route : rds_update.routes) {
|
2199
|
-
if (!route.weighted_clusters.empty()) {
|
2200
|
-
WeightedClustersKeys keys =
|
2201
|
-
GetWeightedClustersKey(route.weighted_clusters);
|
2202
|
-
auto action_it = actions_to_process.find(keys.cluster_weights_key);
|
2203
|
-
if (action_it == actions_to_process.end()) {
|
2204
|
-
actions_to_process[std::move(keys.cluster_weights_key)] =
|
2205
|
-
std::move(keys.cluster_names_key);
|
2206
|
-
}
|
2207
|
-
}
|
2208
|
-
}
|
2209
|
-
// First pass of all unique WeightedCluster actions: if the exact same
|
2210
|
-
// weighted target policy (same clusters and weights) appears in the old map,
|
2211
|
-
// then that old action name is taken again and should be moved to the new
|
2212
|
-
// map; any other action names from the old set of actions are candidates for
|
2213
|
-
// reuse.
|
2214
|
-
XdsClient::WeightedClusterIndexMap new_weighted_cluster_index_map;
|
2215
|
-
for (auto action_it = actions_to_process.begin();
|
2216
|
-
action_it != actions_to_process.end();) {
|
2217
|
-
const std::string& cluster_names_key = action_it->second;
|
2218
|
-
const std::string& cluster_weights_key = action_it->first;
|
2219
|
-
auto old_cluster_names_map_it =
|
2220
|
-
weighted_cluster_index_map_.find(cluster_names_key);
|
2221
|
-
if (old_cluster_names_map_it != weighted_cluster_index_map_.end()) {
|
2222
|
-
// Add cluster_names_key to the new map and copy next_index.
|
2223
|
-
auto& new_cluster_names_info =
|
2224
|
-
new_weighted_cluster_index_map[cluster_names_key];
|
2225
|
-
new_cluster_names_info.next_index =
|
2226
|
-
old_cluster_names_map_it->second.next_index;
|
2227
|
-
// Lookup cluster_weights_key in old map.
|
2228
|
-
auto& old_cluster_weights_map =
|
2229
|
-
old_cluster_names_map_it->second.cluster_weights_map;
|
2230
|
-
auto old_cluster_weights_map_it =
|
2231
|
-
old_cluster_weights_map.find(cluster_weights_key);
|
2232
|
-
if (old_cluster_weights_map_it != old_cluster_weights_map.end()) {
|
2233
|
-
// same policy found, move from old map to new map.
|
2234
|
-
new_cluster_names_info.cluster_weights_map[cluster_weights_key] =
|
2235
|
-
old_cluster_weights_map_it->second;
|
2236
|
-
old_cluster_weights_map.erase(old_cluster_weights_map_it);
|
2237
|
-
// This action has been added to new map, so no need to process it
|
2238
|
-
// again.
|
2239
|
-
action_it = actions_to_process.erase(action_it);
|
2240
|
-
continue;
|
2241
|
-
}
|
2242
|
-
}
|
2243
|
-
++action_it;
|
2244
|
-
}
|
2245
|
-
// Second pass of all remaining unique WeightedCluster actions: if clusters
|
2246
|
-
// for a new action are the same as an old unused action, reuse the name. If
|
2247
|
-
// clusters differ, use a brand new name.
|
2248
|
-
for (const auto& action : actions_to_process) {
|
2249
|
-
const std::string& cluster_names_key = action.second;
|
2250
|
-
const std::string& cluster_weights_key = action.first;
|
2251
|
-
auto& new_cluster_names_info =
|
2252
|
-
new_weighted_cluster_index_map[cluster_names_key];
|
2253
|
-
auto& old_cluster_weights_map =
|
2254
|
-
weighted_cluster_index_map_[cluster_names_key].cluster_weights_map;
|
2255
|
-
auto old_cluster_weights_it = old_cluster_weights_map.begin();
|
2256
|
-
if (old_cluster_weights_it != old_cluster_weights_map.end()) {
|
2257
|
-
// There is something to reuse: this action uses the same set
|
2258
|
-
// of clusters as a previous action and that action name is not
|
2259
|
-
// already taken.
|
2260
|
-
new_cluster_names_info.cluster_weights_map[cluster_weights_key] =
|
2261
|
-
old_cluster_weights_it->second;
|
2262
|
-
// Remove the name from being able to reuse again.
|
2263
|
-
old_cluster_weights_map.erase(old_cluster_weights_it);
|
2264
|
-
} else {
|
2265
|
-
// There is nothing to reuse, take the next index to use and
|
2266
|
-
// increment.
|
2267
|
-
new_cluster_names_info.cluster_weights_map[cluster_weights_key] =
|
2268
|
-
new_cluster_names_info.next_index++;
|
2269
|
-
}
|
2270
|
-
}
|
2271
|
-
weighted_cluster_index_map_ = std::move(new_weighted_cluster_index_map);
|
2272
|
-
}
|
2273
|
-
|
2274
|
-
grpc_error* XdsClient::CreateServiceConfig(
|
2275
|
-
const XdsApi::RdsUpdate& rds_update,
|
2276
|
-
RefCountedPtr<ServiceConfig>* service_config) {
|
2277
|
-
UpdateWeightedClusterIndexMap(rds_update);
|
2278
|
-
std::vector<std::string> actions_vector;
|
2279
|
-
std::vector<std::string> route_table;
|
2280
|
-
std::set<std::string> actions_set;
|
2281
|
-
for (const auto& route : rds_update.routes) {
|
2282
|
-
const std::string action_name =
|
2283
|
-
route.weighted_clusters.empty()
|
2284
|
-
? route.cluster_name
|
2285
|
-
: WeightedClustersActionName(route.weighted_clusters);
|
2286
|
-
if (actions_set.find(action_name) == actions_set.end()) {
|
2287
|
-
actions_set.emplace(action_name);
|
2288
|
-
actions_vector.push_back(
|
2289
|
-
route.weighted_clusters.empty()
|
2290
|
-
? CreateServiceConfigActionCluster(action_name)
|
2291
|
-
: CreateServiceConfigActionWeightedCluster(
|
2292
|
-
action_name, route.weighted_clusters));
|
2293
|
-
}
|
2294
|
-
route_table.push_back(CreateServiceConfigRoute(
|
2295
|
-
absl::StrFormat("%s:%s",
|
2296
|
-
route.weighted_clusters.empty() ? "cds" : "weighted",
|
2297
|
-
action_name),
|
2298
|
-
route));
|
2299
|
-
}
|
2300
|
-
std::vector<std::string> config_parts;
|
2301
|
-
config_parts.push_back(
|
2302
|
-
"{\n"
|
2303
|
-
" \"loadBalancingConfig\":[\n"
|
2304
|
-
" { \"xds_routing_experimental\":{\n"
|
2305
|
-
" \"actions\":{\n");
|
2306
|
-
config_parts.push_back(absl::StrJoin(actions_vector, ",\n"));
|
2307
|
-
config_parts.push_back(
|
2308
|
-
" },\n"
|
2309
|
-
" \"routes\":[\n");
|
2310
|
-
config_parts.push_back(absl::StrJoin(route_table, ",\n"));
|
2311
|
-
config_parts.push_back(
|
2312
|
-
" ]\n"
|
2313
|
-
" } }\n"
|
2314
|
-
" ]\n"
|
2315
|
-
"}");
|
2316
|
-
std::string json = absl::StrJoin(config_parts, "");
|
2317
|
-
grpc_error* error = GRPC_ERROR_NONE;
|
2318
|
-
*service_config = ServiceConfig::Create(json.c_str(), &error);
|
2319
|
-
return error;
|
2320
|
-
}
|
2321
|
-
|
2322
1990
|
XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshot(
|
2323
1991
|
bool send_all_clusters, const std::set<std::string>& clusters) {
|
2324
1992
|
XdsApi::ClusterLoadReportMap snapshot_map;
|
@@ -2388,8 +2056,8 @@ XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshot(
|
|
2388
2056
|
}
|
2389
2057
|
|
2390
2058
|
void XdsClient::NotifyOnError(grpc_error* error) {
|
2391
|
-
if (
|
2392
|
-
|
2059
|
+
if (listener_watcher_ != nullptr) {
|
2060
|
+
listener_watcher_->OnError(GRPC_ERROR_REF(error));
|
2393
2061
|
}
|
2394
2062
|
for (const auto& p : cluster_map_) {
|
2395
2063
|
const ClusterState& cluster_state = p.second;
|