grpc 1.58.3 → 1.59.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (548) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +48 -33
  3. data/include/grpc/event_engine/event_engine.h +6 -10
  4. data/include/grpc/impl/channel_arg_names.h +4 -0
  5. data/include/grpc/support/port_platform.h +74 -1
  6. data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +22 -9
  7. data/src/core/ext/filters/client_channel/client_channel.cc +422 -56
  8. data/src/core/ext/filters/client_channel/client_channel.h +52 -8
  9. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +15 -1
  10. data/src/core/ext/filters/client_channel/dynamic_filters.h +2 -0
  11. data/src/core/ext/filters/client_channel/{http_proxy.cc → http_proxy_mapper.cc} +1 -1
  12. data/src/core/ext/filters/client_channel/{http_proxy.h → http_proxy_mapper.h} +3 -3
  13. data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.cc +188 -0
  14. data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.h +214 -0
  15. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +17 -4
  16. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +41 -6
  17. data/src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h +5 -3
  18. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +32 -103
  19. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +0 -7
  20. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +416 -139
  21. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.h +16 -0
  22. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +434 -459
  23. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +410 -26
  24. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +14 -46
  25. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +851 -57
  26. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +16 -10
  27. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +47 -32
  28. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +55 -3
  29. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +105 -175
  30. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +14 -7
  31. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +24 -6
  32. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +36 -2
  33. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +54 -44
  34. data/src/core/ext/filters/client_channel/subchannel.cc +33 -0
  35. data/src/core/ext/filters/client_channel/subchannel.h +9 -0
  36. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -1
  37. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +11 -6
  38. data/src/core/ext/transport/chttp2/transport/flow_control.cc +28 -22
  39. data/src/core/ext/transport/chttp2/transport/flow_control.h +27 -4
  40. data/src/core/ext/transport/chttp2/transport/frame_data.h +1 -1
  41. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +1 -1
  42. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +9 -0
  43. data/src/core/ext/transport/chttp2/transport/frame_ping.h +1 -1
  44. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +1 -1
  45. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +1 -1
  46. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +1 -1
  47. data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -1
  48. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +1 -1
  49. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +1 -1
  50. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +34 -36
  51. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -3
  52. data/src/core/ext/transport/chttp2/transport/internal.h +66 -47
  53. data/src/core/ext/transport/chttp2/transport/{frame.h → legacy_frame.h} +3 -3
  54. data/src/core/ext/transport/chttp2/transport/parsing.cc +4 -2
  55. data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.cc +10 -0
  56. data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.h +4 -0
  57. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +1 -1
  58. data/src/core/ext/transport/chttp2/transport/writing.cc +2 -1
  59. data/src/core/ext/transport/inproc/inproc_transport.cc +9 -0
  60. data/src/core/ext/upb-generated/envoy/admin/v3/certs.upb.c +16 -18
  61. data/src/core/ext/upb-generated/envoy/admin/v3/certs.upb.h +75 -83
  62. data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.c +27 -29
  63. data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.h +102 -110
  64. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +16 -18
  65. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +73 -81
  66. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.c +65 -67
  67. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump_shared.upb.h +294 -302
  68. data/src/core/ext/upb-generated/envoy/admin/v3/init_dump.upb.c +4 -6
  69. data/src/core/ext/upb-generated/envoy/admin/v3/init_dump.upb.h +20 -28
  70. data/src/core/ext/upb-generated/envoy/admin/v3/listeners.upb.c +5 -7
  71. data/src/core/ext/upb-generated/envoy/admin/v3/listeners.upb.h +24 -32
  72. data/src/core/ext/upb-generated/envoy/admin/v3/memory.upb.c +7 -9
  73. data/src/core/ext/upb-generated/envoy/admin/v3/memory.upb.h +19 -27
  74. data/src/core/ext/upb-generated/envoy/admin/v3/metrics.upb.c +4 -6
  75. data/src/core/ext/upb-generated/envoy/admin/v3/metrics.upb.h +10 -18
  76. data/src/core/ext/upb-generated/envoy/admin/v3/mutex_stats.upb.c +4 -6
  77. data/src/core/ext/upb-generated/envoy/admin/v3/mutex_stats.upb.h +10 -18
  78. data/src/core/ext/upb-generated/envoy/admin/v3/server_info.upb.c +42 -44
  79. data/src/core/ext/upb-generated/envoy/admin/v3/server_info.upb.h +141 -149
  80. data/src/core/ext/upb-generated/envoy/admin/v3/tap.upb.c +3 -5
  81. data/src/core/ext/upb-generated/envoy/admin/v3/tap.upb.h +8 -16
  82. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.c +5 -7
  83. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +1 -9
  84. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +3 -5
  85. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +4 -12
  86. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +36 -38
  87. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +157 -165
  88. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +87 -89
  89. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +372 -380
  90. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +13 -15
  91. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +55 -63
  92. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +111 -113
  93. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +441 -449
  94. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +3 -5
  95. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +8 -16
  96. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +23 -25
  97. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +88 -96
  98. data/src/core/ext/upb-generated/envoy/config/common/matcher/v3/matcher.upb.c +40 -42
  99. data/src/core/ext/upb-generated/envoy/config/common/matcher/v3/matcher.upb.h +180 -188
  100. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +26 -28
  101. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +108 -116
  102. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +3 -5
  103. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +9 -17
  104. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +65 -67
  105. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +245 -253
  106. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +27 -29
  107. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +119 -127
  108. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +2 -4
  109. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +6 -14
  110. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +3 -5
  111. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +8 -16
  112. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_method_list.upb.c +4 -6
  113. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_method_list.upb.h +20 -28
  114. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +49 -51
  115. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +184 -192
  116. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +49 -51
  117. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +225 -233
  118. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +4 -6
  119. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +13 -21
  120. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +63 -65
  121. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +246 -254
  122. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +5 -7
  123. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +19 -27
  124. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.c +5 -7
  125. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.h +19 -27
  126. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +8 -10
  127. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +30 -38
  128. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +7 -9
  129. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +28 -36
  130. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.c +3 -5
  131. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.h +9 -17
  132. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +12 -14
  133. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +48 -56
  134. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +23 -25
  135. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +92 -100
  136. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +27 -29
  137. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +108 -116
  138. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +2 -4
  139. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +5 -13
  140. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +38 -40
  141. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +167 -175
  142. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +34 -36
  143. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +162 -170
  144. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +10 -12
  145. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +37 -45
  146. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +4 -6
  147. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +13 -21
  148. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.c +6 -8
  149. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.h +18 -26
  150. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +22 -24
  151. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +97 -105
  152. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +24 -26
  153. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +111 -119
  154. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +43 -45
  155. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +183 -191
  156. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +20 -22
  157. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +102 -110
  158. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +253 -255
  159. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +1108 -1116
  160. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +8 -10
  161. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +31 -39
  162. data/src/core/ext/upb-generated/envoy/config/tap/v3/common.upb.c +35 -37
  163. data/src/core/ext/upb-generated/envoy/config/tap/v3/common.upb.h +150 -158
  164. data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.c +4 -6
  165. data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.h +10 -18
  166. data/src/core/ext/upb-generated/envoy/config/trace/v3/dynamic_ot.upb.c +3 -5
  167. data/src/core/ext/upb-generated/envoy/config/trace/v3/dynamic_ot.upb.h +8 -16
  168. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +4 -6
  169. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +13 -21
  170. data/src/core/ext/upb-generated/envoy/config/trace/v3/lightstep.upb.c +5 -7
  171. data/src/core/ext/upb-generated/envoy/config/trace/v3/lightstep.upb.h +19 -27
  172. data/src/core/ext/upb-generated/envoy/config/trace/v3/opencensus.upb.c +14 -16
  173. data/src/core/ext/upb-generated/envoy/config/trace/v3/opencensus.upb.h +53 -61
  174. data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.c +3 -5
  175. data/src/core/ext/upb-generated/envoy/config/trace/v3/opentelemetry.upb.h +8 -16
  176. data/src/core/ext/upb-generated/envoy/config/trace/v3/service.upb.c +2 -4
  177. data/src/core/ext/upb-generated/envoy/config/trace/v3/service.upb.h +5 -13
  178. data/src/core/ext/upb-generated/envoy/config/trace/v3/skywalking.upb.c +7 -9
  179. data/src/core/ext/upb-generated/envoy/config/trace/v3/skywalking.upb.h +24 -32
  180. data/src/core/ext/upb-generated/envoy/config/trace/v3/trace.upb.c +1 -3
  181. data/src/core/ext/upb-generated/envoy/config/trace/v3/trace.upb.h +1 -9
  182. data/src/core/ext/upb-generated/envoy/config/trace/v3/xray.upb.c +7 -9
  183. data/src/core/ext/upb-generated/envoy/config/trace/v3/xray.upb.h +23 -31
  184. data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.c +8 -10
  185. data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.h +23 -31
  186. data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.c +114 -116
  187. data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.h +372 -380
  188. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.c +2 -4
  189. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +9 -17
  190. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +8 -10
  191. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +30 -38
  192. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +21 -23
  193. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +81 -89
  194. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.c +7 -9
  195. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +24 -32
  196. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +12 -14
  197. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +52 -60
  198. data/src/core/ext/upb-generated/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.c +4 -6
  199. data/src/core/ext/upb-generated/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.h +14 -22
  200. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +114 -116
  201. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +468 -476
  202. data/src/core/ext/upb-generated/envoy/extensions/http/stateful_session/cookie/v3/cookie.upb.c +2 -4
  203. data/src/core/ext/upb-generated/envoy/extensions/http/stateful_session/cookie/v3/cookie.upb.h +5 -13
  204. 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
  205. 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
  206. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.c +11 -13
  207. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +40 -48
  208. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.c +2 -4
  209. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.h +4 -12
  210. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.c +8 -10
  211. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.h +27 -35
  212. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.c +2 -4
  213. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.h +5 -13
  214. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +1 -3
  215. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +1 -9
  216. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +35 -37
  217. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +165 -173
  218. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +9 -11
  219. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +32 -40
  220. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +39 -41
  221. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +169 -177
  222. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.c +4 -6
  223. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.h +16 -24
  224. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.c +1 -3
  225. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +1 -9
  226. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +55 -57
  227. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +241 -249
  228. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +7 -9
  229. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +31 -39
  230. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +23 -25
  231. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +98 -106
  232. data/src/core/ext/upb-generated/envoy/type/http/v3/cookie.upb.c +4 -6
  233. data/src/core/ext/upb-generated/envoy/type/http/v3/cookie.upb.h +11 -19
  234. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.c +4 -6
  235. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.h +18 -26
  236. data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.c +3 -5
  237. data/src/core/ext/upb-generated/envoy/type/matcher/v3/filter_state.upb.h +9 -17
  238. data/src/core/ext/upb-generated/envoy/type/matcher/v3/http_inputs.upb.c +6 -8
  239. data/src/core/ext/upb-generated/envoy/type/matcher/v3/http_inputs.upb.h +16 -24
  240. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +6 -8
  241. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +24 -32
  242. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +3 -5
  243. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +13 -21
  244. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +3 -5
  245. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +10 -18
  246. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +2 -4
  247. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +6 -14
  248. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +6 -8
  249. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +20 -28
  250. data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.c +1 -3
  251. data/src/core/ext/upb-generated/envoy/type/matcher/v3/status_code_input.upb.h +1 -9
  252. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +8 -10
  253. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +33 -41
  254. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +4 -6
  255. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +18 -26
  256. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +8 -10
  257. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +31 -39
  258. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +8 -10
  259. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +34 -42
  260. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +14 -16
  261. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +47 -55
  262. data/src/core/ext/upb-generated/envoy/type/v3/hash_policy.upb.c +4 -6
  263. data/src/core/ext/upb-generated/envoy/type/v3/hash_policy.upb.h +13 -21
  264. data/src/core/ext/upb-generated/envoy/type/v3/http.upb.c +1 -3
  265. data/src/core/ext/upb-generated/envoy/type/v3/http.upb.h +1 -9
  266. data/src/core/ext/upb-generated/envoy/type/v3/http_status.upb.c +2 -4
  267. data/src/core/ext/upb-generated/envoy/type/v3/http_status.upb.h +4 -12
  268. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +4 -6
  269. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +10 -18
  270. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +7 -9
  271. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +19 -27
  272. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_strategy.upb.c +6 -8
  273. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_strategy.upb.h +20 -28
  274. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.c +1 -3
  275. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.h +1 -9
  276. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.c +4 -6
  277. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +10 -18
  278. data/src/core/ext/upb-generated/envoy/type/v3/token_bucket.upb.c +4 -6
  279. data/src/core/ext/upb-generated/envoy/type/v3/token_bucket.upb.h +12 -20
  280. data/src/core/ext/upb-generated/google/api/annotations.upb.c +2 -4
  281. data/src/core/ext/upb-generated/google/api/annotations.upb.h +1 -9
  282. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +45 -47
  283. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +190 -198
  284. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +54 -56
  285. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +210 -218
  286. data/src/core/ext/upb-generated/google/api/http.upb.c +15 -17
  287. data/src/core/ext/upb-generated/google/api/http.upb.h +60 -68
  288. data/src/core/ext/upb-generated/google/api/httpbody.upb.c +4 -6
  289. data/src/core/ext/upb-generated/google/api/httpbody.upb.h +15 -23
  290. data/src/core/ext/upb-generated/google/protobuf/any.upb.c +3 -5
  291. data/src/core/ext/upb-generated/google/protobuf/any.upb.h +7 -15
  292. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +359 -204
  293. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +1340 -760
  294. data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +3 -5
  295. data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +7 -15
  296. data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +1 -3
  297. data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +1 -9
  298. data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +11 -13
  299. data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +43 -51
  300. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +3 -5
  301. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +7 -15
  302. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +10 -12
  303. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +28 -36
  304. data/src/core/ext/upb-generated/google/rpc/status.upb.c +4 -6
  305. data/src/core/ext/upb-generated/google/rpc/status.upb.h +15 -23
  306. data/src/core/ext/upb-generated/opencensus/proto/trace/v1/trace_config.upb.c +11 -13
  307. data/src/core/ext/upb-generated/opencensus/proto/trace/v1/trace_config.upb.h +35 -43
  308. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +10 -12
  309. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +28 -36
  310. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +48 -50
  311. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +190 -198
  312. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +5 -7
  313. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +15 -23
  314. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +3 -5
  315. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +7 -15
  316. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +21 -23
  317. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +80 -88
  318. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c +9 -11
  319. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h +29 -37
  320. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls_config.upb.c +32 -34
  321. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls_config.upb.h +147 -155
  322. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +10 -12
  323. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +13 -21
  324. data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +4 -6
  325. data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +7 -15
  326. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c +2 -4
  327. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +1 -9
  328. data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +4 -6
  329. data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +7 -15
  330. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +3 -5
  331. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +4 -12
  332. data/src/core/ext/upb-generated/validate/validate.upb.c +201 -203
  333. data/src/core/ext/upb-generated/validate/validate.upb.h +924 -932
  334. data/src/core/ext/upb-generated/xds/annotations/v3/migrate.upb.c +10 -12
  335. data/src/core/ext/upb-generated/xds/annotations/v3/migrate.upb.h +13 -21
  336. data/src/core/ext/upb-generated/xds/annotations/v3/security.upb.c +4 -6
  337. data/src/core/ext/upb-generated/xds/annotations/v3/security.upb.h +7 -15
  338. data/src/core/ext/upb-generated/xds/annotations/v3/sensitive.upb.c +2 -4
  339. data/src/core/ext/upb-generated/xds/annotations/v3/sensitive.upb.h +1 -9
  340. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.c +9 -11
  341. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.h +16 -24
  342. data/src/core/ext/upb-generated/xds/annotations/v3/versioning.upb.c +3 -5
  343. data/src/core/ext/upb-generated/xds/annotations/v3/versioning.upb.h +4 -12
  344. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.c +2 -4
  345. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.h +4 -12
  346. data/src/core/ext/upb-generated/xds/core/v3/cidr.upb.c +3 -5
  347. data/src/core/ext/upb-generated/xds/core/v3/cidr.upb.h +8 -16
  348. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +6 -8
  349. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.h +20 -28
  350. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +4 -6
  351. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.h +9 -17
  352. data/src/core/ext/upb-generated/xds/core/v3/extension.upb.c +3 -5
  353. data/src/core/ext/upb-generated/xds/core/v3/extension.upb.h +8 -16
  354. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.c +4 -6
  355. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.h +12 -20
  356. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +9 -11
  357. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.h +35 -43
  358. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +5 -7
  359. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.h +14 -22
  360. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +16 -18
  361. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +43 -51
  362. data/src/core/ext/upb-generated/xds/service/orca/v3/orca.upb.c +3 -5
  363. data/src/core/ext/upb-generated/xds/service/orca/v3/orca.upb.h +13 -21
  364. data/src/core/ext/upb-generated/xds/type/matcher/v3/cel.upb.c +2 -4
  365. data/src/core/ext/upb-generated/xds/type/matcher/v3/cel.upb.h +5 -13
  366. data/src/core/ext/upb-generated/xds/type/matcher/v3/domain.upb.c +4 -6
  367. data/src/core/ext/upb-generated/xds/type/matcher/v3/domain.upb.h +21 -29
  368. data/src/core/ext/upb-generated/xds/type/matcher/v3/http_inputs.upb.c +1 -3
  369. data/src/core/ext/upb-generated/xds/type/matcher/v3/http_inputs.upb.h +1 -9
  370. data/src/core/ext/upb-generated/xds/type/matcher/v3/ip.upb.c +5 -7
  371. data/src/core/ext/upb-generated/xds/type/matcher/v3/ip.upb.h +24 -32
  372. data/src/core/ext/upb-generated/xds/type/matcher/v3/matcher.upb.c +24 -26
  373. data/src/core/ext/upb-generated/xds/type/matcher/v3/matcher.upb.h +103 -111
  374. data/src/core/ext/upb-generated/xds/type/matcher/v3/range.upb.c +10 -12
  375. data/src/core/ext/upb-generated/xds/type/matcher/v3/range.upb.h +61 -69
  376. data/src/core/ext/upb-generated/xds/type/matcher/v3/regex.upb.c +3 -5
  377. data/src/core/ext/upb-generated/xds/type/matcher/v3/regex.upb.h +9 -17
  378. data/src/core/ext/upb-generated/xds/type/matcher/v3/string.upb.c +8 -10
  379. data/src/core/ext/upb-generated/xds/type/matcher/v3/string.upb.h +33 -41
  380. data/src/core/ext/upb-generated/xds/type/v3/cel.upb.c +5 -7
  381. data/src/core/ext/upb-generated/xds/type/v3/cel.upb.h +18 -26
  382. data/src/core/ext/upb-generated/xds/type/v3/range.upb.c +7 -9
  383. data/src/core/ext/upb-generated/xds/type/v3/range.upb.h +19 -27
  384. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.c +3 -5
  385. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.h +8 -16
  386. data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c +367 -290
  387. data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.h +10 -0
  388. data/src/core/ext/xds/xds_client.cc +6 -9
  389. data/src/core/ext/xds/xds_client.h +2 -2
  390. data/src/core/ext/xds/xds_cluster.cc +30 -42
  391. data/src/core/ext/xds/xds_cluster.h +0 -4
  392. data/src/core/ext/xds/xds_endpoint.cc +12 -19
  393. data/src/core/ext/xds/xds_endpoint.h +0 -1
  394. data/src/core/ext/xds/xds_http_filters.cc +1 -4
  395. data/src/core/ext/xds/xds_listener.cc +14 -14
  396. data/src/core/ext/xds/xds_listener.h +13 -3
  397. data/src/core/ext/xds/xds_resource_type.h +1 -7
  398. data/src/core/ext/xds/xds_resource_type_impl.h +9 -11
  399. data/src/core/ext/xds/xds_route_config.cc +10 -11
  400. data/src/core/ext/xds/xds_route_config.h +1 -1
  401. data/src/core/ext/xds/xds_server_config_fetcher.cc +53 -28
  402. data/src/core/ext/xds/xds_transport_grpc.cc +11 -1
  403. data/src/core/lib/backoff/random_early_detection.cc +4 -2
  404. data/src/core/lib/backoff/random_early_detection.h +2 -4
  405. data/src/core/lib/channel/call_tracer.cc +7 -1
  406. data/src/core/lib/channel/call_tracer.h +4 -1
  407. data/src/core/lib/channel/channelz_registry.h +4 -2
  408. data/src/core/lib/channel/connected_channel.cc +1 -1
  409. data/src/core/lib/config/config_vars.h +1 -1
  410. data/src/core/lib/config/core_configuration.cc +2 -1
  411. data/src/core/lib/config/core_configuration.h +5 -4
  412. data/src/core/lib/debug/stats_data.cc +146 -51
  413. data/src/core/lib/debug/stats_data.h +81 -20
  414. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +3 -0
  415. data/src/core/lib/event_engine/cf_engine/cf_engine.h +3 -0
  416. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +3 -0
  417. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +3 -0
  418. data/src/core/lib/event_engine/cf_engine/cftype_unique_ref.h +3 -0
  419. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +15 -3
  420. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +3 -0
  421. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +1 -1
  422. data/src/core/lib/event_engine/thread_pool/thread_count.h +15 -0
  423. data/src/core/lib/event_engine/thread_pool/thread_pool_factory.cc +3 -15
  424. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +10 -4
  425. data/src/core/lib/experiments/config.cc +9 -1
  426. data/src/core/lib/experiments/experiments.cc +144 -60
  427. data/src/core/lib/experiments/experiments.h +146 -41
  428. data/src/core/lib/gprpp/fork.h +1 -1
  429. data/src/core/lib/gprpp/manual_constructor.h +1 -2
  430. data/src/core/lib/gprpp/no_destruct.h +1 -1
  431. data/src/core/lib/gprpp/per_cpu.cc +2 -0
  432. data/src/core/lib/gprpp/per_cpu.h +36 -7
  433. data/src/core/lib/gprpp/ref_counted_ptr.h +63 -0
  434. data/src/core/lib/gprpp/work_serializer.cc +297 -25
  435. data/src/core/lib/gprpp/work_serializer.h +25 -9
  436. data/src/core/lib/iomgr/combiner.cc +54 -15
  437. data/src/core/lib/iomgr/combiner.h +8 -3
  438. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +2 -4
  439. data/src/core/lib/iomgr/exec_ctx.cc +12 -0
  440. data/src/core/lib/iomgr/exec_ctx.h +55 -19
  441. data/src/core/lib/iomgr/polling_entity.cc +10 -0
  442. data/src/core/lib/iomgr/polling_entity.h +2 -0
  443. data/src/core/lib/iomgr/port.h +14 -0
  444. data/src/core/lib/iomgr/tcp_posix.cc +17 -14
  445. data/src/core/lib/load_balancing/lb_policy.h +10 -9
  446. data/src/core/lib/promise/arena_promise.h +5 -1
  447. data/src/core/lib/promise/detail/seq_state.h +418 -0
  448. data/src/core/lib/promise/latch.h +1 -0
  449. data/src/core/lib/promise/loop.h +8 -5
  450. data/src/core/lib/promise/pipe.h +24 -24
  451. data/src/core/lib/promise/poll.h +4 -6
  452. data/src/core/lib/resolver/server_address.h +1 -0
  453. data/src/core/lib/resource_quota/memory_quota.cc +58 -2
  454. data/src/core/lib/resource_quota/memory_quota.h +4 -1
  455. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +115 -9
  456. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +14 -0
  457. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_match.cc +86 -0
  458. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +0 -59
  459. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +2 -0
  460. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +7 -57
  461. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +1 -1
  462. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +2 -14
  463. data/src/core/lib/slice/slice.h +6 -0
  464. data/src/core/lib/slice/slice_buffer.cc +15 -0
  465. data/src/core/lib/slice/slice_buffer.h +16 -4
  466. data/src/core/lib/slice/slice_refcount.h +1 -1
  467. data/src/core/lib/surface/call.cc +92 -34
  468. data/src/core/lib/surface/call.h +4 -0
  469. data/src/core/lib/surface/channel.cc +7 -4
  470. data/src/core/lib/surface/channel_init.h +3 -2
  471. data/src/core/lib/surface/server.cc +45 -5
  472. data/src/core/lib/surface/server.h +18 -6
  473. data/src/core/lib/surface/version.cc +2 -2
  474. data/src/core/lib/transport/batch_builder.cc +3 -5
  475. data/src/core/lib/transport/metadata_batch.cc +6 -0
  476. data/src/core/lib/transport/metadata_batch.h +20 -1
  477. data/src/core/lib/transport/parsed_metadata.h +2 -4
  478. data/src/core/lib/transport/simple_slice_based_metadata.h +1 -2
  479. data/src/core/lib/transport/transport.h +21 -11
  480. data/src/core/tsi/ssl_transport_security.cc +7 -0
  481. data/src/core/tsi/ssl_transport_security.h +4 -0
  482. data/src/ruby/ext/grpc/extconf.rb +1 -1
  483. data/src/ruby/ext/grpc/rb_channel_args.c +6 -4
  484. data/src/ruby/lib/grpc/version.rb +1 -1
  485. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +4 -1
  486. data/third_party/abseil-cpp/absl/random/bit_gen_ref.h +185 -0
  487. data/third_party/upb/upb/collections/array.c +6 -0
  488. data/third_party/upb/upb/collections/array.h +6 -0
  489. data/third_party/upb/upb/collections/map.c +7 -0
  490. data/third_party/upb/upb/collections/map.h +5 -0
  491. data/third_party/upb/upb/collections/map_sorter_internal.h +1 -1
  492. data/third_party/upb/upb/collections/message_value.h +8 -1
  493. data/third_party/upb/upb/generated_code_support.h +54 -0
  494. data/third_party/upb/upb/hash/common.c +5 -0
  495. data/third_party/upb/upb/hash/common.h +1 -0
  496. data/third_party/upb/upb/hash/str_table.h +1 -0
  497. data/third_party/upb/upb/message/accessors.c +25 -1
  498. data/third_party/upb/upb/message/accessors.h +46 -25
  499. data/third_party/upb/upb/message/accessors_internal.h +69 -3
  500. data/third_party/upb/upb/message/extension_internal.h +1 -1
  501. data/third_party/upb/upb/message/internal/map_entry.h +64 -0
  502. data/third_party/upb/upb/message/internal.h +2 -6
  503. data/third_party/upb/upb/message/message.c +0 -6
  504. data/third_party/upb/upb/message/message.h +1 -1
  505. data/third_party/upb/upb/message/tagged_ptr.h +89 -0
  506. data/third_party/upb/upb/mini_descriptor/build_enum.c +150 -0
  507. data/third_party/upb/upb/mini_descriptor/build_enum.h +63 -0
  508. data/third_party/upb/upb/{mini_table → mini_descriptor}/decode.c +122 -374
  509. data/third_party/upb/upb/{mini_table → mini_descriptor}/decode.h +11 -50
  510. data/third_party/upb/upb/mini_descriptor/internal/base92.c +46 -0
  511. data/third_party/upb/upb/mini_descriptor/internal/base92.h +81 -0
  512. data/third_party/upb/upb/mini_descriptor/internal/decoder.h +73 -0
  513. data/third_party/upb/upb/{mini_table → mini_descriptor/internal}/encode.c +58 -32
  514. data/third_party/upb/upb/{mini_table/encode_internal.h → mini_descriptor/internal/encode.h} +3 -4
  515. data/third_party/upb/upb/{mini_table/encode_internal.hpp → mini_descriptor/internal/encode.hpp} +1 -1
  516. data/third_party/upb/upb/mini_descriptor/internal/modifiers.h +50 -0
  517. data/third_party/upb/upb/{mini_table/common_internal.h → mini_descriptor/internal/wire_constants.h} +3 -23
  518. data/third_party/upb/upb/mini_descriptor/link.c +142 -0
  519. data/third_party/upb/upb/mini_descriptor/link.h +104 -0
  520. data/third_party/upb/upb/mini_table/{types.h → enum.h} +19 -9
  521. data/third_party/upb/upb/mini_table/extension.h +40 -0
  522. data/third_party/upb/upb/mini_table/extension_registry.c +1 -1
  523. data/third_party/upb/upb/mini_table/extension_registry.h +2 -1
  524. data/third_party/upb/upb/mini_table/field.h +118 -0
  525. data/third_party/upb/upb/{json_decode.h → mini_table/file.h} +5 -6
  526. data/third_party/upb/upb/mini_table/{enum_internal.h → internal/enum.h} +7 -19
  527. data/third_party/upb/upb/mini_table/{extension_internal.h → internal/extension.h} +8 -8
  528. data/third_party/upb/upb/mini_table/{field_internal.h → internal/field.h} +10 -66
  529. data/third_party/upb/upb/mini_table/{file_internal.h → internal/file.h} +6 -4
  530. data/third_party/upb/upb/mini_table/internal/message.c +39 -0
  531. data/third_party/upb/upb/mini_table/{message_internal.h → internal/message.h} +14 -37
  532. data/third_party/upb/upb/mini_table/{sub_internal.h → internal/sub.h} +7 -6
  533. data/third_party/upb/upb/mini_table/{common.c → message.c} +2 -33
  534. data/third_party/upb/upb/mini_table/{common.h → message.h} +12 -77
  535. data/third_party/upb/upb/{json_encode.h → mini_table/sub.h} +5 -6
  536. data/third_party/upb/upb/reflection/def.hpp +16 -4
  537. data/third_party/upb/upb/reflection/def_pool_internal.h +1 -1
  538. data/third_party/upb/upb/reflection/desc_state_internal.h +1 -1
  539. data/third_party/upb/upb/reflection/enum_def.c +1 -1
  540. data/third_party/upb/upb/reflection/field_def.c +2 -1
  541. data/third_party/upb/upb/reflection/message.c +2 -2
  542. data/third_party/upb/upb/reflection/message_def.c +3 -1
  543. data/third_party/upb/upb/wire/decode.c +68 -29
  544. data/third_party/upb/upb/wire/decode.h +40 -0
  545. data/third_party/upb/upb/wire/encode.c +23 -13
  546. metadata +43 -27
  547. data/src/core/lib/event_engine/thread_pool/original_thread_pool.cc +0 -256
  548. data/src/core/lib/event_engine/thread_pool/original_thread_pool.h +0 -137
