grpc 1.58.3 → 1.59.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +48 -33
- data/include/grpc/event_engine/event_engine.h +6 -10
- data/include/grpc/impl/channel_arg_names.h +4 -0
- data/include/grpc/support/port_platform.h +74 -1
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +22 -9
- data/src/core/ext/filters/client_channel/client_channel.cc +422 -56
- data/src/core/ext/filters/client_channel/client_channel.h +52 -8
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +15 -1
- data/src/core/ext/filters/client_channel/dynamic_filters.h +2 -0
- data/src/core/ext/filters/client_channel/{http_proxy.cc → http_proxy_mapper.cc} +1 -1
- data/src/core/ext/filters/client_channel/{http_proxy.h → http_proxy_mapper.h} +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.cc +188 -0
- data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.h +214 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +17 -4
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +41 -6
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h +5 -3
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +32 -103
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +0 -7
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +416 -139
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.h +16 -0
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +434 -459
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +410 -26
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +14 -46
- data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +851 -57
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +16 -10
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +47 -32
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +55 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +105 -175
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +14 -7
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +24 -6
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +36 -2
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +54 -44
- data/src/core/ext/filters/client_channel/subchannel.cc +33 -0
- data/src/core/ext/filters/client_channel/subchannel.h +9 -0
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +11 -6
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +28 -22
- data/src/core/ext/transport/chttp2/transport/flow_control.h +27 -4
- data/src/core/ext/transport/chttp2/transport/frame_data.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +9 -0
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +34 -36
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +66 -47
- data/src/core/ext/transport/chttp2/transport/{frame.h → legacy_frame.h} +3 -3
- data/src/core/ext/transport/chttp2/transport/parsing.cc +4 -2
- data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.cc +10 -0
- data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.h +4 -0
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/writing.cc +2 -1
- data/src/core/ext/transport/inproc/inproc_transport.cc +9 -0
- data/src/core/ext/upb-generated/envoy/admin/v3/certs.upb.c +16 -18
- data/src/core/ext/upb-generated/envoy/admin/v3/certs.upb.h +75 -83
- data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.c +27 -29
- data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.h +102 -110
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +16 -18
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +73 -81
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.c +65 -67
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.h +294 -302
- data/src/core/ext/upb-generated/envoy/admin/v3/init_dump.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/admin/v3/init_dump.upb.h +20 -28
- data/src/core/ext/upb-generated/envoy/admin/v3/listeners.upb.c +5 -7
- data/src/core/ext/upb-generated/envoy/admin/v3/listeners.upb.h +24 -32
- data/src/core/ext/upb-generated/envoy/admin/v3/memory.upb.c +7 -9
- data/src/core/ext/upb-generated/envoy/admin/v3/memory.upb.h +19 -27
- data/src/core/ext/upb-generated/envoy/admin/v3/metrics.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/admin/v3/metrics.upb.h +10 -18
- data/src/core/ext/upb-generated/envoy/admin/v3/mutex_stats.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/admin/v3/mutex_stats.upb.h +10 -18
- data/src/core/ext/upb-generated/envoy/admin/v3/server_info.upb.c +42 -44
- data/src/core/ext/upb-generated/envoy/admin/v3/server_info.upb.h +141 -149
- data/src/core/ext/upb-generated/envoy/admin/v3/tap.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/admin/v3/tap.upb.h +8 -16
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.c +5 -7
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +1 -9
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +4 -12
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +36 -38
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +157 -165
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +87 -89
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +372 -380
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +13 -15
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +55 -63
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +111 -113
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +441 -449
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +8 -16
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +23 -25
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +88 -96
- data/src/core/ext/upb-generated/envoy/config/common/matcher/v3/matcher.upb.c +40 -42
- data/src/core/ext/upb-generated/envoy/config/common/matcher/v3/matcher.upb.h +180 -188
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +26 -28
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +108 -116
- data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +9 -17
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +65 -67
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +245 -253
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +27 -29
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +119 -127
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +6 -14
- data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +8 -16
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_method_list.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_method_list.upb.h +20 -28
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +49 -51
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +184 -192
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +49 -51
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +225 -233
- data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +13 -21
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +63 -65
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +246 -254
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +5 -7
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +19 -27
- data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.c +5 -7
- data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.h +19 -27
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +8 -10
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +30 -38
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +7 -9
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +28 -36
- data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.h +9 -17
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +12 -14
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +48 -56
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +23 -25
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +92 -100
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +27 -29
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +108 -116
- data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +5 -13
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +38 -40
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +167 -175
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +34 -36
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +162 -170
- data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +10 -12
- data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +37 -45
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +13 -21
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.c +6 -8
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.h +18 -26
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +22 -24
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +97 -105
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +24 -26
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +111 -119
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +43 -45
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +183 -191
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +20 -22
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +102 -110
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +253 -255
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +1108 -1116
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +8 -10
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +31 -39
- data/src/core/ext/upb-generated/envoy/config/tap/v3/common.upb.c +35 -37
- data/src/core/ext/upb-generated/envoy/config/tap/v3/common.upb.h +150 -158
- data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.h +10 -18
- data/src/core/ext/upb-generated/envoy/config/trace/v3/dynamic_ot.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/config/trace/v3/dynamic_ot.upb.h +8 -16
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +13 -21
- data/src/core/ext/upb-generated/envoy/config/trace/v3/lightstep.upb.c +5 -7
- data/src/core/ext/upb-generated/envoy/config/trace/v3/lightstep.upb.h +19 -27
- data/src/core/ext/upb-generated/envoy/config/trace/v3/opencensus.upb.c +14 -16
- data/src/core/ext/upb-generated/envoy/config/trace/v3/opencensus.upb.h +53 -61
- data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.h +8 -16
- data/src/core/ext/upb-generated/envoy/config/trace/v3/service.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/config/trace/v3/service.upb.h +5 -13
- data/src/core/ext/upb-generated/envoy/config/trace/v3/skywalking.upb.c +7 -9
- data/src/core/ext/upb-generated/envoy/config/trace/v3/skywalking.upb.h +24 -32
- data/src/core/ext/upb-generated/envoy/config/trace/v3/trace.upb.c +1 -3
- data/src/core/ext/upb-generated/envoy/config/trace/v3/trace.upb.h +1 -9
- data/src/core/ext/upb-generated/envoy/config/trace/v3/xray.upb.c +7 -9
- data/src/core/ext/upb-generated/envoy/config/trace/v3/xray.upb.h +23 -31
- data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.c +8 -10
- data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.h +23 -31
- data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.c +114 -116
- data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.h +372 -380
- data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +9 -17
- data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +8 -10
- data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +30 -38
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +21 -23
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +81 -89
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.c +7 -9
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +24 -32
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +12 -14
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +52 -60
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.h +14 -22
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +114 -116
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +468 -476
- data/src/core/ext/upb-generated/envoy/extensions/http/stateful_session/cookie/v3/cookie.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/extensions/http/stateful_session/cookie/v3/cookie.upb.h +5 -13
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.c +7 -9
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +25 -33
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.c +11 -13
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +40 -48
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.h +4 -12
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.c +8 -10
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.h +27 -35
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.h +5 -13
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +1 -3
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +1 -9
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +35 -37
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +165 -173
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +9 -11
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +32 -40
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +39 -41
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +169 -177
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.h +16 -24
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.c +1 -3
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +1 -9
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +55 -57
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +241 -249
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +7 -9
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +31 -39
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +23 -25
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +98 -106
- data/src/core/ext/upb-generated/envoy/type/http/v3/cookie.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/type/http/v3/cookie.upb.h +11 -19
- data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.h +18 -26
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.h +9 -17
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/http_inputs.upb.c +6 -8
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/http_inputs.upb.h +16 -24
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +6 -8
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +24 -32
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +13 -21
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +3 -5
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +10 -18
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +6 -14
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +6 -8
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +20 -28
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.c +1 -3
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.h +1 -9
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +8 -10
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +33 -41
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +18 -26
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +8 -10
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +31 -39
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +8 -10
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +34 -42
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +14 -16
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +47 -55
- data/src/core/ext/upb-generated/envoy/type/v3/hash_policy.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/type/v3/hash_policy.upb.h +13 -21
- data/src/core/ext/upb-generated/envoy/type/v3/http.upb.c +1 -3
- data/src/core/ext/upb-generated/envoy/type/v3/http.upb.h +1 -9
- data/src/core/ext/upb-generated/envoy/type/v3/http_status.upb.c +2 -4
- data/src/core/ext/upb-generated/envoy/type/v3/http_status.upb.h +4 -12
- data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +10 -18
- data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +7 -9
- data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +19 -27
- data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_strategy.upb.c +6 -8
- data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_strategy.upb.h +20 -28
- data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.c +1 -3
- data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.h +1 -9
- data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +10 -18
- data/src/core/ext/upb-generated/envoy/type/v3/token_bucket.upb.c +4 -6
- data/src/core/ext/upb-generated/envoy/type/v3/token_bucket.upb.h +12 -20
- data/src/core/ext/upb-generated/google/api/annotations.upb.c +2 -4
- data/src/core/ext/upb-generated/google/api/annotations.upb.h +1 -9
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +45 -47
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +190 -198
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +54 -56
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +210 -218
- data/src/core/ext/upb-generated/google/api/http.upb.c +15 -17
- data/src/core/ext/upb-generated/google/api/http.upb.h +60 -68
- data/src/core/ext/upb-generated/google/api/httpbody.upb.c +4 -6
- data/src/core/ext/upb-generated/google/api/httpbody.upb.h +15 -23
- data/src/core/ext/upb-generated/google/protobuf/any.upb.c +3 -5
- data/src/core/ext/upb-generated/google/protobuf/any.upb.h +7 -15
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +359 -204
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +1340 -760
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +3 -5
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +7 -15
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +1 -3
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +1 -9
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +11 -13
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +43 -51
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +3 -5
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +7 -15
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +10 -12
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +28 -36
- data/src/core/ext/upb-generated/google/rpc/status.upb.c +4 -6
- data/src/core/ext/upb-generated/google/rpc/status.upb.h +15 -23
- data/src/core/ext/upb-generated/opencensus/proto/trace/v1/trace_config.upb.c +11 -13
- data/src/core/ext/upb-generated/opencensus/proto/trace/v1/trace_config.upb.h +35 -43
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +10 -12
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +28 -36
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +48 -50
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +190 -198
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +5 -7
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +15 -23
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +3 -5
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +7 -15
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +21 -23
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +80 -88
- data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c +9 -11
- data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h +29 -37
- data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls_config.upb.c +32 -34
- data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls_config.upb.h +147 -155
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +10 -12
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +13 -21
- data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +4 -6
- data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +7 -15
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c +2 -4
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +1 -9
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +4 -6
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +7 -15
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +3 -5
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +4 -12
- data/src/core/ext/upb-generated/validate/validate.upb.c +201 -203
- data/src/core/ext/upb-generated/validate/validate.upb.h +924 -932
- data/src/core/ext/upb-generated/xds/annotations/v3/migrate.upb.c +10 -12
- data/src/core/ext/upb-generated/xds/annotations/v3/migrate.upb.h +13 -21
- data/src/core/ext/upb-generated/xds/annotations/v3/security.upb.c +4 -6
- data/src/core/ext/upb-generated/xds/annotations/v3/security.upb.h +7 -15
- data/src/core/ext/upb-generated/xds/annotations/v3/sensitive.upb.c +2 -4
- data/src/core/ext/upb-generated/xds/annotations/v3/sensitive.upb.h +1 -9
- data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.c +9 -11
- data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.h +16 -24
- data/src/core/ext/upb-generated/xds/annotations/v3/versioning.upb.c +3 -5
- data/src/core/ext/upb-generated/xds/annotations/v3/versioning.upb.h +4 -12
- data/src/core/ext/upb-generated/xds/core/v3/authority.upb.c +2 -4
- data/src/core/ext/upb-generated/xds/core/v3/authority.upb.h +4 -12
- data/src/core/ext/upb-generated/xds/core/v3/cidr.upb.c +3 -5
- data/src/core/ext/upb-generated/xds/core/v3/cidr.upb.h +8 -16
- data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +6 -8
- data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.h +20 -28
- data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +4 -6
- data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.h +9 -17
- data/src/core/ext/upb-generated/xds/core/v3/extension.upb.c +3 -5
- data/src/core/ext/upb-generated/xds/core/v3/extension.upb.h +8 -16
- data/src/core/ext/upb-generated/xds/core/v3/resource.upb.c +4 -6
- data/src/core/ext/upb-generated/xds/core/v3/resource.upb.h +12 -20
- data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +9 -11
- data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.h +35 -43
- data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +5 -7
- data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.h +14 -22
- data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +16 -18
- data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +43 -51
- data/src/core/ext/upb-generated/xds/service/orca/v3/orca.upb.c +3 -5
- data/src/core/ext/upb-generated/xds/service/orca/v3/orca.upb.h +13 -21
- data/src/core/ext/upb-generated/xds/type/matcher/v3/cel.upb.c +2 -4
- data/src/core/ext/upb-generated/xds/type/matcher/v3/cel.upb.h +5 -13
- data/src/core/ext/upb-generated/xds/type/matcher/v3/domain.upb.c +4 -6
- data/src/core/ext/upb-generated/xds/type/matcher/v3/domain.upb.h +21 -29
- data/src/core/ext/upb-generated/xds/type/matcher/v3/http_inputs.upb.c +1 -3
- data/src/core/ext/upb-generated/xds/type/matcher/v3/http_inputs.upb.h +1 -9
- data/src/core/ext/upb-generated/xds/type/matcher/v3/ip.upb.c +5 -7
- data/src/core/ext/upb-generated/xds/type/matcher/v3/ip.upb.h +24 -32
- data/src/core/ext/upb-generated/xds/type/matcher/v3/matcher.upb.c +24 -26
- data/src/core/ext/upb-generated/xds/type/matcher/v3/matcher.upb.h +103 -111
- data/src/core/ext/upb-generated/xds/type/matcher/v3/range.upb.c +10 -12
- data/src/core/ext/upb-generated/xds/type/matcher/v3/range.upb.h +61 -69
- data/src/core/ext/upb-generated/xds/type/matcher/v3/regex.upb.c +3 -5
- data/src/core/ext/upb-generated/xds/type/matcher/v3/regex.upb.h +9 -17
- data/src/core/ext/upb-generated/xds/type/matcher/v3/string.upb.c +8 -10
- data/src/core/ext/upb-generated/xds/type/matcher/v3/string.upb.h +33 -41
- data/src/core/ext/upb-generated/xds/type/v3/cel.upb.c +5 -7
- data/src/core/ext/upb-generated/xds/type/v3/cel.upb.h +18 -26
- data/src/core/ext/upb-generated/xds/type/v3/range.upb.c +7 -9
- data/src/core/ext/upb-generated/xds/type/v3/range.upb.h +19 -27
- data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.c +3 -5
- data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.h +8 -16
- data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c +367 -290
- data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.h +10 -0
- data/src/core/ext/xds/xds_client.cc +6 -9
- data/src/core/ext/xds/xds_client.h +2 -2
- data/src/core/ext/xds/xds_cluster.cc +30 -42
- data/src/core/ext/xds/xds_cluster.h +0 -4
- data/src/core/ext/xds/xds_endpoint.cc +12 -19
- data/src/core/ext/xds/xds_endpoint.h +0 -1
- data/src/core/ext/xds/xds_http_filters.cc +1 -4
- data/src/core/ext/xds/xds_listener.cc +14 -14
- data/src/core/ext/xds/xds_listener.h +13 -3
- data/src/core/ext/xds/xds_resource_type.h +1 -7
- data/src/core/ext/xds/xds_resource_type_impl.h +9 -11
- data/src/core/ext/xds/xds_route_config.cc +10 -11
- data/src/core/ext/xds/xds_route_config.h +1 -1
- data/src/core/ext/xds/xds_server_config_fetcher.cc +53 -28
- data/src/core/ext/xds/xds_transport_grpc.cc +11 -1
- data/src/core/lib/backoff/random_early_detection.cc +4 -2
- data/src/core/lib/backoff/random_early_detection.h +2 -4
- data/src/core/lib/channel/call_tracer.cc +7 -1
- data/src/core/lib/channel/call_tracer.h +4 -1
- data/src/core/lib/channel/channelz_registry.h +4 -2
- data/src/core/lib/channel/connected_channel.cc +1 -1
- data/src/core/lib/config/config_vars.h +1 -1
- data/src/core/lib/config/core_configuration.cc +2 -1
- data/src/core/lib/config/core_configuration.h +5 -4
- data/src/core/lib/debug/stats_data.cc +146 -51
- data/src/core/lib/debug/stats_data.h +81 -20
- data/src/core/lib/event_engine/cf_engine/cf_engine.cc +3 -0
- data/src/core/lib/event_engine/cf_engine/cf_engine.h +3 -0
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +3 -0
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +3 -0
- data/src/core/lib/event_engine/cf_engine/cftype_unique_ref.h +3 -0
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +15 -3
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +3 -0
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +1 -1
- data/src/core/lib/event_engine/thread_pool/thread_count.h +15 -0
- data/src/core/lib/event_engine/thread_pool/thread_pool_factory.cc +3 -15
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +10 -4
- data/src/core/lib/experiments/config.cc +9 -1
- data/src/core/lib/experiments/experiments.cc +144 -60
- data/src/core/lib/experiments/experiments.h +146 -41
- data/src/core/lib/gprpp/fork.h +1 -1
- data/src/core/lib/gprpp/manual_constructor.h +1 -2
- data/src/core/lib/gprpp/no_destruct.h +1 -1
- data/src/core/lib/gprpp/per_cpu.cc +2 -0
- data/src/core/lib/gprpp/per_cpu.h +36 -7
- data/src/core/lib/gprpp/ref_counted_ptr.h +63 -0
- data/src/core/lib/gprpp/work_serializer.cc +297 -25
- data/src/core/lib/gprpp/work_serializer.h +25 -9
- data/src/core/lib/iomgr/combiner.cc +54 -15
- data/src/core/lib/iomgr/combiner.h +8 -3
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +2 -4
- data/src/core/lib/iomgr/exec_ctx.cc +12 -0
- data/src/core/lib/iomgr/exec_ctx.h +55 -19
- data/src/core/lib/iomgr/polling_entity.cc +10 -0
- data/src/core/lib/iomgr/polling_entity.h +2 -0
- data/src/core/lib/iomgr/port.h +14 -0
- data/src/core/lib/iomgr/tcp_posix.cc +17 -14
- data/src/core/lib/load_balancing/lb_policy.h +10 -9
- data/src/core/lib/promise/arena_promise.h +5 -1
- data/src/core/lib/promise/detail/seq_state.h +418 -0
- data/src/core/lib/promise/latch.h +1 -0
- data/src/core/lib/promise/loop.h +8 -5
- data/src/core/lib/promise/pipe.h +24 -24
- data/src/core/lib/promise/poll.h +4 -6
- data/src/core/lib/resolver/server_address.h +1 -0
- data/src/core/lib/resource_quota/memory_quota.cc +58 -2
- data/src/core/lib/resource_quota/memory_quota.h +4 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +115 -9
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +14 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_match.cc +86 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +0 -59
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +2 -0
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +7 -57
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +1 -1
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +2 -14
- data/src/core/lib/slice/slice.h +6 -0
- data/src/core/lib/slice/slice_buffer.cc +15 -0
- data/src/core/lib/slice/slice_buffer.h +16 -4
- data/src/core/lib/slice/slice_refcount.h +1 -1
- data/src/core/lib/surface/call.cc +92 -34
- data/src/core/lib/surface/call.h +4 -0
- data/src/core/lib/surface/channel.cc +7 -4
- data/src/core/lib/surface/channel_init.h +3 -2
- data/src/core/lib/surface/server.cc +45 -5
- data/src/core/lib/surface/server.h +18 -6
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/batch_builder.cc +3 -5
- data/src/core/lib/transport/metadata_batch.cc +6 -0
- data/src/core/lib/transport/metadata_batch.h +20 -1
- data/src/core/lib/transport/parsed_metadata.h +2 -4
- data/src/core/lib/transport/simple_slice_based_metadata.h +1 -2
- data/src/core/lib/transport/transport.h +21 -11
- data/src/core/tsi/ssl_transport_security.cc +7 -0
- data/src/core/tsi/ssl_transport_security.h +4 -0
- data/src/ruby/ext/grpc/extconf.rb +1 -1
- data/src/ruby/ext/grpc/rb_channel_args.c +6 -4
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +4 -1
- data/third_party/abseil-cpp/absl/random/bit_gen_ref.h +185 -0
- data/third_party/upb/upb/collections/array.c +6 -0
- data/third_party/upb/upb/collections/array.h +6 -0
- data/third_party/upb/upb/collections/map.c +7 -0
- data/third_party/upb/upb/collections/map.h +5 -0
- data/third_party/upb/upb/collections/map_sorter_internal.h +1 -1
- data/third_party/upb/upb/collections/message_value.h +8 -1
- data/third_party/upb/upb/generated_code_support.h +54 -0
- data/third_party/upb/upb/hash/common.c +5 -0
- data/third_party/upb/upb/hash/common.h +1 -0
- data/third_party/upb/upb/hash/str_table.h +1 -0
- data/third_party/upb/upb/message/accessors.c +25 -1
- data/third_party/upb/upb/message/accessors.h +46 -25
- data/third_party/upb/upb/message/accessors_internal.h +69 -3
- data/third_party/upb/upb/message/extension_internal.h +1 -1
- data/third_party/upb/upb/message/internal/map_entry.h +64 -0
- data/third_party/upb/upb/message/internal.h +2 -6
- data/third_party/upb/upb/message/message.c +0 -6
- data/third_party/upb/upb/message/message.h +1 -1
- data/third_party/upb/upb/message/tagged_ptr.h +89 -0
- data/third_party/upb/upb/mini_descriptor/build_enum.c +150 -0
- data/third_party/upb/upb/mini_descriptor/build_enum.h +63 -0
- data/third_party/upb/upb/{mini_table → mini_descriptor}/decode.c +122 -374
- data/third_party/upb/upb/{mini_table → mini_descriptor}/decode.h +11 -50
- data/third_party/upb/upb/mini_descriptor/internal/base92.c +46 -0
- data/third_party/upb/upb/mini_descriptor/internal/base92.h +81 -0
- data/third_party/upb/upb/mini_descriptor/internal/decoder.h +73 -0
- data/third_party/upb/upb/{mini_table → mini_descriptor/internal}/encode.c +58 -32
- data/third_party/upb/upb/{mini_table/encode_internal.h → mini_descriptor/internal/encode.h} +3 -4
- data/third_party/upb/upb/{mini_table/encode_internal.hpp → mini_descriptor/internal/encode.hpp} +1 -1
- data/third_party/upb/upb/mini_descriptor/internal/modifiers.h +50 -0
- data/third_party/upb/upb/{mini_table/common_internal.h → mini_descriptor/internal/wire_constants.h} +3 -23
- data/third_party/upb/upb/mini_descriptor/link.c +142 -0
- data/third_party/upb/upb/mini_descriptor/link.h +104 -0
- data/third_party/upb/upb/mini_table/{types.h → enum.h} +19 -9
- data/third_party/upb/upb/mini_table/extension.h +40 -0
- data/third_party/upb/upb/mini_table/extension_registry.c +1 -1
- data/third_party/upb/upb/mini_table/extension_registry.h +2 -1
- data/third_party/upb/upb/mini_table/field.h +118 -0
- data/third_party/upb/upb/{json_decode.h → mini_table/file.h} +5 -6
- data/third_party/upb/upb/mini_table/{enum_internal.h → internal/enum.h} +7 -19
- data/third_party/upb/upb/mini_table/{extension_internal.h → internal/extension.h} +8 -8
- data/third_party/upb/upb/mini_table/{field_internal.h → internal/field.h} +10 -66
- data/third_party/upb/upb/mini_table/{file_internal.h → internal/file.h} +6 -4
- data/third_party/upb/upb/mini_table/internal/message.c +39 -0
- data/third_party/upb/upb/mini_table/{message_internal.h → internal/message.h} +14 -37
- data/third_party/upb/upb/mini_table/{sub_internal.h → internal/sub.h} +7 -6
- data/third_party/upb/upb/mini_table/{common.c → message.c} +2 -33
- data/third_party/upb/upb/mini_table/{common.h → message.h} +12 -77
- data/third_party/upb/upb/{json_encode.h → mini_table/sub.h} +5 -6
- data/third_party/upb/upb/reflection/def.hpp +16 -4
- data/third_party/upb/upb/reflection/def_pool_internal.h +1 -1
- data/third_party/upb/upb/reflection/desc_state_internal.h +1 -1
- data/third_party/upb/upb/reflection/enum_def.c +1 -1
- data/third_party/upb/upb/reflection/field_def.c +2 -1
- data/third_party/upb/upb/reflection/message.c +2 -2
- data/third_party/upb/upb/reflection/message_def.c +3 -1
- data/third_party/upb/upb/wire/decode.c +68 -29
- data/third_party/upb/upb/wire/decode.h +40 -0
- data/third_party/upb/upb/wire/encode.c +23 -13
- metadata +43 -27
- data/src/core/lib/event_engine/thread_pool/original_thread_pool.cc +0 -256
- data/src/core/lib/event_engine/thread_pool/original_thread_pool.h +0 -137
@@ -20,18 +20,28 @@
|
|
20
20
|
|
21
21
|
#include <stdint.h>
|
22
22
|
|
23
|
+
#include <algorithm>
|
23
24
|
#include <atomic>
|
25
|
+
#include <chrono>
|
24
26
|
#include <functional>
|
25
27
|
#include <memory>
|
26
28
|
#include <thread>
|
27
29
|
#include <utility>
|
28
30
|
|
31
|
+
#include "absl/container/inlined_vector.h"
|
32
|
+
|
33
|
+
#include <grpc/event_engine/event_engine.h>
|
29
34
|
#include <grpc/support/log.h>
|
30
35
|
|
36
|
+
#include "src/core/lib/debug/stats.h"
|
37
|
+
#include "src/core/lib/debug/stats_data.h"
|
31
38
|
#include "src/core/lib/debug/trace.h"
|
39
|
+
#include "src/core/lib/experiments/experiments.h"
|
32
40
|
#include "src/core/lib/gprpp/debug_location.h"
|
33
41
|
#include "src/core/lib/gprpp/mpscq.h"
|
34
42
|
#include "src/core/lib/gprpp/orphanable.h"
|
43
|
+
#include "src/core/lib/gprpp/sync.h"
|
44
|
+
#include "src/core/lib/iomgr/exec_ctx.h"
|
35
45
|
|
36
46
|
namespace grpc_core {
|
37
47
|
|
@@ -43,13 +53,32 @@ DebugOnlyTraceFlag grpc_work_serializer_trace(false, "work_serializer");
|
|
43
53
|
|
44
54
|
class WorkSerializer::WorkSerializerImpl : public Orphanable {
|
45
55
|
public:
|
46
|
-
void Run(std::function<void()> callback,
|
47
|
-
|
48
|
-
void
|
56
|
+
virtual void Run(std::function<void()> callback,
|
57
|
+
const DebugLocation& location) = 0;
|
58
|
+
virtual void Schedule(std::function<void()> callback,
|
59
|
+
const DebugLocation& location) = 0;
|
60
|
+
virtual void DrainQueue() = 0;
|
61
|
+
|
62
|
+
#ifndef NDEBUG
|
63
|
+
virtual bool RunningInWorkSerializer() const = 0;
|
64
|
+
#endif
|
65
|
+
};
|
66
|
+
|
67
|
+
//
|
68
|
+
// WorkSerializer::LegacyWorkSerializer
|
69
|
+
//
|
70
|
+
|
71
|
+
class WorkSerializer::LegacyWorkSerializer final : public WorkSerializerImpl {
|
72
|
+
public:
|
73
|
+
void Run(std::function<void()> callback,
|
74
|
+
const DebugLocation& location) override;
|
75
|
+
void Schedule(std::function<void()> callback,
|
76
|
+
const DebugLocation& location) override;
|
77
|
+
void DrainQueue() override;
|
49
78
|
void Orphan() override;
|
50
79
|
|
51
80
|
#ifndef NDEBUG
|
52
|
-
bool RunningInWorkSerializer() const {
|
81
|
+
bool RunningInWorkSerializer() const override {
|
53
82
|
return std::this_thread::get_id() == current_thread_;
|
54
83
|
}
|
55
84
|
#endif
|
@@ -89,6 +118,14 @@ class WorkSerializer::WorkSerializerImpl : public Orphanable {
|
|
89
118
|
return static_cast<uint64_t>(ref_pair & 0xffffffffffffu);
|
90
119
|
}
|
91
120
|
|
121
|
+
#ifndef NDEBUG
|
122
|
+
void SetCurrentThread() { current_thread_ = std::this_thread::get_id(); }
|
123
|
+
void ClearCurrentThread() { current_thread_ = std::thread::id(); }
|
124
|
+
#else
|
125
|
+
void SetCurrentThread() {}
|
126
|
+
void ClearCurrentThread() {}
|
127
|
+
#endif
|
128
|
+
|
92
129
|
// An initial size of 1 keeps track of whether the work serializer has been
|
93
130
|
// orphaned.
|
94
131
|
std::atomic<uint64_t> refs_{MakeRefPair(0, 1)};
|
@@ -98,8 +135,8 @@ class WorkSerializer::WorkSerializerImpl : public Orphanable {
|
|
98
135
|
#endif
|
99
136
|
};
|
100
137
|
|
101
|
-
void WorkSerializer::
|
102
|
-
|
138
|
+
void WorkSerializer::LegacyWorkSerializer::Run(std::function<void()> callback,
|
139
|
+
const DebugLocation& location) {
|
103
140
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) {
|
104
141
|
gpr_log(GPR_INFO, "WorkSerializer::Run() %p Scheduling callback [%s:%d]",
|
105
142
|
this, location.file(), location.line());
|
@@ -112,9 +149,7 @@ void WorkSerializer::WorkSerializerImpl::Run(std::function<void()> callback,
|
|
112
149
|
GPR_DEBUG_ASSERT(GetSize(prev_ref_pair) > 0);
|
113
150
|
if (GetOwners(prev_ref_pair) == 0) {
|
114
151
|
// We took ownership of the WorkSerializer. Invoke callback and drain queue.
|
115
|
-
|
116
|
-
current_thread_ = std::this_thread::get_id();
|
117
|
-
#endif
|
152
|
+
SetCurrentThread();
|
118
153
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) {
|
119
154
|
gpr_log(GPR_INFO, " Executing immediately");
|
120
155
|
}
|
@@ -137,7 +172,7 @@ void WorkSerializer::WorkSerializerImpl::Run(std::function<void()> callback,
|
|
137
172
|
}
|
138
173
|
}
|
139
174
|
|
140
|
-
void WorkSerializer::
|
175
|
+
void WorkSerializer::LegacyWorkSerializer::Schedule(
|
141
176
|
std::function<void()> callback, const DebugLocation& location) {
|
142
177
|
CallbackWrapper* cb_wrapper =
|
143
178
|
new CallbackWrapper(std::move(callback), location);
|
@@ -150,7 +185,7 @@ void WorkSerializer::WorkSerializerImpl::Schedule(
|
|
150
185
|
queue_.Push(&cb_wrapper->mpscq_node);
|
151
186
|
}
|
152
187
|
|
153
|
-
void WorkSerializer::
|
188
|
+
void WorkSerializer::LegacyWorkSerializer::Orphan() {
|
154
189
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) {
|
155
190
|
gpr_log(GPR_INFO, "WorkSerializer::Orphan() %p", this);
|
156
191
|
}
|
@@ -166,7 +201,7 @@ void WorkSerializer::WorkSerializerImpl::Orphan() {
|
|
166
201
|
|
167
202
|
// The thread that calls this loans itself to the work serializer so as to
|
168
203
|
// execute all the scheduled callbacks.
|
169
|
-
void WorkSerializer::
|
204
|
+
void WorkSerializer::LegacyWorkSerializer::DrainQueue() {
|
170
205
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) {
|
171
206
|
gpr_log(GPR_INFO, "WorkSerializer::DrainQueue() %p", this);
|
172
207
|
}
|
@@ -175,9 +210,7 @@ void WorkSerializer::WorkSerializerImpl::DrainQueue() {
|
|
175
210
|
const uint64_t prev_ref_pair =
|
176
211
|
refs_.fetch_add(MakeRefPair(1, 1), std::memory_order_acq_rel);
|
177
212
|
if (GetOwners(prev_ref_pair) == 0) {
|
178
|
-
|
179
|
-
current_thread_ = std::this_thread::get_id();
|
180
|
-
#endif
|
213
|
+
SetCurrentThread();
|
181
214
|
// We took ownership of the WorkSerializer. Drain the queue.
|
182
215
|
DrainQueueOwned();
|
183
216
|
} else {
|
@@ -189,7 +222,7 @@ void WorkSerializer::WorkSerializerImpl::DrainQueue() {
|
|
189
222
|
}
|
190
223
|
}
|
191
224
|
|
192
|
-
void WorkSerializer::
|
225
|
+
void WorkSerializer::LegacyWorkSerializer::DrainQueueOwned() {
|
193
226
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) {
|
194
227
|
gpr_log(GPR_INFO, "WorkSerializer::DrainQueueOwned() %p", this);
|
195
228
|
}
|
@@ -206,12 +239,10 @@ void WorkSerializer::WorkSerializerImpl::DrainQueueOwned() {
|
|
206
239
|
}
|
207
240
|
if (GetSize(prev_ref_pair) == 2) {
|
208
241
|
// Queue drained. Give up ownership but only if queue remains empty.
|
209
|
-
#ifndef NDEBUG
|
210
242
|
// Reset current_thread_ before giving up ownership to avoid TSAN
|
211
243
|
// race. If we don't wind up giving up ownership, we'll set this
|
212
244
|
// again below before we pull the next callback out of the queue.
|
213
|
-
|
214
|
-
#endif
|
245
|
+
ClearCurrentThread();
|
215
246
|
uint64_t expected = MakeRefPair(1, 1);
|
216
247
|
if (refs_.compare_exchange_strong(expected, MakeRefPair(0, 1),
|
217
248
|
std::memory_order_acq_rel)) {
|
@@ -226,10 +257,8 @@ void WorkSerializer::WorkSerializerImpl::DrainQueueOwned() {
|
|
226
257
|
delete this;
|
227
258
|
return;
|
228
259
|
}
|
229
|
-
#ifndef NDEBUG
|
230
260
|
// Didn't wind up giving up ownership, so set current_thread_ again.
|
231
|
-
|
232
|
-
#endif
|
261
|
+
SetCurrentThread();
|
233
262
|
}
|
234
263
|
// There is at least one callback on the queue. Pop the callback from the
|
235
264
|
// queue and execute it.
|
@@ -253,14 +282,257 @@ void WorkSerializer::WorkSerializerImpl::DrainQueueOwned() {
|
|
253
282
|
}
|
254
283
|
}
|
255
284
|
|
285
|
+
//
|
286
|
+
// WorkSerializer::DispatchingWorkSerializer
|
287
|
+
//
|
288
|
+
|
289
|
+
// DispatchingWorkSerializer: executes callbacks one at a time on EventEngine.
|
290
|
+
// One at a time guarantees that fixed size thread pools in EventEngine
|
291
|
+
// implementations are not starved of threads by long running work serializers.
|
292
|
+
// We implement EventEngine::Closure directly to avoid allocating once per
|
293
|
+
// callback in the queue when scheduling.
|
294
|
+
class WorkSerializer::DispatchingWorkSerializer final
|
295
|
+
: public WorkSerializerImpl,
|
296
|
+
public grpc_event_engine::experimental::EventEngine::Closure {
|
297
|
+
public:
|
298
|
+
explicit DispatchingWorkSerializer(
|
299
|
+
std::shared_ptr<grpc_event_engine::experimental::EventEngine>
|
300
|
+
event_engine)
|
301
|
+
: event_engine_(std::move(event_engine)) {}
|
302
|
+
void Run(std::function<void()> callback,
|
303
|
+
const DebugLocation& location) override;
|
304
|
+
void Schedule(std::function<void()> callback,
|
305
|
+
const DebugLocation& location) override {
|
306
|
+
// We always dispatch to event engine, so Schedule and Run share semantics.
|
307
|
+
Run(callback, location);
|
308
|
+
}
|
309
|
+
void DrainQueue() override {}
|
310
|
+
void Orphan() override;
|
311
|
+
|
312
|
+
// Override EventEngine::Closure
|
313
|
+
void Run() override;
|
314
|
+
|
315
|
+
#ifndef NDEBUG
|
316
|
+
bool RunningInWorkSerializer() const override {
|
317
|
+
return running_work_serializer_ == this;
|
318
|
+
}
|
319
|
+
#endif
|
320
|
+
|
321
|
+
private:
|
322
|
+
// Wrapper to capture DebugLocation for the callback.
|
323
|
+
struct CallbackWrapper {
|
324
|
+
CallbackWrapper(std::function<void()> cb, const DebugLocation& loc)
|
325
|
+
: callback(std::move(cb)), location(loc) {}
|
326
|
+
std::function<void()> callback;
|
327
|
+
// GPR_NO_UNIQUE_ADDRESS means this is 0 sized in release builds.
|
328
|
+
GPR_NO_UNIQUE_ADDRESS DebugLocation location;
|
329
|
+
};
|
330
|
+
using CallbackVector = absl::InlinedVector<CallbackWrapper, 1>;
|
331
|
+
|
332
|
+
// Refill processing_ from incoming_
|
333
|
+
// If processing_ is empty, also update running_ and return false.
|
334
|
+
// If additionally orphaned, will also delete this (therefore, it's not safe
|
335
|
+
// to touch any member variables if Refill returns false).
|
336
|
+
bool Refill();
|
337
|
+
|
338
|
+
// Perform the parts of Refill that need to acquire mu_
|
339
|
+
// Returns a tri-state indicating whether we were refilled successfully (=>
|
340
|
+
// keep running), or finished, and then if we were orphaned.
|
341
|
+
enum class RefillResult { kRefilled, kFinished, kFinishedAndOrphaned };
|
342
|
+
RefillResult RefillInner();
|
343
|
+
|
344
|
+
#ifndef NDEBUG
|
345
|
+
void SetCurrentThread() { running_work_serializer_ = this; }
|
346
|
+
void ClearCurrentThread() { running_work_serializer_ = nullptr; }
|
347
|
+
#else
|
348
|
+
void SetCurrentThread() {}
|
349
|
+
void ClearCurrentThread() {}
|
350
|
+
#endif
|
351
|
+
|
352
|
+
// Member variables are roughly sorted to keep processing cache lines
|
353
|
+
// separated from incoming cache lines.
|
354
|
+
|
355
|
+
// Callbacks that are currently being processed.
|
356
|
+
// Only accessed by: a Run() call going from not-running to running, or a work
|
357
|
+
// item being executed in EventEngine -- ie this does not need a mutex because
|
358
|
+
// all access is serialized.
|
359
|
+
// Stored in reverse execution order so that callbacks can be `pop_back()`'d
|
360
|
+
// on completion to free up any resources they hold.
|
361
|
+
CallbackVector processing_;
|
362
|
+
// EventEngine instance upon which we'll do our work.
|
363
|
+
const std::shared_ptr<grpc_event_engine::experimental::EventEngine>
|
364
|
+
event_engine_;
|
365
|
+
std::chrono::steady_clock::time_point running_start_time_
|
366
|
+
ABSL_GUARDED_BY(mu_);
|
367
|
+
std::chrono::steady_clock::duration time_running_items_;
|
368
|
+
uint64_t items_processed_during_run_;
|
369
|
+
// Flags containing run state:
|
370
|
+
// - running_ goes from false->true whenever the first callback is scheduled
|
371
|
+
// on an idle WorkSerializer, and transitions back to false after the last
|
372
|
+
// callback scheduled is completed and the WorkSerializer is again idle.
|
373
|
+
// - orphaned_ transitions to true once upon Orphan being called.
|
374
|
+
// When orphaned_ is true and running_ is false, the DispatchingWorkSerializer
|
375
|
+
// instance is deleted.
|
376
|
+
bool running_ ABSL_GUARDED_BY(mu_) = false;
|
377
|
+
bool orphaned_ ABSL_GUARDED_BY(mu_) = false;
|
378
|
+
Mutex mu_;
|
379
|
+
// Queued callbacks. New work items land here, and when processing_ is drained
|
380
|
+
// we move this entire queue into processing_ and work on draining it again.
|
381
|
+
// In low traffic scenarios this gives two mutex acquisitions per work item,
|
382
|
+
// but as load increases we get some natural batching and the rate of mutex
|
383
|
+
// acquisitions per work item tends towards 1.
|
384
|
+
CallbackVector incoming_ ABSL_GUARDED_BY(mu_);
|
385
|
+
|
386
|
+
#ifndef NDEBUG
|
387
|
+
static thread_local DispatchingWorkSerializer* running_work_serializer_;
|
388
|
+
#endif
|
389
|
+
};
|
390
|
+
|
391
|
+
#ifndef NDEBUG
|
392
|
+
thread_local WorkSerializer::DispatchingWorkSerializer*
|
393
|
+
WorkSerializer::DispatchingWorkSerializer::running_work_serializer_ =
|
394
|
+
nullptr;
|
395
|
+
#endif
|
396
|
+
|
397
|
+
void WorkSerializer::DispatchingWorkSerializer::Orphan() {
|
398
|
+
ReleasableMutexLock lock(&mu_);
|
399
|
+
// If we're not running, then we can delete immediately.
|
400
|
+
if (!running_) {
|
401
|
+
lock.Release();
|
402
|
+
delete this;
|
403
|
+
return;
|
404
|
+
}
|
405
|
+
// Otherwise store a flag to delete when we're done.
|
406
|
+
orphaned_ = true;
|
407
|
+
}
|
408
|
+
|
409
|
+
// Implementation of WorkSerializerImpl::Run
|
410
|
+
void WorkSerializer::DispatchingWorkSerializer::Run(
|
411
|
+
std::function<void()> callback, const DebugLocation& location) {
|
412
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) {
|
413
|
+
gpr_log(GPR_INFO, "WorkSerializer[%p] Scheduling callback [%s:%d]", this,
|
414
|
+
location.file(), location.line());
|
415
|
+
}
|
416
|
+
global_stats().IncrementWorkSerializerItemsEnqueued();
|
417
|
+
MutexLock lock(&mu_);
|
418
|
+
if (!running_) {
|
419
|
+
// If we were previously idle, insert this callback directly into the empty
|
420
|
+
// processing_ list and start running.
|
421
|
+
running_ = true;
|
422
|
+
running_start_time_ = std::chrono::steady_clock::now();
|
423
|
+
items_processed_during_run_ = 0;
|
424
|
+
time_running_items_ = std::chrono::steady_clock::duration();
|
425
|
+
GPR_ASSERT(processing_.empty());
|
426
|
+
processing_.emplace_back(std::move(callback), location);
|
427
|
+
event_engine_->Run(this);
|
428
|
+
} else {
|
429
|
+
// We are already running, so add this callback to the incoming_ list.
|
430
|
+
// The work loop will eventually get to it.
|
431
|
+
incoming_.emplace_back(std::move(callback), location);
|
432
|
+
}
|
433
|
+
}
|
434
|
+
|
435
|
+
// Implementation of EventEngine::Closure::Run - our actual work loop
|
436
|
+
void WorkSerializer::DispatchingWorkSerializer::Run() {
|
437
|
+
// TODO(ctiller): remove these when we can deprecate ExecCtx
|
438
|
+
ApplicationCallbackExecCtx app_exec_ctx;
|
439
|
+
ExecCtx exec_ctx;
|
440
|
+
// Grab the last element of processing_ - which is the next item in our queue
|
441
|
+
// since processing_ is stored in reverse order.
|
442
|
+
auto& cb = processing_.back();
|
443
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) {
|
444
|
+
gpr_log(GPR_INFO, "WorkSerializer[%p] Executing callback [%s:%d]", this,
|
445
|
+
cb.location.file(), cb.location.line());
|
446
|
+
}
|
447
|
+
// Run the work item.
|
448
|
+
const auto start = std::chrono::steady_clock::now();
|
449
|
+
SetCurrentThread();
|
450
|
+
cb.callback();
|
451
|
+
// pop_back here destroys the callback - freeing any resources it might hold.
|
452
|
+
// We do so before clearing the current thread in case the callback destructor
|
453
|
+
// wants to check that it's in the WorkSerializer too.
|
454
|
+
processing_.pop_back();
|
455
|
+
ClearCurrentThread();
|
456
|
+
global_stats().IncrementWorkSerializerItemsDequeued();
|
457
|
+
const auto work_time = std::chrono::steady_clock::now() - start;
|
458
|
+
global_stats().IncrementWorkSerializerWorkTimePerItemMs(
|
459
|
+
std::chrono::duration_cast<std::chrono::milliseconds>(work_time).count());
|
460
|
+
time_running_items_ += work_time;
|
461
|
+
++items_processed_during_run_;
|
462
|
+
// Check if we've drained the queue and if so refill it.
|
463
|
+
if (processing_.empty() && !Refill()) return;
|
464
|
+
// There's still work in processing_, so schedule ourselves again on
|
465
|
+
// EventEngine.
|
466
|
+
event_engine_->Run(this);
|
467
|
+
}
|
468
|
+
|
469
|
+
WorkSerializer::DispatchingWorkSerializer::RefillResult
|
470
|
+
WorkSerializer::DispatchingWorkSerializer::RefillInner() {
|
471
|
+
// Recover any memory held by processing_, so that we don't grow forever.
|
472
|
+
// Do so before acquiring a lock so we don't cause inadvertent contention.
|
473
|
+
processing_.shrink_to_fit();
|
474
|
+
MutexLock lock(&mu_);
|
475
|
+
// Swap incoming_ into processing_ - effectively lets us release memory
|
476
|
+
// (outside the lock) once per iteration for the storage vectors.
|
477
|
+
processing_.swap(incoming_);
|
478
|
+
// If there were no items, then we've finished running.
|
479
|
+
if (processing_.empty()) {
|
480
|
+
running_ = false;
|
481
|
+
global_stats().IncrementWorkSerializerRunTimeMs(
|
482
|
+
std::chrono::duration_cast<std::chrono::milliseconds>(
|
483
|
+
std::chrono::steady_clock::now() - running_start_time_)
|
484
|
+
.count());
|
485
|
+
global_stats().IncrementWorkSerializerWorkTimeMs(
|
486
|
+
std::chrono::duration_cast<std::chrono::milliseconds>(
|
487
|
+
time_running_items_)
|
488
|
+
.count());
|
489
|
+
global_stats().IncrementWorkSerializerItemsPerRun(
|
490
|
+
items_processed_during_run_);
|
491
|
+
// And if we're also orphaned then it's time to delete this object.
|
492
|
+
if (orphaned_) {
|
493
|
+
return RefillResult::kFinishedAndOrphaned;
|
494
|
+
} else {
|
495
|
+
return RefillResult::kFinished;
|
496
|
+
}
|
497
|
+
}
|
498
|
+
return RefillResult::kRefilled;
|
499
|
+
}
|
500
|
+
|
501
|
+
bool WorkSerializer::DispatchingWorkSerializer::Refill() {
|
502
|
+
const auto result = RefillInner();
|
503
|
+
switch (result) {
|
504
|
+
case RefillResult::kRefilled:
|
505
|
+
// Reverse processing_ so that we can pop_back() items in the correct
|
506
|
+
// order. (note that this is mostly pointer swaps inside the
|
507
|
+
// std::function's, so should be relatively cheap even for longer lists).
|
508
|
+
// Do so here so we're outside of the RefillInner lock.
|
509
|
+
std::reverse(processing_.begin(), processing_.end());
|
510
|
+
return true;
|
511
|
+
case RefillResult::kFinished:
|
512
|
+
return false;
|
513
|
+
case RefillResult::kFinishedAndOrphaned:
|
514
|
+
// Orphaned and finished - finally delete this object.
|
515
|
+
// Here so that the mutex lock in RefillInner is released.
|
516
|
+
delete this;
|
517
|
+
return false;
|
518
|
+
}
|
519
|
+
GPR_UNREACHABLE_CODE(return false);
|
520
|
+
}
|
521
|
+
|
256
522
|
//
|
257
523
|
// WorkSerializer
|
258
524
|
//
|
259
525
|
|
260
|
-
WorkSerializer::WorkSerializer(
|
261
|
-
|
526
|
+
WorkSerializer::WorkSerializer(
|
527
|
+
std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine)
|
528
|
+
: impl_(IsWorkSerializerDispatchEnabled()
|
529
|
+
? OrphanablePtr<WorkSerializerImpl>(
|
530
|
+
MakeOrphanable<DispatchingWorkSerializer>(
|
531
|
+
std::move(event_engine)))
|
532
|
+
: OrphanablePtr<WorkSerializerImpl>(
|
533
|
+
MakeOrphanable<LegacyWorkSerializer>())) {}
|
262
534
|
|
263
|
-
WorkSerializer::~WorkSerializer()
|
535
|
+
WorkSerializer::~WorkSerializer() = default;
|
264
536
|
|
265
537
|
void WorkSerializer::Run(std::function<void()> callback,
|
266
538
|
const DebugLocation& location) {
|
@@ -20,9 +20,12 @@
|
|
20
20
|
#include <grpc/support/port_platform.h>
|
21
21
|
|
22
22
|
#include <functional>
|
23
|
+
#include <memory>
|
23
24
|
|
24
25
|
#include "absl/base/thread_annotations.h"
|
25
26
|
|
27
|
+
#include <grpc/event_engine/event_engine.h>
|
28
|
+
|
26
29
|
#include "src/core/lib/gprpp/debug_location.h"
|
27
30
|
#include "src/core/lib/gprpp/orphanable.h"
|
28
31
|
|
@@ -44,14 +47,28 @@ namespace grpc_core {
|
|
44
47
|
// invoke DrainQueue() when it is safe to invoke the callback.
|
45
48
|
class ABSL_LOCKABLE WorkSerializer {
|
46
49
|
public:
|
47
|
-
WorkSerializer(
|
48
|
-
|
50
|
+
explicit WorkSerializer(
|
51
|
+
std::shared_ptr<grpc_event_engine::experimental::EventEngine>
|
52
|
+
event_engine);
|
49
53
|
~WorkSerializer();
|
50
54
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
+
WorkSerializer(const WorkSerializer&) = delete;
|
56
|
+
WorkSerializer& operator=(const WorkSerializer&) = delete;
|
57
|
+
WorkSerializer(WorkSerializer&&) noexcept = default;
|
58
|
+
WorkSerializer& operator=(WorkSerializer&&) noexcept = default;
|
59
|
+
|
60
|
+
// Runs a given callback on the work serializer.
|
61
|
+
//
|
62
|
+
// If experiment `work_serializer_dispatch` is enabled:
|
63
|
+
// The callback will be executed as an EventEngine callback, that then
|
64
|
+
// arranges for the next callback in the queue to execute.
|
65
|
+
//
|
66
|
+
// If experiment `work_serializer_dispatch` is NOT enabled:
|
67
|
+
// If there is no other thread currently executing the WorkSerializer, the
|
68
|
+
// callback is run immediately. In this case, the current thread is also
|
69
|
+
// borrowed for draining the queue for any callbacks that get added in the
|
70
|
+
// meantime.
|
71
|
+
// This behavior is deprecated and will be removed soon.
|
55
72
|
//
|
56
73
|
// If you want to use clang thread annotation to make sure that callback is
|
57
74
|
// called by WorkSerializer only, you need to add the annotation to both the
|
@@ -64,9 +81,6 @@ class ABSL_LOCKABLE WorkSerializer {
|
|
64
81
|
// }, DEBUG_LOCATION);
|
65
82
|
// }
|
66
83
|
// void callback() ABSL_EXCLUSIVE_LOCKS_REQUIRED(work_serializer) { ... }
|
67
|
-
//
|
68
|
-
// TODO(yashkt): Replace DebugLocation with absl::SourceLocation
|
69
|
-
// once we can start using it directly.
|
70
84
|
void Run(std::function<void()> callback, const DebugLocation& location);
|
71
85
|
|
72
86
|
// Schedule \a callback to be run later when the queue of callbacks is
|
@@ -82,6 +96,8 @@ class ABSL_LOCKABLE WorkSerializer {
|
|
82
96
|
|
83
97
|
private:
|
84
98
|
class WorkSerializerImpl;
|
99
|
+
class LegacyWorkSerializer;
|
100
|
+
class DispatchingWorkSerializer;
|
85
101
|
|
86
102
|
OrphanablePtr<WorkSerializerImpl> impl_;
|
87
103
|
};
|
@@ -27,6 +27,7 @@
|
|
27
27
|
#include <grpc/support/alloc.h>
|
28
28
|
#include <grpc/support/log.h>
|
29
29
|
|
30
|
+
#include "src/core/lib/experiments/experiments.h"
|
30
31
|
#include "src/core/lib/gprpp/crash.h"
|
31
32
|
#include "src/core/lib/gprpp/mpscq.h"
|
32
33
|
#include "src/core/lib/iomgr/executor.h"
|
@@ -50,14 +51,22 @@ static void combiner_finally_exec(grpc_core::Combiner* lock,
|
|
50
51
|
grpc_closure* closure,
|
51
52
|
grpc_error_handle error);
|
52
53
|
|
54
|
+
// TODO(ctiller): delete this when the combiner_offload_to_event_engine
|
55
|
+
// experiment is removed.
|
53
56
|
static void offload(void* arg, grpc_error_handle error);
|
54
57
|
|
55
|
-
grpc_core::Combiner* grpc_combiner_create(
|
58
|
+
grpc_core::Combiner* grpc_combiner_create(
|
59
|
+
std::shared_ptr<grpc_event_engine::experimental::EventEngine>
|
60
|
+
event_engine) {
|
56
61
|
grpc_core::Combiner* lock = new grpc_core::Combiner();
|
62
|
+
if (grpc_core::IsCombinerOffloadToEventEngineEnabled()) {
|
63
|
+
lock->event_engine = event_engine;
|
64
|
+
} else {
|
65
|
+
GRPC_CLOSURE_INIT(&lock->offload, offload, lock, nullptr);
|
66
|
+
}
|
57
67
|
gpr_ref_init(&lock->refs, 1);
|
58
68
|
gpr_atm_no_barrier_store(&lock->state, STATE_UNORPHANED);
|
59
69
|
grpc_closure_list_init(&lock->final_list);
|
60
|
-
GRPC_CLOSURE_INIT(&lock->offload, offload, lock, nullptr);
|
61
70
|
GRPC_COMBINER_TRACE(gpr_log(GPR_INFO, "C:%p create", lock));
|
62
71
|
return lock;
|
63
72
|
}
|
@@ -172,7 +181,16 @@ static void offload(void* arg, grpc_error_handle /*error*/) {
|
|
172
181
|
static void queue_offload(grpc_core::Combiner* lock) {
|
173
182
|
move_next();
|
174
183
|
GRPC_COMBINER_TRACE(gpr_log(GPR_INFO, "C:%p queue_offload", lock));
|
175
|
-
grpc_core::
|
184
|
+
if (grpc_core::IsCombinerOffloadToEventEngineEnabled()) {
|
185
|
+
lock->event_engine->Run([lock] {
|
186
|
+
grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
|
187
|
+
grpc_core::ExecCtx exec_ctx(0);
|
188
|
+
push_last_on_exec_ctx(lock);
|
189
|
+
exec_ctx.Flush();
|
190
|
+
});
|
191
|
+
} else {
|
192
|
+
grpc_core::Executor::Run(&lock->offload, absl::OkStatus());
|
193
|
+
}
|
176
194
|
}
|
177
195
|
|
178
196
|
bool grpc_combiner_continue_exec_ctx() {
|
@@ -194,18 +212,33 @@ bool grpc_combiner_continue_exec_ctx() {
|
|
194
212
|
grpc_core::ExecCtx::Get()->IsReadyToFinish(),
|
195
213
|
lock->time_to_execute_final_list));
|
196
214
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
215
|
+
if (grpc_core::IsCombinerOffloadToEventEngineEnabled()) {
|
216
|
+
// offload only if both (1) the combiner is contended and has more than one
|
217
|
+
// closure to execute, and (2) the current execution context needs to finish
|
218
|
+
// as soon as possible
|
219
|
+
if (contended && grpc_core::ExecCtx::Get()->IsReadyToFinish()) {
|
220
|
+
// this execution context wants to move on: schedule remaining work to be
|
221
|
+
// picked up on the executor
|
222
|
+
queue_offload(lock);
|
223
|
+
return true;
|
224
|
+
}
|
225
|
+
} else {
|
226
|
+
// TODO(ctiller): delete this when the combiner_offload_to_event_engine
|
227
|
+
// experiment is removed.
|
228
|
+
|
229
|
+
// offload only if all the following conditions are true:
|
230
|
+
// 1. the combiner is contended and has more than one closure to execute
|
231
|
+
// 2. the current execution context needs to finish as soon as possible
|
232
|
+
// 3. the current thread is not a worker for any background poller
|
233
|
+
// 4. the DEFAULT executor is threaded
|
234
|
+
if (contended && grpc_core::ExecCtx::Get()->IsReadyToFinish() &&
|
235
|
+
!grpc_iomgr_platform_is_any_background_poller_thread() &&
|
236
|
+
grpc_core::Executor::IsThreadedDefault()) {
|
237
|
+
// this execution context wants to move on: schedule remaining work to be
|
238
|
+
// picked up on the executor
|
239
|
+
queue_offload(lock);
|
240
|
+
return true;
|
241
|
+
}
|
209
242
|
}
|
210
243
|
|
211
244
|
if (!lock->time_to_execute_final_list ||
|
@@ -328,4 +361,10 @@ void Combiner::Run(grpc_closure* closure, grpc_error_handle error) {
|
|
328
361
|
void Combiner::FinallyRun(grpc_closure* closure, grpc_error_handle error) {
|
329
362
|
combiner_finally_exec(this, closure, error);
|
330
363
|
}
|
364
|
+
|
365
|
+
void Combiner::ForceOffload() {
|
366
|
+
gpr_atm_no_barrier_store(&initiating_exec_ctx_or_null, 0);
|
367
|
+
ExecCtx::Get()->SetReadyToFinishFlag();
|
368
|
+
}
|
369
|
+
|
331
370
|
} // namespace grpc_core
|
@@ -36,6 +36,8 @@ class Combiner {
|
|
36
36
|
void Run(grpc_closure* closure, grpc_error_handle error);
|
37
37
|
// TODO(yashkt) : Remove this method
|
38
38
|
void FinallyRun(grpc_closure* closure, grpc_error_handle error);
|
39
|
+
// Force the next combiner execution to be offloaded
|
40
|
+
void ForceOffload();
|
39
41
|
Combiner* next_combiner_on_this_exec_ctx = nullptr;
|
40
42
|
MultiProducerSingleConsumerQueue queue;
|
41
43
|
// either:
|
@@ -49,8 +51,11 @@ class Combiner {
|
|
49
51
|
gpr_atm state;
|
50
52
|
bool time_to_execute_final_list = false;
|
51
53
|
grpc_closure_list final_list;
|
54
|
+
// TODO(ctiller): delete this when the combiner_offload_to_event_engine
|
55
|
+
// experiment is removed.
|
52
56
|
grpc_closure offload;
|
53
57
|
gpr_refcount refs;
|
58
|
+
std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine;
|
54
59
|
};
|
55
60
|
} // namespace grpc_core
|
56
61
|
|
@@ -59,9 +64,9 @@ class Combiner {
|
|
59
64
|
// The actual thread executing actions may change over time (but there will only
|
60
65
|
// ever be one at a time).
|
61
66
|
|
62
|
-
// Initialize the lock
|
63
|
-
|
64
|
-
|
67
|
+
// Initialize the lock
|
68
|
+
grpc_core::Combiner* grpc_combiner_create(
|
69
|
+
std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine);
|
65
70
|
|
66
71
|
#ifndef NDEBUG
|
67
72
|
#define GRPC_COMBINER_DEBUG_ARGS \
|
@@ -60,10 +60,8 @@ class EventEngineEndpointWrapper {
|
|
60
60
|
struct grpc_event_engine_endpoint {
|
61
61
|
grpc_endpoint base;
|
62
62
|
EventEngineEndpointWrapper* wrapper;
|
63
|
-
|
64
|
-
|
65
|
-
std::aligned_storage<sizeof(SliceBuffer), alignof(SliceBuffer)>::type
|
66
|
-
write_buffer;
|
63
|
+
alignas(SliceBuffer) char read_buffer[sizeof(SliceBuffer)];
|
64
|
+
alignas(SliceBuffer) char write_buffer[sizeof(SliceBuffer)];
|
67
65
|
};
|
68
66
|
|
69
67
|
explicit EventEngineEndpointWrapper(
|
@@ -56,9 +56,21 @@ static void exec_ctx_sched(grpc_closure* closure) {
|
|
56
56
|
|
57
57
|
namespace grpc_core {
|
58
58
|
|
59
|
+
#if !defined(_WIN32) || !defined(_DLL)
|
59
60
|
thread_local ExecCtx* ExecCtx::exec_ctx_;
|
60
61
|
thread_local ApplicationCallbackExecCtx*
|
61
62
|
ApplicationCallbackExecCtx::callback_exec_ctx_;
|
63
|
+
#else // _WIN32
|
64
|
+
ExecCtx*& ExecCtx::exec_ctx() {
|
65
|
+
static thread_local ExecCtx* exec_ctx;
|
66
|
+
return exec_ctx;
|
67
|
+
}
|
68
|
+
|
69
|
+
ApplicationCallbackExecCtx*& ApplicationCallbackExecCtx::callback_exec_ctx() {
|
70
|
+
static thread_local ApplicationCallbackExecCtx* callback_exec_ctx;
|
71
|
+
return callback_exec_ctx;
|
72
|
+
}
|
73
|
+
#endif // _WIN32
|
62
74
|
|
63
75
|
bool ExecCtx::Flush() {
|
64
76
|
bool did_something = false;
|