grpc 1.30.2 → 1.32.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +723 -15910
- data/include/grpc/grpc_security.h +31 -14
- data/include/grpc/grpc_security_constants.h +3 -0
- data/include/grpc/impl/codegen/README.md +22 -0
- data/include/grpc/impl/codegen/grpc_types.h +7 -5
- data/include/grpc/impl/codegen/port_platform.h +6 -33
- data/src/core/ext/filters/client_channel/backend_metric.cc +12 -9
- data/src/core/ext/filters/client_channel/backup_poller.cc +3 -2
- data/src/core/ext/filters/client_channel/client_channel.cc +470 -285
- data/src/core/ext/filters/client_channel/client_channel.h +1 -1
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +0 -3
- data/src/core/ext/filters/client_channel/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 +8 -1
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +8 -8
- data/src/core/ext/filters/client_channel/http_proxy.cc +6 -4
- data/src/core/ext/filters/client_channel/lb_policy.h +4 -0
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +6 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +59 -36
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +0 -13
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +0 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +1 -37
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +19 -13
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +29 -10
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +5 -4
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +4 -6
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +23 -13
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +18 -12
- data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +22 -14
- data/src/core/ext/filters/client_channel/lb_policy/xds/lrs.cc +18 -9
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +385 -78
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +4 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +5 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +6 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +8 -6
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +9 -7
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +7 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +36 -51
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +6 -2
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +383 -31
- data/src/core/ext/filters/client_channel/resolver_registry.cc +13 -14
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +6 -7
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +0 -1
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +38 -32
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +39 -20
- data/src/core/ext/filters/client_channel/server_address.cc +40 -7
- data/src/core/ext/filters/client_channel/server_address.h +42 -4
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +142 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +65 -24
- data/src/core/ext/filters/client_channel/subchannel.h +16 -4
- data/src/core/ext/filters/http/client/http_client_filter.cc +5 -5
- data/src/core/ext/filters/http/http_filters_plugin.cc +2 -1
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +74 -33
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.h +3 -1
- data/src/core/ext/filters/max_age/max_age_filter.cc +2 -1
- data/src/core/ext/filters/message_size/message_size_filter.cc +56 -80
- data/src/core/ext/filters/message_size/message_size_filter.h +6 -0
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +87 -31
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +18 -1
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +10 -35
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +378 -348
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +7 -2
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +3 -3
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +10 -16
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +9 -9
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +256 -279
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +23 -28
- 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_ping.cc +5 -6
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +12 -13
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +8 -9
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +9 -12
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +25 -29
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +13 -17
- data/src/core/ext/transport/chttp2/transport/internal.h +18 -1
- data/src/core/ext/transport/chttp2/transport/parsing.cc +34 -71
- data/src/core/ext/transport/chttp2/transport/writing.cc +15 -19
- data/src/core/ext/transport/inproc/inproc_transport.cc +47 -27
- 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/config/accesslog/v3/accesslog.upb.c +224 -0
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +700 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +74 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +226 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +380 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +1378 -0
- data/src/core/ext/upb-generated/envoy/{api/v2/cluster → config/cluster/v3}/filter.upb.c +8 -8
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +69 -0
- data/src/core/ext/upb-generated/envoy/{api/v2/cluster → config/cluster/v3}/outlier_detection.upb.c +8 -8
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +323 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +112 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +334 -0
- data/src/core/ext/upb-generated/envoy/{api/v2/core → config/core/v3}/backoff.upb.c +8 -8
- data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +79 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +309 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +869 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +96 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +328 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +71 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +195 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +634 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +170 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +684 -0
- data/src/core/ext/upb-generated/envoy/{api/v2/core → config/core/v3}/http_uri.upb.c +8 -8
- data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +80 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +152 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +536 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +28 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +58 -0
- data/src/core/ext/upb-generated/envoy/{api/v2/core → config/core/v3}/socket_option.upb.c +6 -6
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +88 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +91 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +220 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +91 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +273 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +112 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +332 -0
- data/src/core/ext/upb-generated/envoy/config/listener/{v2 → v3}/api_listener.upb.c +8 -8
- data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +65 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +108 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +401 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +138 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +490 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +41 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +94 -0
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +174 -0
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +599 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +63 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +204 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +773 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +2855 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +59 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +135 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +50 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +108 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +312 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +1125 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +20 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +34 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +111 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +401 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +72 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +198 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +105 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +388 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/cluster/v3}/cds.upb.c +5 -6
- data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.h +49 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/{v2 → v3}/ads.upb.c +5 -4
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +49 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +129 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +386 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/endpoint/v3}/eds.upb.c +5 -6
- data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.h +49 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/listener/v3}/lds.upb.c +5 -6
- data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.h +49 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +55 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +136 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/route/v3}/rds.upb.c +5 -6
- data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.h +49 -0
- data/src/core/ext/upb-generated/envoy/{api/v2 → service/route/v3}/srds.upb.c +5 -6
- data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.h +49 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +47 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +114 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +77 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +71 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +64 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +145 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +53 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +127 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +63 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +188 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +88 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +258 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +90 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +250 -0
- data/src/core/ext/upb-generated/envoy/type/{http.upb.c → v3/http.upb.c} +2 -2
- data/src/core/ext/upb-generated/envoy/type/{http.upb.h → v3/http.upb.h} +8 -9
- data/src/core/ext/upb-generated/envoy/type/{percent.upb.c → v3/percent.upb.c} +9 -8
- data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +86 -0
- data/src/core/ext/upb-generated/envoy/type/{range.upb.c → v3/range.upb.c} +12 -11
- data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +111 -0
- data/src/core/ext/upb-generated/envoy/type/{semantic_version.upb.c → v3/semantic_version.upb.c} +6 -5
- data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +61 -0
- data/src/core/ext/upb-generated/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/expr/v1alpha1/syntax.upb.c +234 -0
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +759 -0
- data/src/core/ext/upb-generated/google/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 +39 -39
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +412 -386
- 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 +34 -55
- 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.h +5 -6
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +27 -0
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +53 -0
- data/src/core/ext/upb-generated/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 +11 -11
- data/src/core/ext/upb-generated/validate/validate.upb.h +537 -536
- data/src/core/ext/xds/xds_api.cc +2388 -0
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_api.h +120 -40
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_bootstrap.cc +56 -25
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_bootstrap.h +8 -3
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_channel.h +4 -4
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_channel_args.h +3 -3
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_channel_secure.cc +2 -5
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_client.cc +94 -347
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_client.h +12 -45
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_client_stats.cc +2 -2
- data/src/core/ext/{filters/client_channel/xds → xds}/xds_client_stats.h +13 -13
- data/src/core/lib/channel/channel_trace.cc +2 -6
- data/src/core/lib/channel/channelz.cc +19 -30
- data/src/core/lib/channel/channelz.h +1 -1
- data/src/core/lib/channel/channelz_registry.cc +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/string.cc +10 -9
- data/src/core/lib/gpr/string.h +4 -2
- data/src/core/lib/gpr/sync_posix.cc +2 -8
- data/src/core/lib/gprpp/global_config_env.cc +8 -6
- data/src/core/lib/http/httpcli.cc +13 -10
- data/src/core/lib/http/httpcli_security_connector.cc +5 -5
- data/src/core/lib/iomgr/cfstream_handle.cc +1 -0
- data/src/core/lib/iomgr/endpoint.cc +5 -1
- data/src/core/lib/iomgr/endpoint.h +7 -3
- data/src/core/lib/iomgr/endpoint_cfstream.cc +32 -11
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +10 -10
- data/src/core/lib/iomgr/error_cfstream.cc +9 -8
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +5 -6
- data/src/core/lib/iomgr/ev_epollex_linux.cc +15 -21
- data/src/core/lib/iomgr/ev_poll_posix.cc +6 -5
- data/src/core/lib/iomgr/is_epollexclusive_available.cc +14 -0
- data/src/core/{ext/filters/client_channel → lib/iomgr}/parse_address.cc +1 -1
- data/src/core/{ext/filters/client_channel → lib/iomgr}/parse_address.h +3 -3
- data/src/core/lib/iomgr/port.h +1 -21
- data/src/core/lib/iomgr/resolve_address_custom.cc +13 -18
- data/src/core/lib/iomgr/resolve_address_windows.cc +8 -8
- data/src/core/lib/iomgr/resource_quota.cc +34 -31
- data/src/core/lib/iomgr/sockaddr_utils.cc +9 -6
- data/src/core/lib/iomgr/sockaddr_utils.h +3 -2
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +95 -55
- data/src/core/lib/iomgr/socket_windows.cc +4 -5
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +9 -11
- data/src/core/lib/iomgr/tcp_client_custom.cc +6 -9
- data/src/core/lib/iomgr/tcp_client_posix.cc +27 -36
- data/src/core/lib/iomgr/tcp_client_windows.cc +9 -9
- data/src/core/lib/iomgr/tcp_custom.cc +33 -17
- data/src/core/lib/iomgr/tcp_custom.h +1 -1
- data/src/core/lib/iomgr/tcp_posix.cc +31 -13
- 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 +6 -14
- data/src/core/lib/iomgr/tcp_server_posix.cc +34 -41
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -4
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -7
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +4 -9
- data/src/core/lib/iomgr/tcp_server_windows.cc +16 -16
- data/src/core/lib/iomgr/tcp_windows.cc +26 -10
- data/src/core/lib/iomgr/timer_generic.cc +13 -12
- data/src/core/lib/iomgr/udp_server.cc +24 -23
- 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_reader.cc +20 -21
- data/src/core/lib/security/authorization/authorization_engine.cc +177 -0
- data/src/core/lib/security/authorization/authorization_engine.h +84 -0
- data/src/core/lib/security/authorization/evaluate_args.cc +153 -0
- data/src/core/lib/security/authorization/evaluate_args.h +59 -0
- data/src/core/lib/security/authorization/mock_cel/activation.h +57 -0
- data/src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h +42 -0
- data/src/core/lib/security/authorization/mock_cel/cel_expression.h +68 -0
- data/src/core/lib/security/authorization/mock_cel/cel_value.h +93 -0
- data/src/core/lib/security/authorization/mock_cel/evaluator_core.h +67 -0
- data/src/core/lib/security/authorization/mock_cel/flat_expr_builder.h +56 -0
- data/src/core/lib/security/authorization/mock_cel/statusor.h +50 -0
- data/src/core/lib/security/credentials/credentials.h +5 -3
- 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 +64 -43
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +7 -4
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +19 -28
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +6 -6
- 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.h +10 -0
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +11 -12
- data/src/core/lib/security/security_connector/security_connector.cc +2 -0
- data/src/core/lib/security/security_connector/security_connector.h +1 -1
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +18 -11
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +5 -0
- data/src/core/lib/security/security_connector/ssl_utils.cc +44 -23
- data/src/core/lib/security/security_connector/ssl_utils.h +6 -2
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +27 -24
- data/src/core/lib/security/transport/client_auth_filter.cc +10 -9
- data/src/core/lib/security/transport/secure_endpoint.cc +7 -1
- 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_internal.h +1 -0
- data/src/core/lib/surface/call.cc +52 -53
- data/src/core/lib/surface/call.h +2 -1
- data/src/core/lib/surface/channel.cc +28 -20
- data/src/core/lib/surface/channel.h +12 -2
- data/src/core/lib/surface/completion_queue.cc +0 -5
- data/src/core/lib/surface/init.cc +1 -1
- data/src/core/lib/surface/server.cc +1102 -1347
- data/src/core/lib/surface/server.h +369 -71
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/authority_override.cc +38 -0
- data/src/core/lib/transport/authority_override.h +32 -0
- data/src/core/lib/transport/connectivity_state.cc +18 -13
- data/src/core/lib/transport/connectivity_state.h +18 -6
- data/src/core/lib/transport/error_utils.cc +13 -0
- data/src/core/lib/transport/error_utils.h +6 -0
- data/src/core/lib/transport/static_metadata.cc +295 -276
- data/src/core/lib/transport/static_metadata.h +80 -73
- data/src/core/lib/transport/transport.h +13 -0
- data/src/core/lib/uri/uri_parser.cc +30 -35
- data/src/core/lib/uri/uri_parser.h +3 -1
- data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +23 -13
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +24 -0
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +2 -0
- data/src/core/tsi/ssl_transport_security.cc +102 -11
- data/src/core/tsi/ssl_transport_security.h +14 -2
- data/src/core/tsi/transport_security_interface.h +5 -0
- data/src/ruby/bin/math_services_pb.rb +4 -4
- data/src/ruby/ext/grpc/extconf.rb +5 -2
- data/src/ruby/ext/grpc/rb_call.c +3 -2
- data/src/ruby/ext/grpc/rb_call.h +4 -0
- data/src/ruby/ext/grpc/rb_call_credentials.c +54 -10
- data/src/ruby/ext/grpc/rb_channel_credentials.c +9 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +4 -4
- data/src/ruby/lib/grpc/generic/client_stub.rb +1 -1
- data/src/ruby/lib/grpc/generic/interceptors.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +2 -2
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +5 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +28 -12
- data/src/ruby/spec/channel_credentials_spec.rb +10 -0
- data/src/ruby/spec/generic/active_call_spec.rb +19 -8
- data/src/ruby/spec/pb/codegen/grpc/testing/same_package_service_name.proto +27 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/same_ruby_package_service_name.proto +29 -0
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +20 -0
- data/src/ruby/spec/user_agent_spec.rb +74 -0
- data/third_party/abseil-cpp/absl/algorithm/container.h +1727 -0
- data/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +161 -0
- data/third_party/abseil-cpp/absl/base/internal/exponential_biased.cc +93 -0
- data/third_party/abseil-cpp/absl/base/internal/exponential_biased.h +130 -0
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +620 -0
- data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.h +126 -0
- data/third_party/abseil-cpp/absl/container/fixed_array.h +515 -0
- data/third_party/abseil-cpp/absl/container/flat_hash_set.h +503 -0
- data/third_party/abseil-cpp/absl/container/internal/common.h +202 -0
- data/third_party/abseil-cpp/absl/container/internal/container_memory.h +440 -0
- data/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h +146 -0
- data/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h +191 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtable_debug_hooks.h +85 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +269 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +297 -0
- data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc +30 -0
- data/third_party/abseil-cpp/absl/container/internal/have_sse.h +49 -0
- data/third_party/abseil-cpp/absl/container/internal/layout.h +741 -0
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +48 -0
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +1882 -0
- data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc +138 -0
- data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.h +32 -0
- data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +1895 -0
- data/third_party/abseil-cpp/absl/debugging/internal/demangle.h +71 -0
- data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc +382 -0
- data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h +134 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +192 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_arm-inl.inc +125 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h +70 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc +99 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +248 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_unimplemented-inl.inc +24 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_win32-inl.inc +85 -0
- data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +346 -0
- data/third_party/abseil-cpp/absl/debugging/internal/symbolize.h +128 -0
- data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc +194 -0
- data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.h +158 -0
- data/third_party/abseil-cpp/absl/debugging/stacktrace.cc +140 -0
- data/third_party/abseil-cpp/absl/debugging/stacktrace.h +231 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize.cc +25 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize.h +99 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +1480 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize_unimplemented.inc +40 -0
- data/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc +81 -0
- data/third_party/abseil-cpp/absl/functional/function_ref.h +139 -0
- data/third_party/abseil-cpp/absl/functional/internal/function_ref.h +106 -0
- data/third_party/abseil-cpp/absl/hash/hash.h +324 -0
- data/third_party/abseil-cpp/absl/hash/internal/city.cc +346 -0
- data/third_party/abseil-cpp/absl/hash/internal/city.h +96 -0
- data/third_party/abseil-cpp/absl/hash/internal/hash.cc +55 -0
- data/third_party/abseil-cpp/absl/hash/internal/hash.h +988 -0
- data/third_party/abseil-cpp/absl/status/status.cc +447 -0
- data/third_party/abseil-cpp/absl/status/status.h +428 -0
- data/third_party/abseil-cpp/absl/status/status_payload_printer.cc +43 -0
- data/third_party/abseil-cpp/absl/status/status_payload_printer.h +51 -0
- data/third_party/abseil-cpp/absl/strings/cord.cc +2019 -0
- data/third_party/abseil-cpp/absl/strings/cord.h +1121 -0
- data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +151 -0
- data/third_party/abseil-cpp/absl/synchronization/barrier.cc +52 -0
- data/third_party/abseil-cpp/absl/synchronization/barrier.h +79 -0
- data/third_party/abseil-cpp/absl/synchronization/blocking_counter.cc +57 -0
- data/third_party/abseil-cpp/absl/synchronization/blocking_counter.h +99 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc +140 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.h +60 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +697 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.h +141 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +155 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/mutex_nonprod.inc +261 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc +106 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.h +115 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc +484 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/waiter.h +159 -0
- data/third_party/abseil-cpp/absl/synchronization/mutex.cc +2728 -0
- data/third_party/abseil-cpp/absl/synchronization/mutex.h +1056 -0
- data/third_party/abseil-cpp/absl/synchronization/notification.cc +78 -0
- data/third_party/abseil-cpp/absl/synchronization/notification.h +123 -0
- data/third_party/abseil-cpp/absl/types/bad_variant_access.cc +64 -0
- data/third_party/abseil-cpp/absl/types/bad_variant_access.h +82 -0
- data/third_party/abseil-cpp/absl/types/internal/variant.h +1646 -0
- data/third_party/abseil-cpp/absl/types/variant.h +861 -0
- data/third_party/boringssl-with-bazel/err_data.c +266 -254
- 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/tls_cbc.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +12 -52
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +0 -22
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +159 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/mode_wrappers.c +17 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +11 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +13 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64.c +24 -23
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +20 -16
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/util.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +62 -0
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +456 -0
- data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +192 -0
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +29 -15
- 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/trust_token/internal.h +0 -29
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +116 -363
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +7 -45
- 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 +41 -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 +28 -9
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +25 -0
- 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_sig.c +20 -0
- 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/arm_arch.h +52 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +22 -22
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +2 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +69 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +72 -23
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +2 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +1 -10
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +800 -715
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +3 -3
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +9 -2
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +9 -0
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +21 -14
- data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +7 -7
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +3 -6
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +38 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +4 -24
- data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +5 -5
- data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +45 -24
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +34 -9
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +31 -21
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +17 -9
- data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +5 -3
- 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 +517 -505
- data/third_party/upb/upb/encode.c +165 -123
- 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 -86
- data/third_party/upb/upb/table.int.h +11 -52
- data/third_party/upb/upb/upb.c +151 -125
- data/third_party/upb/upb/upb.h +91 -147
- data/third_party/upb/upb/upb.hpp +88 -0
- metadata +308 -148
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +0 -1906
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +0 -21
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +0 -35
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.c +0 -114
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +0 -418
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.c +0 -72
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +0 -197
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.c +0 -105
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +0 -378
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +0 -53
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +0 -403
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +0 -1447
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +0 -74
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +0 -218
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +0 -69
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +0 -305
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +0 -112
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +0 -328
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +0 -78
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +0 -313
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +0 -897
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +0 -96
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +0 -322
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.c +0 -34
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +0 -72
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +0 -197
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +0 -642
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +0 -172
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +0 -673
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +0 -80
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +0 -152
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +0 -518
- data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +0 -89
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +0 -129
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +0 -392
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +0 -53
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +0 -92
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +0 -240
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +0 -18
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +0 -33
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +0 -91
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +0 -266
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +0 -112
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +0 -324
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +0 -53
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +0 -109
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +0 -399
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +0 -18
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +0 -33
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +0 -145
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +0 -527
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +0 -43
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +0 -112
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +0 -53
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +0 -63
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +0 -199
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +0 -18
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +0 -33
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +0 -815
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +0 -3032
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +0 -59
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +0 -134
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +0 -53
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +0 -228
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +0 -725
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +0 -316
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +0 -1132
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +0 -65
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.c +0 -51
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +0 -125
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +0 -50
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +0 -54
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +0 -134
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +0 -63
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +0 -144
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +0 -53
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +0 -133
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +0 -88
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +0 -258
- data/src/core/ext/upb-generated/envoy/type/percent.upb.h +0 -87
- data/src/core/ext/upb-generated/envoy/type/range.upb.h +0 -112
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +0 -62
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +0 -89
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +0 -249
- data/src/core/lib/security/transport/target_authority_table.cc +0 -75
- data/src/core/lib/security/transport/target_authority_table.h +0 -40
- data/src/core/lib/slice/slice_hash_table.h +0 -199
- data/src/core/lib/slice/slice_weak_hash_table.h +0 -102
- data/third_party/upb/upb/generated_util.h +0 -105
@@ -119,6 +119,18 @@ GRPCAPI void grpc_ssl_session_cache_destroy(grpc_ssl_session_cache* cache);
|
|
119
119
|
GRPCAPI grpc_arg
|
120
120
|
grpc_ssl_session_cache_create_channel_arg(grpc_ssl_session_cache* cache);
|
121
121
|
|
122
|
+
/** --- grpc_call_credentials object.
|
123
|
+
|
124
|
+
A call credentials object represents a way to authenticate on a particular
|
125
|
+
call. These credentials can be composed with a channel credentials object
|
126
|
+
so that they are sent with every call on this channel. */
|
127
|
+
|
128
|
+
typedef struct grpc_call_credentials grpc_call_credentials;
|
129
|
+
|
130
|
+
/** Releases a call credentials object.
|
131
|
+
The creator of the credentials object is responsible for its release. */
|
132
|
+
GRPCAPI void grpc_call_credentials_release(grpc_call_credentials* creds);
|
133
|
+
|
122
134
|
/** --- grpc_channel_credentials object. ---
|
123
135
|
|
124
136
|
A channel credentials object represents a way to authenticate a client on a
|
@@ -133,8 +145,23 @@ GRPCAPI void grpc_channel_credentials_release(grpc_channel_credentials* creds);
|
|
133
145
|
/** Creates default credentials to connect to a google gRPC service.
|
134
146
|
WARNING: Do NOT use this credentials to connect to a non-google service as
|
135
147
|
this could result in an oauth2 token leak. The security level of the
|
136
|
-
resulting connection is GRPC_PRIVACY_AND_INTEGRITY.
|
137
|
-
|
148
|
+
resulting connection is GRPC_PRIVACY_AND_INTEGRITY.
|
149
|
+
|
150
|
+
If specified, the supplied call credentials object will be attached to the
|
151
|
+
returned channel credentials object. The call_credentials object must remain
|
152
|
+
valid throughout the lifetime of the returned grpc_channel_credentials
|
153
|
+
object. It is expected that the call credentials object was generated
|
154
|
+
according to the Application Default Credentials mechanism and asserts the
|
155
|
+
identity of the default service account of the machine. Supplying any other
|
156
|
+
sort of call credential will result in undefined behavior, up to and
|
157
|
+
including the sudden and unexpected failure of RPCs.
|
158
|
+
|
159
|
+
If nullptr is supplied, the returned channel credentials object will use a
|
160
|
+
call credentials object based on the Application Default Credentials
|
161
|
+
mechanism.
|
162
|
+
*/
|
163
|
+
GRPCAPI grpc_channel_credentials* grpc_google_default_credentials_create(
|
164
|
+
grpc_call_credentials* call_credentials);
|
138
165
|
|
139
166
|
/** Callback for getting the SSL roots override from the application.
|
140
167
|
In case of success, *pem_roots_certs must be set to a NULL terminated string
|
@@ -272,24 +299,14 @@ GRPCAPI grpc_channel_credentials* grpc_ssl_credentials_create_ex(
|
|
272
299
|
const char* pem_root_certs, grpc_ssl_pem_key_cert_pair* pem_key_cert_pair,
|
273
300
|
const grpc_ssl_verify_peer_options* verify_options, void* reserved);
|
274
301
|
|
275
|
-
/** --- grpc_call_credentials object.
|
276
|
-
|
277
|
-
A call credentials object represents a way to authenticate on a particular
|
278
|
-
call. These credentials can be composed with a channel credentials object
|
279
|
-
so that they are sent with every call on this channel. */
|
280
|
-
|
281
|
-
typedef struct grpc_call_credentials grpc_call_credentials;
|
282
|
-
|
283
|
-
/** Releases a call credentials object.
|
284
|
-
The creator of the credentials object is responsible for its release. */
|
285
|
-
GRPCAPI void grpc_call_credentials_release(grpc_call_credentials* creds);
|
286
|
-
|
287
302
|
/** Creates a composite channel credentials object. The security level of
|
288
303
|
* resulting connection is determined by channel_creds. */
|
289
304
|
GRPCAPI grpc_channel_credentials* grpc_composite_channel_credentials_create(
|
290
305
|
grpc_channel_credentials* channel_creds, grpc_call_credentials* call_creds,
|
291
306
|
void* reserved);
|
292
307
|
|
308
|
+
/** --- composite credentials. */
|
309
|
+
|
293
310
|
/** Creates a composite call credentials object. */
|
294
311
|
GRPCAPI grpc_call_credentials* grpc_composite_call_credentials_create(
|
295
312
|
grpc_call_credentials* creds1, grpc_call_credentials* creds2,
|
@@ -139,6 +139,9 @@ typedef enum {
|
|
139
139
|
*/
|
140
140
|
typedef enum { UDS = 0, LOCAL_TCP } grpc_local_connect_type;
|
141
141
|
|
142
|
+
/** The TLS versions that are supported by the SSL stack. **/
|
143
|
+
typedef enum { TLS1_2, TLS1_3 } grpc_tls_version;
|
144
|
+
|
142
145
|
#ifdef __cplusplus
|
143
146
|
}
|
144
147
|
#endif
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Welcome to `include/grpc/impl/codegen`
|
2
|
+
|
3
|
+
## Why is this directory here?
|
4
|
+
|
5
|
+
This directory exists so that generated C++ code can include selected files upon
|
6
|
+
which it depends without having to depend on the entire gRPC C++ library. This
|
7
|
+
directory thus exists to support `include/grpcpp/impl/codegen`. This constraint
|
8
|
+
is particularly relevant for users of bazel, particularly if they use the
|
9
|
+
multi-lingual `proto_library` target type. Generated code that uses this target
|
10
|
+
only depends on the gRPC C++ targets associated with these header files, not the
|
11
|
+
entire gRPC C++ codebase since that would make the build time of these types of
|
12
|
+
targets excessively large (particularly when they are not even C++ specific).
|
13
|
+
|
14
|
+
## What should user code do?
|
15
|
+
|
16
|
+
User code should *not* include anything from this directory. Only generated code
|
17
|
+
and gRPC library code should include contents from this directory. C++ user code
|
18
|
+
should instead include contents from the main `grpcpp` directory or its
|
19
|
+
accessible subcomponents like `grpcpp/support`. It is possible that we may
|
20
|
+
remove this directory altogether if the motivations for its existence are no
|
21
|
+
longer strong enough (e.g., if the gRPC C++ library no longer has a need for an
|
22
|
+
`impl/codegen` directory of its own).
|
@@ -203,18 +203,18 @@ typedef struct {
|
|
203
203
|
/** Should BDP probing be performed? */
|
204
204
|
#define GRPC_ARG_HTTP2_BDP_PROBE "grpc.http2.bdp_probe"
|
205
205
|
/** Minimum time between sending successive ping frames without receiving any
|
206
|
-
data/header
|
206
|
+
data/header frame, Int valued, milliseconds. */
|
207
207
|
#define GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS \
|
208
208
|
"grpc.http2.min_time_between_pings_ms"
|
209
209
|
/** Minimum allowed time between a server receiving successive ping frames
|
210
|
-
without sending any data/header
|
210
|
+
without sending any data/header frame. Int valued, milliseconds
|
211
211
|
*/
|
212
212
|
#define GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS \
|
213
213
|
"grpc.http2.min_ping_interval_without_data_ms"
|
214
214
|
/** Channel arg to override the http2 :scheme header */
|
215
215
|
#define GRPC_ARG_HTTP2_SCHEME "grpc.http2_scheme"
|
216
216
|
/** How many pings can we send before needing to send a
|
217
|
-
data/header
|
217
|
+
data/header frame? (0 indicates that an infinite number of
|
218
218
|
pings can be sent without sending a data frame or header frame) */
|
219
219
|
#define GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA \
|
220
220
|
"grpc.http2.max_pings_without_data"
|
@@ -674,8 +674,10 @@ typedef struct grpc_op {
|
|
674
674
|
const char** error_string;
|
675
675
|
} recv_status_on_client;
|
676
676
|
struct grpc_op_recv_close_on_server {
|
677
|
-
/** out argument, set to 1 if the call failed
|
678
|
-
|
677
|
+
/** out argument, set to 1 if the call failed at the server for
|
678
|
+
a reason other than a non-OK status (cancel, deadline
|
679
|
+
exceeded, network failure, etc.), 0 otherwise (RPC processing ran to
|
680
|
+
completion and was able to provide any status from the server) */
|
679
681
|
int* cancelled;
|
680
682
|
} recv_close_on_server;
|
681
683
|
} data;
|
@@ -27,19 +27,17 @@
|
|
27
27
|
* - some syscalls to be made directly
|
28
28
|
*/
|
29
29
|
|
30
|
-
/*
|
31
|
-
* Defines GRPC_USE_ABSL to use Abseil Common Libraries (C++)
|
32
|
-
*/
|
33
|
-
#ifndef GRPC_USE_ABSL
|
34
|
-
#define GRPC_USE_ABSL 1
|
35
|
-
#endif
|
36
|
-
|
37
30
|
/*
|
38
31
|
* Defines GPR_ABSEIL_SYNC to use synchronization features from Abseil
|
39
32
|
*/
|
40
33
|
#ifndef GPR_ABSEIL_SYNC
|
41
|
-
|
34
|
+
#if defined(__APPLE__)
|
35
|
+
// This is disabled on Apple platforms because macos/grpc_basictests_c_cpp
|
36
|
+
// fails with this. https://github.com/grpc/grpc/issues/23661
|
37
|
+
#else
|
38
|
+
#define GPR_ABSEIL_SYNC 1
|
42
39
|
#endif
|
40
|
+
#endif // GPR_ABSEIL_SYNC
|
43
41
|
|
44
42
|
/* Get windows.h included everywhere (we need it) */
|
45
43
|
#if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
|
@@ -112,31 +110,6 @@
|
|
112
110
|
#define GPR_WINDOWS_ATOMIC 1
|
113
111
|
#define GPR_MSVC_TLS 1
|
114
112
|
#endif
|
115
|
-
#elif defined(GPR_MANYLINUX1)
|
116
|
-
// TODO(atash): manylinux1 is just another __linux__ but with ancient
|
117
|
-
// libraries; it should be integrated with the `__linux__` definitions below.
|
118
|
-
#define GPR_PLATFORM_STRING "manylinux"
|
119
|
-
#define GPR_POSIX_CRASH_HANDLER 1
|
120
|
-
#define GPR_CPU_POSIX 1
|
121
|
-
#define GPR_GCC_ATOMIC 1
|
122
|
-
#define GPR_GCC_TLS 1
|
123
|
-
#define GPR_LINUX 1
|
124
|
-
#define GPR_LINUX_LOG 1
|
125
|
-
#define GPR_SUPPORT_CHANNELS_FROM_FD 1
|
126
|
-
#define GPR_LINUX_ENV 1
|
127
|
-
#define GPR_POSIX_TMPFILE 1
|
128
|
-
#define GPR_POSIX_STRING 1
|
129
|
-
#define GPR_POSIX_SUBPROCESS 1
|
130
|
-
#define GPR_POSIX_SYNC 1
|
131
|
-
#define GPR_POSIX_TIME 1
|
132
|
-
#define GPR_HAS_PTHREAD_H 1
|
133
|
-
#define GPR_GETPID_IN_UNISTD_H 1
|
134
|
-
#ifdef _LP64
|
135
|
-
#define GPR_ARCH_64 1
|
136
|
-
#else /* _LP64 */
|
137
|
-
#define GPR_ARCH_32 1
|
138
|
-
#endif /* _LP64 */
|
139
|
-
#include <linux/version.h>
|
140
113
|
#elif defined(ANDROID) || defined(__ANDROID__)
|
141
114
|
#define GPR_PLATFORM_STRING "android"
|
142
115
|
#define GPR_ANDROID 1
|
@@ -21,6 +21,7 @@
|
|
21
21
|
#include "absl/strings/string_view.h"
|
22
22
|
|
23
23
|
#include "udpa/data/orca/v1/orca_load_report.upb.h"
|
24
|
+
#include "upb/upb.hpp"
|
24
25
|
|
25
26
|
#include "src/core/lib/gprpp/map.h"
|
26
27
|
|
@@ -31,17 +32,19 @@ namespace {
|
|
31
32
|
template <typename EntryType>
|
32
33
|
std::map<absl::string_view, double, StringLess> ParseMap(
|
33
34
|
udpa_data_orca_v1_OrcaLoadReport* msg,
|
34
|
-
EntryType
|
35
|
+
const EntryType* (*entry_func)(const udpa_data_orca_v1_OrcaLoadReport*,
|
36
|
+
size_t*),
|
35
37
|
upb_strview (*key_func)(const EntryType*),
|
36
38
|
double (*value_func)(const EntryType*), Arena* arena) {
|
37
39
|
std::map<absl::string_view, double, StringLess> result;
|
38
|
-
size_t
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
size_t i = UPB_MAP_BEGIN;
|
41
|
+
while (true) {
|
42
|
+
const auto* entry = entry_func(msg, &i);
|
43
|
+
if (entry == nullptr) break;
|
44
|
+
upb_strview key_view = key_func(entry);
|
45
|
+
char* key = static_cast<char*>(arena->Alloc(key_view.size));
|
43
46
|
memcpy(key, key_view.data, key_view.size);
|
44
|
-
result[absl::string_view(key, key_view.size)] = value_func(
|
47
|
+
result[absl::string_view(key, key_view.size)] = value_func(entry);
|
45
48
|
}
|
46
49
|
return result;
|
47
50
|
}
|
@@ -67,12 +70,12 @@ const LoadBalancingPolicy::BackendMetricData* ParseBackendMetricData(
|
|
67
70
|
udpa_data_orca_v1_OrcaLoadReport_rps(msg);
|
68
71
|
backend_metric_data->request_cost =
|
69
72
|
ParseMap<udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry>(
|
70
|
-
msg,
|
73
|
+
msg, udpa_data_orca_v1_OrcaLoadReport_request_cost_next,
|
71
74
|
udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_key,
|
72
75
|
udpa_data_orca_v1_OrcaLoadReport_RequestCostEntry_value, arena);
|
73
76
|
backend_metric_data->utilization =
|
74
77
|
ParseMap<udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry>(
|
75
|
-
msg,
|
78
|
+
msg, udpa_data_orca_v1_OrcaLoadReport_utilization_next,
|
76
79
|
udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_key,
|
77
80
|
udpa_data_orca_v1_OrcaLoadReport_UtilizationEntry_value, arena);
|
78
81
|
return backend_metric_data;
|
@@ -106,6 +106,7 @@ static void g_poller_unref() {
|
|
106
106
|
grpc_schedule_on_exec_ctx));
|
107
107
|
gpr_mu_unlock(p->pollset_mu);
|
108
108
|
grpc_timer_cancel(&p->polling_timer);
|
109
|
+
backup_poller_shutdown_unref(p);
|
109
110
|
} else {
|
110
111
|
gpr_mu_unlock(&g_poller_mu);
|
111
112
|
}
|
@@ -143,8 +144,8 @@ static void g_poller_init_locked() {
|
|
143
144
|
g_poller->shutting_down = false;
|
144
145
|
grpc_pollset_init(g_poller->pollset, &g_poller->pollset_mu);
|
145
146
|
gpr_ref_init(&g_poller->refs, 0);
|
146
|
-
// one for timer cancellation, one for pollset shutdown
|
147
|
-
gpr_ref_init(&g_poller->shutdown_refs,
|
147
|
+
// one for timer cancellation, one for pollset shutdown, one for g_poller
|
148
|
+
gpr_ref_init(&g_poller->shutdown_refs, 3);
|
148
149
|
GRPC_CLOSURE_INIT(&g_poller->run_poller_closure, run_poller, g_poller,
|
149
150
|
grpc_schedule_on_exec_ctx);
|
150
151
|
grpc_timer_init(&g_poller->polling_timer,
|
@@ -28,6 +28,8 @@
|
|
28
28
|
|
29
29
|
#include <set>
|
30
30
|
|
31
|
+
#include "absl/strings/numbers.h"
|
32
|
+
#include "absl/strings/str_cat.h"
|
31
33
|
#include "absl/strings/string_view.h"
|
32
34
|
|
33
35
|
#include <grpc/support/alloc.h>
|
@@ -40,6 +42,7 @@
|
|
40
42
|
|
41
43
|
#include "src/core/ext/filters/client_channel/backend_metric.h"
|
42
44
|
#include "src/core/ext/filters/client_channel/backup_poller.h"
|
45
|
+
#include "src/core/ext/filters/client_channel/config_selector.h"
|
43
46
|
#include "src/core/ext/filters/client_channel/global_subchannel_pool.h"
|
44
47
|
#include "src/core/ext/filters/client_channel/http_connect_handshaker.h"
|
45
48
|
#include "src/core/ext/filters/client_channel/lb_policy_registry.h"
|
@@ -149,12 +152,16 @@ class ChannelData {
|
|
149
152
|
bool received_service_config_data() const {
|
150
153
|
return received_service_config_data_;
|
151
154
|
}
|
155
|
+
grpc_error* resolver_transient_failure_error() const {
|
156
|
+
return resolver_transient_failure_error_;
|
157
|
+
}
|
152
158
|
RefCountedPtr<ServerRetryThrottleData> retry_throttle_data() const {
|
153
159
|
return retry_throttle_data_;
|
154
160
|
}
|
155
161
|
RefCountedPtr<ServiceConfig> service_config() const {
|
156
162
|
return service_config_;
|
157
163
|
}
|
164
|
+
ConfigSelector* config_selector() const { return config_selector_.get(); }
|
158
165
|
WorkSerializer* work_serializer() const { return work_serializer_.get(); }
|
159
166
|
|
160
167
|
RefCountedPtr<ConnectedSubchannel> GetConnectedSubchannelInDataPlane(
|
@@ -166,29 +173,14 @@ class ChannelData {
|
|
166
173
|
grpc_connectivity_state* state,
|
167
174
|
grpc_closure* on_complete,
|
168
175
|
grpc_closure* watcher_timer_init) {
|
169
|
-
|
170
|
-
|
171
|
-
{
|
172
|
-
MutexLock lock(&external_watchers_mu_);
|
173
|
-
// Will be deleted when the watch is complete.
|
174
|
-
GPR_ASSERT(external_watchers_[on_complete] == nullptr);
|
175
|
-
external_watchers_[on_complete] = watcher;
|
176
|
-
}
|
177
|
-
watcher->Start();
|
176
|
+
new ExternalConnectivityWatcher(this, pollent, state, on_complete,
|
177
|
+
watcher_timer_init);
|
178
178
|
}
|
179
179
|
|
180
180
|
void RemoveExternalConnectivityWatcher(grpc_closure* on_complete,
|
181
181
|
bool cancel) {
|
182
|
-
ExternalConnectivityWatcher
|
183
|
-
|
184
|
-
MutexLock lock(&external_watchers_mu_);
|
185
|
-
auto it = external_watchers_.find(on_complete);
|
186
|
-
if (it != external_watchers_.end()) {
|
187
|
-
watcher = it->second;
|
188
|
-
external_watchers_.erase(it);
|
189
|
-
}
|
190
|
-
}
|
191
|
-
if (watcher != nullptr && cancel) watcher->Cancel();
|
182
|
+
ExternalConnectivityWatcher::RemoveWatcherFromExternalWatchersMap(
|
183
|
+
this, on_complete, cancel);
|
192
184
|
}
|
193
185
|
|
194
186
|
int NumExternalConnectivityWatchers() const {
|
@@ -219,13 +211,19 @@ class ChannelData {
|
|
219
211
|
|
220
212
|
~ExternalConnectivityWatcher();
|
221
213
|
|
222
|
-
|
214
|
+
// Removes the watcher from the external_watchers_ map.
|
215
|
+
static void RemoveWatcherFromExternalWatchersMap(ChannelData* chand,
|
216
|
+
grpc_closure* on_complete,
|
217
|
+
bool cancel);
|
223
218
|
|
224
|
-
void Notify(grpc_connectivity_state state
|
219
|
+
void Notify(grpc_connectivity_state state,
|
220
|
+
const absl::Status& /* status */) override;
|
225
221
|
|
226
222
|
void Cancel();
|
227
223
|
|
228
224
|
private:
|
225
|
+
// Adds the watcher to state_tracker_. Consumes the ref that is passed to it
|
226
|
+
// from Start().
|
229
227
|
void AddWatcherLocked();
|
230
228
|
void RemoveWatcherLocked();
|
231
229
|
|
@@ -238,37 +236,51 @@ class ChannelData {
|
|
238
236
|
Atomic<bool> done_{false};
|
239
237
|
};
|
240
238
|
|
239
|
+
class ChannelConfigHelper
|
240
|
+
: public ResolvingLoadBalancingPolicy::ChannelConfigHelper {
|
241
|
+
public:
|
242
|
+
explicit ChannelConfigHelper(ChannelData* chand) : chand_(chand) {}
|
243
|
+
|
244
|
+
ApplyServiceConfigResult ApplyServiceConfig(
|
245
|
+
const Resolver::Result& result) override;
|
246
|
+
|
247
|
+
void ApplyConfigSelector(
|
248
|
+
bool service_config_changed,
|
249
|
+
RefCountedPtr<ConfigSelector> config_selector) override;
|
250
|
+
|
251
|
+
void ResolverTransientFailure(grpc_error* error) override;
|
252
|
+
|
253
|
+
private:
|
254
|
+
static void ProcessLbPolicy(
|
255
|
+
const Resolver::Result& resolver_result,
|
256
|
+
const internal::ClientChannelGlobalParsedConfig* parsed_service_config,
|
257
|
+
RefCountedPtr<LoadBalancingPolicy::Config>* lb_policy_config);
|
258
|
+
|
259
|
+
ChannelData* chand_;
|
260
|
+
};
|
261
|
+
|
241
262
|
ChannelData(grpc_channel_element_args* args, grpc_error** error);
|
242
263
|
~ChannelData();
|
243
264
|
|
244
265
|
void UpdateStateAndPickerLocked(
|
245
|
-
grpc_connectivity_state state, const
|
266
|
+
grpc_connectivity_state state, const absl::Status& status,
|
267
|
+
const char* reason,
|
246
268
|
std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker);
|
247
269
|
|
248
|
-
void
|
249
|
-
|
250
|
-
RefCountedPtr<
|
270
|
+
void UpdateServiceConfigInDataPlaneLocked(
|
271
|
+
bool service_config_changed,
|
272
|
+
RefCountedPtr<ConfigSelector> config_selector);
|
251
273
|
|
252
274
|
void CreateResolvingLoadBalancingPolicyLocked();
|
253
275
|
|
254
276
|
void DestroyResolvingLoadBalancingPolicyLocked();
|
255
277
|
|
256
|
-
static bool ProcessResolverResultLocked(
|
257
|
-
void* arg, const Resolver::Result& result,
|
258
|
-
RefCountedPtr<LoadBalancingPolicy::Config>* lb_policy_config,
|
259
|
-
grpc_error** service_config_error, bool* no_valid_service_config);
|
260
|
-
|
261
278
|
grpc_error* DoPingLocked(grpc_transport_op* op);
|
262
279
|
|
263
280
|
void StartTransportOpLocked(grpc_transport_op* op);
|
264
281
|
|
265
282
|
void TryToConnectLocked();
|
266
283
|
|
267
|
-
void ProcessLbPolicy(
|
268
|
-
const Resolver::Result& resolver_result,
|
269
|
-
const internal::ClientChannelGlobalParsedConfig* parsed_service_config,
|
270
|
-
RefCountedPtr<LoadBalancingPolicy::Config>* lb_policy_config);
|
271
|
-
|
272
284
|
//
|
273
285
|
// Fields set at construction and never modified.
|
274
286
|
//
|
@@ -282,6 +294,7 @@ class ChannelData {
|
|
282
294
|
grpc_core::UniquePtr<char> server_name_;
|
283
295
|
grpc_core::UniquePtr<char> target_uri_;
|
284
296
|
channelz::ChannelNode* channelz_node_;
|
297
|
+
ChannelConfigHelper channel_config_helper_;
|
285
298
|
|
286
299
|
//
|
287
300
|
// Fields used in the data plane. Guarded by data_plane_mu.
|
@@ -290,9 +303,11 @@ class ChannelData {
|
|
290
303
|
std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker_;
|
291
304
|
QueuedPick* queued_picks_ = nullptr; // Linked list of queued picks.
|
292
305
|
// Data from service config.
|
306
|
+
grpc_error* resolver_transient_failure_error_ = GRPC_ERROR_NONE;
|
293
307
|
bool received_service_config_data_ = false;
|
294
308
|
RefCountedPtr<ServerRetryThrottleData> retry_throttle_data_;
|
295
309
|
RefCountedPtr<ServiceConfig> service_config_;
|
310
|
+
RefCountedPtr<ConfigSelector> config_selector_;
|
296
311
|
|
297
312
|
//
|
298
313
|
// Fields used in the control plane. Guarded by work_serializer.
|
@@ -304,6 +319,7 @@ class ChannelData {
|
|
304
319
|
ConnectivityStateTracker state_tracker_;
|
305
320
|
grpc_core::UniquePtr<char> health_check_service_name_;
|
306
321
|
RefCountedPtr<ServiceConfig> saved_service_config_;
|
322
|
+
RefCountedPtr<ConfigSelector> saved_config_selector_;
|
307
323
|
bool received_first_resolver_result_ = false;
|
308
324
|
// The number of SubchannelWrapper instances referencing a given Subchannel.
|
309
325
|
std::map<Subchannel*, int> subchannel_refcount_map_;
|
@@ -316,6 +332,7 @@ class ChannelData {
|
|
316
332
|
// applied in the data plane mutex when the picker is updated.
|
317
333
|
std::map<RefCountedPtr<SubchannelWrapper>, RefCountedPtr<ConnectedSubchannel>>
|
318
334
|
pending_subchannel_updates_;
|
335
|
+
int keepalive_time_ = -1;
|
319
336
|
|
320
337
|
//
|
321
338
|
// Fields accessed from both data plane mutex and control plane
|
@@ -336,7 +353,8 @@ class ChannelData {
|
|
336
353
|
// synchronously via grpc_channel_num_external_connectivity_watchers().
|
337
354
|
//
|
338
355
|
mutable Mutex external_watchers_mu_;
|
339
|
-
std::map<grpc_closure*, ExternalConnectivityWatcher
|
356
|
+
std::map<grpc_closure*, RefCountedPtr<ExternalConnectivityWatcher>>
|
357
|
+
external_watchers_;
|
340
358
|
};
|
341
359
|
|
342
360
|
//
|
@@ -356,9 +374,6 @@ class CallData {
|
|
356
374
|
|
357
375
|
RefCountedPtr<SubchannelCall> subchannel_call() { return subchannel_call_; }
|
358
376
|
|
359
|
-
// Invoked by channel for queued picks once resolver results are available.
|
360
|
-
void MaybeApplyServiceConfigToCallLocked(grpc_call_element* elem);
|
361
|
-
|
362
377
|
// Invoked by channel for queued picks when the picker is updated.
|
363
378
|
static void PickSubchannel(void* arg, grpc_error* error);
|
364
379
|
|
@@ -392,7 +407,8 @@ class CallData {
|
|
392
407
|
iterator begin() const override {
|
393
408
|
static_assert(sizeof(grpc_linked_mdelem*) <= sizeof(intptr_t),
|
394
409
|
"iterator size too large");
|
395
|
-
return iterator(
|
410
|
+
return iterator(
|
411
|
+
this, reinterpret_cast<intptr_t>(MaybeSkipEntry(batch_->list.head)));
|
396
412
|
}
|
397
413
|
iterator end() const override {
|
398
414
|
static_assert(sizeof(grpc_linked_mdelem*) <= sizeof(intptr_t),
|
@@ -409,11 +425,19 @@ class CallData {
|
|
409
425
|
}
|
410
426
|
|
411
427
|
private:
|
428
|
+
grpc_linked_mdelem* MaybeSkipEntry(grpc_linked_mdelem* entry) const {
|
429
|
+
if (entry != nullptr && batch_->idx.named.path == entry) {
|
430
|
+
return entry->next;
|
431
|
+
}
|
432
|
+
return entry;
|
433
|
+
}
|
434
|
+
|
412
435
|
intptr_t IteratorHandleNext(intptr_t handle) const override {
|
413
436
|
grpc_linked_mdelem* linked_mdelem =
|
414
437
|
reinterpret_cast<grpc_linked_mdelem*>(handle);
|
415
|
-
return reinterpret_cast<intptr_t>(linked_mdelem->next);
|
438
|
+
return reinterpret_cast<intptr_t>(MaybeSkipEntry(linked_mdelem->next));
|
416
439
|
}
|
440
|
+
|
417
441
|
std::pair<absl::string_view, absl::string_view> IteratorHandleGet(
|
418
442
|
intptr_t handle) const override {
|
419
443
|
grpc_linked_mdelem* linked_mdelem =
|
@@ -746,13 +770,17 @@ class CallData {
|
|
746
770
|
void CreateSubchannelCall(grpc_call_element* elem);
|
747
771
|
// Invoked when a pick is completed, on both success or failure.
|
748
772
|
static void PickDone(void* arg, grpc_error* error);
|
749
|
-
// Removes the call from the channel's list of queued picks.
|
750
|
-
void
|
751
|
-
// Adds the call to the channel's list of queued picks.
|
752
|
-
void
|
773
|
+
// Removes the call from the channel's list of queued picks if present.
|
774
|
+
void MaybeRemoveCallFromQueuedPicksLocked(grpc_call_element* elem);
|
775
|
+
// Adds the call to the channel's list of queued picks if not already present.
|
776
|
+
void MaybeAddCallToQueuedPicksLocked(grpc_call_element* elem);
|
753
777
|
// Applies service config to the call. Must be invoked once we know
|
754
778
|
// that the resolver has returned results to the channel.
|
755
|
-
|
779
|
+
// If an error is returned, the error indicates the status with which
|
780
|
+
// the call should be failed.
|
781
|
+
grpc_error* ApplyServiceConfigToCallLocked(
|
782
|
+
grpc_call_element* elem, grpc_metadata_batch* initial_metadata);
|
783
|
+
void MaybeInvokeConfigSelectorCommitCallback();
|
756
784
|
|
757
785
|
// State for handling deadlines.
|
758
786
|
// The code in deadline_filter.c requires this to be the first field.
|
@@ -773,6 +801,7 @@ class CallData {
|
|
773
801
|
RefCountedPtr<ServerRetryThrottleData> retry_throttle_data_;
|
774
802
|
const ClientChannelMethodParsedConfig* method_params_ = nullptr;
|
775
803
|
std::map<const char*, absl::string_view> call_attributes_;
|
804
|
+
std::function<void()> on_call_committed_;
|
776
805
|
|
777
806
|
RefCountedPtr<SubchannelCall> subchannel_call_;
|
778
807
|
|
@@ -945,6 +974,10 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
|
945
974
|
|
946
975
|
void ResetBackoff() override { subchannel_->ResetBackoff(); }
|
947
976
|
|
977
|
+
void ThrottleKeepaliveTime(int new_keepalive_time) {
|
978
|
+
subchannel_->ThrottleKeepaliveTime(new_keepalive_time);
|
979
|
+
}
|
980
|
+
|
948
981
|
const grpc_channel_args* channel_args() override {
|
949
982
|
return subchannel_->channel_args();
|
950
983
|
}
|
@@ -1075,6 +1108,32 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
|
|
1075
1108
|
watcher_.get());
|
1076
1109
|
}
|
1077
1110
|
ConnectivityStateChange state_change = PopConnectivityStateChange();
|
1111
|
+
absl::optional<absl::Cord> keepalive_throttling =
|
1112
|
+
state_change.status.GetPayload(grpc_core::kKeepaliveThrottlingKey);
|
1113
|
+
if (keepalive_throttling.has_value()) {
|
1114
|
+
int new_keepalive_time = -1;
|
1115
|
+
if (absl::SimpleAtoi(std::string(keepalive_throttling.value()),
|
1116
|
+
&new_keepalive_time)) {
|
1117
|
+
if (new_keepalive_time > parent_->chand_->keepalive_time_) {
|
1118
|
+
parent_->chand_->keepalive_time_ = new_keepalive_time;
|
1119
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
1120
|
+
gpr_log(GPR_INFO, "chand=%p: throttling keepalive time to %d",
|
1121
|
+
parent_->chand_, parent_->chand_->keepalive_time_);
|
1122
|
+
}
|
1123
|
+
// Propagate the new keepalive time to all subchannels. This is so
|
1124
|
+
// that new transports created by any subchannel (and not just the
|
1125
|
+
// subchannel that received the GOAWAY), use the new keepalive time.
|
1126
|
+
for (auto* subchannel_wrapper :
|
1127
|
+
parent_->chand_->subchannel_wrappers_) {
|
1128
|
+
subchannel_wrapper->ThrottleKeepaliveTime(new_keepalive_time);
|
1129
|
+
}
|
1130
|
+
}
|
1131
|
+
} else {
|
1132
|
+
gpr_log(GPR_ERROR, "chand=%p: Illegal keepalive throttling value %s",
|
1133
|
+
parent_->chand_,
|
1134
|
+
std::string(keepalive_throttling.value()).c_str());
|
1135
|
+
}
|
1136
|
+
}
|
1078
1137
|
// Ignore update if the parent WatcherWrapper has been replaced
|
1079
1138
|
// since this callback was scheduled.
|
1080
1139
|
if (watcher_ != nullptr) {
|
@@ -1145,6 +1204,21 @@ ChannelData::ExternalConnectivityWatcher::ExternalConnectivityWatcher(
|
|
1145
1204
|
grpc_polling_entity_add_to_pollset_set(&pollent_,
|
1146
1205
|
chand_->interested_parties_);
|
1147
1206
|
GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "ExternalConnectivityWatcher");
|
1207
|
+
{
|
1208
|
+
MutexLock lock(&chand_->external_watchers_mu_);
|
1209
|
+
// Will be deleted when the watch is complete.
|
1210
|
+
GPR_ASSERT(chand->external_watchers_[on_complete] == nullptr);
|
1211
|
+
// Store a ref to the watcher in the external_watchers_ map.
|
1212
|
+
chand->external_watchers_[on_complete] =
|
1213
|
+
Ref(DEBUG_LOCATION, "AddWatcherToExternalWatchersMapLocked");
|
1214
|
+
}
|
1215
|
+
// Pass the ref from creating the object to Start().
|
1216
|
+
chand_->work_serializer_->Run(
|
1217
|
+
[this]() {
|
1218
|
+
// The ref is passed to AddWatcherLocked().
|
1219
|
+
AddWatcherLocked();
|
1220
|
+
},
|
1221
|
+
DEBUG_LOCATION);
|
1148
1222
|
}
|
1149
1223
|
|
1150
1224
|
ChannelData::ExternalConnectivityWatcher::~ExternalConnectivityWatcher() {
|
@@ -1154,13 +1228,26 @@ ChannelData::ExternalConnectivityWatcher::~ExternalConnectivityWatcher() {
|
|
1154
1228
|
"ExternalConnectivityWatcher");
|
1155
1229
|
}
|
1156
1230
|
|
1157
|
-
void ChannelData::ExternalConnectivityWatcher::
|
1158
|
-
|
1159
|
-
|
1231
|
+
void ChannelData::ExternalConnectivityWatcher::
|
1232
|
+
RemoveWatcherFromExternalWatchersMap(ChannelData* chand,
|
1233
|
+
grpc_closure* on_complete,
|
1234
|
+
bool cancel) {
|
1235
|
+
RefCountedPtr<ExternalConnectivityWatcher> watcher;
|
1236
|
+
{
|
1237
|
+
MutexLock lock(&chand->external_watchers_mu_);
|
1238
|
+
auto it = chand->external_watchers_.find(on_complete);
|
1239
|
+
if (it != chand->external_watchers_.end()) {
|
1240
|
+
watcher = std::move(it->second);
|
1241
|
+
chand->external_watchers_.erase(it);
|
1242
|
+
}
|
1243
|
+
}
|
1244
|
+
// watcher->Cancel() will hop into the WorkSerializer, so we have to unlock
|
1245
|
+
// the mutex before calling it.
|
1246
|
+
if (watcher != nullptr && cancel) watcher->Cancel();
|
1160
1247
|
}
|
1161
1248
|
|
1162
1249
|
void ChannelData::ExternalConnectivityWatcher::Notify(
|
1163
|
-
grpc_connectivity_state state) {
|
1250
|
+
grpc_connectivity_state state, const absl::Status& /* status */) {
|
1164
1251
|
bool done = false;
|
1165
1252
|
if (!done_.CompareExchangeStrong(&done, true, MemoryOrder::RELAXED,
|
1166
1253
|
MemoryOrder::RELAXED)) {
|
@@ -1194,7 +1281,7 @@ void ChannelData::ExternalConnectivityWatcher::Cancel() {
|
|
1194
1281
|
|
1195
1282
|
void ChannelData::ExternalConnectivityWatcher::AddWatcherLocked() {
|
1196
1283
|
Closure::Run(DEBUG_LOCATION, watcher_timer_init_, GRPC_ERROR_NONE);
|
1197
|
-
// Add new watcher.
|
1284
|
+
// Add new watcher. Pass the ref of the object from creation to OrphanablePtr.
|
1198
1285
|
chand_->state_tracker_.AddWatcher(
|
1199
1286
|
initial_state_, OrphanablePtr<ConnectivityStateWatcherInterface>(this));
|
1200
1287
|
}
|
@@ -1295,24 +1382,27 @@ class ChannelData::ClientChannelControlHelper
|
|
1295
1382
|
chand_->client_channel_factory_->CreateSubchannel(new_args);
|
1296
1383
|
grpc_channel_args_destroy(new_args);
|
1297
1384
|
if (subchannel == nullptr) return nullptr;
|
1385
|
+
subchannel->ThrottleKeepaliveTime(chand_->keepalive_time_);
|
1298
1386
|
return MakeRefCounted<SubchannelWrapper>(
|
1299
1387
|
chand_, subchannel, std::move(health_check_service_name));
|
1300
1388
|
}
|
1301
1389
|
|
1302
1390
|
void UpdateState(
|
1303
|
-
grpc_connectivity_state state,
|
1391
|
+
grpc_connectivity_state state, const absl::Status& status,
|
1304
1392
|
std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker) override {
|
1305
1393
|
grpc_error* disconnect_error = chand_->disconnect_error();
|
1306
1394
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
1307
1395
|
const char* extra = disconnect_error == GRPC_ERROR_NONE
|
1308
1396
|
? ""
|
1309
1397
|
: " (ignoring -- channel shutting down)";
|
1310
|
-
gpr_log(GPR_INFO, "chand=%p: update: state=%s picker=%p%s",
|
1311
|
-
ConnectivityStateName(state),
|
1398
|
+
gpr_log(GPR_INFO, "chand=%p: update: state=%s status=(%s) picker=%p%s",
|
1399
|
+
chand_, ConnectivityStateName(state), status.ToString().c_str(),
|
1400
|
+
picker.get(), extra);
|
1312
1401
|
}
|
1313
1402
|
// Do update only if not shutting down.
|
1314
1403
|
if (disconnect_error == GRPC_ERROR_NONE) {
|
1315
|
-
chand_->UpdateStateAndPickerLocked(state, "helper",
|
1404
|
+
chand_->UpdateStateAndPickerLocked(state, status, "helper",
|
1405
|
+
std::move(picker));
|
1316
1406
|
}
|
1317
1407
|
}
|
1318
1408
|
|
@@ -1339,6 +1429,180 @@ class ChannelData::ClientChannelControlHelper
|
|
1339
1429
|
ChannelData* chand_;
|
1340
1430
|
};
|
1341
1431
|
|
1432
|
+
//
|
1433
|
+
// ChannelData::ChannelConfigHelper
|
1434
|
+
//
|
1435
|
+
|
1436
|
+
// Synchronous callback from ResolvingLoadBalancingPolicy to process a
|
1437
|
+
// resolver result update.
|
1438
|
+
ChannelData::ChannelConfigHelper::ApplyServiceConfigResult
|
1439
|
+
ChannelData::ChannelConfigHelper::ApplyServiceConfig(
|
1440
|
+
const Resolver::Result& result) {
|
1441
|
+
ApplyServiceConfigResult service_config_result;
|
1442
|
+
RefCountedPtr<ServiceConfig> service_config;
|
1443
|
+
// If resolver did not return a service config or returned an invalid service
|
1444
|
+
// config, we need a fallback service config.
|
1445
|
+
if (result.service_config_error != GRPC_ERROR_NONE) {
|
1446
|
+
// If the service config was invalid, then fallback to the saved service
|
1447
|
+
// config. If there is no saved config either, use the default service
|
1448
|
+
// config.
|
1449
|
+
if (chand_->saved_service_config_ != nullptr) {
|
1450
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
1451
|
+
gpr_log(GPR_INFO,
|
1452
|
+
"chand=%p: resolver returned invalid service config. "
|
1453
|
+
"Continuing to use previous service config.",
|
1454
|
+
chand_);
|
1455
|
+
}
|
1456
|
+
service_config = chand_->saved_service_config_;
|
1457
|
+
} else if (chand_->default_service_config_ != nullptr) {
|
1458
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
1459
|
+
gpr_log(GPR_INFO,
|
1460
|
+
"chand=%p: resolver returned invalid service config. Using "
|
1461
|
+
"default service config provided by client API.",
|
1462
|
+
chand_);
|
1463
|
+
}
|
1464
|
+
service_config = chand_->default_service_config_;
|
1465
|
+
}
|
1466
|
+
} else if (result.service_config == nullptr) {
|
1467
|
+
if (chand_->default_service_config_ != nullptr) {
|
1468
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
1469
|
+
gpr_log(GPR_INFO,
|
1470
|
+
"chand=%p: resolver returned no service config. Using default "
|
1471
|
+
"service config provided by client API.",
|
1472
|
+
chand_);
|
1473
|
+
}
|
1474
|
+
service_config = chand_->default_service_config_;
|
1475
|
+
}
|
1476
|
+
} else {
|
1477
|
+
service_config = result.service_config;
|
1478
|
+
}
|
1479
|
+
service_config_result.service_config_error =
|
1480
|
+
GRPC_ERROR_REF(result.service_config_error);
|
1481
|
+
if (service_config == nullptr &&
|
1482
|
+
result.service_config_error != GRPC_ERROR_NONE) {
|
1483
|
+
service_config_result.no_valid_service_config = true;
|
1484
|
+
return service_config_result;
|
1485
|
+
}
|
1486
|
+
// Process service config.
|
1487
|
+
grpc_core::UniquePtr<char> service_config_json;
|
1488
|
+
const internal::ClientChannelGlobalParsedConfig* parsed_service_config =
|
1489
|
+
nullptr;
|
1490
|
+
if (service_config != nullptr) {
|
1491
|
+
parsed_service_config =
|
1492
|
+
static_cast<const internal::ClientChannelGlobalParsedConfig*>(
|
1493
|
+
service_config->GetGlobalParsedConfig(
|
1494
|
+
internal::ClientChannelServiceConfigParser::ParserIndex()));
|
1495
|
+
}
|
1496
|
+
// Check if the config has changed.
|
1497
|
+
service_config_result.service_config_changed =
|
1498
|
+
((service_config == nullptr) !=
|
1499
|
+
(chand_->saved_service_config_ == nullptr)) ||
|
1500
|
+
(service_config != nullptr &&
|
1501
|
+
service_config->json_string() !=
|
1502
|
+
chand_->saved_service_config_->json_string());
|
1503
|
+
if (service_config_result.service_config_changed) {
|
1504
|
+
service_config_json.reset(gpr_strdup(
|
1505
|
+
service_config != nullptr ? service_config->json_string().c_str()
|
1506
|
+
: ""));
|
1507
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
1508
|
+
gpr_log(GPR_INFO,
|
1509
|
+
"chand=%p: resolver returned updated service config: \"%s\"",
|
1510
|
+
chand_, service_config_json.get());
|
1511
|
+
}
|
1512
|
+
// Save health check service name.
|
1513
|
+
if (service_config != nullptr) {
|
1514
|
+
chand_->health_check_service_name_.reset(
|
1515
|
+
gpr_strdup(parsed_service_config->health_check_service_name()));
|
1516
|
+
} else {
|
1517
|
+
chand_->health_check_service_name_.reset();
|
1518
|
+
}
|
1519
|
+
// Update health check service name used by existing subchannel wrappers.
|
1520
|
+
for (auto* subchannel_wrapper : chand_->subchannel_wrappers_) {
|
1521
|
+
subchannel_wrapper->UpdateHealthCheckServiceName(
|
1522
|
+
grpc_core::UniquePtr<char>(
|
1523
|
+
gpr_strdup(chand_->health_check_service_name_.get())));
|
1524
|
+
}
|
1525
|
+
// Save service config.
|
1526
|
+
chand_->saved_service_config_ = std::move(service_config);
|
1527
|
+
}
|
1528
|
+
// Find LB policy config.
|
1529
|
+
ProcessLbPolicy(result, parsed_service_config,
|
1530
|
+
&service_config_result.lb_policy_config);
|
1531
|
+
grpc_core::UniquePtr<char> lb_policy_name(
|
1532
|
+
gpr_strdup((service_config_result.lb_policy_config)->name()));
|
1533
|
+
// Swap out the data used by GetChannelInfo().
|
1534
|
+
{
|
1535
|
+
MutexLock lock(&chand_->info_mu_);
|
1536
|
+
chand_->info_lb_policy_name_ = std::move(lb_policy_name);
|
1537
|
+
if (service_config_json != nullptr) {
|
1538
|
+
chand_->info_service_config_json_ = std::move(service_config_json);
|
1539
|
+
}
|
1540
|
+
}
|
1541
|
+
// Return results.
|
1542
|
+
return service_config_result;
|
1543
|
+
}
|
1544
|
+
|
1545
|
+
void ChannelData::ChannelConfigHelper::ApplyConfigSelector(
|
1546
|
+
bool service_config_changed,
|
1547
|
+
RefCountedPtr<ConfigSelector> config_selector) {
|
1548
|
+
chand_->UpdateServiceConfigInDataPlaneLocked(service_config_changed,
|
1549
|
+
std::move(config_selector));
|
1550
|
+
}
|
1551
|
+
|
1552
|
+
void ChannelData::ChannelConfigHelper::ResolverTransientFailure(
|
1553
|
+
grpc_error* error) {
|
1554
|
+
MutexLock lock(&chand_->data_plane_mu_);
|
1555
|
+
GRPC_ERROR_UNREF(chand_->resolver_transient_failure_error_);
|
1556
|
+
chand_->resolver_transient_failure_error_ = error;
|
1557
|
+
}
|
1558
|
+
|
1559
|
+
void ChannelData::ChannelConfigHelper::ProcessLbPolicy(
|
1560
|
+
const Resolver::Result& resolver_result,
|
1561
|
+
const internal::ClientChannelGlobalParsedConfig* parsed_service_config,
|
1562
|
+
RefCountedPtr<LoadBalancingPolicy::Config>* lb_policy_config) {
|
1563
|
+
// Prefer the LB policy config found in the service config.
|
1564
|
+
if (parsed_service_config != nullptr &&
|
1565
|
+
parsed_service_config->parsed_lb_config() != nullptr) {
|
1566
|
+
*lb_policy_config = parsed_service_config->parsed_lb_config();
|
1567
|
+
return;
|
1568
|
+
}
|
1569
|
+
// Try the deprecated LB policy name from the service config.
|
1570
|
+
// If not, try the setting from channel args.
|
1571
|
+
const char* policy_name = nullptr;
|
1572
|
+
if (parsed_service_config != nullptr &&
|
1573
|
+
!parsed_service_config->parsed_deprecated_lb_policy().empty()) {
|
1574
|
+
policy_name = parsed_service_config->parsed_deprecated_lb_policy().c_str();
|
1575
|
+
} else {
|
1576
|
+
const grpc_arg* channel_arg =
|
1577
|
+
grpc_channel_args_find(resolver_result.args, GRPC_ARG_LB_POLICY_NAME);
|
1578
|
+
policy_name = grpc_channel_arg_get_string(channel_arg);
|
1579
|
+
}
|
1580
|
+
// Use pick_first if nothing was specified and we didn't select grpclb
|
1581
|
+
// above.
|
1582
|
+
if (policy_name == nullptr) policy_name = "pick_first";
|
1583
|
+
// Now that we have the policy name, construct an empty config for it.
|
1584
|
+
Json config_json = Json::Array{Json::Object{
|
1585
|
+
{policy_name, Json::Object{}},
|
1586
|
+
}};
|
1587
|
+
grpc_error* parse_error = GRPC_ERROR_NONE;
|
1588
|
+
*lb_policy_config = LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(
|
1589
|
+
config_json, &parse_error);
|
1590
|
+
// The policy name came from one of three places:
|
1591
|
+
// - The deprecated loadBalancingPolicy field in the service config,
|
1592
|
+
// in which case the code in ClientChannelServiceConfigParser
|
1593
|
+
// already verified that the policy does not require a config.
|
1594
|
+
// - One of the hard-coded values here, all of which are known to not
|
1595
|
+
// require a config.
|
1596
|
+
// - A channel arg, in which case the application did something that
|
1597
|
+
// is a misuse of our API.
|
1598
|
+
// In the first two cases, these assertions will always be true. In
|
1599
|
+
// the last case, this is probably fine for now.
|
1600
|
+
// TODO(roth): If the last case becomes a problem, add better error
|
1601
|
+
// handling here.
|
1602
|
+
GPR_ASSERT(*lb_policy_config != nullptr);
|
1603
|
+
GPR_ASSERT(parse_error == GRPC_ERROR_NONE);
|
1604
|
+
}
|
1605
|
+
|
1342
1606
|
//
|
1343
1607
|
// ChannelData implementation
|
1344
1608
|
//
|
@@ -1397,6 +1661,7 @@ ChannelData::ChannelData(grpc_channel_element_args* args, grpc_error** error)
|
|
1397
1661
|
client_channel_factory_(
|
1398
1662
|
ClientChannelFactory::GetFromChannelArgs(args->channel_args)),
|
1399
1663
|
channelz_node_(GetChannelzNode(args->channel_args)),
|
1664
|
+
channel_config_helper_(this),
|
1400
1665
|
work_serializer_(std::make_shared<WorkSerializer>()),
|
1401
1666
|
interested_parties_(grpc_pollset_set_create()),
|
1402
1667
|
subchannel_pool_(GetSubchannelPool(args->channel_args)),
|
@@ -1451,9 +1716,13 @@ ChannelData::ChannelData(grpc_channel_element_args* args, grpc_error** error)
|
|
1451
1716
|
channel_args_ = new_args != nullptr
|
1452
1717
|
? new_args
|
1453
1718
|
: grpc_channel_args_copy(args->channel_args);
|
1719
|
+
keepalive_time_ = grpc_channel_args_find_integer(
|
1720
|
+
channel_args_, GRPC_ARG_KEEPALIVE_TIME_MS,
|
1721
|
+
{-1 /* default value, unset */, 1, INT_MAX});
|
1454
1722
|
if (!ResolverRegistry::IsValidTarget(target_uri_.get())) {
|
1455
|
-
|
1456
|
-
|
1723
|
+
std::string error_message =
|
1724
|
+
absl::StrCat("the target uri is not valid: ", target_uri_.get());
|
1725
|
+
*error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_message.c_str());
|
1457
1726
|
return;
|
1458
1727
|
}
|
1459
1728
|
*error = GRPC_ERROR_NONE;
|
@@ -1465,6 +1734,7 @@ ChannelData::~ChannelData() {
|
|
1465
1734
|
}
|
1466
1735
|
DestroyResolvingLoadBalancingPolicyLocked();
|
1467
1736
|
grpc_channel_args_destroy(channel_args_);
|
1737
|
+
GRPC_ERROR_UNREF(resolver_transient_failure_error_);
|
1468
1738
|
// Stop backup polling.
|
1469
1739
|
grpc_client_channel_stop_backup_polling(interested_parties_);
|
1470
1740
|
grpc_pollset_set_destroy(interested_parties_);
|
@@ -1473,16 +1743,18 @@ ChannelData::~ChannelData() {
|
|
1473
1743
|
}
|
1474
1744
|
|
1475
1745
|
void ChannelData::UpdateStateAndPickerLocked(
|
1476
|
-
grpc_connectivity_state state, const
|
1746
|
+
grpc_connectivity_state state, const absl::Status& status,
|
1747
|
+
const char* reason,
|
1477
1748
|
std::unique_ptr<LoadBalancingPolicy::SubchannelPicker> picker) {
|
1478
1749
|
// Clean the control plane when entering IDLE.
|
1479
1750
|
if (picker_ == nullptr) {
|
1480
1751
|
health_check_service_name_.reset();
|
1481
1752
|
saved_service_config_.reset();
|
1753
|
+
saved_config_selector_.reset();
|
1482
1754
|
received_first_resolver_result_ = false;
|
1483
1755
|
}
|
1484
1756
|
// Update connectivity state.
|
1485
|
-
state_tracker_.SetState(state, reason);
|
1757
|
+
state_tracker_.SetState(state, status, reason);
|
1486
1758
|
if (channelz_node_ != nullptr) {
|
1487
1759
|
channelz_node_->SetConnectivityState(state);
|
1488
1760
|
channelz_node_->AddTraceEvent(
|
@@ -1501,9 +1773,11 @@ void ChannelData::UpdateStateAndPickerLocked(
|
|
1501
1773
|
// - refs to subchannel wrappers in the keys of pending_subchannel_updates_
|
1502
1774
|
// - ref stored in retry_throttle_data_
|
1503
1775
|
// - ref stored in service_config_
|
1776
|
+
// - ref stored in config_selector_
|
1504
1777
|
// - ownership of the existing picker in picker_
|
1505
1778
|
RefCountedPtr<ServerRetryThrottleData> retry_throttle_data_to_unref;
|
1506
1779
|
RefCountedPtr<ServiceConfig> service_config_to_unref;
|
1780
|
+
RefCountedPtr<ConfigSelector> config_selector_to_unref;
|
1507
1781
|
{
|
1508
1782
|
MutexLock lock(&data_plane_mu_);
|
1509
1783
|
// Handle subchannel updates.
|
@@ -1528,6 +1802,7 @@ void ChannelData::UpdateStateAndPickerLocked(
|
|
1528
1802
|
// Note: We save the objects to unref until after the lock is released.
|
1529
1803
|
retry_throttle_data_to_unref = std::move(retry_throttle_data_);
|
1530
1804
|
service_config_to_unref = std::move(service_config_);
|
1805
|
+
config_selector_to_unref = std::move(config_selector_);
|
1531
1806
|
}
|
1532
1807
|
// Re-process queued picks.
|
1533
1808
|
for (QueuedPick* pick = queued_picks_; pick != nullptr; pick = pick->next) {
|
@@ -1544,24 +1819,72 @@ void ChannelData::UpdateStateAndPickerLocked(
|
|
1544
1819
|
pending_subchannel_updates_.clear();
|
1545
1820
|
}
|
1546
1821
|
|
1547
|
-
void ChannelData::
|
1548
|
-
|
1549
|
-
RefCountedPtr<
|
1822
|
+
void ChannelData::UpdateServiceConfigInDataPlaneLocked(
|
1823
|
+
bool service_config_changed,
|
1824
|
+
RefCountedPtr<ConfigSelector> config_selector) {
|
1825
|
+
// Check if ConfigSelector has changed.
|
1826
|
+
const bool config_selector_changed =
|
1827
|
+
saved_config_selector_ != config_selector;
|
1828
|
+
saved_config_selector_ = config_selector;
|
1829
|
+
// We want to set the service config at least once, even if the
|
1830
|
+
// resolver does not return a config, because that ensures that we
|
1831
|
+
// disable retries if they are not enabled in the service config.
|
1832
|
+
// TODO(roth): Consider removing the received_first_resolver_result_ check
|
1833
|
+
// when we implement transparent retries.
|
1834
|
+
if (!service_config_changed && !config_selector_changed &&
|
1835
|
+
received_first_resolver_result_) {
|
1836
|
+
return;
|
1837
|
+
}
|
1838
|
+
received_first_resolver_result_ = true;
|
1839
|
+
// Get retry throttle data from service config.
|
1840
|
+
RefCountedPtr<ServerRetryThrottleData> retry_throttle_data;
|
1841
|
+
if (saved_service_config_ != nullptr) {
|
1842
|
+
const internal::ClientChannelGlobalParsedConfig* parsed_service_config =
|
1843
|
+
static_cast<const internal::ClientChannelGlobalParsedConfig*>(
|
1844
|
+
saved_service_config_->GetGlobalParsedConfig(
|
1845
|
+
internal::ClientChannelServiceConfigParser::ParserIndex()));
|
1846
|
+
if (parsed_service_config != nullptr) {
|
1847
|
+
absl::optional<internal::ClientChannelGlobalParsedConfig::RetryThrottling>
|
1848
|
+
retry_throttle_config = parsed_service_config->retry_throttling();
|
1849
|
+
if (retry_throttle_config.has_value()) {
|
1850
|
+
retry_throttle_data =
|
1851
|
+
internal::ServerRetryThrottleMap::GetDataForServer(
|
1852
|
+
server_name_.get(),
|
1853
|
+
retry_throttle_config.value().max_milli_tokens,
|
1854
|
+
retry_throttle_config.value().milli_token_ratio);
|
1855
|
+
}
|
1856
|
+
}
|
1857
|
+
}
|
1858
|
+
// Create default config selector if not provided by resolver.
|
1859
|
+
if (config_selector == nullptr) {
|
1860
|
+
config_selector =
|
1861
|
+
MakeRefCounted<DefaultConfigSelector>(saved_service_config_);
|
1862
|
+
}
|
1550
1863
|
// Grab data plane lock to update service config.
|
1551
1864
|
//
|
1552
1865
|
// We defer unreffing the old values (and deallocating memory) until
|
1553
1866
|
// after releasing the lock to keep the critical section small.
|
1867
|
+
RefCountedPtr<ServiceConfig> service_config_to_unref = saved_service_config_;
|
1868
|
+
RefCountedPtr<ConfigSelector> config_selector_to_unref =
|
1869
|
+
std::move(config_selector);
|
1554
1870
|
{
|
1555
1871
|
MutexLock lock(&data_plane_mu_);
|
1872
|
+
GRPC_ERROR_UNREF(resolver_transient_failure_error_);
|
1873
|
+
resolver_transient_failure_error_ = GRPC_ERROR_NONE;
|
1556
1874
|
// Update service config.
|
1557
1875
|
received_service_config_data_ = true;
|
1558
1876
|
// Old values will be unreffed after lock is released.
|
1559
1877
|
retry_throttle_data_.swap(retry_throttle_data);
|
1560
|
-
service_config_.swap(
|
1561
|
-
|
1878
|
+
service_config_.swap(service_config_to_unref);
|
1879
|
+
config_selector_.swap(config_selector_to_unref);
|
1880
|
+
// Re-process queued picks.
|
1562
1881
|
for (QueuedPick* pick = queued_picks_; pick != nullptr; pick = pick->next) {
|
1563
|
-
|
1564
|
-
calld
|
1882
|
+
grpc_call_element* elem = pick->elem;
|
1883
|
+
CallData* calld = static_cast<CallData*>(elem->call_data);
|
1884
|
+
grpc_error* error = GRPC_ERROR_NONE;
|
1885
|
+
if (calld->PickSubchannelLocked(elem, &error)) {
|
1886
|
+
calld->AsyncPickDone(elem, error);
|
1887
|
+
}
|
1565
1888
|
}
|
1566
1889
|
}
|
1567
1890
|
// Old values will be unreffed after lock is released when they go out
|
@@ -1578,7 +1901,7 @@ void ChannelData::CreateResolvingLoadBalancingPolicyLocked() {
|
|
1578
1901
|
grpc_core::UniquePtr<char> target_uri(gpr_strdup(target_uri_.get()));
|
1579
1902
|
resolving_lb_policy_.reset(new ResolvingLoadBalancingPolicy(
|
1580
1903
|
std::move(lb_args), &grpc_client_channel_routing_trace,
|
1581
|
-
std::move(target_uri),
|
1904
|
+
std::move(target_uri), &channel_config_helper_));
|
1582
1905
|
grpc_pollset_set_add_pollset_set(resolving_lb_policy_->interested_parties(),
|
1583
1906
|
interested_parties_);
|
1584
1907
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
@@ -1595,180 +1918,6 @@ void ChannelData::DestroyResolvingLoadBalancingPolicyLocked() {
|
|
1595
1918
|
}
|
1596
1919
|
}
|
1597
1920
|
|
1598
|
-
void ChannelData::ProcessLbPolicy(
|
1599
|
-
const Resolver::Result& resolver_result,
|
1600
|
-
const internal::ClientChannelGlobalParsedConfig* parsed_service_config,
|
1601
|
-
RefCountedPtr<LoadBalancingPolicy::Config>* lb_policy_config) {
|
1602
|
-
// Prefer the LB policy config found in the service config.
|
1603
|
-
if (parsed_service_config != nullptr &&
|
1604
|
-
parsed_service_config->parsed_lb_config() != nullptr) {
|
1605
|
-
*lb_policy_config = parsed_service_config->parsed_lb_config();
|
1606
|
-
return;
|
1607
|
-
}
|
1608
|
-
// Try the deprecated LB policy name from the service config.
|
1609
|
-
// If not, try the setting from channel args.
|
1610
|
-
const char* policy_name = nullptr;
|
1611
|
-
if (parsed_service_config != nullptr &&
|
1612
|
-
!parsed_service_config->parsed_deprecated_lb_policy().empty()) {
|
1613
|
-
policy_name = parsed_service_config->parsed_deprecated_lb_policy().c_str();
|
1614
|
-
} else {
|
1615
|
-
const grpc_arg* channel_arg =
|
1616
|
-
grpc_channel_args_find(resolver_result.args, GRPC_ARG_LB_POLICY_NAME);
|
1617
|
-
policy_name = grpc_channel_arg_get_string(channel_arg);
|
1618
|
-
}
|
1619
|
-
// Use pick_first if nothing was specified and we didn't select grpclb
|
1620
|
-
// above.
|
1621
|
-
if (policy_name == nullptr) policy_name = "pick_first";
|
1622
|
-
// Now that we have the policy name, construct an empty config for it.
|
1623
|
-
Json config_json = Json::Array{Json::Object{
|
1624
|
-
{policy_name, Json::Object{}},
|
1625
|
-
}};
|
1626
|
-
grpc_error* parse_error = GRPC_ERROR_NONE;
|
1627
|
-
*lb_policy_config = LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(
|
1628
|
-
config_json, &parse_error);
|
1629
|
-
// The policy name came from one of three places:
|
1630
|
-
// - The deprecated loadBalancingPolicy field in the service config,
|
1631
|
-
// in which case the code in ClientChannelServiceConfigParser
|
1632
|
-
// already verified that the policy does not require a config.
|
1633
|
-
// - One of the hard-coded values here, all of which are known to not
|
1634
|
-
// require a config.
|
1635
|
-
// - A channel arg, in which case the application did something that
|
1636
|
-
// is a misuse of our API.
|
1637
|
-
// In the first two cases, these assertions will always be true. In
|
1638
|
-
// the last case, this is probably fine for now.
|
1639
|
-
// TODO(roth): If the last case becomes a problem, add better error
|
1640
|
-
// handling here.
|
1641
|
-
GPR_ASSERT(*lb_policy_config != nullptr);
|
1642
|
-
GPR_ASSERT(parse_error == GRPC_ERROR_NONE);
|
1643
|
-
}
|
1644
|
-
|
1645
|
-
// Synchronous callback from ResolvingLoadBalancingPolicy to process a
|
1646
|
-
// resolver result update.
|
1647
|
-
bool ChannelData::ProcessResolverResultLocked(
|
1648
|
-
void* arg, const Resolver::Result& result,
|
1649
|
-
RefCountedPtr<LoadBalancingPolicy::Config>* lb_policy_config,
|
1650
|
-
grpc_error** service_config_error, bool* no_valid_service_config) {
|
1651
|
-
ChannelData* chand = static_cast<ChannelData*>(arg);
|
1652
|
-
RefCountedPtr<ServiceConfig> service_config;
|
1653
|
-
// If resolver did not return a service config or returned an invalid service
|
1654
|
-
// config, we need a fallback service config.
|
1655
|
-
if (result.service_config_error != GRPC_ERROR_NONE) {
|
1656
|
-
// If the service config was invalid, then fallback to the saved service
|
1657
|
-
// config. If there is no saved config either, use the default service
|
1658
|
-
// config.
|
1659
|
-
if (chand->saved_service_config_ != nullptr) {
|
1660
|
-
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
1661
|
-
gpr_log(GPR_INFO,
|
1662
|
-
"chand=%p: resolver returned invalid service config. "
|
1663
|
-
"Continuing to use previous service config.",
|
1664
|
-
chand);
|
1665
|
-
}
|
1666
|
-
service_config = chand->saved_service_config_;
|
1667
|
-
} else if (chand->default_service_config_ != nullptr) {
|
1668
|
-
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
1669
|
-
gpr_log(GPR_INFO,
|
1670
|
-
"chand=%p: resolver returned invalid service config. Using "
|
1671
|
-
"default service config provided by client API.",
|
1672
|
-
chand);
|
1673
|
-
}
|
1674
|
-
service_config = chand->default_service_config_;
|
1675
|
-
}
|
1676
|
-
} else if (result.service_config == nullptr) {
|
1677
|
-
if (chand->default_service_config_ != nullptr) {
|
1678
|
-
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
1679
|
-
gpr_log(GPR_INFO,
|
1680
|
-
"chand=%p: resolver returned no service config. Using default "
|
1681
|
-
"service config provided by client API.",
|
1682
|
-
chand);
|
1683
|
-
}
|
1684
|
-
service_config = chand->default_service_config_;
|
1685
|
-
}
|
1686
|
-
} else {
|
1687
|
-
service_config = result.service_config;
|
1688
|
-
}
|
1689
|
-
*service_config_error = GRPC_ERROR_REF(result.service_config_error);
|
1690
|
-
if (service_config == nullptr &&
|
1691
|
-
result.service_config_error != GRPC_ERROR_NONE) {
|
1692
|
-
*no_valid_service_config = true;
|
1693
|
-
return false;
|
1694
|
-
}
|
1695
|
-
// Process service config.
|
1696
|
-
grpc_core::UniquePtr<char> service_config_json;
|
1697
|
-
const internal::ClientChannelGlobalParsedConfig* parsed_service_config =
|
1698
|
-
nullptr;
|
1699
|
-
if (service_config != nullptr) {
|
1700
|
-
parsed_service_config =
|
1701
|
-
static_cast<const internal::ClientChannelGlobalParsedConfig*>(
|
1702
|
-
service_config->GetGlobalParsedConfig(
|
1703
|
-
internal::ClientChannelServiceConfigParser::ParserIndex()));
|
1704
|
-
}
|
1705
|
-
// Check if the config has changed.
|
1706
|
-
const bool service_config_changed =
|
1707
|
-
((service_config == nullptr) !=
|
1708
|
-
(chand->saved_service_config_ == nullptr)) ||
|
1709
|
-
(service_config != nullptr &&
|
1710
|
-
service_config->json_string() !=
|
1711
|
-
chand->saved_service_config_->json_string());
|
1712
|
-
if (service_config_changed) {
|
1713
|
-
service_config_json.reset(gpr_strdup(
|
1714
|
-
service_config != nullptr ? service_config->json_string().c_str()
|
1715
|
-
: ""));
|
1716
|
-
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
1717
|
-
gpr_log(GPR_INFO,
|
1718
|
-
"chand=%p: resolver returned updated service config: \"%s\"",
|
1719
|
-
chand, service_config_json.get());
|
1720
|
-
}
|
1721
|
-
// Save health check service name.
|
1722
|
-
if (service_config != nullptr) {
|
1723
|
-
chand->health_check_service_name_.reset(
|
1724
|
-
gpr_strdup(parsed_service_config->health_check_service_name()));
|
1725
|
-
} else {
|
1726
|
-
chand->health_check_service_name_.reset();
|
1727
|
-
}
|
1728
|
-
// Update health check service name used by existing subchannel wrappers.
|
1729
|
-
for (auto* subchannel_wrapper : chand->subchannel_wrappers_) {
|
1730
|
-
subchannel_wrapper->UpdateHealthCheckServiceName(
|
1731
|
-
grpc_core::UniquePtr<char>(
|
1732
|
-
gpr_strdup(chand->health_check_service_name_.get())));
|
1733
|
-
}
|
1734
|
-
// Save service config.
|
1735
|
-
chand->saved_service_config_ = std::move(service_config);
|
1736
|
-
}
|
1737
|
-
// We want to set the service config at least once. This should not really be
|
1738
|
-
// needed, but we are doing it as a defensive approach. This can be removed,
|
1739
|
-
// if we feel it is unnecessary.
|
1740
|
-
if (service_config_changed || !chand->received_first_resolver_result_) {
|
1741
|
-
chand->received_first_resolver_result_ = true;
|
1742
|
-
RefCountedPtr<ServerRetryThrottleData> retry_throttle_data;
|
1743
|
-
if (parsed_service_config != nullptr) {
|
1744
|
-
absl::optional<internal::ClientChannelGlobalParsedConfig::RetryThrottling>
|
1745
|
-
retry_throttle_config = parsed_service_config->retry_throttling();
|
1746
|
-
if (retry_throttle_config.has_value()) {
|
1747
|
-
retry_throttle_data =
|
1748
|
-
internal::ServerRetryThrottleMap::GetDataForServer(
|
1749
|
-
chand->server_name_.get(),
|
1750
|
-
retry_throttle_config.value().max_milli_tokens,
|
1751
|
-
retry_throttle_config.value().milli_token_ratio);
|
1752
|
-
}
|
1753
|
-
}
|
1754
|
-
chand->UpdateServiceConfigLocked(std::move(retry_throttle_data),
|
1755
|
-
chand->saved_service_config_);
|
1756
|
-
}
|
1757
|
-
chand->ProcessLbPolicy(result, parsed_service_config, lb_policy_config);
|
1758
|
-
grpc_core::UniquePtr<char> lb_policy_name(
|
1759
|
-
gpr_strdup((*lb_policy_config)->name()));
|
1760
|
-
// Swap out the data used by GetChannelInfo().
|
1761
|
-
{
|
1762
|
-
MutexLock lock(&chand->info_mu_);
|
1763
|
-
chand->info_lb_policy_name_ = std::move(lb_policy_name);
|
1764
|
-
if (service_config_json != nullptr) {
|
1765
|
-
chand->info_service_config_json_ = std::move(service_config_json);
|
1766
|
-
}
|
1767
|
-
}
|
1768
|
-
// Return results.
|
1769
|
-
return service_config_changed;
|
1770
|
-
}
|
1771
|
-
|
1772
1921
|
grpc_error* ChannelData::DoPingLocked(grpc_transport_op* op) {
|
1773
1922
|
if (state_tracker_.state() != GRPC_CHANNEL_READY) {
|
1774
1923
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("channel not connected");
|
@@ -1832,8 +1981,8 @@ void ChannelData::StartTransportOpLocked(grpc_transport_op* op) {
|
|
1832
1981
|
static_cast<grpc_connectivity_state>(value) == GRPC_CHANNEL_IDLE) {
|
1833
1982
|
if (disconnect_error() == GRPC_ERROR_NONE) {
|
1834
1983
|
// Enter IDLE state.
|
1835
|
-
UpdateStateAndPickerLocked(GRPC_CHANNEL_IDLE,
|
1836
|
-
nullptr);
|
1984
|
+
UpdateStateAndPickerLocked(GRPC_CHANNEL_IDLE, absl::Status(),
|
1985
|
+
"channel entering IDLE", nullptr);
|
1837
1986
|
}
|
1838
1987
|
GRPC_ERROR_UNREF(op->disconnect_with_error);
|
1839
1988
|
} else {
|
@@ -1842,7 +1991,7 @@ void ChannelData::StartTransportOpLocked(grpc_transport_op* op) {
|
|
1842
1991
|
GRPC_ERROR_NONE);
|
1843
1992
|
disconnect_error_.Store(op->disconnect_with_error, MemoryOrder::RELEASE);
|
1844
1993
|
UpdateStateAndPickerLocked(
|
1845
|
-
GRPC_CHANNEL_SHUTDOWN, "shutdown from API",
|
1994
|
+
GRPC_CHANNEL_SHUTDOWN, absl::Status(), "shutdown from API",
|
1846
1995
|
absl::make_unique<LoadBalancingPolicy::TransientFailurePicker>(
|
1847
1996
|
GRPC_ERROR_REF(op->disconnect_with_error)));
|
1848
1997
|
}
|
@@ -2027,13 +2176,14 @@ void CallData::Destroy(grpc_call_element* elem,
|
|
2027
2176
|
const grpc_call_final_info* /*final_info*/,
|
2028
2177
|
grpc_closure* then_schedule_closure) {
|
2029
2178
|
CallData* calld = static_cast<CallData*>(elem->call_data);
|
2030
|
-
|
2031
|
-
calld->subchannel_call_->SetAfterCallStackDestroy(then_schedule_closure);
|
2032
|
-
then_schedule_closure = nullptr;
|
2033
|
-
}
|
2179
|
+
RefCountedPtr<SubchannelCall> subchannel_call = calld->subchannel_call_;
|
2034
2180
|
calld->~CallData();
|
2035
|
-
|
2036
|
-
|
2181
|
+
if (GPR_LIKELY(subchannel_call != nullptr)) {
|
2182
|
+
subchannel_call->SetAfterCallStackDestroy(then_schedule_closure);
|
2183
|
+
} else {
|
2184
|
+
// TODO(yashkt) : This can potentially be a Closure::Run
|
2185
|
+
ExecCtx::Run(DEBUG_LOCATION, then_schedule_closure, GRPC_ERROR_NONE);
|
2186
|
+
}
|
2037
2187
|
}
|
2038
2188
|
|
2039
2189
|
void CallData::StartTransportStreamOpBatch(
|
@@ -2811,6 +2961,7 @@ void CallData::RecvInitialMetadataReady(void* arg, grpc_error* error) {
|
|
2811
2961
|
}
|
2812
2962
|
// Received valid initial metadata, so commit the call.
|
2813
2963
|
calld->RetryCommit(elem, retry_state);
|
2964
|
+
calld->MaybeInvokeConfigSelectorCommitCallback();
|
2814
2965
|
// Invoke the callback to return the result to the surface.
|
2815
2966
|
// Manually invoking a callback function; it does not take ownership of error.
|
2816
2967
|
calld->InvokeRecvInitialMetadataCallback(batch_data, error);
|
@@ -2897,6 +3048,7 @@ void CallData::RecvMessageReady(void* arg, grpc_error* error) {
|
|
2897
3048
|
}
|
2898
3049
|
// Received a valid message, so commit the call.
|
2899
3050
|
calld->RetryCommit(elem, retry_state);
|
3051
|
+
calld->MaybeInvokeConfigSelectorCommitCallback();
|
2900
3052
|
// Invoke the callback to return the result to the surface.
|
2901
3053
|
// Manually invoking a callback function; it does not take ownership of error.
|
2902
3054
|
calld->InvokeRecvMessageCallback(batch_data, error);
|
@@ -3098,6 +3250,7 @@ void CallData::RecvTrailingMetadataReady(void* arg, grpc_error* error) {
|
|
3098
3250
|
}
|
3099
3251
|
// Not retrying, so commit the call.
|
3100
3252
|
calld->RetryCommit(elem, retry_state);
|
3253
|
+
calld->MaybeInvokeConfigSelectorCommitCallback();
|
3101
3254
|
// Run any necessary closures.
|
3102
3255
|
calld->RunClosuresForCompletedCall(batch_data, GRPC_ERROR_REF(error));
|
3103
3256
|
}
|
@@ -3720,7 +3873,7 @@ class CallData::QueuedPickCanceller {
|
|
3720
3873
|
}
|
3721
3874
|
if (calld->pick_canceller_ == self && error != GRPC_ERROR_NONE) {
|
3722
3875
|
// Remove pick from list of queued picks.
|
3723
|
-
calld->
|
3876
|
+
calld->MaybeRemoveCallFromQueuedPicksLocked(self->elem_);
|
3724
3877
|
// Fail pending batches on the call.
|
3725
3878
|
calld->PendingBatchesFail(self->elem_, GRPC_ERROR_REF(error),
|
3726
3879
|
YieldCallCombinerIfPendingBatchesFound);
|
@@ -3733,7 +3886,8 @@ class CallData::QueuedPickCanceller {
|
|
3733
3886
|
grpc_closure closure_;
|
3734
3887
|
};
|
3735
3888
|
|
3736
|
-
void CallData::
|
3889
|
+
void CallData::MaybeRemoveCallFromQueuedPicksLocked(grpc_call_element* elem) {
|
3890
|
+
if (!pick_queued_) return;
|
3737
3891
|
auto* chand = static_cast<ChannelData*>(elem->channel_data);
|
3738
3892
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
3739
3893
|
gpr_log(GPR_INFO, "chand=%p calld=%p: removing from queued picks list",
|
@@ -3745,7 +3899,8 @@ void CallData::RemoveCallFromQueuedPicksLocked(grpc_call_element* elem) {
|
|
3745
3899
|
pick_canceller_ = nullptr;
|
3746
3900
|
}
|
3747
3901
|
|
3748
|
-
void CallData::
|
3902
|
+
void CallData::MaybeAddCallToQueuedPicksLocked(grpc_call_element* elem) {
|
3903
|
+
if (pick_queued_) return;
|
3749
3904
|
auto* chand = static_cast<ChannelData*>(elem->channel_data);
|
3750
3905
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
3751
3906
|
gpr_log(GPR_INFO, "chand=%p calld=%p: adding to queued picks list", chand,
|
@@ -3758,23 +3913,29 @@ void CallData::AddCallToQueuedPicksLocked(grpc_call_element* elem) {
|
|
3758
3913
|
pick_canceller_ = new QueuedPickCanceller(elem);
|
3759
3914
|
}
|
3760
3915
|
|
3761
|
-
|
3916
|
+
grpc_error* CallData::ApplyServiceConfigToCallLocked(
|
3917
|
+
grpc_call_element* elem, grpc_metadata_batch* initial_metadata) {
|
3762
3918
|
ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
|
3763
3919
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
3764
3920
|
gpr_log(GPR_INFO, "chand=%p calld=%p: applying service config to call",
|
3765
3921
|
chand, this);
|
3766
3922
|
}
|
3923
|
+
ConfigSelector* config_selector = chand->config_selector();
|
3767
3924
|
auto service_config = chand->service_config();
|
3768
3925
|
if (service_config != nullptr) {
|
3926
|
+
// Use the ConfigSelector to determine the config for the call.
|
3927
|
+
ConfigSelector::CallConfig call_config =
|
3928
|
+
config_selector->GetCallConfig({&path_, initial_metadata, arena_});
|
3929
|
+
if (call_config.error != GRPC_ERROR_NONE) return call_config.error;
|
3930
|
+
call_attributes_ = std::move(call_config.call_attributes);
|
3931
|
+
on_call_committed_ = std::move(call_config.on_call_committed);
|
3769
3932
|
// Create a ServiceConfigCallData for the call. This stores a ref to the
|
3770
3933
|
// ServiceConfig and caches the right set of parsed configs to use for
|
3771
3934
|
// the call. The MethodConfig will store itself in the call context,
|
3772
3935
|
// so that it can be accessed by filters in the subchannel, and it
|
3773
3936
|
// will be cleaned up when the call ends.
|
3774
|
-
const auto* method_params_vector =
|
3775
|
-
service_config->GetMethodParsedConfigVector(path_);
|
3776
3937
|
auto* service_config_call_data = arena_->New<ServiceConfigCallData>(
|
3777
|
-
std::move(service_config),
|
3938
|
+
std::move(service_config), call_config.method_configs, call_context_);
|
3778
3939
|
// Apply our own method params to the call.
|
3779
3940
|
method_params_ = static_cast<ClientChannelMethodParsedConfig*>(
|
3780
3941
|
service_config_call_data->GetMethodParsedConfig(
|
@@ -3816,16 +3977,13 @@ void CallData::ApplyServiceConfigToCallLocked(grpc_call_element* elem) {
|
|
3816
3977
|
if (method_params_ == nullptr || method_params_->retry_policy() == nullptr) {
|
3817
3978
|
enable_retries_ = false;
|
3818
3979
|
}
|
3980
|
+
return GRPC_ERROR_NONE;
|
3819
3981
|
}
|
3820
3982
|
|
3821
|
-
void CallData::
|
3822
|
-
|
3823
|
-
|
3824
|
-
|
3825
|
-
if (GPR_LIKELY(chand->received_service_config_data() &&
|
3826
|
-
!service_config_applied_)) {
|
3827
|
-
service_config_applied_ = true;
|
3828
|
-
ApplyServiceConfigToCallLocked(elem);
|
3983
|
+
void CallData::MaybeInvokeConfigSelectorCommitCallback() {
|
3984
|
+
if (on_call_committed_ != nullptr) {
|
3985
|
+
on_call_committed_();
|
3986
|
+
on_call_committed_ = nullptr;
|
3829
3987
|
}
|
3830
3988
|
}
|
3831
3989
|
|
@@ -3886,11 +4044,45 @@ bool CallData::PickSubchannelLocked(grpc_call_element* elem,
|
|
3886
4044
|
GRPC_ERROR_NONE);
|
3887
4045
|
// Queue the pick, so that it will be attempted once the channel
|
3888
4046
|
// becomes connected.
|
3889
|
-
|
4047
|
+
MaybeAddCallToQueuedPicksLocked(elem);
|
3890
4048
|
return false;
|
3891
4049
|
}
|
3892
|
-
|
3893
|
-
|
4050
|
+
grpc_metadata_batch* initial_metadata_batch =
|
4051
|
+
seen_send_initial_metadata_
|
4052
|
+
? &send_initial_metadata_
|
4053
|
+
: pending_batches_[0]
|
4054
|
+
.batch->payload->send_initial_metadata.send_initial_metadata;
|
4055
|
+
// Grab initial metadata flags so that we can check later if the call has
|
4056
|
+
// wait_for_ready enabled.
|
4057
|
+
const uint32_t send_initial_metadata_flags =
|
4058
|
+
seen_send_initial_metadata_ ? send_initial_metadata_flags_
|
4059
|
+
: pending_batches_[0]
|
4060
|
+
.batch->payload->send_initial_metadata
|
4061
|
+
.send_initial_metadata_flags;
|
4062
|
+
// Avoid picking if we haven't yet received service config data.
|
4063
|
+
if (GPR_UNLIKELY(!chand->received_service_config_data())) {
|
4064
|
+
// If the resolver returned transient failure before returning the
|
4065
|
+
// first service config, fail any non-wait_for_ready calls.
|
4066
|
+
grpc_error* resolver_error = chand->resolver_transient_failure_error();
|
4067
|
+
if (resolver_error != GRPC_ERROR_NONE &&
|
4068
|
+
(send_initial_metadata_flags & GRPC_INITIAL_METADATA_WAIT_FOR_READY) ==
|
4069
|
+
0) {
|
4070
|
+
MaybeRemoveCallFromQueuedPicksLocked(elem);
|
4071
|
+
*error = GRPC_ERROR_REF(resolver_error);
|
4072
|
+
return true;
|
4073
|
+
}
|
4074
|
+
// Either the resolver has not yet returned a result, or it has
|
4075
|
+
// returned transient failure but the call is wait_for_ready. In
|
4076
|
+
// either case, queue the call.
|
4077
|
+
MaybeAddCallToQueuedPicksLocked(elem);
|
4078
|
+
return false;
|
4079
|
+
}
|
4080
|
+
// Apply service config to call if not yet applied.
|
4081
|
+
if (GPR_LIKELY(!service_config_applied_)) {
|
4082
|
+
service_config_applied_ = true;
|
4083
|
+
*error = ApplyServiceConfigToCallLocked(elem, initial_metadata_batch);
|
4084
|
+
if (*error != GRPC_ERROR_NONE) return true;
|
4085
|
+
}
|
3894
4086
|
// If this is a retry, use the send_initial_metadata payload that
|
3895
4087
|
// we've cached; otherwise, use the pending batch. The
|
3896
4088
|
// send_initial_metadata batch will be the first pending batch in the
|
@@ -3902,21 +4094,10 @@ bool CallData::PickSubchannelLocked(grpc_call_element* elem,
|
|
3902
4094
|
// subchannel's copy of the metadata batch (which is copied for each
|
3903
4095
|
// attempt) to the LB policy instead the one from the parent channel.
|
3904
4096
|
LoadBalancingPolicy::PickArgs pick_args;
|
4097
|
+
pick_args.path = StringViewFromSlice(path_);
|
3905
4098
|
pick_args.call_state = &lb_call_state_;
|
3906
|
-
Metadata initial_metadata(
|
3907
|
-
this,
|
3908
|
-
seen_send_initial_metadata_
|
3909
|
-
? &send_initial_metadata_
|
3910
|
-
: pending_batches_[0]
|
3911
|
-
.batch->payload->send_initial_metadata.send_initial_metadata);
|
4099
|
+
Metadata initial_metadata(this, initial_metadata_batch);
|
3912
4100
|
pick_args.initial_metadata = &initial_metadata;
|
3913
|
-
// Grab initial metadata flags so that we can check later if the call has
|
3914
|
-
// wait_for_ready enabled.
|
3915
|
-
const uint32_t send_initial_metadata_flags =
|
3916
|
-
seen_send_initial_metadata_ ? send_initial_metadata_flags_
|
3917
|
-
: pending_batches_[0]
|
3918
|
-
.batch->payload->send_initial_metadata
|
3919
|
-
.send_initial_metadata_flags;
|
3920
4101
|
// Attempt pick.
|
3921
4102
|
auto result = chand->picker()->Pick(pick_args);
|
3922
4103
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
|
@@ -3931,7 +4112,8 @@ bool CallData::PickSubchannelLocked(grpc_call_element* elem,
|
|
3931
4112
|
grpc_error* disconnect_error = chand->disconnect_error();
|
3932
4113
|
if (disconnect_error != GRPC_ERROR_NONE) {
|
3933
4114
|
GRPC_ERROR_UNREF(result.error);
|
3934
|
-
|
4115
|
+
MaybeRemoveCallFromQueuedPicksLocked(elem);
|
4116
|
+
MaybeInvokeConfigSelectorCommitCallback();
|
3935
4117
|
*error = GRPC_ERROR_REF(disconnect_error);
|
3936
4118
|
return true;
|
3937
4119
|
}
|
@@ -3952,8 +4134,9 @@ bool CallData::PickSubchannelLocked(grpc_call_element* elem,
|
|
3952
4134
|
"Failed to pick subchannel", &result.error, 1);
|
3953
4135
|
GRPC_ERROR_UNREF(result.error);
|
3954
4136
|
*error = new_error;
|
4137
|
+
MaybeInvokeConfigSelectorCommitCallback();
|
3955
4138
|
}
|
3956
|
-
|
4139
|
+
MaybeRemoveCallFromQueuedPicksLocked(elem);
|
3957
4140
|
return !retried;
|
3958
4141
|
}
|
3959
4142
|
// If wait_for_ready is true, then queue to retry when we get a new
|
@@ -3962,22 +4145,24 @@ bool CallData::PickSubchannelLocked(grpc_call_element* elem,
|
|
3962
4145
|
}
|
3963
4146
|
// Fallthrough
|
3964
4147
|
case LoadBalancingPolicy::PickResult::PICK_QUEUE:
|
3965
|
-
|
4148
|
+
MaybeAddCallToQueuedPicksLocked(elem);
|
3966
4149
|
return false;
|
3967
4150
|
default: // PICK_COMPLETE
|
3968
|
-
|
4151
|
+
MaybeRemoveCallFromQueuedPicksLocked(elem);
|
3969
4152
|
// Handle drops.
|
3970
4153
|
if (GPR_UNLIKELY(result.subchannel == nullptr)) {
|
3971
4154
|
result.error = grpc_error_set_int(
|
3972
4155
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
3973
4156
|
"Call dropped by load balancing policy"),
|
3974
4157
|
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
|
4158
|
+
MaybeInvokeConfigSelectorCommitCallback();
|
3975
4159
|
} else {
|
3976
4160
|
// Grab a ref to the connected subchannel while we're still
|
3977
4161
|
// holding the data plane mutex.
|
3978
4162
|
connected_subchannel_ =
|
3979
4163
|
chand->GetConnectedSubchannelInDataPlane(result.subchannel.get());
|
3980
4164
|
GPR_ASSERT(connected_subchannel_ != nullptr);
|
4165
|
+
if (retry_committed_) MaybeInvokeConfigSelectorCommitCallback();
|
3981
4166
|
}
|
3982
4167
|
lb_recv_trailing_metadata_ready_ = result.recv_trailing_metadata_ready;
|
3983
4168
|
*error = result.error;
|