@@ -16,6 +16,8 @@
16
16
 
17
17
  #include <grpc/support/port_platform.h>
18
18
 
19
+ #include "src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.h"
20
+
19
21
  #include <inttypes.h>
20
22
  #include <string.h>
21
23
 
@@ -33,19 +35,18 @@
33
35
  #include "absl/strings/string_view.h"
34
36
  #include "absl/types/optional.h"
35
37
 
36
- #include <grpc/impl/channel_arg_names.h>
37
38
  #include <grpc/impl/connectivity_state.h>
38
39
  #include <grpc/support/log.h>
39
40
 
40
- #include "src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h"
41
- #include "src/core/ext/filters/client_channel/lb_policy/subchannel_list.h"
41
+ #include "src/core/ext/filters/client_channel/lb_policy/health_check_client.h"
42
42
  #include "src/core/lib/channel/channel_args.h"
43
43
  #include "src/core/lib/config/core_configuration.h"
44
44
  #include "src/core/lib/debug/trace.h"
45
+ #include "src/core/lib/gprpp/crash.h"
45
46
  #include "src/core/lib/gprpp/debug_location.h"
46
47
  #include "src/core/lib/gprpp/orphanable.h"
47
48
  #include "src/core/lib/gprpp/ref_counted_ptr.h"
