grpc 1.28.0 → 1.31.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +8314 -11869
- data/include/grpc/grpc.h +2 -2
- data/include/grpc/grpc_security.h +30 -9
- data/include/grpc/grpc_security_constants.h +4 -0
- data/include/grpc/impl/codegen/grpc_types.h +23 -23
- data/include/grpc/impl/codegen/port_platform.h +6 -34
- data/include/grpc/module.modulemap +24 -39
- data/src/core/ext/filters/client_channel/backend_metric.cc +18 -12
- data/src/core/ext/filters/client_channel/client_channel.cc +591 -479
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +3 -2
- data/src/core/ext/filters/client_channel/config_selector.cc +62 -0
- data/src/core/ext/filters/client_channel/config_selector.h +93 -0
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +24 -2
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +9 -22
- data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +6 -5
- data/src/core/ext/filters/client_channel/http_proxy.cc +23 -14
- data/src/core/ext/filters/client_channel/lb_policy.cc +19 -18
- data/src/core/ext/filters/client_channel/lb_policy.h +44 -33
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +83 -0
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +99 -0
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +10 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +279 -324
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +89 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +40 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +11 -9
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +3 -2
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +871 -0
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +9 -17
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +733 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +84 -37
- data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +938 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/lrs.cc +528 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +1 -2
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +1143 -0
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +10 -7
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +2 -1
- data/src/core/ext/filters/client_channel/parse_address.cc +22 -21
- data/src/core/ext/filters/client_channel/resolver.cc +5 -8
- data/src/core/ext/filters/client_channel/resolver.h +12 -14
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +78 -61
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +41 -40
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +8 -7
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +22 -24
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +12 -10
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +79 -122
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +199 -163
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +5 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +7 -4
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +46 -45
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +93 -102
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +0 -4
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +38 -8
- data/src/core/ext/filters/client_channel/resolver_factory.h +2 -2
- data/src/core/ext/filters/client_channel/resolver_registry.cc +19 -17
- data/src/core/ext/filters/client_channel/resolver_registry.h +8 -8
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +21 -22
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +19 -16
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +49 -55
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +43 -23
- data/src/core/ext/filters/client_channel/server_address.cc +6 -9
- data/src/core/ext/filters/client_channel/server_address.h +6 -12
- data/src/core/ext/filters/client_channel/service_config.cc +104 -144
- data/src/core/ext/filters/client_channel/service_config.h +28 -98
- data/src/core/ext/filters/client_channel/service_config_call_data.h +68 -0
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +142 -0
- data/src/core/ext/filters/client_channel/service_config_parser.cc +87 -0
- data/src/core/ext/filters/client_channel/service_config_parser.h +89 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +55 -25
- data/src/core/ext/filters/client_channel/subchannel.h +35 -11
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +565 -234
- data/src/core/ext/filters/client_channel/xds/xds_api.h +102 -37
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +55 -71
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +4 -3
- data/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +4 -2
- data/src/core/ext/filters/client_channel/xds/xds_client.cc +619 -347
- data/src/core/ext/filters/client_channel/xds/xds_client.h +57 -22
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.cc +11 -12
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +40 -28
- data/src/core/ext/filters/http/client/http_client_filter.cc +28 -33
- data/src/core/ext/filters/http/client_authority_filter.cc +4 -4
- data/src/core/ext/filters/http/http_filters_plugin.cc +28 -12
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +258 -221
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +399 -0
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.h +31 -0
- data/src/core/ext/filters/message_size/message_size_filter.cc +61 -88
- data/src/core/ext/filters/message_size/message_size_filter.h +10 -4
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +386 -350
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +6 -2
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +1 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +7 -13
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +7 -8
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +4 -6
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +42 -26
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +25 -30
- data/src/core/ext/transport/chttp2/transport/flow_control.h +14 -16
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +9 -12
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +4 -6
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -6
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +12 -13
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +6 -7
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -3
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +9 -12
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +29 -16
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +25 -29
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +13 -17
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +2 -2
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +4 -5
- data/src/core/ext/transport/chttp2/transport/huffsyms.h +2 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +27 -21
- data/src/core/ext/transport/chttp2/transport/parsing.cc +33 -43
- data/src/core/ext/transport/chttp2/transport/stream_map.h +2 -3
- data/src/core/ext/transport/chttp2/transport/writing.cc +24 -22
- data/src/core/ext/transport/inproc/inproc_transport.cc +54 -15
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +3 -4
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +4 -229
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +5 -876
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.c +114 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +429 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.c +72 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +198 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.c +105 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +388 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +23 -10
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +352 -310
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +42 -34
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +7 -7
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +79 -61
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +2 -1
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +55 -49
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +79 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +48 -27
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +258 -214
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +51 -45
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +71 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +2 -1
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +107 -100
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +24 -20
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +157 -122
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +9 -9
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +38 -18
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +173 -73
- data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +88 -0
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +2 -1
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +95 -101
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +2 -1
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +49 -65
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +9 -6
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +53 -38
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +70 -62
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +15 -10
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +95 -63
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +3 -2
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +91 -80
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +9 -10
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +36 -31
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +68 -46
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +770 -722
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +16 -15
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +2 -1
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +95 -88
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +48 -28
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +305 -210
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +5 -5
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.c +51 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +125 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +4 -2
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +22 -16
- data/src/core/ext/upb-generated/envoy/type/http.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/http.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +16 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +48 -11
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +14 -14
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +23 -23
- data/src/core/ext/upb-generated/envoy/type/percent.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/percent.upb.h +8 -9
- data/src/core/ext/upb-generated/envoy/type/range.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/range.upb.h +15 -16
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +7 -8
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +36 -35
- data/src/core/ext/upb-generated/gogoproto/gogo.upb.h +0 -1
- data/src/core/ext/upb-generated/google/api/annotations.upb.h +0 -1
- data/src/core/ext/upb-generated/google/api/http.upb.h +29 -28
- data/src/core/ext/upb-generated/google/protobuf/any.upb.h +5 -6
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +12 -11
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +421 -389
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +5 -6
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +1 -2
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +33 -54
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +5 -6
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +27 -28
- data/src/core/ext/upb-generated/google/rpc/status.upb.h +8 -8
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +1 -1
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +32 -45
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +4 -4
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +157 -178
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +14 -13
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +6 -7
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +59 -56
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +11 -12
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +0 -1
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +28 -0
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +64 -0
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +6 -6
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +41 -68
- data/src/core/ext/upb-generated/validate/validate.upb.c +21 -20
- data/src/core/ext/upb-generated/validate/validate.upb.h +569 -562
- data/src/core/lib/channel/channel_args.cc +15 -14
- data/src/core/lib/channel/channel_args.h +3 -1
- data/src/core/lib/channel/channel_stack.h +20 -13
- data/src/core/lib/channel/channel_trace.cc +2 -6
- data/src/core/lib/channel/channelz.cc +10 -21
- data/src/core/lib/channel/channelz.h +3 -2
- data/src/core/lib/channel/channelz_registry.cc +5 -3
- data/src/core/lib/channel/connected_channel.cc +7 -5
- data/src/core/lib/channel/context.h +1 -1
- data/src/core/lib/channel/handshaker.cc +11 -13
- data/src/core/lib/channel/handshaker.h +4 -2
- data/src/core/lib/channel/handshaker_registry.cc +5 -17
- data/src/core/lib/channel/status_util.cc +2 -3
- data/src/core/lib/compression/message_compress.cc +5 -1
- data/src/core/lib/debug/stats.cc +21 -27
- data/src/core/lib/debug/stats.h +3 -1
- data/src/core/lib/gpr/log_linux.cc +6 -8
- data/src/core/lib/gpr/log_posix.cc +6 -8
- data/src/core/lib/gpr/spinlock.h +2 -3
- data/src/core/lib/gpr/string.cc +10 -33
- data/src/core/lib/gpr/string.h +4 -18
- data/src/core/lib/gpr/sync_abseil.cc +2 -0
- data/src/core/lib/gpr/time.cc +4 -0
- data/src/core/lib/gpr/time_posix.cc +1 -1
- data/src/core/lib/gprpp/atomic.h +6 -6
- data/src/core/lib/gprpp/fork.cc +1 -1
- data/src/core/lib/gprpp/global_config_env.cc +8 -6
- data/src/core/lib/gprpp/host_port.cc +29 -35
- data/src/core/lib/gprpp/host_port.h +14 -17
- data/src/core/lib/gprpp/map.h +5 -11
- data/src/core/lib/gprpp/ref_counted_ptr.h +5 -0
- data/src/core/lib/http/format_request.cc +46 -65
- data/src/core/lib/http/httpcli.cc +15 -13
- data/src/core/lib/http/httpcli.h +2 -3
- data/src/core/lib/http/httpcli_security_connector.cc +10 -10
- data/src/core/lib/http/parser.h +2 -3
- data/src/core/lib/iomgr/buffer_list.h +22 -21
- data/src/core/lib/iomgr/call_combiner.h +3 -2
- data/src/core/lib/iomgr/cfstream_handle.cc +4 -2
- data/src/core/lib/iomgr/closure.h +2 -3
- data/src/core/lib/iomgr/dualstack_socket_posix.cc +47 -0
- data/src/core/lib/iomgr/endpoint_cfstream.cc +2 -3
- data/src/core/lib/iomgr/endpoint_pair.h +2 -3
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +10 -10
- data/src/core/lib/iomgr/error.cc +6 -9
- data/src/core/lib/iomgr/error.h +0 -1
- data/src/core/lib/iomgr/error_cfstream.cc +9 -8
- data/src/core/lib/iomgr/ev_apple.cc +356 -0
- data/src/core/lib/iomgr/ev_apple.h +43 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +25 -29
- data/src/core/lib/iomgr/ev_epollex_linux.cc +17 -24
- data/src/core/lib/iomgr/ev_poll_posix.cc +9 -8
- data/src/core/lib/iomgr/ev_posix.cc +4 -3
- data/src/core/lib/iomgr/exec_ctx.h +14 -2
- data/src/core/lib/iomgr/iomgr.cc +10 -0
- data/src/core/lib/iomgr/iomgr.h +10 -0
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +84 -20
- data/src/core/lib/iomgr/is_epollexclusive_available.cc +14 -0
- data/src/core/lib/iomgr/pollset_set_custom.cc +10 -10
- data/src/core/lib/{gprpp/optional.h → iomgr/pollset_uv.h} +11 -12
- data/src/core/lib/iomgr/port.h +2 -21
- data/src/core/lib/iomgr/python_util.h +46 -0
- data/src/core/lib/iomgr/resolve_address.h +4 -6
- data/src/core/lib/iomgr/resolve_address_custom.cc +42 -57
- data/src/core/lib/iomgr/resolve_address_custom.h +4 -2
- data/src/core/lib/iomgr/resolve_address_posix.cc +10 -11
- data/src/core/lib/iomgr/resolve_address_windows.cc +16 -25
- data/src/core/lib/iomgr/resource_quota.cc +38 -37
- data/src/core/lib/iomgr/sockaddr_utils.cc +29 -33
- data/src/core/lib/iomgr/sockaddr_utils.h +10 -15
- data/src/core/lib/iomgr/socket_factory_posix.h +2 -3
- data/src/core/lib/iomgr/socket_mutator.h +2 -3
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +102 -81
- data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
- data/src/core/lib/iomgr/socket_windows.cc +4 -5
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +14 -18
- data/src/core/lib/iomgr/tcp_client_custom.cc +6 -9
- data/src/core/lib/iomgr/tcp_client_posix.cc +30 -36
- data/src/core/lib/iomgr/tcp_client_windows.cc +10 -11
- data/src/core/lib/iomgr/tcp_custom.cc +3 -4
- data/src/core/lib/iomgr/tcp_custom.h +1 -1
- data/src/core/lib/iomgr/tcp_server.cc +3 -4
- data/src/core/lib/iomgr/tcp_server.h +7 -5
- data/src/core/lib/iomgr/tcp_server_custom.cc +11 -23
- data/src/core/lib/iomgr/tcp_server_posix.cc +38 -44
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -4
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +7 -8
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +10 -18
- data/src/core/lib/iomgr/tcp_server_windows.cc +16 -16
- data/src/core/lib/iomgr/tcp_uv.cc +3 -2
- data/src/core/lib/iomgr/time_averaged_stats.h +2 -3
- data/src/core/lib/iomgr/timer_generic.cc +15 -15
- data/src/core/lib/{gprpp/inlined_vector.h → iomgr/timer_generic.h} +19 -17
- data/src/core/lib/iomgr/timer_heap.h +2 -3
- data/src/core/lib/iomgr/udp_server.cc +32 -36
- data/src/core/lib/iomgr/udp_server.h +5 -2
- data/src/core/lib/iomgr/unix_sockets_posix.cc +9 -14
- data/src/core/lib/iomgr/unix_sockets_posix.h +3 -1
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +5 -2
- data/src/core/lib/json/json.h +3 -2
- data/src/core/lib/json/json_reader.cc +25 -26
- data/src/core/lib/json/json_writer.cc +13 -12
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +12 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.h +6 -3
- data/src/core/lib/security/credentials/credentials.cc +0 -84
- data/src/core/lib/security/credentials/credentials.h +13 -62
- data/src/core/lib/security/credentials/fake/fake_credentials.h +4 -0
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +8 -6
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +15 -17
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +8 -6
- data/src/core/lib/security/credentials/iam/iam_credentials.h +4 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
- data/src/core/lib/security/credentials/jwt/json_token.h +2 -5
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +7 -4
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +12 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +8 -15
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -3
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +73 -54
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +9 -3
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +19 -6
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +20 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +10 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +23 -13
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +48 -11
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +21 -6
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +17 -17
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +3 -2
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +1 -1
- data/src/core/lib/security/security_connector/security_connector.cc +2 -0
- data/src/core/lib/security/security_connector/security_connector.h +2 -2
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +38 -36
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +8 -5
- data/src/core/lib/security/security_connector/ssl_utils.cc +89 -21
- data/src/core/lib/security/security_connector/ssl_utils.h +18 -12
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +101 -72
- data/src/core/lib/security/security_connector/tls/tls_security_connector.h +27 -5
- data/src/core/lib/security/transport/auth_filters.h +0 -5
- data/src/core/lib/security/transport/client_auth_filter.cc +11 -11
- data/src/core/lib/security/util/json_util.cc +12 -13
- data/src/core/lib/slice/slice.cc +38 -1
- data/src/core/lib/slice/slice_intern.cc +2 -3
- data/src/core/lib/slice/slice_internal.h +15 -0
- data/src/core/lib/slice/slice_utils.h +9 -0
- data/src/core/lib/surface/byte_buffer_reader.cc +2 -47
- data/src/core/lib/surface/call.cc +42 -44
- data/src/core/lib/surface/call_log_batch.cc +50 -58
- data/src/core/lib/surface/channel.cc +53 -31
- data/src/core/lib/surface/channel.h +35 -4
- data/src/core/lib/surface/channel_ping.cc +2 -3
- data/src/core/lib/surface/completion_queue.cc +304 -47
- data/src/core/lib/surface/completion_queue.h +8 -0
- data/src/core/lib/surface/event_string.cc +18 -25
- data/src/core/lib/surface/event_string.h +3 -1
- data/src/core/lib/surface/init.cc +2 -0
- data/src/core/lib/surface/init_secure.cc +1 -4
- data/src/core/lib/surface/server.cc +971 -837
- data/src/core/lib/surface/server.h +66 -12
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/byte_stream.h +7 -2
- data/src/core/lib/transport/connectivity_state.cc +7 -6
- data/src/core/lib/transport/connectivity_state.h +5 -3
- data/src/core/lib/transport/metadata.cc +3 -3
- data/src/core/lib/transport/metadata_batch.h +2 -3
- data/src/core/lib/transport/static_metadata.h +1 -1
- data/src/core/lib/transport/status_conversion.cc +6 -14
- data/src/core/lib/transport/transport.cc +2 -3
- data/src/core/lib/transport/transport.h +9 -2
- data/src/core/lib/transport/transport_op_string.cc +61 -102
- data/src/core/lib/uri/uri_parser.cc +8 -15
- data/src/core/lib/uri/uri_parser.h +2 -3
- data/src/core/plugin_registry/grpc_plugin_registry.cc +24 -4
- data/src/core/tsi/alts/crypt/aes_gcm.cc +0 -2
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +31 -14
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +8 -4
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +34 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +9 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +2 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h +2 -3
- data/src/core/tsi/fake_transport_security.cc +10 -15
- data/src/core/tsi/ssl/session_cache/ssl_session.h +0 -2
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +0 -2
- data/src/core/tsi/ssl_transport_security.cc +154 -50
- data/src/core/tsi/ssl_transport_security.h +22 -10
- data/src/core/tsi/ssl_types.h +0 -2
- data/src/core/tsi/transport_security.h +6 -9
- data/src/core/tsi/transport_security_grpc.h +2 -3
- data/src/core/tsi/transport_security_interface.h +8 -3
- data/src/ruby/ext/grpc/extconf.rb +5 -2
- data/src/ruby/ext/grpc/rb_call.c +12 -3
- data/src/ruby/ext/grpc/rb_call.h +4 -0
- data/src/ruby/ext/grpc/rb_call_credentials.c +57 -12
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
- data/src/ruby/lib/grpc/errors.rb +103 -42
- data/src/ruby/lib/grpc/generic/active_call.rb +2 -3
- data/src/ruby/lib/grpc/generic/interceptors.rb +5 -5
- data/src/ruby/lib/grpc/generic/rpc_server.rb +9 -10
- data/src/ruby/lib/grpc/generic/service.rb +5 -4
- data/src/ruby/lib/grpc/structs.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/generate_proto_ruby.sh +5 -3
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +11 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +16 -0
- data/src/ruby/spec/debug_message_spec.rb +134 -0
- data/src/ruby/spec/generic/service_spec.rb +2 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import2.proto +23 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +7 -0
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +7 -1
- data/src/ruby/spec/support/services.rb +10 -4
- data/src/ruby/spec/testdata/ca.pem +18 -13
- data/src/ruby/spec/testdata/client.key +26 -14
- data/src/ruby/spec/testdata/client.pem +18 -12
- data/src/ruby/spec/testdata/server1.key +26 -14
- data/src/ruby/spec/testdata/server1.pem +20 -14
- data/third_party/abseil-cpp/absl/time/civil_time.cc +175 -0
- data/third_party/abseil-cpp/absl/time/civil_time.h +538 -0
- data/third_party/abseil-cpp/absl/time/clock.cc +569 -0
- data/third_party/abseil-cpp/absl/time/clock.h +74 -0
- data/third_party/abseil-cpp/absl/time/duration.cc +922 -0
- data/third_party/abseil-cpp/absl/time/format.cc +153 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time.h +332 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +622 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +384 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/zone_info_source.h +102 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/civil_time_detail.cc +94 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc +140 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.h +52 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +922 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc +45 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h +76 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc +121 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h +93 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +958 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h +138 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +308 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h +55 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +187 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.cc +159 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.h +132 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +122 -0
- data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +115 -0
- data/third_party/abseil-cpp/absl/time/internal/get_current_time_chrono.inc +31 -0
- data/third_party/abseil-cpp/absl/time/internal/get_current_time_posix.inc +24 -0
- data/third_party/abseil-cpp/absl/time/time.cc +499 -0
- data/third_party/abseil-cpp/absl/time/time.h +1584 -0
- data/third_party/boringssl-with-bazel/err_data.c +335 -297
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bitstr.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_enum.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_int.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_type.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn_pack.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_enum.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_int.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_string.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/derive_key.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/tls_cbc.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu-arm-linux.c +7 -5
- data/third_party/boringssl-with-bazel/src/crypto/cpu-intel.c +13 -4
- data/third_party/boringssl-with-bazel/src/crypto/crypto.c +11 -0
- data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/curve25519.c +18 -26
- data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/curve25519_tables.h +13 -21
- data/third_party/boringssl-with-bazel/src/{third_party/fiat → crypto/curve25519}/internal.h +14 -22
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/spake25519.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/dh/dh.c +15 -0
- data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +10 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +385 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +56 -0
- data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/ecdh_extra.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/err/err.c +33 -32
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +143 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes_nohw.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/mode_wrappers.c +17 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/exponentiation.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +25 -12
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.c +8 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/mul.c +30 -154
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digests.c +16 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +289 -117
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +13 -27
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +96 -55
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/felem.c +25 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +434 -161
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +63 -71
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +18 -25
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64-table.h +9481 -9485
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64.c +104 -122
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +740 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +297 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +90 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +125 -148
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +189 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/util.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +61 -18
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +20 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +137 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.h +49 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/getrandom_fillin.h +64 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +41 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +32 -17
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +24 -114
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/blinding.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +51 -38
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +15 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +62 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +44 -35
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +47 -16
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +15 -1
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +7 -0
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +36 -5
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +6 -10
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +16 -0
- data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/thread_win.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +249 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +1227 -0
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +682 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/a_strex.c +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/algorithm.c +8 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.c +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509.c +0 -67
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +13 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +10 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +57 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +4 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +33 -9
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +25 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +4 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +35 -13
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +0 -154
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +28 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +74 -35
- data/third_party/boringssl-with-bazel/src/include/openssl/aes.h +16 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +22 -22
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +6 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +9 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +20 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +1 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +16 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +6 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/err.h +2 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +69 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +5 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +3 -17
- data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +31 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/sha.h +26 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +191 -79
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +1 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +282 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +791 -715
- data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +1 -0
- data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +0 -4
- data/third_party/boringssl-with-bazel/src/ssl/d1_lib.cc +3 -3
- data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +13 -4
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +146 -57
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +23 -5
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +30 -22
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +21 -4
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +74 -54
- data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +10 -10
- data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +21 -21
- data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +29 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +4 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +34 -1
- data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +13 -2
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +44 -5
- data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +6 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +5 -5
- data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +51 -26
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +47 -53
- data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +1 -1
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +129 -48
- data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +23 -75
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +55 -22
- data/third_party/boringssl-with-bazel/src/ssl/tls_method.cc +63 -25
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_32.h +245 -175
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64.h +135 -75
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_32.h +1593 -1672
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64.h +512 -503
- data/third_party/re2/re2/bitmap256.h +117 -0
- data/third_party/re2/re2/bitstate.cc +385 -0
- data/third_party/re2/re2/compile.cc +1279 -0
- data/third_party/re2/re2/dfa.cc +2130 -0
- data/third_party/re2/re2/filtered_re2.cc +121 -0
- data/third_party/re2/re2/filtered_re2.h +109 -0
- data/third_party/re2/re2/mimics_pcre.cc +197 -0
- data/third_party/re2/re2/nfa.cc +713 -0
- data/third_party/re2/re2/onepass.cc +623 -0
- data/third_party/re2/re2/parse.cc +2464 -0
- data/third_party/re2/re2/perl_groups.cc +119 -0
- data/third_party/re2/re2/pod_array.h +55 -0
- data/third_party/re2/re2/prefilter.cc +710 -0
- data/third_party/re2/re2/prefilter.h +108 -0
- data/third_party/re2/re2/prefilter_tree.cc +407 -0
- data/third_party/re2/re2/prefilter_tree.h +139 -0
- data/third_party/re2/re2/prog.cc +988 -0
- data/third_party/re2/re2/prog.h +436 -0
- data/third_party/re2/re2/re2.cc +1362 -0
- data/third_party/re2/re2/re2.h +1002 -0
- data/third_party/re2/re2/regexp.cc +980 -0
- data/third_party/re2/re2/regexp.h +659 -0
- data/third_party/re2/re2/set.cc +154 -0
- data/third_party/re2/re2/set.h +80 -0
- data/third_party/re2/re2/simplify.cc +657 -0
- data/third_party/re2/re2/sparse_array.h +392 -0
- data/third_party/re2/re2/sparse_set.h +264 -0
- data/third_party/re2/re2/stringpiece.cc +65 -0
- data/third_party/re2/re2/stringpiece.h +210 -0
- data/third_party/re2/re2/tostring.cc +351 -0
- data/third_party/re2/re2/unicode_casefold.cc +582 -0
- data/third_party/re2/re2/unicode_casefold.h +78 -0
- data/third_party/re2/re2/unicode_groups.cc +6269 -0
- data/third_party/re2/re2/unicode_groups.h +67 -0
- data/third_party/re2/re2/walker-inl.h +246 -0
- data/third_party/re2/util/benchmark.h +156 -0
- data/third_party/re2/util/flags.h +26 -0
- data/third_party/re2/util/logging.h +109 -0
- data/third_party/re2/util/malloc_counter.h +19 -0
- data/third_party/re2/util/mix.h +41 -0
- data/third_party/re2/util/mutex.h +148 -0
- data/third_party/re2/util/pcre.cc +1025 -0
- data/third_party/re2/util/pcre.h +681 -0
- data/third_party/re2/util/rune.cc +260 -0
- data/third_party/re2/util/strutil.cc +149 -0
- data/third_party/re2/util/strutil.h +21 -0
- data/third_party/re2/util/test.h +50 -0
- data/third_party/re2/util/utf.h +44 -0
- data/third_party/re2/util/util.h +42 -0
- data/third_party/upb/upb/decode.c +467 -504
- data/third_party/upb/upb/encode.c +163 -121
- data/third_party/upb/upb/msg.c +130 -64
- data/third_party/upb/upb/msg.h +418 -14
- data/third_party/upb/upb/port_def.inc +35 -6
- data/third_party/upb/upb/port_undef.inc +8 -1
- data/third_party/upb/upb/table.c +53 -75
- data/third_party/upb/upb/table.int.h +11 -43
- data/third_party/upb/upb/upb.c +148 -124
- data/third_party/upb/upb/upb.h +65 -147
- data/third_party/upb/upb/upb.hpp +86 -0
- metadata +175 -47
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +0 -1754
- data/src/core/lib/gprpp/string_view.h +0 -60
- data/src/core/tsi/grpc_shadow_boringssl.h +0 -3311
- data/third_party/boringssl-with-bazel/src/third_party/fiat/p256.c +0 -1063
- data/third_party/upb/upb/generated_util.h +0 -105
@@ -0,0 +1,89 @@
|
|
1
|
+
//
|
2
|
+
// Copyright 2016 gRPC authors.
|
3
|
+
//
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
// you may not use this file except in compliance with the License.
|
6
|
+
// You may obtain a copy of the License at
|
7
|
+
//
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
//
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
// See the License for the specific language governing permissions and
|
14
|
+
// limitations under the License.
|
15
|
+
//
|
16
|
+
|
17
|
+
#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_SERVICE_CONFIG_PARSER_H
|
18
|
+
#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_SERVICE_CONFIG_PARSER_H
|
19
|
+
|
20
|
+
#include <grpc/support/port_platform.h>
|
21
|
+
|
22
|
+
#include <memory>
|
23
|
+
|
24
|
+
#include "absl/container/inlined_vector.h"
|
25
|
+
|
26
|
+
#include "src/core/lib/iomgr/error.h"
|
27
|
+
#include "src/core/lib/json/json.h"
|
28
|
+
|
29
|
+
namespace grpc_core {
|
30
|
+
|
31
|
+
// Service config parser registry.
|
32
|
+
// See service_config.h for more information.
|
33
|
+
class ServiceConfigParser {
|
34
|
+
public:
|
35
|
+
/// This is the base class that all service config parsers MUST use to store
|
36
|
+
/// parsed service config data.
|
37
|
+
class ParsedConfig {
|
38
|
+
public:
|
39
|
+
virtual ~ParsedConfig() = default;
|
40
|
+
};
|
41
|
+
|
42
|
+
/// This is the base class that all service config parsers should derive from.
|
43
|
+
class Parser {
|
44
|
+
public:
|
45
|
+
virtual ~Parser() = default;
|
46
|
+
|
47
|
+
virtual std::unique_ptr<ParsedConfig> ParseGlobalParams(
|
48
|
+
const Json& /* json */, grpc_error** error) {
|
49
|
+
// Avoid unused parameter warning on debug-only parameter
|
50
|
+
(void)error;
|
51
|
+
GPR_DEBUG_ASSERT(error != nullptr);
|
52
|
+
return nullptr;
|
53
|
+
}
|
54
|
+
|
55
|
+
virtual std::unique_ptr<ParsedConfig> ParsePerMethodParams(
|
56
|
+
const Json& /* json */, grpc_error** error) {
|
57
|
+
// Avoid unused parameter warning on debug-only parameter
|
58
|
+
(void)error;
|
59
|
+
GPR_DEBUG_ASSERT(error != nullptr);
|
60
|
+
return nullptr;
|
61
|
+
}
|
62
|
+
};
|
63
|
+
|
64
|
+
static constexpr int kNumPreallocatedParsers = 4;
|
65
|
+
typedef absl::InlinedVector<std::unique_ptr<ParsedConfig>,
|
66
|
+
kNumPreallocatedParsers>
|
67
|
+
ParsedConfigVector;
|
68
|
+
|
69
|
+
static void Init();
|
70
|
+
static void Shutdown();
|
71
|
+
|
72
|
+
/// Globally register a service config parser. On successful registration, it
|
73
|
+
/// returns the index at which the parser was registered. On failure, -1 is
|
74
|
+
/// returned. Each new service config update will go through all the
|
75
|
+
/// registered parser. Each parser is responsible for reading the service
|
76
|
+
/// config json and returning a parsed config. This parsed config can later be
|
77
|
+
/// retrieved using the same index that was returned at registration time.
|
78
|
+
static size_t RegisterParser(std::unique_ptr<Parser> parser);
|
79
|
+
|
80
|
+
static ParsedConfigVector ParseGlobalParameters(const Json& json,
|
81
|
+
grpc_error** error);
|
82
|
+
|
83
|
+
static ParsedConfigVector ParsePerMethodParameters(const Json& json,
|
84
|
+
grpc_error** error);
|
85
|
+
};
|
86
|
+
|
87
|
+
} // namespace grpc_core
|
88
|
+
|
89
|
+
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_SERVICE_CONFIG_PARSER_H */
|
@@ -362,12 +362,44 @@ class Subchannel::ConnectedSubchannelStateWatcher
|
|
362
362
|
Subchannel* subchannel_;
|
363
363
|
};
|
364
364
|
|
365
|
+
// Asynchronously notifies the \a watcher of a change in the connectvity state
|
366
|
+
// of \a subchannel to the current \a state. Deletes itself when done.
|
367
|
+
class Subchannel::AsyncWatcherNotifierLocked {
|
368
|
+
public:
|
369
|
+
AsyncWatcherNotifierLocked(
|
370
|
+
RefCountedPtr<Subchannel::ConnectivityStateWatcherInterface> watcher,
|
371
|
+
Subchannel* subchannel, grpc_connectivity_state state)
|
372
|
+
: watcher_(std::move(watcher)) {
|
373
|
+
RefCountedPtr<ConnectedSubchannel> connected_subchannel;
|
374
|
+
if (state == GRPC_CHANNEL_READY) {
|
375
|
+
connected_subchannel = subchannel->connected_subchannel_;
|
376
|
+
}
|
377
|
+
watcher_->PushConnectivityStateChange(
|
378
|
+
{state, std::move(connected_subchannel)});
|
379
|
+
ExecCtx::Run(
|
380
|
+
DEBUG_LOCATION,
|
381
|
+
GRPC_CLOSURE_INIT(&closure_,
|
382
|
+
[](void* arg, grpc_error* /*error*/) {
|
383
|
+
auto* self =
|
384
|
+
static_cast<AsyncWatcherNotifierLocked*>(arg);
|
385
|
+
self->watcher_->OnConnectivityStateChange();
|
386
|
+
delete self;
|
387
|
+
},
|
388
|
+
this, nullptr),
|
389
|
+
GRPC_ERROR_NONE);
|
390
|
+
}
|
391
|
+
|
392
|
+
private:
|
393
|
+
RefCountedPtr<Subchannel::ConnectivityStateWatcherInterface> watcher_;
|
394
|
+
grpc_closure closure_;
|
395
|
+
};
|
396
|
+
|
365
397
|
//
|
366
398
|
// Subchannel::ConnectivityStateWatcherList
|
367
399
|
//
|
368
400
|
|
369
401
|
void Subchannel::ConnectivityStateWatcherList::AddWatcherLocked(
|
370
|
-
|
402
|
+
RefCountedPtr<ConnectivityStateWatcherInterface> watcher) {
|
371
403
|
watchers_.insert(std::make_pair(watcher.get(), std::move(watcher)));
|
372
404
|
}
|
373
405
|
|
@@ -379,19 +411,7 @@ void Subchannel::ConnectivityStateWatcherList::RemoveWatcherLocked(
|
|
379
411
|
void Subchannel::ConnectivityStateWatcherList::NotifyLocked(
|
380
412
|
Subchannel* subchannel, grpc_connectivity_state state) {
|
381
413
|
for (const auto& p : watchers_) {
|
382
|
-
|
383
|
-
if (state == GRPC_CHANNEL_READY) {
|
384
|
-
connected_subchannel = subchannel->connected_subchannel_;
|
385
|
-
}
|
386
|
-
// TODO(roth): In principle, it seems wrong to send this notification
|
387
|
-
// to the watcher while holding the subchannel's mutex, since it could
|
388
|
-
// lead to a deadlock if the watcher calls back into the subchannel
|
389
|
-
// before returning back to us. In practice, this doesn't happen,
|
390
|
-
// because the LB policy code that watches subchannels always bounces
|
391
|
-
// the notification into the client_channel control-plane combiner
|
392
|
-
// before processing it. But if we ever have any other callers here,
|
393
|
-
// we will probably need to change this.
|
394
|
-
p.second->OnConnectivityStateChange(state, std::move(connected_subchannel));
|
414
|
+
new AsyncWatcherNotifierLocked(p.second, subchannel, state);
|
395
415
|
}
|
396
416
|
}
|
397
417
|
|
@@ -428,14 +448,9 @@ class Subchannel::HealthWatcherMap::HealthWatcher
|
|
428
448
|
|
429
449
|
void AddWatcherLocked(
|
430
450
|
grpc_connectivity_state initial_state,
|
431
|
-
|
451
|
+
RefCountedPtr<Subchannel::ConnectivityStateWatcherInterface> watcher) {
|
432
452
|
if (state_ != initial_state) {
|
433
|
-
|
434
|
-
if (state_ == GRPC_CHANNEL_READY) {
|
435
|
-
connected_subchannel = subchannel_->connected_subchannel_;
|
436
|
-
}
|
437
|
-
watcher->OnConnectivityStateChange(state_,
|
438
|
-
std::move(connected_subchannel));
|
453
|
+
new AsyncWatcherNotifierLocked(watcher, subchannel_, state_);
|
439
454
|
}
|
440
455
|
watcher_list_.AddWatcherLocked(std::move(watcher));
|
441
456
|
}
|
@@ -503,7 +518,7 @@ class Subchannel::HealthWatcherMap::HealthWatcher
|
|
503
518
|
void Subchannel::HealthWatcherMap::AddWatcherLocked(
|
504
519
|
Subchannel* subchannel, grpc_connectivity_state initial_state,
|
505
520
|
grpc_core::UniquePtr<char> health_check_service_name,
|
506
|
-
|
521
|
+
RefCountedPtr<ConnectivityStateWatcherInterface> watcher) {
|
507
522
|
// If the health check service name is not already present in the map,
|
508
523
|
// add it.
|
509
524
|
auto it = map_.find(health_check_service_name.get());
|
@@ -613,6 +628,21 @@ BackOff::Options ParseArgsForBackoffValues(
|
|
613
628
|
|
614
629
|
} // namespace
|
615
630
|
|
631
|
+
void Subchannel::ConnectivityStateWatcherInterface::PushConnectivityStateChange(
|
632
|
+
ConnectivityStateChange state_change) {
|
633
|
+
MutexLock lock(&mu_);
|
634
|
+
connectivity_state_queue_.push_back(std::move(state_change));
|
635
|
+
}
|
636
|
+
|
637
|
+
Subchannel::ConnectivityStateWatcherInterface::ConnectivityStateChange
|
638
|
+
Subchannel::ConnectivityStateWatcherInterface::PopConnectivityStateChange() {
|
639
|
+
MutexLock lock(&mu_);
|
640
|
+
GPR_ASSERT(!connectivity_state_queue_.empty());
|
641
|
+
ConnectivityStateChange state_change = connectivity_state_queue_.front();
|
642
|
+
connectivity_state_queue_.pop_front();
|
643
|
+
return state_change;
|
644
|
+
}
|
645
|
+
|
616
646
|
Subchannel::Subchannel(SubchannelKey* key,
|
617
647
|
OrphanablePtr<SubchannelConnector> connector,
|
618
648
|
const grpc_channel_args* args)
|
@@ -788,7 +818,7 @@ grpc_connectivity_state Subchannel::CheckConnectivityState(
|
|
788
818
|
void Subchannel::WatchConnectivityState(
|
789
819
|
grpc_connectivity_state initial_state,
|
790
820
|
grpc_core::UniquePtr<char> health_check_service_name,
|
791
|
-
|
821
|
+
RefCountedPtr<ConnectivityStateWatcherInterface> watcher) {
|
792
822
|
MutexLock lock(&mu_);
|
793
823
|
grpc_pollset_set* interested_parties = watcher->interested_parties();
|
794
824
|
if (interested_parties != nullptr) {
|
@@ -796,7 +826,7 @@ void Subchannel::WatchConnectivityState(
|
|
796
826
|
}
|
797
827
|
if (health_check_service_name == nullptr) {
|
798
828
|
if (state_ != initial_state) {
|
799
|
-
watcher
|
829
|
+
new AsyncWatcherNotifierLocked(watcher, this, state_);
|
800
830
|
}
|
801
831
|
watcher_list_.AddWatcherLocked(std::move(watcher));
|
802
832
|
} else {
|
@@ -842,7 +872,7 @@ grpc_arg Subchannel::CreateSubchannelAddressArg(
|
|
842
872
|
const grpc_resolved_address* addr) {
|
843
873
|
return grpc_channel_arg_string_create(
|
844
874
|
(char*)GRPC_ARG_SUBCHANNEL_ADDRESS,
|
845
|
-
addr->len > 0 ? grpc_sockaddr_to_uri(addr) :
|
875
|
+
gpr_strdup(addr->len > 0 ? grpc_sockaddr_to_uri(addr).c_str() : ""));
|
846
876
|
}
|
847
877
|
|
848
878
|
const char* Subchannel::GetUriFromSubchannelAddressArg(
|
@@ -21,6 +21,8 @@
|
|
21
21
|
|
22
22
|
#include <grpc/support/port_platform.h>
|
23
23
|
|
24
|
+
#include <deque>
|
25
|
+
|
24
26
|
#include "src/core/ext/filters/client_channel/client_channel_channelz.h"
|
25
27
|
#include "src/core/ext/filters/client_channel/connector.h"
|
26
28
|
#include "src/core/ext/filters/client_channel/subchannel_pool_interface.h"
|
@@ -176,24 +178,44 @@ class SubchannelCall {
|
|
176
178
|
class Subchannel {
|
177
179
|
public:
|
178
180
|
class ConnectivityStateWatcherInterface
|
179
|
-
: public
|
181
|
+
: public RefCounted<ConnectivityStateWatcherInterface> {
|
180
182
|
public:
|
183
|
+
struct ConnectivityStateChange {
|
184
|
+
grpc_connectivity_state state;
|
185
|
+
RefCountedPtr<ConnectedSubchannel> connected_subchannel;
|
186
|
+
};
|
187
|
+
|
181
188
|
virtual ~ConnectivityStateWatcherInterface() = default;
|
182
189
|
|
183
190
|
// Will be invoked whenever the subchannel's connectivity state
|
184
191
|
// changes. There will be only one invocation of this method on a
|
185
192
|
// given watcher instance at any given time.
|
186
|
-
//
|
193
|
+
// Implementations should call PopConnectivityStateChange to get the next
|
194
|
+
// connectivity state change.
|
195
|
+
virtual void OnConnectivityStateChange() = 0;
|
196
|
+
|
197
|
+
virtual grpc_pollset_set* interested_parties() = 0;
|
198
|
+
|
199
|
+
// Enqueues connectivity state change notifications.
|
187
200
|
// When the state changes to READY, connected_subchannel will
|
188
201
|
// contain a ref to the connected subchannel. When it changes from
|
189
202
|
// READY to some other state, the implementation must release its
|
190
203
|
// ref to the connected subchannel.
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
204
|
+
// TODO(yashkt): This is currently needed to send the state updates in the
|
205
|
+
// right order when asynchronously notifying. This will no longer be
|
206
|
+
// necessary when we have access to EventManager.
|
207
|
+
void PushConnectivityStateChange(ConnectivityStateChange state_change);
|
195
208
|
|
196
|
-
|
209
|
+
// Dequeues connectivity state change notifications.
|
210
|
+
ConnectivityStateChange PopConnectivityStateChange();
|
211
|
+
|
212
|
+
private:
|
213
|
+
// Keeps track of the updates that the watcher instance must be notified of.
|
214
|
+
// TODO(yashkt): This is currently needed to send the state updates in the
|
215
|
+
// right order when asynchronously notifying. This will no longer be
|
216
|
+
// necessary when we have access to EventManager.
|
217
|
+
std::deque<ConnectivityStateChange> connectivity_state_queue_;
|
218
|
+
Mutex mu_; // protects the queue
|
197
219
|
};
|
198
220
|
|
199
221
|
// The ctor and dtor are not intended to use directly.
|
@@ -243,7 +265,7 @@ class Subchannel {
|
|
243
265
|
void WatchConnectivityState(
|
244
266
|
grpc_connectivity_state initial_state,
|
245
267
|
grpc_core::UniquePtr<char> health_check_service_name,
|
246
|
-
|
268
|
+
RefCountedPtr<ConnectivityStateWatcherInterface> watcher);
|
247
269
|
|
248
270
|
// Cancels a connectivity state watch.
|
249
271
|
// If the watcher has already been destroyed, this is a no-op.
|
@@ -280,7 +302,7 @@ class Subchannel {
|
|
280
302
|
~ConnectivityStateWatcherList() { Clear(); }
|
281
303
|
|
282
304
|
void AddWatcherLocked(
|
283
|
-
|
305
|
+
RefCountedPtr<ConnectivityStateWatcherInterface> watcher);
|
284
306
|
void RemoveWatcherLocked(ConnectivityStateWatcherInterface* watcher);
|
285
307
|
|
286
308
|
// Notifies all watchers in the list about a change to state.
|
@@ -294,7 +316,7 @@ class Subchannel {
|
|
294
316
|
// TODO(roth): Once we can use C++-14 heterogeneous lookups, this can
|
295
317
|
// be a set instead of a map.
|
296
318
|
std::map<ConnectivityStateWatcherInterface*,
|
297
|
-
|
319
|
+
RefCountedPtr<ConnectivityStateWatcherInterface>>
|
298
320
|
watchers_;
|
299
321
|
};
|
300
322
|
|
@@ -312,7 +334,7 @@ class Subchannel {
|
|
312
334
|
void AddWatcherLocked(
|
313
335
|
Subchannel* subchannel, grpc_connectivity_state initial_state,
|
314
336
|
grpc_core::UniquePtr<char> health_check_service_name,
|
315
|
-
|
337
|
+
RefCountedPtr<ConnectivityStateWatcherInterface> watcher);
|
316
338
|
void RemoveWatcherLocked(const char* health_check_service_name,
|
317
339
|
ConnectivityStateWatcherInterface* watcher);
|
318
340
|
|
@@ -332,6 +354,8 @@ class Subchannel {
|
|
332
354
|
|
333
355
|
class ConnectedSubchannelStateWatcher;
|
334
356
|
|
357
|
+
class AsyncWatcherNotifierLocked;
|
358
|
+
|
335
359
|
// Sets the subchannel's connectivity state to \a state.
|
336
360
|
void SetConnectivityStateLocked(grpc_connectivity_state state);
|
337
361
|
|
@@ -23,14 +23,20 @@
|
|
23
23
|
#include <cstdlib>
|
24
24
|
|
25
25
|
#include "absl/strings/str_cat.h"
|
26
|
+
#include "absl/strings/str_format.h"
|
26
27
|
#include "absl/strings/str_join.h"
|
28
|
+
#include "absl/strings/str_split.h"
|
29
|
+
|
30
|
+
#include "upb/upb.hpp"
|
27
31
|
|
28
32
|
#include <grpc/impl/codegen/log.h>
|
29
33
|
#include <grpc/support/alloc.h>
|
30
34
|
#include <grpc/support/string_util.h>
|
31
35
|
|
32
36
|
#include "src/core/ext/filters/client_channel/xds/xds_api.h"
|
33
|
-
#include "src/core/lib/
|
37
|
+
#include "src/core/lib/gpr/env.h"
|
38
|
+
#include "src/core/lib/gpr/string.h"
|
39
|
+
#include "src/core/lib/gpr/useful.h"
|
34
40
|
#include "src/core/lib/iomgr/error.h"
|
35
41
|
#include "src/core/lib/iomgr/sockaddr_utils.h"
|
36
42
|
|
@@ -49,7 +55,9 @@
|
|
49
55
|
#include "envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h"
|
50
56
|
#include "envoy/config/listener/v2/api_listener.upb.h"
|
51
57
|
#include "envoy/service/load_stats/v2/lrs.upb.h"
|
58
|
+
#include "envoy/type/matcher/regex.upb.h"
|
52
59
|
#include "envoy/type/percent.upb.h"
|
60
|
+
#include "envoy/type/range.upb.h"
|
53
61
|
#include "google/protobuf/any.upb.h"
|
54
62
|
#include "google/protobuf/duration.upb.h"
|
55
63
|
#include "google/protobuf/struct.upb.h"
|
@@ -126,6 +134,94 @@ const char* XdsApi::kCdsTypeUrl = "type.googleapis.com/envoy.api.v2.Cluster";
|
|
126
134
|
const char* XdsApi::kEdsTypeUrl =
|
127
135
|
"type.googleapis.com/envoy.api.v2.ClusterLoadAssignment";
|
128
136
|
|
137
|
+
std::string XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::ToString()
|
138
|
+
const {
|
139
|
+
std::string path_type_string;
|
140
|
+
switch (type) {
|
141
|
+
case PathMatcherType::PATH:
|
142
|
+
path_type_string = "path match";
|
143
|
+
break;
|
144
|
+
case PathMatcherType::PREFIX:
|
145
|
+
path_type_string = "prefix match";
|
146
|
+
break;
|
147
|
+
case PathMatcherType::REGEX:
|
148
|
+
path_type_string = "regex match";
|
149
|
+
break;
|
150
|
+
default:
|
151
|
+
break;
|
152
|
+
}
|
153
|
+
return absl::StrFormat("Path %s:/%s/", path_type_string,
|
154
|
+
type == PathMatcherType::REGEX
|
155
|
+
? regex_matcher->pattern()
|
156
|
+
: string_matcher);
|
157
|
+
}
|
158
|
+
|
159
|
+
std::string XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::ToString()
|
160
|
+
const {
|
161
|
+
switch (type) {
|
162
|
+
case HeaderMatcherType::EXACT:
|
163
|
+
return absl::StrFormat("Header exact match:%s %s:%s",
|
164
|
+
invert_match ? " not" : "", name, string_matcher);
|
165
|
+
case HeaderMatcherType::REGEX:
|
166
|
+
return absl::StrFormat("Header regex match:%s %s:%s",
|
167
|
+
invert_match ? " not" : "", name,
|
168
|
+
regex_match->pattern());
|
169
|
+
case HeaderMatcherType::RANGE:
|
170
|
+
return absl::StrFormat("Header range match:%s %s:[%d, %d)",
|
171
|
+
invert_match ? " not" : "", name, range_start,
|
172
|
+
range_end);
|
173
|
+
case HeaderMatcherType::PRESENT:
|
174
|
+
return absl::StrFormat("Header present match:%s %s:%s",
|
175
|
+
invert_match ? " not" : "", name,
|
176
|
+
present_match ? "true" : "false");
|
177
|
+
case HeaderMatcherType::PREFIX:
|
178
|
+
return absl::StrFormat("Header prefix match:%s %s:%s",
|
179
|
+
invert_match ? " not" : "", name, string_matcher);
|
180
|
+
case HeaderMatcherType::SUFFIX:
|
181
|
+
return absl::StrFormat("Header suffix match:%s %s:%s",
|
182
|
+
invert_match ? " not" : "", name, string_matcher);
|
183
|
+
default:
|
184
|
+
return "";
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
std::string XdsApi::RdsUpdate::RdsRoute::Matchers::ToString() const {
|
189
|
+
std::vector<std::string> contents;
|
190
|
+
contents.push_back(path_matcher.ToString());
|
191
|
+
for (const auto& header_it : header_matchers) {
|
192
|
+
contents.push_back(header_it.ToString());
|
193
|
+
}
|
194
|
+
if (fraction_per_million.has_value()) {
|
195
|
+
contents.push_back(absl::StrFormat("Fraction Per Million %d",
|
196
|
+
fraction_per_million.value()));
|
197
|
+
}
|
198
|
+
return absl::StrJoin(contents, "\n");
|
199
|
+
}
|
200
|
+
|
201
|
+
std::string XdsApi::RdsUpdate::RdsRoute::ClusterWeight::ToString() const {
|
202
|
+
return absl::StrFormat("{cluster=%s, weight=%d}", name, weight);
|
203
|
+
}
|
204
|
+
|
205
|
+
std::string XdsApi::RdsUpdate::RdsRoute::ToString() const {
|
206
|
+
std::vector<std::string> contents;
|
207
|
+
contents.push_back(matchers.ToString());
|
208
|
+
if (!cluster_name.empty()) {
|
209
|
+
contents.push_back(absl::StrFormat("Cluster name: %s", cluster_name));
|
210
|
+
}
|
211
|
+
for (const auto& weighted_it : weighted_clusters) {
|
212
|
+
contents.push_back(weighted_it.ToString());
|
213
|
+
}
|
214
|
+
return absl::StrJoin(contents, "\n");
|
215
|
+
}
|
216
|
+
|
217
|
+
std::string XdsApi::RdsUpdate::ToString() const {
|
218
|
+
std::vector<std::string> contents;
|
219
|
+
for (const auto& route_it : routes) {
|
220
|
+
contents.push_back(route_it.ToString());
|
221
|
+
}
|
222
|
+
return absl::StrJoin(contents, ",\n");
|
223
|
+
}
|
224
|
+
|
129
225
|
XdsApi::XdsApi(XdsClient* client, TraceFlag* tracer,
|
130
226
|
const XdsBootstrap::Node* node)
|
131
227
|
: client_(client),
|
@@ -151,13 +247,10 @@ void PopulateListValue(upb_arena* arena, google_protobuf_ListValue* list_value,
|
|
151
247
|
void PopulateMetadata(upb_arena* arena, google_protobuf_Struct* metadata_pb,
|
152
248
|
const Json::Object& metadata) {
|
153
249
|
for (const auto& p : metadata) {
|
154
|
-
|
155
|
-
google_protobuf_Struct_add_fields(metadata_pb, arena);
|
156
|
-
google_protobuf_Struct_FieldsEntry_set_key(
|
157
|
-
field, upb_strview_makez(p.first.c_str()));
|
158
|
-
google_protobuf_Value* value =
|
159
|
-
google_protobuf_Struct_FieldsEntry_mutable_value(field, arena);
|
250
|
+
google_protobuf_Value* value = google_protobuf_Value_new(arena);
|
160
251
|
PopulateMetadataValue(arena, value, p.second);
|
252
|
+
google_protobuf_Struct_fields_set(
|
253
|
+
metadata_pb, upb_strview_makez(p.first.c_str()), value, arena);
|
161
254
|
}
|
162
255
|
}
|
163
256
|
|
@@ -218,14 +311,12 @@ void PopulateNode(upb_arena* arena, const XdsBootstrap::Node* node,
|
|
218
311
|
if (!server_name.empty()) {
|
219
312
|
google_protobuf_Struct* metadata =
|
220
313
|
envoy_api_v2_core_Node_mutable_metadata(node_msg, arena);
|
221
|
-
|
222
|
-
google_protobuf_Struct_add_fields(metadata, arena);
|
223
|
-
google_protobuf_Struct_FieldsEntry_set_key(
|
224
|
-
field, upb_strview_makez("PROXYLESS_CLIENT_HOSTNAME"));
|
225
|
-
google_protobuf_Value* value =
|
226
|
-
google_protobuf_Struct_FieldsEntry_mutable_value(field, arena);
|
314
|
+
google_protobuf_Value* value = google_protobuf_Value_new(arena);
|
227
315
|
google_protobuf_Value_set_string_value(
|
228
316
|
value, upb_strview_make(server_name.data(), server_name.size()));
|
317
|
+
google_protobuf_Struct_fields_set(
|
318
|
+
metadata, upb_strview_makez("PROXYLESS_CLIENT_HOSTNAME"), value,
|
319
|
+
arena);
|
229
320
|
}
|
230
321
|
if (!node->locality_region.empty() || !node->locality_zone.empty() ||
|
231
322
|
!node->locality_subzone.empty()) {
|
@@ -257,46 +348,14 @@ void PopulateNode(upb_arena* arena, const XdsBootstrap::Node* node,
|
|
257
348
|
arena);
|
258
349
|
}
|
259
350
|
|
260
|
-
envoy_api_v2_DiscoveryRequest* CreateDiscoveryRequest(
|
261
|
-
upb_arena* arena, const char* type_url, const std::string& version,
|
262
|
-
const std::string& nonce, grpc_error* error) {
|
263
|
-
// Create a request.
|
264
|
-
envoy_api_v2_DiscoveryRequest* request =
|
265
|
-
envoy_api_v2_DiscoveryRequest_new(arena);
|
266
|
-
// Set type_url.
|
267
|
-
envoy_api_v2_DiscoveryRequest_set_type_url(request,
|
268
|
-
upb_strview_makez(type_url));
|
269
|
-
// Set version_info.
|
270
|
-
if (!version.empty()) {
|
271
|
-
envoy_api_v2_DiscoveryRequest_set_version_info(
|
272
|
-
request, upb_strview_makez(version.c_str()));
|
273
|
-
}
|
274
|
-
// Set nonce.
|
275
|
-
if (!nonce.empty()) {
|
276
|
-
envoy_api_v2_DiscoveryRequest_set_response_nonce(
|
277
|
-
request, upb_strview_makez(nonce.c_str()));
|
278
|
-
}
|
279
|
-
// Set error_detail if it's a NACK.
|
280
|
-
if (error != GRPC_ERROR_NONE) {
|
281
|
-
grpc_slice error_description_slice;
|
282
|
-
GPR_ASSERT(grpc_error_get_str(error, GRPC_ERROR_STR_DESCRIPTION,
|
283
|
-
&error_description_slice));
|
284
|
-
upb_strview error_description_strview =
|
285
|
-
upb_strview_make(reinterpret_cast<const char*>(
|
286
|
-
GPR_SLICE_START_PTR(error_description_slice)),
|
287
|
-
GPR_SLICE_LENGTH(error_description_slice));
|
288
|
-
google_rpc_Status* error_detail =
|
289
|
-
envoy_api_v2_DiscoveryRequest_mutable_error_detail(request, arena);
|
290
|
-
google_rpc_Status_set_message(error_detail, error_description_strview);
|
291
|
-
GRPC_ERROR_UNREF(error);
|
292
|
-
}
|
293
|
-
return request;
|
294
|
-
}
|
295
|
-
|
296
351
|
inline absl::string_view UpbStringToAbsl(const upb_strview& str) {
|
297
352
|
return absl::string_view(str.data, str.size);
|
298
353
|
}
|
299
354
|
|
355
|
+
inline std::string UpbStringToStdString(const upb_strview& str) {
|
356
|
+
return std::string(str.data, str.size);
|
357
|
+
}
|
358
|
+
|
300
359
|
inline void AddStringField(const char* name, const upb_strview& value,
|
301
360
|
std::vector<std::string>* fields,
|
302
361
|
bool add_if_empty = false) {
|
@@ -306,6 +365,15 @@ inline void AddStringField(const char* name, const upb_strview& value,
|
|
306
365
|
}
|
307
366
|
}
|
308
367
|
|
368
|
+
inline void AddUInt32ValueField(const char* name,
|
369
|
+
const google_protobuf_UInt32Value* value,
|
370
|
+
std::vector<std::string>* fields) {
|
371
|
+
if (value != nullptr) {
|
372
|
+
fields->emplace_back(absl::StrCat(
|
373
|
+
name, " { value: ", google_protobuf_UInt32Value_value(value), " }"));
|
374
|
+
}
|
375
|
+
}
|
376
|
+
|
309
377
|
inline void AddLocalityField(int indent_level,
|
310
378
|
const envoy_api_v2_core_Locality* locality,
|
311
379
|
std::vector<std::string>* fields) {
|
@@ -335,18 +403,18 @@ void AddNodeLogFields(const envoy_api_v2_core_Node* node,
|
|
335
403
|
envoy_api_v2_core_Node_metadata(node);
|
336
404
|
if (metadata != nullptr) {
|
337
405
|
fields->emplace_back(" metadata {");
|
338
|
-
size_t
|
339
|
-
|
340
|
-
|
341
|
-
|
406
|
+
size_t entry_idx = UPB_MAP_BEGIN;
|
407
|
+
while (true) {
|
408
|
+
const google_protobuf_Struct_FieldsEntry* entry =
|
409
|
+
google_protobuf_Struct_fields_next(metadata, &entry_idx);
|
410
|
+
if (entry == nullptr) break;
|
342
411
|
fields->emplace_back(" field {");
|
343
412
|
// key
|
344
|
-
AddStringField(" key",
|
345
|
-
google_protobuf_Struct_FieldsEntry_key(entries[i]),
|
413
|
+
AddStringField(" key", google_protobuf_Struct_FieldsEntry_key(entry),
|
346
414
|
fields);
|
347
415
|
// value
|
348
416
|
const google_protobuf_Value* value =
|
349
|
-
google_protobuf_Struct_FieldsEntry_value(
|
417
|
+
google_protobuf_Struct_FieldsEntry_value(entry);
|
350
418
|
if (value != nullptr) {
|
351
419
|
std::string value_str;
|
352
420
|
if (google_protobuf_Value_has_string_value(value)) {
|
@@ -459,91 +527,43 @@ grpc_slice SerializeDiscoveryRequest(upb_arena* arena,
|
|
459
527
|
|
460
528
|
} // namespace
|
461
529
|
|
462
|
-
grpc_slice XdsApi::
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
arena.ptr(), type_url.c_str(), /*version=*/"", nonce, error);
|
468
|
-
MaybeLogDiscoveryRequest(client_, tracer_, request);
|
469
|
-
return SerializeDiscoveryRequest(arena.ptr(), request);
|
470
|
-
}
|
471
|
-
|
472
|
-
grpc_slice XdsApi::CreateLdsRequest(const std::string& server_name,
|
473
|
-
const std::string& version,
|
474
|
-
const std::string& nonce, grpc_error* error,
|
475
|
-
bool populate_node) {
|
476
|
-
upb::Arena arena;
|
477
|
-
envoy_api_v2_DiscoveryRequest* request =
|
478
|
-
CreateDiscoveryRequest(arena.ptr(), kLdsTypeUrl, version, nonce, error);
|
479
|
-
// Populate node.
|
480
|
-
if (populate_node) {
|
481
|
-
envoy_api_v2_core_Node* node_msg =
|
482
|
-
envoy_api_v2_DiscoveryRequest_mutable_node(request, arena.ptr());
|
483
|
-
PopulateNode(arena.ptr(), node_, build_version_, user_agent_name_, "",
|
484
|
-
node_msg);
|
485
|
-
}
|
486
|
-
// Add resource_name.
|
487
|
-
envoy_api_v2_DiscoveryRequest_add_resource_names(
|
488
|
-
request, upb_strview_make(server_name.data(), server_name.size()),
|
489
|
-
arena.ptr());
|
490
|
-
MaybeLogDiscoveryRequest(client_, tracer_, request);
|
491
|
-
return SerializeDiscoveryRequest(arena.ptr(), request);
|
492
|
-
}
|
493
|
-
|
494
|
-
grpc_slice XdsApi::CreateRdsRequest(const std::string& route_config_name,
|
495
|
-
const std::string& version,
|
496
|
-
const std::string& nonce, grpc_error* error,
|
497
|
-
bool populate_node) {
|
530
|
+
grpc_slice XdsApi::CreateAdsRequest(
|
531
|
+
const std::string& type_url,
|
532
|
+
const std::set<absl::string_view>& resource_names,
|
533
|
+
const std::string& version, const std::string& nonce, grpc_error* error,
|
534
|
+
bool populate_node) {
|
498
535
|
upb::Arena arena;
|
536
|
+
// Create a request.
|
499
537
|
envoy_api_v2_DiscoveryRequest* request =
|
500
|
-
|
501
|
-
//
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
538
|
+
envoy_api_v2_DiscoveryRequest_new(arena.ptr());
|
539
|
+
// Set type_url.
|
540
|
+
envoy_api_v2_DiscoveryRequest_set_type_url(
|
541
|
+
request, upb_strview_make(type_url.data(), type_url.size()));
|
542
|
+
// Set version_info.
|
543
|
+
if (!version.empty()) {
|
544
|
+
envoy_api_v2_DiscoveryRequest_set_version_info(
|
545
|
+
request, upb_strview_make(version.data(), version.size()));
|
507
546
|
}
|
508
|
-
//
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
arena.ptr());
|
513
|
-
MaybeLogDiscoveryRequest(client_, tracer_, request);
|
514
|
-
return SerializeDiscoveryRequest(arena.ptr(), request);
|
515
|
-
}
|
516
|
-
|
517
|
-
grpc_slice XdsApi::CreateCdsRequest(const std::set<StringView>& cluster_names,
|
518
|
-
const std::string& version,
|
519
|
-
const std::string& nonce, grpc_error* error,
|
520
|
-
bool populate_node) {
|
521
|
-
upb::Arena arena;
|
522
|
-
envoy_api_v2_DiscoveryRequest* request =
|
523
|
-
CreateDiscoveryRequest(arena.ptr(), kCdsTypeUrl, version, nonce, error);
|
524
|
-
// Populate node.
|
525
|
-
if (populate_node) {
|
526
|
-
envoy_api_v2_core_Node* node_msg =
|
527
|
-
envoy_api_v2_DiscoveryRequest_mutable_node(request, arena.ptr());
|
528
|
-
PopulateNode(arena.ptr(), node_, build_version_, user_agent_name_, "",
|
529
|
-
node_msg);
|
547
|
+
// Set nonce.
|
548
|
+
if (!nonce.empty()) {
|
549
|
+
envoy_api_v2_DiscoveryRequest_set_response_nonce(
|
550
|
+
request, upb_strview_make(nonce.data(), nonce.size()));
|
530
551
|
}
|
531
|
-
//
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
552
|
+
// Set error_detail if it's a NACK.
|
553
|
+
if (error != GRPC_ERROR_NONE) {
|
554
|
+
grpc_slice error_description_slice;
|
555
|
+
GPR_ASSERT(grpc_error_get_str(error, GRPC_ERROR_STR_DESCRIPTION,
|
556
|
+
&error_description_slice));
|
557
|
+
upb_strview error_description_strview =
|
558
|
+
upb_strview_make(reinterpret_cast<const char*>(
|
559
|
+
GPR_SLICE_START_PTR(error_description_slice)),
|
560
|
+
GPR_SLICE_LENGTH(error_description_slice));
|
561
|
+
google_rpc_Status* error_detail =
|
562
|
+
envoy_api_v2_DiscoveryRequest_mutable_error_detail(request,
|
563
|
+
arena.ptr());
|
564
|
+
google_rpc_Status_set_message(error_detail, error_description_strview);
|
565
|
+
GRPC_ERROR_UNREF(error);
|
536
566
|
}
|
537
|
-
MaybeLogDiscoveryRequest(client_, tracer_, request);
|
538
|
-
return SerializeDiscoveryRequest(arena.ptr(), request);
|
539
|
-
}
|
540
|
-
|
541
|
-
grpc_slice XdsApi::CreateEdsRequest(
|
542
|
-
const std::set<StringView>& eds_service_names, const std::string& version,
|
543
|
-
const std::string& nonce, grpc_error* error, bool populate_node) {
|
544
|
-
upb::Arena arena;
|
545
|
-
envoy_api_v2_DiscoveryRequest* request =
|
546
|
-
CreateDiscoveryRequest(arena.ptr(), kEdsTypeUrl, version, nonce, error);
|
547
567
|
// Populate node.
|
548
568
|
if (populate_node) {
|
549
569
|
envoy_api_v2_core_Node* node_msg =
|
@@ -552,10 +572,9 @@ grpc_slice XdsApi::CreateEdsRequest(
|
|
552
572
|
node_msg);
|
553
573
|
}
|
554
574
|
// Add resource_names.
|
555
|
-
for (const auto&
|
575
|
+
for (const auto& resource_name : resource_names) {
|
556
576
|
envoy_api_v2_DiscoveryRequest_add_resource_names(
|
557
|
-
request,
|
558
|
-
upb_strview_make(eds_service_name.data(), eds_service_name.size()),
|
577
|
+
request, upb_strview_make(resource_name.data(), resource_name.size()),
|
559
578
|
arena.ptr());
|
560
579
|
}
|
561
580
|
MaybeLogDiscoveryRequest(client_, tracer_, request);
|
@@ -678,7 +697,34 @@ void MaybeLogRouteConfiguration(
|
|
678
697
|
envoy_api_v2_route_RouteAction_cluster_header(action), &fields);
|
679
698
|
} else if (envoy_api_v2_route_RouteAction_has_weighted_clusters(
|
680
699
|
action)) {
|
681
|
-
|
700
|
+
const envoy_api_v2_route_WeightedCluster* weighted_clusters =
|
701
|
+
envoy_api_v2_route_RouteAction_weighted_clusters(action);
|
702
|
+
fields.emplace_back(" weighted_clusters {");
|
703
|
+
size_t num_cluster_weights;
|
704
|
+
const envoy_api_v2_route_WeightedCluster_ClusterWeight* const*
|
705
|
+
cluster_weights = envoy_api_v2_route_WeightedCluster_clusters(
|
706
|
+
weighted_clusters, &num_cluster_weights);
|
707
|
+
for (size_t i = 0; i < num_cluster_weights; ++i) {
|
708
|
+
const envoy_api_v2_route_WeightedCluster_ClusterWeight*
|
709
|
+
cluster_weight = cluster_weights[i];
|
710
|
+
fields.emplace_back(" clusters {");
|
711
|
+
AddStringField(
|
712
|
+
" name",
|
713
|
+
envoy_api_v2_route_WeightedCluster_ClusterWeight_name(
|
714
|
+
cluster_weight),
|
715
|
+
&fields);
|
716
|
+
AddUInt32ValueField(
|
717
|
+
" weight",
|
718
|
+
envoy_api_v2_route_WeightedCluster_ClusterWeight_weight(
|
719
|
+
cluster_weight),
|
720
|
+
&fields);
|
721
|
+
fields.emplace_back(" }");
|
722
|
+
}
|
723
|
+
AddUInt32ValueField(" total_weight",
|
724
|
+
envoy_api_v2_route_WeightedCluster_total_weight(
|
725
|
+
weighted_clusters),
|
726
|
+
&fields);
|
727
|
+
fields.emplace_back(" }");
|
682
728
|
}
|
683
729
|
fields.emplace_back(" }");
|
684
730
|
} else if (envoy_api_v2_route_Route_has_redirect(route)) {
|
@@ -839,14 +885,11 @@ void MaybeLogClusterLoadAssignment(
|
|
839
885
|
fields.emplace_back(" }");
|
840
886
|
}
|
841
887
|
// load_balancing_weight
|
842
|
-
|
888
|
+
AddUInt32ValueField(
|
889
|
+
" load_balancing_weight",
|
843
890
|
envoy_api_v2_endpoint_LocalityLbEndpoints_load_balancing_weight(
|
844
|
-
locality_endpoint)
|
845
|
-
|
846
|
-
fields.emplace_back(
|
847
|
-
absl::StrCat(" load_balancing_weight { value: ",
|
848
|
-
google_protobuf_UInt32Value_value(lb_weight), " }"));
|
849
|
-
}
|
891
|
+
locality_endpoint),
|
892
|
+
&fields);
|
850
893
|
// priority
|
851
894
|
uint32_t priority =
|
852
895
|
envoy_api_v2_endpoint_LocalityLbEndpoints_priority(locality_endpoint);
|
@@ -923,16 +966,18 @@ bool DomainMatch(MatchType match_type, std::string domain_pattern,
|
|
923
966
|
} else if (match_type == SUFFIX_MATCH) {
|
924
967
|
// Asterisk must match at least one char.
|
925
968
|
if (expected_host_name.size() < domain_pattern.size()) return false;
|
926
|
-
|
927
|
-
|
928
|
-
|
969
|
+
absl::string_view pattern_suffix(domain_pattern.c_str() + 1);
|
970
|
+
absl::string_view host_suffix(expected_host_name.c_str() +
|
971
|
+
expected_host_name.size() -
|
972
|
+
pattern_suffix.size());
|
929
973
|
return pattern_suffix == host_suffix;
|
930
974
|
} else if (match_type == PREFIX_MATCH) {
|
931
975
|
// Asterisk must match at least one char.
|
932
976
|
if (expected_host_name.size() < domain_pattern.size()) return false;
|
933
|
-
|
934
|
-
|
935
|
-
|
977
|
+
absl::string_view pattern_prefix(domain_pattern.c_str(),
|
978
|
+
domain_pattern.size() - 1);
|
979
|
+
absl::string_view host_prefix(expected_host_name.c_str(),
|
980
|
+
pattern_prefix.size());
|
936
981
|
return pattern_prefix == host_prefix;
|
937
982
|
} else {
|
938
983
|
return match_type == UNIVERSE_MATCH;
|
@@ -948,6 +993,267 @@ MatchType DomainPatternMatchType(const std::string& domain_pattern) {
|
|
948
993
|
return INVALID_MATCH;
|
949
994
|
}
|
950
995
|
|
996
|
+
grpc_error* RoutePathMatchParse(const envoy_api_v2_route_RouteMatch* match,
|
997
|
+
XdsApi::RdsUpdate::RdsRoute* rds_route,
|
998
|
+
bool* ignore_route) {
|
999
|
+
if (envoy_api_v2_route_RouteMatch_has_prefix(match)) {
|
1000
|
+
upb_strview prefix = envoy_api_v2_route_RouteMatch_prefix(match);
|
1001
|
+
// Empty prefix "" is accepted.
|
1002
|
+
if (prefix.size > 0) {
|
1003
|
+
// Prefix "/" is accepted.
|
1004
|
+
if (prefix.data[0] != '/') {
|
1005
|
+
// Prefix which does not start with a / will never match anything, so
|
1006
|
+
// ignore this route.
|
1007
|
+
*ignore_route = true;
|
1008
|
+
return GRPC_ERROR_NONE;
|
1009
|
+
}
|
1010
|
+
std::vector<absl::string_view> prefix_elements =
|
1011
|
+
absl::StrSplit(absl::string_view(prefix.data, prefix.size).substr(1),
|
1012
|
+
absl::MaxSplits('/', 2));
|
1013
|
+
if (prefix_elements.size() > 2) {
|
1014
|
+
// Prefix cannot have more than 2 slashes.
|
1015
|
+
*ignore_route = true;
|
1016
|
+
return GRPC_ERROR_NONE;
|
1017
|
+
} else if (prefix_elements.size() == 2 && prefix_elements[0].empty()) {
|
1018
|
+
// Prefix contains empty string between the 2 slashes
|
1019
|
+
*ignore_route = true;
|
1020
|
+
return GRPC_ERROR_NONE;
|
1021
|
+
}
|
1022
|
+
}
|
1023
|
+
rds_route->matchers.path_matcher.type = XdsApi::RdsUpdate::RdsRoute::
|
1024
|
+
Matchers::PathMatcher::PathMatcherType::PREFIX;
|
1025
|
+
rds_route->matchers.path_matcher.string_matcher =
|
1026
|
+
UpbStringToStdString(prefix);
|
1027
|
+
} else if (envoy_api_v2_route_RouteMatch_has_path(match)) {
|
1028
|
+
upb_strview path = envoy_api_v2_route_RouteMatch_path(match);
|
1029
|
+
if (path.size == 0) {
|
1030
|
+
// Path that is empty will never match anything, so ignore this route.
|
1031
|
+
*ignore_route = true;
|
1032
|
+
return GRPC_ERROR_NONE;
|
1033
|
+
}
|
1034
|
+
if (path.data[0] != '/') {
|
1035
|
+
// Path which does not start with a / will never match anything, so
|
1036
|
+
// ignore this route.
|
1037
|
+
*ignore_route = true;
|
1038
|
+
return GRPC_ERROR_NONE;
|
1039
|
+
}
|
1040
|
+
std::vector<absl::string_view> path_elements =
|
1041
|
+
absl::StrSplit(absl::string_view(path.data, path.size).substr(1),
|
1042
|
+
absl::MaxSplits('/', 2));
|
1043
|
+
if (path_elements.size() != 2) {
|
1044
|
+
// Path not in the required format of /service/method will never match
|
1045
|
+
// anything, so ignore this route.
|
1046
|
+
*ignore_route = true;
|
1047
|
+
return GRPC_ERROR_NONE;
|
1048
|
+
} else if (path_elements[0].empty()) {
|
1049
|
+
// Path contains empty service name will never match anything, so ignore
|
1050
|
+
// this route.
|
1051
|
+
*ignore_route = true;
|
1052
|
+
return GRPC_ERROR_NONE;
|
1053
|
+
} else if (path_elements[1].empty()) {
|
1054
|
+
// Path contains empty method name will never match anything, so ignore
|
1055
|
+
// this route.
|
1056
|
+
*ignore_route = true;
|
1057
|
+
return GRPC_ERROR_NONE;
|
1058
|
+
}
|
1059
|
+
rds_route->matchers.path_matcher.type = XdsApi::RdsUpdate::RdsRoute::
|
1060
|
+
Matchers::PathMatcher::PathMatcherType::PATH;
|
1061
|
+
rds_route->matchers.path_matcher.string_matcher =
|
1062
|
+
UpbStringToStdString(path);
|
1063
|
+
} else if (envoy_api_v2_route_RouteMatch_has_safe_regex(match)) {
|
1064
|
+
const envoy_type_matcher_RegexMatcher* regex_matcher =
|
1065
|
+
envoy_api_v2_route_RouteMatch_safe_regex(match);
|
1066
|
+
GPR_ASSERT(regex_matcher != nullptr);
|
1067
|
+
const std::string matcher = UpbStringToStdString(
|
1068
|
+
envoy_type_matcher_RegexMatcher_regex(regex_matcher));
|
1069
|
+
std::unique_ptr<RE2> regex = absl::make_unique<RE2>(matcher);
|
1070
|
+
if (!regex->ok()) {
|
1071
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1072
|
+
"Invalid regex string specified in path matcher.");
|
1073
|
+
}
|
1074
|
+
rds_route->matchers.path_matcher.type = XdsApi::RdsUpdate::RdsRoute::
|
1075
|
+
Matchers::PathMatcher::PathMatcherType::REGEX;
|
1076
|
+
rds_route->matchers.path_matcher.regex_matcher = std::move(regex);
|
1077
|
+
} else {
|
1078
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1079
|
+
"Invalid route path specifier specified.");
|
1080
|
+
}
|
1081
|
+
return GRPC_ERROR_NONE;
|
1082
|
+
}
|
1083
|
+
|
1084
|
+
grpc_error* RouteHeaderMatchersParse(const envoy_api_v2_route_RouteMatch* match,
|
1085
|
+
XdsApi::RdsUpdate::RdsRoute* rds_route) {
|
1086
|
+
size_t size;
|
1087
|
+
const envoy_api_v2_route_HeaderMatcher* const* headers =
|
1088
|
+
envoy_api_v2_route_RouteMatch_headers(match, &size);
|
1089
|
+
for (size_t i = 0; i < size; ++i) {
|
1090
|
+
const envoy_api_v2_route_HeaderMatcher* header = headers[i];
|
1091
|
+
XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher header_matcher;
|
1092
|
+
header_matcher.name =
|
1093
|
+
UpbStringToStdString(envoy_api_v2_route_HeaderMatcher_name(header));
|
1094
|
+
if (envoy_api_v2_route_HeaderMatcher_has_exact_match(header)) {
|
1095
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
1096
|
+
HeaderMatcher::HeaderMatcherType::EXACT;
|
1097
|
+
header_matcher.string_matcher = UpbStringToStdString(
|
1098
|
+
envoy_api_v2_route_HeaderMatcher_exact_match(header));
|
1099
|
+
} else if (envoy_api_v2_route_HeaderMatcher_has_safe_regex_match(header)) {
|
1100
|
+
const envoy_type_matcher_RegexMatcher* regex_matcher =
|
1101
|
+
envoy_api_v2_route_HeaderMatcher_safe_regex_match(header);
|
1102
|
+
GPR_ASSERT(regex_matcher != nullptr);
|
1103
|
+
const std::string matcher = UpbStringToStdString(
|
1104
|
+
envoy_type_matcher_RegexMatcher_regex(regex_matcher));
|
1105
|
+
std::unique_ptr<RE2> regex = absl::make_unique<RE2>(matcher);
|
1106
|
+
if (!regex->ok()) {
|
1107
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1108
|
+
"Invalid regex string specified in header matcher.");
|
1109
|
+
}
|
1110
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
1111
|
+
HeaderMatcher::HeaderMatcherType::REGEX;
|
1112
|
+
header_matcher.regex_match = std::move(regex);
|
1113
|
+
} else if (envoy_api_v2_route_HeaderMatcher_has_range_match(header)) {
|
1114
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
1115
|
+
HeaderMatcher::HeaderMatcherType::RANGE;
|
1116
|
+
const envoy_type_Int64Range* range_matcher =
|
1117
|
+
envoy_api_v2_route_HeaderMatcher_range_match(header);
|
1118
|
+
header_matcher.range_start = envoy_type_Int64Range_start(range_matcher);
|
1119
|
+
header_matcher.range_end = envoy_type_Int64Range_end(range_matcher);
|
1120
|
+
if (header_matcher.range_end < header_matcher.range_start) {
|
1121
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1122
|
+
"Invalid range header matcher specifier specified: end "
|
1123
|
+
"cannot be smaller than start.");
|
1124
|
+
}
|
1125
|
+
} else if (envoy_api_v2_route_HeaderMatcher_has_present_match(header)) {
|
1126
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
1127
|
+
HeaderMatcher::HeaderMatcherType::PRESENT;
|
1128
|
+
header_matcher.present_match =
|
1129
|
+
envoy_api_v2_route_HeaderMatcher_present_match(header);
|
1130
|
+
} else if (envoy_api_v2_route_HeaderMatcher_has_prefix_match(header)) {
|
1131
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
1132
|
+
HeaderMatcher::HeaderMatcherType::PREFIX;
|
1133
|
+
header_matcher.string_matcher = UpbStringToStdString(
|
1134
|
+
envoy_api_v2_route_HeaderMatcher_prefix_match(header));
|
1135
|
+
} else if (envoy_api_v2_route_HeaderMatcher_has_suffix_match(header)) {
|
1136
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
1137
|
+
HeaderMatcher::HeaderMatcherType::SUFFIX;
|
1138
|
+
header_matcher.string_matcher = UpbStringToStdString(
|
1139
|
+
envoy_api_v2_route_HeaderMatcher_suffix_match(header));
|
1140
|
+
} else {
|
1141
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1142
|
+
"Invalid route header matcher specified.");
|
1143
|
+
}
|
1144
|
+
header_matcher.invert_match =
|
1145
|
+
envoy_api_v2_route_HeaderMatcher_invert_match(header);
|
1146
|
+
rds_route->matchers.header_matchers.emplace_back(std::move(header_matcher));
|
1147
|
+
}
|
1148
|
+
return GRPC_ERROR_NONE;
|
1149
|
+
}
|
1150
|
+
|
1151
|
+
grpc_error* RouteRuntimeFractionParse(
|
1152
|
+
const envoy_api_v2_route_RouteMatch* match,
|
1153
|
+
XdsApi::RdsUpdate::RdsRoute* rds_route) {
|
1154
|
+
const envoy_api_v2_core_RuntimeFractionalPercent* runtime_fraction =
|
1155
|
+
envoy_api_v2_route_RouteMatch_runtime_fraction(match);
|
1156
|
+
if (runtime_fraction != nullptr) {
|
1157
|
+
const envoy_type_FractionalPercent* fraction =
|
1158
|
+
envoy_api_v2_core_RuntimeFractionalPercent_default_value(
|
1159
|
+
runtime_fraction);
|
1160
|
+
if (fraction != nullptr) {
|
1161
|
+
uint32_t numerator = envoy_type_FractionalPercent_numerator(fraction);
|
1162
|
+
const auto denominator =
|
1163
|
+
static_cast<envoy_type_FractionalPercent_DenominatorType>(
|
1164
|
+
envoy_type_FractionalPercent_denominator(fraction));
|
1165
|
+
// Normalize to million.
|
1166
|
+
switch (denominator) {
|
1167
|
+
case envoy_type_FractionalPercent_HUNDRED:
|
1168
|
+
numerator *= 10000;
|
1169
|
+
break;
|
1170
|
+
case envoy_type_FractionalPercent_TEN_THOUSAND:
|
1171
|
+
numerator *= 100;
|
1172
|
+
break;
|
1173
|
+
case envoy_type_FractionalPercent_MILLION:
|
1174
|
+
break;
|
1175
|
+
default:
|
1176
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1177
|
+
"Unknown denominator type");
|
1178
|
+
}
|
1179
|
+
rds_route->matchers.fraction_per_million = numerator;
|
1180
|
+
}
|
1181
|
+
}
|
1182
|
+
return GRPC_ERROR_NONE;
|
1183
|
+
}
|
1184
|
+
|
1185
|
+
grpc_error* RouteActionParse(const envoy_api_v2_route_Route* route,
|
1186
|
+
XdsApi::RdsUpdate::RdsRoute* rds_route,
|
1187
|
+
bool* ignore_route) {
|
1188
|
+
if (!envoy_api_v2_route_Route_has_route(route)) {
|
1189
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1190
|
+
"No RouteAction found in route.");
|
1191
|
+
}
|
1192
|
+
const envoy_api_v2_route_RouteAction* route_action =
|
1193
|
+
envoy_api_v2_route_Route_route(route);
|
1194
|
+
// Get the cluster or weighted_clusters in the RouteAction.
|
1195
|
+
if (envoy_api_v2_route_RouteAction_has_cluster(route_action)) {
|
1196
|
+
const upb_strview cluster_name =
|
1197
|
+
envoy_api_v2_route_RouteAction_cluster(route_action);
|
1198
|
+
if (cluster_name.size == 0) {
|
1199
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1200
|
+
"RouteAction cluster contains empty cluster name.");
|
1201
|
+
}
|
1202
|
+
rds_route->cluster_name = UpbStringToStdString(cluster_name);
|
1203
|
+
} else if (envoy_api_v2_route_RouteAction_has_weighted_clusters(
|
1204
|
+
route_action)) {
|
1205
|
+
const envoy_api_v2_route_WeightedCluster* weighted_cluster =
|
1206
|
+
envoy_api_v2_route_RouteAction_weighted_clusters(route_action);
|
1207
|
+
uint32_t total_weight = 100;
|
1208
|
+
const google_protobuf_UInt32Value* weight =
|
1209
|
+
envoy_api_v2_route_WeightedCluster_total_weight(weighted_cluster);
|
1210
|
+
if (weight != nullptr) {
|
1211
|
+
total_weight = google_protobuf_UInt32Value_value(weight);
|
1212
|
+
}
|
1213
|
+
size_t clusters_size;
|
1214
|
+
const envoy_api_v2_route_WeightedCluster_ClusterWeight* const* clusters =
|
1215
|
+
envoy_api_v2_route_WeightedCluster_clusters(weighted_cluster,
|
1216
|
+
&clusters_size);
|
1217
|
+
uint32_t sum_of_weights = 0;
|
1218
|
+
for (size_t j = 0; j < clusters_size; ++j) {
|
1219
|
+
const envoy_api_v2_route_WeightedCluster_ClusterWeight* cluster_weight =
|
1220
|
+
clusters[j];
|
1221
|
+
XdsApi::RdsUpdate::RdsRoute::ClusterWeight cluster;
|
1222
|
+
cluster.name = UpbStringToStdString(
|
1223
|
+
envoy_api_v2_route_WeightedCluster_ClusterWeight_name(
|
1224
|
+
cluster_weight));
|
1225
|
+
if (cluster.name.empty()) {
|
1226
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1227
|
+
"RouteAction weighted_cluster cluster contains empty cluster "
|
1228
|
+
"name.");
|
1229
|
+
}
|
1230
|
+
const google_protobuf_UInt32Value* weight =
|
1231
|
+
envoy_api_v2_route_WeightedCluster_ClusterWeight_weight(
|
1232
|
+
cluster_weight);
|
1233
|
+
if (weight == nullptr) {
|
1234
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1235
|
+
"RouteAction weighted_cluster cluster missing weight");
|
1236
|
+
}
|
1237
|
+
cluster.weight = google_protobuf_UInt32Value_value(weight);
|
1238
|
+
sum_of_weights += cluster.weight;
|
1239
|
+
rds_route->weighted_clusters.emplace_back(std::move(cluster));
|
1240
|
+
}
|
1241
|
+
if (total_weight != sum_of_weights) {
|
1242
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1243
|
+
"RouteAction weighted_cluster has incorrect total weight");
|
1244
|
+
}
|
1245
|
+
if (rds_route->weighted_clusters.empty()) {
|
1246
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1247
|
+
"RouteAction weighted_cluster has no valid clusters specified.");
|
1248
|
+
}
|
1249
|
+
} else {
|
1250
|
+
// No cluster or weighted_clusters found in RouteAction, ignore this route.
|
1251
|
+
*ignore_route = true;
|
1252
|
+
return GRPC_ERROR_NONE;
|
1253
|
+
}
|
1254
|
+
return GRPC_ERROR_NONE;
|
1255
|
+
}
|
1256
|
+
|
951
1257
|
grpc_error* RouteConfigParse(
|
952
1258
|
XdsClient* client, TraceFlag* tracer,
|
953
1259
|
const envoy_api_v2_RouteConfiguration* route_config,
|
@@ -1011,34 +1317,41 @@ grpc_error* RouteConfigParse(
|
|
1011
1317
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1012
1318
|
"No route found in the virtual host.");
|
1013
1319
|
}
|
1014
|
-
//
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1320
|
+
// Loop over the whole list of routes
|
1321
|
+
for (size_t i = 0; i < size; ++i) {
|
1322
|
+
const envoy_api_v2_route_Route* route = routes[i];
|
1323
|
+
const envoy_api_v2_route_RouteMatch* match =
|
1324
|
+
envoy_api_v2_route_Route_match(route);
|
1325
|
+
size_t query_parameters_size;
|
1326
|
+
static_cast<void>(envoy_api_v2_route_RouteMatch_query_parameters(
|
1327
|
+
match, &query_parameters_size));
|
1328
|
+
if (query_parameters_size > 0) {
|
1329
|
+
continue;
|
1330
|
+
}
|
1331
|
+
XdsApi::RdsUpdate::RdsRoute rds_route;
|
1332
|
+
bool ignore_route = false;
|
1333
|
+
grpc_error* error = RoutePathMatchParse(match, &rds_route, &ignore_route);
|
1334
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1335
|
+
if (ignore_route) continue;
|
1336
|
+
error = RouteHeaderMatchersParse(match, &rds_route);
|
1337
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1338
|
+
error = RouteRuntimeFractionParse(match, &rds_route);
|
1339
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1340
|
+
error = RouteActionParse(route, &rds_route, &ignore_route);
|
1341
|
+
if (error != GRPC_ERROR_NONE) return error;
|
1342
|
+
if (ignore_route) continue;
|
1343
|
+
const google_protobuf_BoolValue* case_sensitive =
|
1344
|
+
envoy_api_v2_route_RouteMatch_case_sensitive(match);
|
1345
|
+
if (case_sensitive != nullptr &&
|
1346
|
+
!google_protobuf_BoolValue_value(case_sensitive)) {
|
1347
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1348
|
+
"case_sensitive if set must be set to true.");
|
1349
|
+
}
|
1350
|
+
rds_update->routes.emplace_back(std::move(rds_route));
|
1031
1351
|
}
|
1032
|
-
|
1033
|
-
|
1034
|
-
// Get the cluster in the RouteAction.
|
1035
|
-
if (!envoy_api_v2_route_RouteAction_has_cluster(route_action)) {
|
1036
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1037
|
-
"No cluster found in RouteAction.");
|
1352
|
+
if (rds_update->routes.empty()) {
|
1353
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("No valid routes specified.");
|
1038
1354
|
}
|
1039
|
-
const upb_strview cluster =
|
1040
|
-
envoy_api_v2_route_RouteAction_cluster(route_action);
|
1041
|
-
rds_update->cluster_name = std::string(cluster.data, cluster.size);
|
1042
1355
|
return GRPC_ERROR_NONE;
|
1043
1356
|
}
|
1044
1357
|
|
@@ -1075,7 +1388,7 @@ grpc_error* LdsResponseParse(XdsClient* client, TraceFlag* tracer,
|
|
1075
1388
|
envoy_api_v2_Listener_api_listener(listener);
|
1076
1389
|
if (api_listener == nullptr) {
|
1077
1390
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1078
|
-
"Listener
|
1391
|
+
"Listener has no ApiListener.");
|
1079
1392
|
}
|
1080
1393
|
const upb_strview encoded_api_listener = google_protobuf_Any_value(
|
1081
1394
|
envoy_config_listener_v2_ApiListener_api_listener(api_listener));
|
@@ -1103,27 +1416,37 @@ grpc_error* LdsResponseParse(XdsClient* client, TraceFlag* tracer,
|
|
1103
1416
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1104
1417
|
"HttpConnectionManager neither has inlined route_config nor RDS.");
|
1105
1418
|
}
|
1106
|
-
// Get the route_config_name.
|
1107
1419
|
const envoy_config_filter_network_http_connection_manager_v2_Rds* rds =
|
1108
1420
|
envoy_config_filter_network_http_connection_manager_v2_HttpConnectionManager_rds(
|
1109
1421
|
http_connection_manager);
|
1110
|
-
|
1111
|
-
|
1422
|
+
// Check that the ConfigSource specifies ADS.
|
1423
|
+
const envoy_api_v2_core_ConfigSource* config_source =
|
1424
|
+
envoy_config_filter_network_http_connection_manager_v2_Rds_config_source(
|
1112
1425
|
rds);
|
1426
|
+
if (config_source == nullptr) {
|
1427
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1428
|
+
"HttpConnectionManager missing config_source for RDS.");
|
1429
|
+
}
|
1430
|
+
if (!envoy_api_v2_core_ConfigSource_has_ads(config_source)) {
|
1431
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1432
|
+
"HttpConnectionManager ConfigSource for RDS does not specify ADS.");
|
1433
|
+
}
|
1434
|
+
// Get the route_config_name.
|
1113
1435
|
lds_update->emplace();
|
1114
|
-
(*lds_update)->route_config_name =
|
1115
|
-
|
1436
|
+
(*lds_update)->route_config_name = UpbStringToStdString(
|
1437
|
+
envoy_config_filter_network_http_connection_manager_v2_Rds_route_config_name(
|
1438
|
+
rds));
|
1116
1439
|
return GRPC_ERROR_NONE;
|
1117
1440
|
}
|
1118
1441
|
return GRPC_ERROR_NONE;
|
1119
1442
|
}
|
1120
1443
|
|
1121
|
-
grpc_error* RdsResponseParse(
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1444
|
+
grpc_error* RdsResponseParse(
|
1445
|
+
XdsClient* client, TraceFlag* tracer,
|
1446
|
+
const envoy_api_v2_DiscoveryResponse* response,
|
1447
|
+
const std::string& expected_server_name,
|
1448
|
+
const std::set<absl::string_view>& expected_route_configuration_names,
|
1449
|
+
absl::optional<XdsApi::RdsUpdate>* rds_update, upb_arena* arena) {
|
1127
1450
|
// Get the resources from the response.
|
1128
1451
|
size_t size;
|
1129
1452
|
const google_protobuf_Any* const* resources =
|
@@ -1144,10 +1467,14 @@ grpc_error* RdsResponseParse(XdsClient* client, TraceFlag* tracer,
|
|
1144
1467
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Can't decode route_config.");
|
1145
1468
|
}
|
1146
1469
|
// Check route_config_name. Ignore unexpected route_config.
|
1147
|
-
const upb_strview
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1470
|
+
const upb_strview route_config_name =
|
1471
|
+
envoy_api_v2_RouteConfiguration_name(route_config);
|
1472
|
+
absl::string_view route_config_name_strview(route_config_name.data,
|
1473
|
+
route_config_name.size);
|
1474
|
+
if (expected_route_configuration_names.find(route_config_name_strview) ==
|
1475
|
+
expected_route_configuration_names.end()) {
|
1476
|
+
continue;
|
1477
|
+
}
|
1151
1478
|
// Parse the route_config.
|
1152
1479
|
XdsApi::RdsUpdate local_rds_update;
|
1153
1480
|
grpc_error* error = RouteConfigParse(
|
@@ -1159,11 +1486,11 @@ grpc_error* RdsResponseParse(XdsClient* client, TraceFlag* tracer,
|
|
1159
1486
|
return GRPC_ERROR_NONE;
|
1160
1487
|
}
|
1161
1488
|
|
1162
|
-
grpc_error* CdsResponseParse(
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1489
|
+
grpc_error* CdsResponseParse(
|
1490
|
+
XdsClient* client, TraceFlag* tracer,
|
1491
|
+
const envoy_api_v2_DiscoveryResponse* response,
|
1492
|
+
const std::set<absl::string_view>& expected_cluster_names,
|
1493
|
+
XdsApi::CdsUpdateMap* cds_update_map, upb_arena* arena) {
|
1167
1494
|
// Get the resources from the response.
|
1168
1495
|
size_t size;
|
1169
1496
|
const google_protobuf_Any* const* resources =
|
@@ -1186,7 +1513,8 @@ grpc_error* CdsResponseParse(XdsClient* client, TraceFlag* tracer,
|
|
1186
1513
|
MaybeLogCluster(client, tracer, cluster);
|
1187
1514
|
// Ignore unexpected cluster names.
|
1188
1515
|
upb_strview cluster_name = envoy_api_v2_Cluster_name(cluster);
|
1189
|
-
|
1516
|
+
absl::string_view cluster_name_strview(cluster_name.data,
|
1517
|
+
cluster_name.size);
|
1190
1518
|
if (expected_cluster_names.find(cluster_name_strview) ==
|
1191
1519
|
expected_cluster_names.end()) {
|
1192
1520
|
continue;
|
@@ -1204,14 +1532,14 @@ grpc_error* CdsResponseParse(XdsClient* client, TraceFlag* tracer,
|
|
1204
1532
|
const envoy_api_v2_core_ConfigSource* eds_config =
|
1205
1533
|
envoy_api_v2_Cluster_EdsClusterConfig_eds_config(eds_cluster_config);
|
1206
1534
|
if (!envoy_api_v2_core_ConfigSource_has_ads(eds_config)) {
|
1207
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1535
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1536
|
+
"EDS ConfigSource is not ADS.");
|
1208
1537
|
}
|
1209
1538
|
// Record EDS service_name (if any).
|
1210
1539
|
upb_strview service_name =
|
1211
1540
|
envoy_api_v2_Cluster_EdsClusterConfig_service_name(eds_cluster_config);
|
1212
1541
|
if (service_name.size != 0) {
|
1213
|
-
cds_update.eds_service_name =
|
1214
|
-
std::string(service_name.data, service_name.size);
|
1542
|
+
cds_update.eds_service_name = UpbStringToStdString(service_name);
|
1215
1543
|
}
|
1216
1544
|
// Check the LB policy.
|
1217
1545
|
if (envoy_api_v2_Cluster_lb_policy(cluster) !=
|
@@ -1225,11 +1553,11 @@ grpc_error* CdsResponseParse(XdsClient* client, TraceFlag* tracer,
|
|
1225
1553
|
if (lrs_server != nullptr) {
|
1226
1554
|
if (!envoy_api_v2_core_ConfigSource_has_self(lrs_server)) {
|
1227
1555
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1228
|
-
"ConfigSource is not self.");
|
1556
|
+
"LRS ConfigSource is not self.");
|
1229
1557
|
}
|
1230
1558
|
cds_update.lrs_load_reporting_server_name.emplace("");
|
1231
1559
|
}
|
1232
|
-
cds_update_map->emplace(
|
1560
|
+
cds_update_map->emplace(UpbStringToStdString(cluster_name),
|
1233
1561
|
std::move(cds_update));
|
1234
1562
|
}
|
1235
1563
|
return GRPC_ERROR_NONE;
|
@@ -1290,8 +1618,8 @@ grpc_error* LocalityParse(
|
|
1290
1618
|
upb_strview zone = envoy_api_v2_core_Locality_region(locality);
|
1291
1619
|
upb_strview sub_zone = envoy_api_v2_core_Locality_sub_zone(locality);
|
1292
1620
|
output_locality->name = MakeRefCounted<XdsLocalityName>(
|
1293
|
-
|
1294
|
-
|
1621
|
+
UpbStringToStdString(region), UpbStringToStdString(zone),
|
1622
|
+
UpbStringToStdString(sub_zone));
|
1295
1623
|
// Parse the addresses.
|
1296
1624
|
size_t size;
|
1297
1625
|
const envoy_api_v2_endpoint_LbEndpoint* const* lb_endpoints =
|
@@ -1341,15 +1669,14 @@ grpc_error* DropParseAndAppend(
|
|
1341
1669
|
}
|
1342
1670
|
// Cap numerator to 1000000.
|
1343
1671
|
numerator = GPR_MIN(numerator, 1000000);
|
1344
|
-
drop_config->AddCategory(
|
1345
|
-
numerator);
|
1672
|
+
drop_config->AddCategory(UpbStringToStdString(category), numerator);
|
1346
1673
|
return GRPC_ERROR_NONE;
|
1347
1674
|
}
|
1348
1675
|
|
1349
1676
|
grpc_error* EdsResponseParse(
|
1350
1677
|
XdsClient* client, TraceFlag* tracer,
|
1351
1678
|
const envoy_api_v2_DiscoveryResponse* response,
|
1352
|
-
const std::set<
|
1679
|
+
const std::set<absl::string_view>& expected_eds_service_names,
|
1353
1680
|
XdsApi::EdsUpdateMap* eds_update_map, upb_arena* arena) {
|
1354
1681
|
// Get the resources from the response.
|
1355
1682
|
size_t size;
|
@@ -1378,7 +1705,8 @@ grpc_error* EdsResponseParse(
|
|
1378
1705
|
// unexpected names.
|
1379
1706
|
upb_strview cluster_name = envoy_api_v2_ClusterLoadAssignment_cluster_name(
|
1380
1707
|
cluster_load_assignment);
|
1381
|
-
|
1708
|
+
absl::string_view cluster_name_strview(cluster_name.data,
|
1709
|
+
cluster_name.size);
|
1382
1710
|
if (expected_eds_service_names.find(cluster_name_strview) ==
|
1383
1711
|
expected_eds_service_names.end()) {
|
1384
1712
|
continue;
|
@@ -1420,14 +1748,7 @@ grpc_error* EdsResponseParse(
|
|
1420
1748
|
if (error != GRPC_ERROR_NONE) return error;
|
1421
1749
|
}
|
1422
1750
|
}
|
1423
|
-
|
1424
|
-
if (eds_update.priority_list_update.empty() &&
|
1425
|
-
!eds_update.drop_config->drop_all()) {
|
1426
|
-
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1427
|
-
"EDS response doesn't contain any valid "
|
1428
|
-
"locality but doesn't require to drop all calls.");
|
1429
|
-
}
|
1430
|
-
eds_update_map->emplace(std::string(cluster_name.data, cluster_name.size),
|
1751
|
+
eds_update_map->emplace(UpbStringToStdString(cluster_name),
|
1431
1752
|
std::move(eds_update));
|
1432
1753
|
}
|
1433
1754
|
return GRPC_ERROR_NONE;
|
@@ -1437,9 +1758,9 @@ grpc_error* EdsResponseParse(
|
|
1437
1758
|
|
1438
1759
|
grpc_error* XdsApi::ParseAdsResponse(
|
1439
1760
|
const grpc_slice& encoded_response, const std::string& expected_server_name,
|
1440
|
-
const std::
|
1441
|
-
const std::set<
|
1442
|
-
const std::set<
|
1761
|
+
const std::set<absl::string_view>& expected_route_configuration_names,
|
1762
|
+
const std::set<absl::string_view>& expected_cluster_names,
|
1763
|
+
const std::set<absl::string_view>& expected_eds_service_names,
|
1443
1764
|
absl::optional<LdsUpdate>* lds_update,
|
1444
1765
|
absl::optional<RdsUpdate>* rds_update, CdsUpdateMap* cds_update_map,
|
1445
1766
|
EdsUpdateMap* eds_update_map, std::string* version, std::string* nonce,
|
@@ -1460,19 +1781,19 @@ grpc_error* XdsApi::ParseAdsResponse(
|
|
1460
1781
|
// Record the type_url, the version_info, and the nonce of the response.
|
1461
1782
|
upb_strview type_url_strview =
|
1462
1783
|
envoy_api_v2_DiscoveryResponse_type_url(response);
|
1463
|
-
*type_url =
|
1784
|
+
*type_url = UpbStringToStdString(type_url_strview);
|
1464
1785
|
upb_strview version_info =
|
1465
1786
|
envoy_api_v2_DiscoveryResponse_version_info(response);
|
1466
|
-
*version =
|
1787
|
+
*version = UpbStringToStdString(version_info);
|
1467
1788
|
upb_strview nonce_strview = envoy_api_v2_DiscoveryResponse_nonce(response);
|
1468
|
-
*nonce =
|
1789
|
+
*nonce = UpbStringToStdString(nonce_strview);
|
1469
1790
|
// Parse the response according to the resource type.
|
1470
1791
|
if (*type_url == kLdsTypeUrl) {
|
1471
1792
|
return LdsResponseParse(client_, tracer_, response, expected_server_name,
|
1472
1793
|
lds_update, arena.ptr());
|
1473
1794
|
} else if (*type_url == kRdsTypeUrl) {
|
1474
1795
|
return RdsResponseParse(client_, tracer_, response, expected_server_name,
|
1475
|
-
|
1796
|
+
expected_route_configuration_names, rds_update,
|
1476
1797
|
arena.ptr());
|
1477
1798
|
} else if (*type_url == kCdsTypeUrl) {
|
1478
1799
|
return CdsResponseParse(client_, tracer_, response, expected_cluster_names,
|
@@ -1626,6 +1947,9 @@ grpc_slice XdsApi::CreateLrsInitialRequest(const std::string& server_name) {
|
|
1626
1947
|
arena.ptr());
|
1627
1948
|
PopulateNode(arena.ptr(), node_, build_version_, user_agent_name_,
|
1628
1949
|
server_name, node_msg);
|
1950
|
+
envoy_api_v2_core_Node_add_client_features(
|
1951
|
+
node_msg, upb_strview_makez("envoy.lrs.supports_send_all_clusters"),
|
1952
|
+
arena.ptr());
|
1629
1953
|
MaybeLogLrsRequest(client_, tracer_, request);
|
1630
1954
|
return SerializeLrsRequest(request, arena.ptr());
|
1631
1955
|
}
|
@@ -1744,6 +2068,7 @@ grpc_slice XdsApi::CreateLrsRequest(
|
|
1744
2068
|
}
|
1745
2069
|
|
1746
2070
|
grpc_error* XdsApi::ParseLrsResponse(const grpc_slice& encoded_response,
|
2071
|
+
bool* send_all_clusters,
|
1747
2072
|
std::set<std::string>* cluster_names,
|
1748
2073
|
grpc_millis* load_reporting_interval) {
|
1749
2074
|
upb::Arena arena;
|
@@ -1756,13 +2081,19 @@ grpc_error* XdsApi::ParseLrsResponse(const grpc_slice& encoded_response,
|
|
1756
2081
|
if (decoded_response == nullptr) {
|
1757
2082
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Can't decode response.");
|
1758
2083
|
}
|
1759
|
-
//
|
1760
|
-
|
1761
|
-
|
1762
|
-
|
1763
|
-
|
1764
|
-
|
1765
|
-
|
2084
|
+
// Check send_all_clusters.
|
2085
|
+
if (envoy_service_load_stats_v2_LoadStatsResponse_send_all_clusters(
|
2086
|
+
decoded_response)) {
|
2087
|
+
*send_all_clusters = true;
|
2088
|
+
} else {
|
2089
|
+
// Store the cluster names.
|
2090
|
+
size_t size;
|
2091
|
+
const upb_strview* clusters =
|
2092
|
+
envoy_service_load_stats_v2_LoadStatsResponse_clusters(decoded_response,
|
2093
|
+
&size);
|
2094
|
+
for (size_t i = 0; i < size; ++i) {
|
2095
|
+
cluster_names->emplace(clusters[i].data, clusters[i].size);
|
2096
|
+
}
|
1766
2097
|
}
|
1767
2098
|
// Get the load report interval.
|
1768
2099
|
const google_protobuf_Duration* load_reporting_interval_duration =
|