48
- #include "src/core/lib/gprpp/work_serializer.h"
49
+ #include "src/core/lib/iomgr/iomgr_fwd.h"
49
50
  #include "src/core/lib/json/json.h"
50
51
  #include "src/core/lib/json/json_args.h"
51
52
  #include "src/core/lib/json/json_object_loader.h"
@@ -98,72 +99,140 @@ class PickFirst : public LoadBalancingPolicy {
98
99
  private:
99
100
  ~PickFirst() override;
100
101
 
101
- class PickFirstSubchannelList;
102
-
103
- class PickFirstSubchannelData
104
- : public SubchannelData<PickFirstSubchannelList,
105
- PickFirstSubchannelData> {
102
+ class SubchannelList : public InternallyRefCounted<SubchannelList> {
106
103
  public:
107
- PickFirstSubchannelData(
108
- SubchannelList<PickFirstSubchannelList, PickFirstSubchannelData>*
109
- subchannel_list,
110
- const ServerAddress& address,
111
- RefCountedPtr<SubchannelInterface> subchannel)
112
- : SubchannelData(subchannel_list, address, std::move(subchannel)) {}
104
+ class SubchannelData {
105
+ public:
106
+ SubchannelData(SubchannelList* subchannel_list,
107
+ RefCountedPtr<SubchannelInterface> subchannel);
108
+
109
+ SubchannelInterface* subchannel() const { return subchannel_.get(); }
110
+ absl::optional<grpc_connectivity_state> connectivity_state() const {
111
+ return connectivity_state_;
112
+ }
113
+
114
+ // Returns the index into the subchannel list of this object.
115
+ size_t Index() const {
116
+ return static_cast<size_t>(this -
117
+ &subchannel_list_->subchannels_.front());
118
+ }
119
+
120
+ // Resets the connection backoff.
121
+ void ResetBackoffLocked() {
122
+ if (subchannel_ != nullptr) subchannel_->ResetBackoff();
123
+ }
124
+
125
+ // Cancels any pending connectivity watch and unrefs the subchannel.
126
+ void ShutdownLocked();
127
+
128
+ private:
129
+ // Watcher for subchannel connectivity state.
130
+ class Watcher
131
+ : public SubchannelInterface::ConnectivityStateWatcherInterface {
132
+ public:
133
+ Watcher(SubchannelData* subchannel_data,
134
+ RefCountedPtr<SubchannelList> subchannel_list)
135
+ : subchannel_data_(subchannel_data),
136
+ subchannel_list_(std::move(subchannel_list)) {}
137
+
138
+ ~Watcher() override {
139
+ subchannel_list_.reset(DEBUG_LOCATION, "Watcher dtor");
140
+ }
141
+
142
+ void OnConnectivityStateChange(grpc_connectivity_state new_state,
143
+ absl::Status status) override {
144
+ subchannel_data_->OnConnectivityStateChange(new_state,
145
+ std::move(status));
146
+ }
147
+
148
+ grpc_pollset_set* interested_parties() override {
149
+ return subchannel_list_->policy_->interested_parties();
150
+ }
151
+
152
+ private:
153
+ SubchannelData* subchannel_data_;
154
+ RefCountedPtr<SubchannelList> subchannel_list_;
155
+ };
156
+
157
+ // This method will be invoked once soon after instantiation to report
158
+ // the current connectivity state, and it will then be invoked again
159
+ // whenever the connectivity state changes.
160
+ void OnConnectivityStateChange(grpc_connectivity_state new_state,
161
+ absl::Status status);
113
162
 
114
- void ProcessConnectivityChangeLocked(
115
- absl::optional<grpc_connectivity_state> old_state,
116
- grpc_connectivity_state new_state) override;
163
+ // Processes the connectivity change to READY for an unselected
164
+ // subchannel.
165
+ void ProcessUnselectedReadyLocked();
166
+
167
+ // Reacts to the current connectivity state while trying to connect.
168
+ void ReactToConnectivityStateLocked();
169
+
170
+ // Backpointer to owning subchannel list. Not owned.
171
+ SubchannelList* subchannel_list_;
172
+ // The subchannel.
173
+ RefCountedPtr<SubchannelInterface> subchannel_;
174
+ // Will be non-null when the subchannel's state is being watched.
175
+ SubchannelInterface::ConnectivityStateWatcherInterface* pending_watcher_ =
176
+ nullptr;
177
+ // Data updated by the watcher.
178
+ absl::optional<grpc_connectivity_state> connectivity_state_;
179
+ absl::Status connectivity_status_;
180
+ };
181
+
182
+ SubchannelList(RefCountedPtr<PickFirst> policy, ServerAddressList addresses,
183
+ const ChannelArgs& args);
184
+
185
+ ~SubchannelList() override;
186
+
187
+ // The number of subchannels in the list.
188
+ size_t size() const { return subchannels_.size(); }
189
+
190
+ // Resets connection backoff of all subchannels.
191
+ void ResetBackoffLocked();
192
+
193
+ void Orphan() override;
117
194
 
118
195
  private:
119
- // Processes the connectivity change to READY for an unselected subchannel.
120
- void ProcessUnselectedReadyLocked();
196
+ // Returns true if all subchannels have seen their initial
197
+ // connectivity state notifications.
198
+ bool AllSubchannelsSeenInitialState();
121
199
 
122
- // Reacts to the current connectivity state while trying to connect.
123
- void ReactToConnectivityStateLocked();
200
+ // Backpointer to owning policy.
201
+ RefCountedPtr<PickFirst> policy_;
202
+
203
+ ChannelArgs args_;
204
+
205
+ // The list of subchannels.
206
+ std::vector<SubchannelData> subchannels_;
207
+
208
+ // Is this list shutting down? This may be true due to the shutdown of the
209
+ // policy itself or because a newer update has arrived while this one hadn't
210
+ // finished processing.
211
+ bool shutting_down_ = false;
212
+
213
+ bool in_transient_failure_ = false;
214
+ size_t attempting_index_ = 0;
124
215
  };
125
216
 
126
- class PickFirstSubchannelList
127
- : public SubchannelList<PickFirstSubchannelList,
128
- PickFirstSubchannelData> {
217
+ class HealthWatcher
218
+ : public SubchannelInterface::ConnectivityStateWatcherInterface {
129
219
  public:
130
- PickFirstSubchannelList(PickFirst* policy, ServerAddressList addresses,
131
- const ChannelArgs& args)
132
- : SubchannelList(policy,
133
- (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)
134
- ? "PickFirstSubchannelList"
135
- : nullptr),
136
- std::move(addresses), policy->channel_control_helper(),
137
- args) {
138
- // Need to maintain a ref to the LB policy as long as we maintain
139
- // any references to subchannels, since the subchannels'
140
- // pollset_sets will include the LB policy's pollset_set.
141
- policy->Ref(DEBUG_LOCATION, "subchannel_list").release();
142
- // Note that we do not start trying to connect to any subchannel here,
143
- // since we will wait until we see the initial connectivity state for all
144
- // subchannels before doing that.
145
- }
220
+ explicit HealthWatcher(RefCountedPtr<PickFirst> policy)
221
+ : policy_(std::move(policy)) {}
146
222
 
147
- ~PickFirstSubchannelList() override {
148
- PickFirst* p = static_cast<PickFirst*>(policy());
149
- p->Unref(DEBUG_LOCATION, "subchannel_list");
223
+ ~HealthWatcher() override {
224
+ policy_.reset(DEBUG_LOCATION, "HealthWatcher dtor");
150
225
  }
151
226
 
152
- bool in_transient_failure() const { return in_transient_failure_; }
153
- void set_in_transient_failure(bool in_transient_failure) {
154
- in_transient_failure_ = in_transient_failure;
155
- }
156
-
157
- size_t attempting_index() const { return attempting_index_; }
158
- void set_attempting_index(size_t index) { attempting_index_ = index; }
227
+ void OnConnectivityStateChange(grpc_connectivity_state new_state,
228
+ absl::Status status) override;
159
229
 
160
- private:
161
- std::shared_ptr<WorkSerializer> work_serializer() const override {
162
- return static_cast<PickFirst*>(policy())->work_serializer();
230
+ grpc_pollset_set* interested_parties() override {
231
+ return policy_->interested_parties();
163
232
  }
164
233
 
165
- bool in_transient_failure_ = false;
166
- size_t attempting_index_ = 0;
234
+ private:
235
+ RefCountedPtr<PickFirst> policy_;
167
236
  };
168
237
 
169
238
  class Picker : public SubchannelPicker {
@@ -181,19 +250,30 @@ class PickFirst : public LoadBalancingPolicy {
181
250
 
182
251
  void ShutdownLocked() override;
183
252
 
184
- void AttemptToConnectUsingLatestUpdateArgsLocked();
185
-
186
253
  void UpdateState(grpc_connectivity_state state, const absl::Status& status,
187
254
  RefCountedPtr<SubchannelPicker> picker);
188
255
 
256
+ void AttemptToConnectUsingLatestUpdateArgsLocked();
257
+
258
+ void UnsetSelectedSubchannel();
259
+
260
+ // Whether we should enable health watching.
261
+ const bool enable_health_watch_;
262
+ // Whether we should omit our status message prefix.
263
+ const bool omit_status_message_prefix_;
264
+
189
265
  // Lateset update args.
190
266
  UpdateArgs latest_update_args_;
191
267
  // All our subchannels.
192
- RefCountedPtr<PickFirstSubchannelList> subchannel_list_;
268
+ OrphanablePtr<SubchannelList> subchannel_list_;
193
269
  // Latest pending subchannel list.
194
- RefCountedPtr<PickFirstSubchannelList> latest_pending_subchannel_list_;
195
- // Selected subchannel in \a subchannel_list_.
196
- PickFirstSubchannelData* selected_ = nullptr;
270
+ OrphanablePtr<SubchannelList> latest_pending_subchannel_list_;
271
+ // Selected subchannel in subchannel_list_.
272
+ SubchannelList::SubchannelData* selected_ = nullptr;
273
+ // Health watcher for the selected subchannel.
274
+ SubchannelInterface::ConnectivityStateWatcherInterface* health_watcher_ =
275
+ nullptr;
276
+ SubchannelInterface::DataWatcherInterface* health_data_watcher_ = nullptr;
197
277
  // Current connectivity state.
198
278
  grpc_connectivity_state state_ = GRPC_CHANNEL_CONNECTING;
199
279
  // Are we shut down?
@@ -202,7 +282,16 @@ class PickFirst : public LoadBalancingPolicy {
202
282
  absl::BitGen bit_gen_;
203
283
  };
204
284
 
205
- PickFirst::PickFirst(Args args) : LoadBalancingPolicy(std::move(args)) {
285
+ PickFirst::PickFirst(Args args)
286
+ : LoadBalancingPolicy(std::move(args)),
287
+ enable_health_watch_(
288
+ channel_args()
289
+ .GetBool(GRPC_ARG_INTERNAL_PICK_FIRST_ENABLE_HEALTH_CHECKING)
290
+ .value_or(false)),
291
+ omit_status_message_prefix_(
292
+ channel_args()
293
+ .GetBool(GRPC_ARG_INTERNAL_PICK_FIRST_OMIT_STATUS_MESSAGE_PREFIX)
294
+ .value_or(false)) {
206
295
  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
207
296
  gpr_log(GPR_INFO, "Pick First %p created.", this);
208
297
  }
@@ -221,13 +310,17 @@ void PickFirst::ShutdownLocked() {
221
310
  gpr_log(GPR_INFO, "Pick First %p Shutting down", this);
222
311
  }
223
312
  shutdown_ = true;
313
+ UnsetSelectedSubchannel();
224
314
  subchannel_list_.reset();
225
315
  latest_pending_subchannel_list_.reset();
226
316
  }
227
317
 
228
318
  void PickFirst::ExitIdleLocked() {
229
319
  if (shutdown_) return;
230
- if (state_ == GRPC_CHANNEL_IDLE) {
320
+ // Need to check subchannel_list_ being null here, in case the
321
+ // application calls channel->GetState(true) again before we
322
+ // transition to state CONNECTING.
323
+ if (state_ == GRPC_CHANNEL_IDLE && subchannel_list_ == nullptr) {
231
324
  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
232
325
  gpr_log(GPR_INFO, "Pick First %p exiting idle", this);
233
326
  }
@@ -255,13 +348,11 @@ void PickFirst::AttemptToConnectUsingLatestUpdateArgsLocked() {
255
348
  "[PF %p] Shutting down previous pending subchannel list %p", this,
256
349
  latest_pending_subchannel_list_.get());
257
350
  }
258
- latest_pending_subchannel_list_ = MakeRefCounted<PickFirstSubchannelList>(
259
- this, std::move(addresses), latest_update_args_.args);
260
- latest_pending_subchannel_list_->StartWatchingLocked(
261
- latest_update_args_.args);
351
+ latest_pending_subchannel_list_ = MakeOrphanable<SubchannelList>(
352
+ Ref(), std::move(addresses), latest_update_args_.args);
262
353
  // Empty update or no valid subchannels. Put the channel in
263
354
  // TRANSIENT_FAILURE and request re-resolution.
264
- if (latest_pending_subchannel_list_->num_subchannels() == 0) {
355
+ if (latest_pending_subchannel_list_->size() == 0) {
265
356
  channel_control_helper()->RequestReresolution();
266
357
  absl::Status status =
267
358
  latest_update_args_.addresses.ok()
@@ -273,9 +364,8 @@ void PickFirst::AttemptToConnectUsingLatestUpdateArgsLocked() {
273
364
  }
274
365
  // If the new update is empty or we don't yet have a selected subchannel in
275
366
  // the current list, replace the current subchannel list immediately.
276
- if (latest_pending_subchannel_list_->num_subchannels() == 0 ||
277
- selected_ == nullptr) {
278
- selected_ = nullptr;
367
+ if (latest_pending_subchannel_list_->size() == 0 || selected_ == nullptr) {
368
+ UnsetSelectedSubchannel();
279
369
  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace) &&
280
370
  subchannel_list_ != nullptr) {
281
371
  gpr_log(GPR_INFO, "[PF %p] Shutting down previous subchannel list %p",
@@ -296,8 +386,6 @@ absl::Status PickFirst::UpdateLocked(UpdateArgs args) {
296
386
  this, args.addresses.status().ToString().c_str());
297
387
  }
298
388
  }
299
- // Add GRPC_ARG_INHIBIT_HEALTH_CHECKING channel arg.
300
- args.args = args.args.Set(GRPC_ARG_INHIBIT_HEALTH_CHECKING, 1);
301
389
  // Set return status based on the address list.
302
390
  absl::Status status;
303
391
  if (!args.addresses.ok()) {
@@ -310,19 +398,6 @@ absl::Status PickFirst::UpdateLocked(UpdateArgs args) {
310
398
  absl::c_shuffle(*args.addresses, bit_gen_);
311
399
  }
312
400
  }
313
- // TODO(roth): This is a hack to disable outlier_detection when used
314
- // with pick_first, for the reasons described in
315
- // https://github.com/grpc/grpc/issues/32967. Remove this when
316
- // implementing the dualstack design.
317
- if (args.addresses.ok()) {
318
- ServerAddressList addresses;
319
- for (const auto& address : *args.addresses) {
320
- addresses.emplace_back(
321
- address.address(),
322
- address.args().Set(GRPC_ARG_OUTLIER_DETECTION_DISABLE, 1));
323
- }
324
- args.addresses = std::move(addresses);
325
- }
326
401
  // If the update contains a resolver error and we have a previous update
327
402
  // that was not a resolver error, keep using the previous addresses.
328
403
  if (!args.addresses.ok() && latest_update_args_.config != nullptr) {
@@ -345,18 +420,122 @@ void PickFirst::UpdateState(grpc_connectivity_state state,
345
420
  channel_control_helper()->UpdateState(state, status, std::move(picker));
346
421
  }
347
422
 
348
- void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
349
- absl::optional<grpc_connectivity_state> old_state,
350
- grpc_connectivity_state new_state) {
351
- PickFirst* p = static_cast<PickFirst*>(subchannel_list()->policy());
423
+ void PickFirst::UnsetSelectedSubchannel() {
424
+ if (selected_ != nullptr && health_data_watcher_ != nullptr) {
425
+ selected_->subchannel()->CancelDataWatcher(health_data_watcher_);
426
+ }
427
+ selected_ = nullptr;
428
+ health_watcher_ = nullptr;
429
+ health_data_watcher_ = nullptr;
430
+ }
431
+
432
+ //
433
+ // PickFirst::HealthWatcher
434
+ //
435
+
436
+ void PickFirst::HealthWatcher::OnConnectivityStateChange(
437
+ grpc_connectivity_state new_state, absl::Status status) {
438
+ if (policy_->health_watcher_ != this) return;
439
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
440
+ gpr_log(GPR_INFO, "[PF %p] health watch state update: %s (%s)",
441
+ policy_.get(), ConnectivityStateName(new_state),
442
+ status.ToString().c_str());
443
+ }
444
+ switch (new_state) {
445
+ case GRPC_CHANNEL_READY:
446
+ policy_->channel_control_helper()->UpdateState(
447
+ GRPC_CHANNEL_READY, absl::OkStatus(),
448
+ MakeRefCounted<Picker>(policy_->selected_->subchannel()->Ref()));
449
+ break;
450
+ case GRPC_CHANNEL_IDLE:
451
+ // If the subchannel becomes disconnected, the health watcher
452
+ // might happen to see the change before the raw connectivity
453
+ // state watcher does. In this case, ignore it, since the raw
454
+ // connectivity state watcher will handle it shortly.
455
+ break;
456
+ case GRPC_CHANNEL_CONNECTING:
457
+ policy_->channel_control_helper()->UpdateState(
458
+ new_state, absl::OkStatus(),
459
+ MakeRefCounted<QueuePicker>(policy_->Ref()));
460
+ break;
461
+ case GRPC_CHANNEL_TRANSIENT_FAILURE:
462
+ policy_->channel_control_helper()->UpdateState(
463
+ GRPC_CHANNEL_TRANSIENT_FAILURE, status,
464
+ MakeRefCounted<TransientFailurePicker>(status));
465
+ break;
466
+ case GRPC_CHANNEL_SHUTDOWN:
467
+ Crash("health watcher reported state SHUTDOWN");
468
+ }
469
+ }
470
+
471
+ //
472
+ // PickFirst::SubchannelList::SubchannelData
473
+ //
474
+
475
+ PickFirst::SubchannelList::SubchannelData::SubchannelData(
476
+ SubchannelList* subchannel_list,
477
+ RefCountedPtr<SubchannelInterface> subchannel)
478
+ : subchannel_list_(subchannel_list), subchannel_(std::move(subchannel)) {
479
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
480
+ gpr_log(GPR_INFO,
481
+ "[PF %p] subchannel list %p index %" PRIuPTR
482
+ " (subchannel %p): starting watch",
483
+ subchannel_list_->policy_.get(), subchannel_list_,
484
+ subchannel_list_->size(), subchannel_.get());
485
+ }
486
+ auto watcher = std::make_unique<Watcher>(
487
+ this, subchannel_list_->Ref(DEBUG_LOCATION, "Watcher"));
488
+ pending_watcher_ = watcher.get();
489
+ subchannel_->WatchConnectivityState(std::move(watcher));
490
+ }
491
+
492
+ void PickFirst::SubchannelList::SubchannelData::ShutdownLocked() {
493
+ if (subchannel_ != nullptr) {
494
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
495
+ gpr_log(GPR_INFO,
496
+ "[PF %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
497
+ " (subchannel %p): cancelling watch and unreffing subchannel",
498
+ subchannel_list_->policy_.get(), subchannel_list_, Index(),
499
+ subchannel_list_->size(), subchannel_.get());
500
+ }
501
+ subchannel_->CancelConnectivityStateWatch(pending_watcher_);
502
+ pending_watcher_ = nullptr;
503
+ subchannel_.reset();
504
+ }
505
+ }
506
+
507
+ void PickFirst::SubchannelList::SubchannelData::OnConnectivityStateChange(
508
+ grpc_connectivity_state new_state, absl::Status status) {
509
+ PickFirst* p = subchannel_list_->policy_.get();
510
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
511
+ gpr_log(
512
+ GPR_INFO,
513
+ "[PF %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
514
+ " (subchannel %p): connectivity changed: old_state=%s, new_state=%s, "
515
+ "status=%s, shutting_down=%d, pending_watcher=%p, "
516
+ "p->selected_=%p, p->subchannel_list_=%p, "
517
+ "p->latest_pending_subchannel_list_=%p",
518
+ p, subchannel_list_, Index(), subchannel_list_->size(),
519
+ subchannel_.get(),
520
+ (connectivity_state_.has_value()
521
+ ? ConnectivityStateName(*connectivity_state_)
522
+ : "N/A"),
523
+ ConnectivityStateName(new_state), status.ToString().c_str(),
524
+ subchannel_list_->shutting_down_, pending_watcher_, p->selected_,
525
+ p->subchannel_list_.get(), p->latest_pending_subchannel_list_.get());
526
+ }
527
+ if (subchannel_list_->shutting_down_ || pending_watcher_ == nullptr) return;
352
528
  // The notification must be for a subchannel in either the current or
353
529
  // latest pending subchannel lists.
354
- GPR_ASSERT(subchannel_list() == p->subchannel_list_.get() ||
355
- subchannel_list() == p->latest_pending_subchannel_list_.get());
530
+ GPR_ASSERT(subchannel_list_ == p->subchannel_list_.get() ||
531
+ subchannel_list_ == p->latest_pending_subchannel_list_.get());
356
532
  GPR_ASSERT(new_state != GRPC_CHANNEL_SHUTDOWN);
533
+ absl::optional<grpc_connectivity_state> old_state = connectivity_state_;
534
+ connectivity_state_ = new_state;
535
+ connectivity_status_ = status;
357
536
  // Handle updates for the currently selected subchannel.
358
537
  if (p->selected_ == this) {
359
- GPR_ASSERT(subchannel_list() == p->subchannel_list_.get());
538
+ GPR_ASSERT(subchannel_list_ == p->subchannel_list_.get());
360
539
  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
361
540
  gpr_log(GPR_INFO,
362
541
  "Pick First %p selected subchannel connectivity changed to %s", p,
@@ -380,17 +559,15 @@ void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
380
559
  p, p->latest_pending_subchannel_list_.get(),
381
560
  p->subchannel_list_.get());
382
561
  }
383
- p->selected_ = nullptr;
562
+ p->UnsetSelectedSubchannel();
384
563
  p->subchannel_list_ = std::move(p->latest_pending_subchannel_list_);
385
564
  // Set our state to that of the pending subchannel list.
386
- if (p->subchannel_list_->in_transient_failure()) {
565
+ if (p->subchannel_list_->in_transient_failure_) {
387
566
  absl::Status status = absl::UnavailableError(absl::StrCat(
388
567
  "selected subchannel failed; switching to pending update; "
389
568
  "last failure: ",
390
- p->subchannel_list_
391
- ->subchannel(p->subchannel_list_->num_subchannels())
392
- ->connectivity_status()
393
- .ToString()));
569
+ p->subchannel_list_->subchannels_.back()
570
+ .connectivity_status_.ToString()));
394
571
  p->UpdateState(GRPC_CHANNEL_TRANSIENT_FAILURE, status,
395
572
  MakeRefCounted<TransientFailurePicker>(status));
396
573
  } else if (p->state_ != GRPC_CHANNEL_TRANSIENT_FAILURE) {
@@ -400,7 +577,7 @@ void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
400
577
  return;
401
578
  }
402
579
  // Enter idle.
403
- p->selected_ = nullptr;
580
+ p->UnsetSelectedSubchannel();
404
581
  p->subchannel_list_.reset();
405
582
  p->UpdateState(
406
583
  GRPC_CHANNEL_IDLE, absl::Status(),
@@ -418,32 +595,33 @@ void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked(
418
595
  // select in place of the current one.
419
596
  // If the subchannel is READY, use it.
420
597
  if (new_state == GRPC_CHANNEL_READY) {
421
- subchannel_list()->set_in_transient_failure(false);
598
+ subchannel_list_->in_transient_failure_ = false;
422
599
  ProcessUnselectedReadyLocked();
423
600
  return;
424
601
  }
425
602
  // If we haven't yet seen the initial connectivity state notification
426
603
  // for all subchannels, do nothing.
427
- if (!subchannel_list()->AllSubchannelsSeenInitialState()) return;
604
+ if (!subchannel_list_->AllSubchannelsSeenInitialState()) return;
428
605
  // If we're still here and this is the initial connectivity state
429
606
  // notification for this subchannel, that means it was the last one to
430
607
  // see its initial notification. Start trying to connect, starting
431
608
  // with the first subchannel.
432
609
  if (!old_state.has_value()) {
433
- subchannel_list()->subchannel(0)->ReactToConnectivityStateLocked();
610
+ subchannel_list_->subchannels_.front().ReactToConnectivityStateLocked();
434
611
  return;
435
612
  }
436
613
  // Ignore any other updates for subchannels we're not currently trying to
437
614
  // connect to.
438
- if (Index() != subchannel_list()->attempting_index()) return;
615
+ if (Index() != subchannel_list_->attempting_index_) return;
439
616
  // React to the connectivity state.
440
617
  ReactToConnectivityStateLocked();
441
618
  }
442
619
 
443
- void PickFirst::PickFirstSubchannelData::ReactToConnectivityStateLocked() {
444
- PickFirst* p = static_cast<PickFirst*>(subchannel_list()->policy());
620
+ void PickFirst::SubchannelList::SubchannelData::
621
+ ReactToConnectivityStateLocked() {
622
+ PickFirst* p = subchannel_list_->policy_.get();
445
623
  // Otherwise, process connectivity state.
446
- switch (connectivity_state().value()) {
624
+ switch (connectivity_state_.value()) {
447
625
  case GRPC_CHANNEL_READY:
448
626
  // Already handled this case above, so this should not happen.
449
627
  GPR_UNREACHABLE_CODE(break);
@@ -451,13 +629,13 @@ void PickFirst::PickFirstSubchannelData::ReactToConnectivityStateLocked() {
451
629
  // Find the next subchannel not in state TRANSIENT_FAILURE.
452
630
  // We skip subchannels in state TRANSIENT_FAILURE to avoid a
453
631
  // large recursion that could overflow the stack.
454
- PickFirstSubchannelData* found_subchannel = nullptr;
632
+ SubchannelData* found_subchannel = nullptr;
455
633
  for (size_t next_index = Index() + 1;
456
- next_index < subchannel_list()->num_subchannels(); ++next_index) {
457
- PickFirstSubchannelData* sc = subchannel_list()->subchannel(next_index);
458
- GPR_ASSERT(sc->connectivity_state().has_value());
459
- if (sc->connectivity_state() != GRPC_CHANNEL_TRANSIENT_FAILURE) {
460
- subchannel_list()->set_attempting_index(next_index);
634
+ next_index < subchannel_list_->size(); ++next_index) {
635
+ SubchannelData* sc = &subchannel_list_->subchannels_[next_index];
636
+ GPR_ASSERT(sc->connectivity_state_.has_value());
637
+ if (sc->connectivity_state_ != GRPC_CHANNEL_TRANSIENT_FAILURE) {
638
+ subchannel_list_->attempting_index_ = next_index;
461
639
  found_subchannel = sc;
462
640
  break;
463
641
  }
@@ -475,14 +653,14 @@ void PickFirst::PickFirstSubchannelData::ReactToConnectivityStateLocked() {
475
653
  gpr_log(GPR_INFO,
476
654
  "Pick First %p subchannel list %p failed to connect to "
477
655
  "all subchannels",
478
- p, subchannel_list());
656
+ p, subchannel_list_);
479
657
  }
480
- subchannel_list()->set_attempting_index(0);
481
- subchannel_list()->set_in_transient_failure(true);
658
+ subchannel_list_->attempting_index_ = 0;
659
+ subchannel_list_->in_transient_failure_ = true;
482
660
  // In case 2, swap to the new subchannel list. This means reporting
483
661
  // TRANSIENT_FAILURE and dropping the existing (working) connection,
484
662
  // but we can't ignore what the control plane has told us.
485
- if (subchannel_list() == p->latest_pending_subchannel_list_.get()) {
663
+ if (subchannel_list_ == p->latest_pending_subchannel_list_.get()) {
486
664
  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
487
665
  gpr_log(GPR_INFO,
488
666
  "Pick First %p promoting pending subchannel list %p to "
@@ -490,36 +668,38 @@ void PickFirst::PickFirstSubchannelData::ReactToConnectivityStateLocked() {
490
668
  p, p->latest_pending_subchannel_list_.get(),
491
669
  p->subchannel_list_.get());
492
670
  }
493
- p->selected_ = nullptr; // owned by p->subchannel_list_
671
+ p->UnsetSelectedSubchannel();
494
672
  p->subchannel_list_ = std::move(p->latest_pending_subchannel_list_);
495
673
  }
496
674
  // If this is the current subchannel list (either because we were
497
675
  // in case 1 or because we were in case 2 and just promoted it to
498
676
  // be the current list), re-resolve and report new state.
499
- if (subchannel_list() == p->subchannel_list_.get()) {
677
+ if (subchannel_list_ == p->subchannel_list_.get()) {
500
678
  p->channel_control_helper()->RequestReresolution();
501
- absl::Status status = absl::UnavailableError(
502
- absl::StrCat("failed to connect to all addresses; last error: ",
503
- connectivity_status().ToString()));
679
+ absl::Status status = absl::UnavailableError(absl::StrCat(
680
+ (p->omit_status_message_prefix_
681
+ ? ""
682
+ : "failed to connect to all addresses; last error: "),
683
+ connectivity_status_.ToString()));
504
684
  p->UpdateState(GRPC_CHANNEL_TRANSIENT_FAILURE, status,
505
685
  MakeRefCounted<TransientFailurePicker>(status));
506
686
  }
507
687
  // If the first subchannel is already IDLE, trigger the next connection
508
- // attempt immediately. Otherwise, we'll wait for it to report
688
+ // attempt immediately. Otherwise, we'll wait for it to report
509
689
  // its own connectivity state change.
510
- auto* subchannel0 = subchannel_list()->subchannel(0);
511
- if (subchannel0->connectivity_state() == GRPC_CHANNEL_IDLE) {
512
- subchannel0->subchannel()->RequestConnection();
690
+ auto& subchannel0 = subchannel_list_->subchannels_.front();
691
+ if (subchannel0.connectivity_state_ == GRPC_CHANNEL_IDLE) {
692
+ subchannel0.subchannel_->RequestConnection();
513
693
  }
514
694
  break;
515
695
  }
516
696
  case GRPC_CHANNEL_IDLE:
517
- subchannel()->RequestConnection();
697
+ subchannel_->RequestConnection();
518
698
  break;
519
699
  case GRPC_CHANNEL_CONNECTING:
520
700
  // Only update connectivity state in case 1, and only if we're not
521
701
  // already in TRANSIENT_FAILURE.
522
- if (subchannel_list() == p->subchannel_list_.get() &&
702
+ if (subchannel_list_ == p->subchannel_list_.get() &&
523
703
  p->state_ != GRPC_CHANNEL_TRANSIENT_FAILURE) {
524
704
  p->UpdateState(GRPC_CHANNEL_CONNECTING, absl::Status(),
525
705
  MakeRefCounted<QueuePicker>(nullptr));
@@ -530,8 +710,8 @@ void PickFirst::PickFirstSubchannelData::ReactToConnectivityStateLocked() {
530
710
  }
531
711
  }
532
712
 
533
- void PickFirst::PickFirstSubchannelData::ProcessUnselectedReadyLocked() {
534
- PickFirst* p = static_cast<PickFirst*>(subchannel_list()->policy());
713
+ void PickFirst::SubchannelList::SubchannelData::ProcessUnselectedReadyLocked() {
714
+ PickFirst* p = subchannel_list_->policy_.get();
535
715
  // If we get here, there are two possible cases:
536
716
  // 1. We do not currently have a selected subchannel, and the update is
537
717
  // for a subchannel in p->subchannel_list_ that we're trying to
@@ -541,10 +721,10 @@ void PickFirst::PickFirstSubchannelData::ProcessUnselectedReadyLocked() {
541
721
  // for a subchannel in p->latest_pending_subchannel_list_. The
542
722
  // goal here is to find a subchannel from the update that we can
543
723
  // select in place of the current one.
544
- GPR_ASSERT(subchannel_list() == p->subchannel_list_.get() ||
545
- subchannel_list() == p->latest_pending_subchannel_list_.get());
724
+ GPR_ASSERT(subchannel_list_ == p->subchannel_list_.get() ||
725
+ subchannel_list_ == p->latest_pending_subchannel_list_.get());
546
726
  // Case 2. Promote p->latest_pending_subchannel_list_ to p->subchannel_list_.
547
- if (subchannel_list() == p->latest_pending_subchannel_list_.get()) {
727
+ if (subchannel_list_ == p->latest_pending_subchannel_list_.get()) {
548
728
  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
549
729
  gpr_log(GPR_INFO,
550
730
  "Pick First %p promoting pending subchannel list %p to "
@@ -556,18 +736,115 @@ void PickFirst::PickFirstSubchannelData::ProcessUnselectedReadyLocked() {
556
736
  }
557
737
  // Cases 1 and 2.
558
738
  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
559
- gpr_log(GPR_INFO, "Pick First %p selected subchannel %p", p, subchannel());
739
+ gpr_log(GPR_INFO, "Pick First %p selected subchannel %p", p,
740
+ subchannel_.get());
560
741
  }
561
742
  p->selected_ = this;
562
- p->UpdateState(GRPC_CHANNEL_READY, absl::Status(),
563
- MakeRefCounted<Picker>(subchannel()->Ref()));
564
- for (size_t i = 0; i < subchannel_list()->num_subchannels(); ++i) {
743
+ // If health checking is enabled, start the health watch, but don't
744
+ // report a new picker -- we want to stay in CONNECTING while we wait
745
+ // for the health status notification.
746
+ // If health checking is NOT enabled, report READY.
747
+ if (p->enable_health_watch_) {
748
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
749
+ gpr_log(GPR_INFO, "[PF %p] starting health watch", p);
750
+ }
751
+ auto watcher = std::make_unique<HealthWatcher>(
752
+ p->Ref(DEBUG_LOCATION, "HealthWatcher"));
753
+ p->health_watcher_ = watcher.get();
754
+ auto health_data_watcher = MakeHealthCheckWatcher(
755
+ p->work_serializer(), subchannel_list_->args_, std::move(watcher));
756
+ p->health_data_watcher_ = health_data_watcher.get();
757
+ subchannel_->AddDataWatcher(std::move(health_data_watcher));
758
+ } else {
759
+ p->UpdateState(GRPC_CHANNEL_READY, absl::Status(),
760
+ MakeRefCounted<Picker>(subchannel()->Ref()));
761
+ }
762
+ // Unref all other subchannels in the list.
763
+ for (size_t i = 0; i < subchannel_list_->size(); ++i) {
565
764
  if (i != Index()) {
566
- subchannel_list()->subchannel(i)->ShutdownLocked();
765
+ subchannel_list_->subchannels_[i].ShutdownLocked();
567
766
  }
568
767
  }
569
768
  }
570
769
 
770
+ //
771
+ // PickFirst::SubchannelList
772
+ //
773
+
774
+ PickFirst::SubchannelList::SubchannelList(RefCountedPtr<PickFirst> policy,
775
+ ServerAddressList addresses,
776
+ const ChannelArgs& args)
777
+ : InternallyRefCounted<SubchannelList>(
778
+ GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace) ? "SubchannelList"
779
+ : nullptr),
780
+ policy_(std::move(policy)),
781
+ args_(args.Remove(GRPC_ARG_INTERNAL_PICK_FIRST_ENABLE_HEALTH_CHECKING)
782
+ .Remove(
783
+ GRPC_ARG_INTERNAL_PICK_FIRST_OMIT_STATUS_MESSAGE_PREFIX)) {
784
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
785
+ gpr_log(GPR_INFO,
786
+ "[PF %p] Creating subchannel list %p for %" PRIuPTR
787
+ " subchannels - channel args: %s",
788
+ policy_.get(), this, addresses.size(), args_.ToString().c_str());
789
+ }
790
+ subchannels_.reserve(addresses.size());
791
+ // Create a subchannel for each address.
792
+ for (const ServerAddress& address : addresses) {
793
+ RefCountedPtr<SubchannelInterface> subchannel =
794
+ policy_->channel_control_helper()->CreateSubchannel(address, args_);
795
+ if (subchannel == nullptr) {
796
+ // Subchannel could not be created.
797
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
798
+ gpr_log(GPR_INFO,
799
+ "[PF %p] could not create subchannel for address %s, ignoring",
800
+ policy_.get(), address.ToString().c_str());
801
+ }
802
+ continue;
803
+ }
804
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
805
+ gpr_log(GPR_INFO,
806
+ "[PF %p] subchannel list %p index %" PRIuPTR
807
+ ": Created subchannel %p for address %s",
808
+ policy_.get(), this, subchannels_.size(), subchannel.get(),
809
+ address.ToString().c_str());
810
+ }
811
+ subchannels_.emplace_back(this, std::move(subchannel));
812
+ }
813
+ }
814
+
815
+ PickFirst::SubchannelList::~SubchannelList() {
816
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
817
+ gpr_log(GPR_INFO, "[PF %p] Destroying subchannel_list %p", policy_.get(),
818
+ this);
819
+ }
820
+ }
821
+
822
+ void PickFirst::SubchannelList::Orphan() {
823
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) {
824
+ gpr_log(GPR_INFO, "[PF %p] Shutting down subchannel_list %p", policy_.get(),
825
+ this);
826
+ }
827
+ GPR_ASSERT(!shutting_down_);
828
+ shutting_down_ = true;
829
+ for (auto& sd : subchannels_) {
830
+ sd.ShutdownLocked();
831
+ }
832
+ Unref();
833
+ }
834
+
835
+ void PickFirst::SubchannelList::ResetBackoffLocked() {
836
+ for (auto& sd : subchannels_) {
837
+ sd.ResetBackoffLocked();
838
+ }
839
+ }
840
+
841
+ bool PickFirst::SubchannelList::AllSubchannelsSeenInitialState() {
842
+ for (auto& sd : subchannels_) {
843
+ if (!sd.connectivity_state().has_value()) return false;
844
+ }
845
+ return true;
846
+ }
847
+
571
848
  //
572
849
  // factory
573
850
  //