grpc 1.78.0 → 1.80.0.pre1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (431) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +22 -8
  3. data/include/grpc/credentials.h +47 -37
  4. data/include/grpc/credentials_cpp.h +39 -0
  5. data/include/grpc/event_engine/event_engine.h +8 -3
  6. data/include/grpc/grpc.h +4 -0
  7. data/include/grpc/impl/call.h +9 -0
  8. data/include/grpc/impl/channel_arg_names.h +7 -0
  9. data/include/grpc/module.modulemap +2 -0
  10. data/include/grpc/private_key_signer.h +104 -0
  11. data/include/grpc/support/port_platform.h +6 -0
  12. data/src/core/call/call_filters.h +101 -78
  13. data/src/core/call/call_spine.h +91 -68
  14. data/src/core/call/call_state.h +60 -4
  15. data/src/core/call/client_call.cc +9 -9
  16. data/src/core/call/client_call.h +1 -1
  17. data/src/core/call/metadata_batch.cc +2 -0
  18. data/src/core/call/metadata_batch.h +48 -1
  19. data/src/core/call/metadata_info.cc +35 -0
  20. data/src/core/call/metadata_info.h +2 -0
  21. data/src/core/call/simple_slice_based_metadata.h +2 -1
  22. data/src/core/channelz/channelz.cc +9 -6
  23. data/src/core/channelz/channelz.h +7 -4
  24. data/src/core/channelz/property_list.h +5 -0
  25. data/src/core/channelz/v2tov1/convert.cc +1 -1
  26. data/src/core/channelz/v2tov1/legacy_api.cc +164 -307
  27. data/src/core/client_channel/buffered_call.cc +7 -3
  28. data/src/core/client_channel/buffered_call.h +11 -5
  29. data/src/core/client_channel/client_channel.cc +106 -44
  30. data/src/core/client_channel/client_channel.h +3 -6
  31. data/src/core/client_channel/client_channel_filter.cc +90 -64
  32. data/src/core/client_channel/client_channel_filter.h +3 -6
  33. data/src/core/client_channel/client_channel_internal.h +5 -0
  34. data/src/core/client_channel/config_selector.h +17 -12
  35. data/src/core/client_channel/dynamic_filters.cc +8 -7
  36. data/src/core/client_channel/dynamic_filters.h +7 -5
  37. data/src/core/client_channel/retry_filter.cc +1 -1
  38. data/src/core/client_channel/retry_filter.h +2 -2
  39. data/src/core/client_channel/subchannel.cc +1682 -266
  40. data/src/core/client_channel/subchannel.h +411 -134
  41. data/src/core/client_channel/subchannel_stream_client.cc +22 -18
  42. data/src/core/client_channel/subchannel_stream_client.h +8 -9
  43. data/src/core/client_channel/subchannel_stream_limiter.cc +76 -0
  44. data/src/core/client_channel/subchannel_stream_limiter.h +51 -0
  45. data/src/core/config/config_vars.cc +9 -1
  46. data/src/core/config/config_vars.h +6 -0
  47. data/src/core/credentials/call/call_creds_registry.h +51 -22
  48. data/src/core/credentials/call/call_creds_registry_init.cc +86 -2
  49. data/src/core/credentials/call/external/aws_external_account_credentials.cc +2 -2
  50. data/src/core/credentials/call/external/external_account_credentials.cc +11 -4
  51. data/src/core/credentials/call/external/file_external_account_credentials.cc +2 -2
  52. data/src/core/credentials/transport/channel_creds_registry.h +71 -20
  53. data/src/core/credentials/transport/channel_creds_registry_init.cc +338 -29
  54. data/src/core/credentials/transport/ssl/ssl_credentials.cc +43 -24
  55. data/src/core/credentials/transport/ssl/ssl_credentials.h +7 -1
  56. data/src/core/credentials/transport/ssl/ssl_security_connector.cc +2 -8
  57. data/src/core/credentials/transport/ssl/ssl_security_connector.h +4 -3
  58. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +25 -5
  59. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +7 -5
  60. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +181 -109
  61. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +55 -42
  62. data/src/core/credentials/transport/tls/grpc_tls_credentials_options.cc +28 -23
  63. data/src/core/credentials/transport/tls/grpc_tls_credentials_options.h +26 -23
  64. data/src/core/credentials/transport/tls/spiffe_utils.cc +2 -2
  65. data/src/core/credentials/transport/tls/ssl_utils.cc +18 -18
  66. data/src/core/credentials/transport/tls/ssl_utils.h +12 -10
  67. data/src/core/credentials/transport/tls/tls_security_connector.cc +106 -74
  68. data/src/core/credentials/transport/tls/tls_security_connector.h +12 -8
  69. data/src/core/credentials/transport/xds/xds_credentials.cc +76 -32
  70. data/src/core/credentials/transport/xds/xds_credentials.h +4 -2
  71. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +117 -35
  72. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +42 -4
  73. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +58 -29
  74. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h +19 -11
  75. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +82 -25
  76. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +28 -3
  77. data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc +9 -7
  78. data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h +1 -1
  79. data/src/core/ext/transport/chttp2/transport/call_tracer_wrapper.h +7 -1
  80. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +117 -67
  81. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +2 -0
  82. data/src/core/ext/transport/chttp2/transport/flow_control.h +11 -1
  83. data/src/core/ext/transport/chttp2/transport/frame.cc +2 -15
  84. data/src/core/ext/transport/chttp2/transport/frame.h +0 -4
  85. data/src/core/ext/transport/chttp2/transport/goaway.cc +17 -2
  86. data/src/core/ext/transport/chttp2/transport/goaway.h +27 -6
  87. data/src/core/ext/transport/chttp2/transport/header_assembler.h +8 -21
  88. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +101 -40
  89. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +95 -0
  90. data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +923 -772
  91. data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +406 -423
  92. data/src/core/ext/transport/chttp2/transport/http2_settings.cc +1 -0
  93. data/src/core/ext/transport/chttp2/transport/http2_settings.h +8 -1
  94. data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +25 -13
  95. data/src/core/ext/transport/chttp2/transport/http2_transport.cc +71 -24
  96. data/src/core/ext/transport/chttp2/transport/http2_transport.h +25 -49
  97. data/src/core/ext/transport/chttp2/transport/http2_ztrace_collector.h +2 -2
  98. data/src/core/ext/transport/chttp2/transport/incoming_metadata_tracker.h +29 -9
  99. data/src/core/ext/transport/chttp2/transport/internal.h +6 -2
  100. data/src/core/ext/transport/chttp2/transport/keepalive.cc +14 -20
  101. data/src/core/ext/transport/chttp2/transport/keepalive.h +9 -6
  102. data/src/core/ext/transport/chttp2/transport/parsing.cc +11 -0
  103. data/src/core/ext/transport/chttp2/transport/ping_promise.cc +34 -74
  104. data/src/core/ext/transport/chttp2/transport/ping_promise.h +123 -79
  105. data/src/core/ext/transport/chttp2/transport/security_frame.h +233 -3
  106. data/src/core/ext/transport/chttp2/transport/stream.h +152 -73
  107. data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +155 -85
  108. data/src/core/ext/transport/chttp2/transport/transport_common.h +0 -5
  109. data/src/core/ext/transport/chttp2/transport/writable_streams.h +8 -7
  110. data/src/core/ext/transport/chttp2/transport/write_cycle.cc +86 -0
  111. data/src/core/ext/transport/chttp2/transport/write_cycle.h +355 -0
  112. data/src/core/ext/transport/chttp2/transport/writing.cc +31 -29
  113. data/src/core/ext/upb-gen/cel/expr/checked.upb.h +1875 -0
  114. data/src/core/ext/upb-gen/cel/expr/checked.upb_minitable.c +409 -0
  115. data/src/core/ext/upb-gen/cel/expr/checked.upb_minitable.h +56 -0
  116. data/src/core/ext/upb-gen/cel/expr/syntax.upb.h +2223 -0
  117. data/src/core/ext/upb-gen/cel/expr/syntax.upb_minitable.c +489 -0
  118. data/src/core/ext/upb-gen/cel/expr/syntax.upb_minitable.h +60 -0
  119. data/src/core/ext/upb-gen/envoy/config/accesslog/v3/accesslog.upb.h +2 -1
  120. data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb.h +130 -18
  121. data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb_minitable.c +18 -13
  122. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb.h +70 -38
  123. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.c +20 -17
  124. data/src/core/ext/upb-gen/envoy/config/common/matcher/v3/matcher.upb.h +26 -10
  125. data/src/core/ext/upb-gen/envoy/config/common/matcher/v3/matcher.upb_minitable.c +8 -7
  126. data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb.h +495 -0
  127. data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb_minitable.c +114 -0
  128. data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb_minitable.h +36 -0
  129. data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb.h +26 -10
  130. data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb_minitable.c +8 -7
  131. data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb.h +121 -0
  132. data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb_minitable.c +54 -0
  133. data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb_minitable.h +32 -0
  134. data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_service.upb.h +143 -9
  135. data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_service.upb_minitable.c +18 -6
  136. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb.h +112 -11
  137. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.c +22 -9
  138. data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb.h +276 -0
  139. data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb_minitable.c +60 -5
  140. data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb_minitable.h +4 -0
  141. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb.h +72 -0
  142. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.c +23 -2
  143. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.h +2 -0
  144. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb.h +129 -13
  145. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.c +36 -10
  146. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.h +2 -0
  147. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb.h +30 -0
  148. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb_minitable.c +5 -3
  149. data/src/core/ext/upb-gen/envoy/config/metrics/v3/metrics_service.upb.h +16 -0
  150. data/src/core/ext/upb-gen/envoy/config/metrics/v3/metrics_service.upb_minitable.c +4 -3
  151. data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb.h +31 -0
  152. data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb_minitable.c +5 -3
  153. data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb.h +2 -1
  154. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb.h +63 -0
  155. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.c +12 -7
  156. data/src/core/ext/upb-gen/envoy/config/route/v3/route.upb.h +97 -81
  157. data/src/core/ext/upb-gen/envoy/config/route/v3/route.upb_minitable.c +40 -23
  158. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb.h +604 -228
  159. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.c +146 -100
  160. data/src/core/ext/upb-gen/envoy/config/tap/v3/common.upb.h +30 -0
  161. data/src/core/ext/upb-gen/envoy/config/tap/v3/common.upb_minitable.c +5 -3
  162. data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb.h +35 -3
  163. data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb_minitable.c +7 -4
  164. data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb.h +66 -14
  165. data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb_minitable.c +22 -11
  166. data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +87 -0
  167. data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb_minitable.c +29 -2
  168. data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb_minitable.h +2 -0
  169. data/src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +0 -1
  170. data/src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb_minitable.c +0 -1
  171. data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.h +20 -4
  172. data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb_minitable.c +5 -4
  173. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +239 -60
  174. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c +59 -28
  175. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.h +2 -0
  176. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb.h +89 -0
  177. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb_minitable.c +50 -0
  178. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb_minitable.h +32 -0
  179. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb.h +135 -0
  180. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb_minitable.c +53 -0
  181. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb_minitable.h +32 -0
  182. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb.h +105 -0
  183. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb_minitable.c +51 -0
  184. data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb_minitable.h +32 -0
  185. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +32 -0
  186. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb_minitable.c +6 -3
  187. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +206 -0
  188. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.c +41 -8
  189. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.h +2 -0
  190. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb.h +64 -0
  191. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb_minitable.c +4 -3
  192. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +64 -0
  193. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb_minitable.c +31 -5
  194. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb_minitable.h +2 -0
  195. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb.h +283 -14
  196. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.c +48 -11
  197. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.h +2 -0
  198. data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb.h +144 -6
  199. data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb_minitable.c +35 -7
  200. data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb_minitable.h +2 -0
  201. data/src/core/ext/upb-gen/envoy/type/tracing/v3/custom_tag.upb.h +42 -21
  202. data/src/core/ext/upb-gen/envoy/type/tracing/v3/custom_tag.upb_minitable.c +9 -8
  203. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb.h +164 -1
  204. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb_minitable.c +37 -6
  205. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb_minitable.h +2 -0
  206. data/src/core/ext/upb-gen/xds/type/matcher/v3/cel.upb.h +0 -1
  207. data/src/core/ext/upb-gen/xds/type/matcher/v3/cel.upb_minitable.c +0 -1
  208. data/src/core/ext/upb-gen/xds/type/matcher/v3/http_inputs.upb.h +0 -1
  209. data/src/core/ext/upb-gen/xds/type/matcher/v3/http_inputs.upb_minitable.c +0 -1
  210. data/src/core/ext/upb-gen/xds/type/matcher/v3/matcher.upb.h +26 -11
  211. data/src/core/ext/upb-gen/xds/type/matcher/v3/matcher.upb_minitable.c +8 -8
  212. data/src/core/ext/upb-gen/xds/type/matcher/v3/string.upb.h +33 -0
  213. data/src/core/ext/upb-gen/xds/type/matcher/v3/string.upb_minitable.c +14 -3
  214. data/src/core/ext/upb-gen/xds/type/v3/cel.upb.h +90 -10
  215. data/src/core/ext/upb-gen/xds/type/v3/cel.upb_minitable.c +18 -7
  216. data/src/core/ext/upbdefs-gen/cel/expr/checked.upbdefs.c +248 -0
  217. data/src/core/ext/upbdefs-gen/cel/expr/checked.upbdefs.h +97 -0
  218. data/src/core/ext/upbdefs-gen/cel/expr/syntax.upbdefs.c +283 -0
  219. data/src/core/ext/upbdefs-gen/cel/expr/syntax.upbdefs.h +107 -0
  220. data/src/core/ext/upbdefs-gen/envoy/config/accesslog/v3/accesslog.upbdefs.c +213 -211
  221. data/src/core/ext/upbdefs-gen/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +635 -614
  222. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.c +1012 -1000
  223. data/src/core/ext/upbdefs-gen/envoy/config/common/matcher/v3/matcher.upbdefs.c +276 -273
  224. data/src/core/ext/upbdefs-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upbdefs.c +152 -0
  225. data/src/core/ext/upbdefs-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upbdefs.h +47 -0
  226. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/address.upbdefs.c +149 -144
  227. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.c +367 -370
  228. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/cel.upbdefs.c +63 -0
  229. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/cel.upbdefs.h +37 -0
  230. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/grpc_service.upbdefs.c +297 -284
  231. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.c +492 -469
  232. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/proxy_protocol.upbdefs.c +74 -43
  233. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/proxy_protocol.upbdefs.h +10 -0
  234. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/substitution_format_string.upbdefs.c +60 -59
  235. data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +202 -184
  236. data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint_components.upbdefs.h +5 -0
  237. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.c +354 -339
  238. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.h +5 -0
  239. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/quic_config.upbdefs.c +28 -19
  240. data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/metrics_service.upbdefs.c +30 -27
  241. data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/stats.upbdefs.c +71 -66
  242. data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.c +94 -91
  243. data/src/core/ext/upbdefs-gen/envoy/config/rbac/v3/rbac.upbdefs.c +386 -369
  244. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route.upbdefs.c +60 -57
  245. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.c +1974 -1884
  246. data/src/core/ext/upbdefs-gen/envoy/config/tap/v3/common.upbdefs.c +119 -112
  247. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opentelemetry.upbdefs.c +62 -51
  248. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/zipkin.upbdefs.c +109 -88
  249. data/src/core/ext/upbdefs-gen/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.c +54 -36
  250. data/src/core/ext/upbdefs-gen/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.h +5 -0
  251. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.c +78 -84
  252. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upbdefs.c +48 -46
  253. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +1041 -984
  254. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
  255. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +304 -290
  256. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.c +94 -77
  257. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.h +5 -0
  258. data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.c +246 -193
  259. data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.h +5 -0
  260. data/src/core/ext/upbdefs-gen/envoy/type/http/v3/cookie.upbdefs.c +37 -23
  261. data/src/core/ext/upbdefs-gen/envoy/type/http/v3/cookie.upbdefs.h +5 -0
  262. data/src/core/ext/upbdefs-gen/envoy/type/tracing/v3/custom_tag.upbdefs.c +5 -3
  263. data/src/core/ext/upbdefs-gen/google/api/http.upbdefs.c +4 -4
  264. data/src/core/ext/upbdefs-gen/google/api/httpbody.upbdefs.c +4 -5
  265. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/promise.upbdefs.c +113 -87
  266. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/promise.upbdefs.h +5 -0
  267. data/src/core/ext/upbdefs-gen/udpa/annotations/migrate.upbdefs.c +5 -5
  268. data/src/core/ext/upbdefs-gen/udpa/annotations/security.upbdefs.c +6 -5
  269. data/src/core/ext/upbdefs-gen/udpa/annotations/sensitive.upbdefs.c +5 -5
  270. data/src/core/ext/upbdefs-gen/udpa/annotations/status.upbdefs.c +5 -5
  271. data/src/core/ext/upbdefs-gen/udpa/annotations/versioning.upbdefs.c +5 -5
  272. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/cel.upbdefs.c +25 -30
  273. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/http_inputs.upbdefs.c +14 -20
  274. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/matcher.upbdefs.c +180 -183
  275. data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/string.upbdefs.c +56 -47
  276. data/src/core/ext/upbdefs-gen/xds/type/v3/cel.upbdefs.c +69 -47
  277. data/src/core/filter/filter_chain.h +95 -0
  278. data/src/core/handshaker/http_connect/{http_connect_handshaker.cc → http_connect_client_handshaker.cc} +32 -31
  279. data/src/core/handshaker/http_connect/{http_connect_handshaker.h → http_connect_client_handshaker.h} +4 -4
  280. data/src/core/handshaker/http_connect/http_proxy_mapper.cc +1 -1
  281. data/src/core/handshaker/http_connect/xds_http_proxy_mapper.cc +1 -1
  282. data/src/core/handshaker/security/pipelined_secure_endpoint.cc +14 -13
  283. data/src/core/handshaker/security/secure_endpoint.cc +282 -68
  284. data/src/core/handshaker/security/secure_endpoint.h +0 -7
  285. data/src/core/lib/channel/channel_args.h +1 -1
  286. data/src/core/lib/channel/promise_based_filter.cc +17 -4
  287. data/src/core/lib/channel/promise_based_filter.h +3 -2
  288. data/src/core/lib/debug/trace_flags.cc +2 -0
  289. data/src/core/lib/debug/trace_flags.h +1 -0
  290. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +35 -8
  291. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +1 -2
  292. data/src/core/lib/event_engine/event_engine.cc +9 -0
  293. data/src/core/lib/event_engine/extensions/tcp_trace.h +0 -3
  294. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +2 -2
  295. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +1 -1
  296. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +34 -9
  297. data/src/core/lib/event_engine/posix_engine/posix_engine.h +24 -2
  298. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +1 -3
  299. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +141 -14
  300. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h +19 -2
  301. data/src/core/lib/event_engine/posix_engine/posix_interface.h +7 -0
  302. data/src/core/lib/event_engine/posix_engine/posix_interface_posix.cc +21 -3
  303. data/src/core/lib/event_engine/posix_engine/posix_interface_windows.cc +16 -0
  304. data/src/core/lib/experiments/experiments.cc +309 -201
  305. data/src/core/lib/experiments/experiments.h +141 -80
  306. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +2 -2
  307. data/src/core/lib/iomgr/resolve_address.h +0 -2
  308. data/src/core/lib/iomgr/resolved_address.h +0 -2
  309. data/src/core/lib/iomgr/tcp_posix.cc +13 -5
  310. data/src/core/lib/iomgr/tcp_server.cc +0 -5
  311. data/src/core/lib/iomgr/tcp_server.h +0 -7
  312. data/src/core/lib/iomgr/tcp_server_posix.cc +0 -17
  313. data/src/core/lib/iomgr/tcp_server_utils_posix.h +0 -3
  314. data/src/core/lib/iomgr/tcp_server_windows.cc +12 -51
  315. data/src/core/lib/promise/all_ok.h +17 -12
  316. data/src/core/lib/promise/cancel_callback.h +12 -13
  317. data/src/core/lib/promise/detail/join_state.h +626 -0
  318. data/src/core/lib/promise/detail/promise_factory.h +14 -14
  319. data/src/core/lib/promise/for_each.h +32 -8
  320. data/src/core/lib/promise/if.h +9 -7
  321. data/src/core/lib/promise/loop.h +18 -16
  322. data/src/core/lib/promise/map.h +54 -47
  323. data/src/core/lib/promise/mpsc.h +11 -10
  324. data/src/core/lib/promise/observable.h +6 -6
  325. data/src/core/lib/promise/party.h +25 -19
  326. data/src/core/lib/promise/poll.h +5 -5
  327. data/src/core/lib/promise/prioritized_race.h +10 -7
  328. data/src/core/lib/promise/promise.h +16 -11
  329. data/src/core/lib/promise/race.h +6 -5
  330. data/src/core/lib/promise/seq.h +109 -74
  331. data/src/core/lib/promise/try_join.h +14 -6
  332. data/src/core/lib/promise/try_seq.h +76 -60
  333. data/src/core/lib/resource_quota/api.cc +7 -0
  334. data/src/core/lib/resource_quota/arena.h +1 -1
  335. data/src/core/lib/resource_quota/memory_quota.cc +4 -1
  336. data/src/core/lib/resource_quota/resource_quota.cc +2 -1
  337. data/src/core/lib/resource_quota/resource_quota.h +3 -0
  338. data/src/core/lib/resource_quota/stream_quota.cc +77 -1
  339. data/src/core/lib/resource_quota/stream_quota.h +64 -1
  340. data/src/core/lib/resource_quota/telemetry.h +1 -1
  341. data/src/core/lib/surface/call.cc +13 -0
  342. data/src/core/lib/surface/call_utils.h +58 -43
  343. data/src/core/lib/surface/channel.h +1 -4
  344. data/src/core/lib/surface/completion_queue.cc +13 -6
  345. data/src/core/lib/surface/validate_metadata.cc +20 -15
  346. data/src/core/lib/surface/validate_metadata.h +3 -1
  347. data/src/core/lib/surface/version.cc +2 -2
  348. data/src/core/lib/transport/promise_endpoint.cc +1 -1
  349. data/src/core/lib/transport/promise_endpoint.h +1 -1
  350. data/src/core/lib/transport/transport.h +5 -0
  351. data/src/core/load_balancing/health_check_client.cc +1 -15
  352. data/src/core/load_balancing/health_check_client_internal.h +0 -2
  353. data/src/core/load_balancing/oob_backend_metric.cc +1 -5
  354. data/src/core/load_balancing/oob_backend_metric_internal.h +0 -1
  355. data/src/core/load_balancing/xds/xds_cluster_impl.cc +12 -9
  356. data/src/core/plugin_registry/grpc_plugin_registry.cc +3 -2
  357. data/src/core/resolver/xds/xds_resolver.cc +162 -116
  358. data/src/core/server/server.cc +18 -1
  359. data/src/core/server/server.h +2 -0
  360. data/src/core/server/xds_server_config_fetcher.cc +4 -4
  361. data/src/core/telemetry/call_tracer.cc +87 -2
  362. data/src/core/telemetry/call_tracer.h +46 -8
  363. data/src/core/telemetry/instrument.cc +102 -40
  364. data/src/core/telemetry/instrument.h +246 -65
  365. data/src/core/tsi/fake_transport_security.cc +3 -1
  366. data/src/core/tsi/ssl_transport_security.cc +516 -137
  367. data/src/core/tsi/ssl_transport_security.h +28 -22
  368. data/src/core/tsi/ssl_transport_security_utils.cc +2 -2
  369. data/src/core/tsi/ssl_transport_security_utils.h +2 -2
  370. data/src/core/util/bitset.h +6 -0
  371. data/src/core/util/function_signature.h +3 -1
  372. data/src/core/util/http_client/httpcli_security_connector.cc +2 -1
  373. data/src/core/util/json/json_reader.cc +0 -4
  374. data/src/core/xds/grpc/certificate_provider_store.cc +2 -1
  375. data/src/core/xds/grpc/certificate_provider_store.h +3 -17
  376. data/src/core/xds/grpc/certificate_provider_store_interface.h +61 -0
  377. data/src/core/xds/grpc/xds_bootstrap_grpc.cc +48 -0
  378. data/src/core/xds/grpc/xds_bootstrap_grpc.h +18 -0
  379. data/src/core/xds/grpc/xds_certificate_provider.cc +7 -2
  380. data/src/core/xds/grpc/xds_certificate_provider.h +13 -2
  381. data/src/core/xds/grpc/xds_client_grpc.cc +13 -6
  382. data/src/core/xds/grpc/xds_client_grpc.h +10 -7
  383. data/src/core/xds/grpc/xds_cluster.cc +18 -4
  384. data/src/core/xds/grpc/xds_cluster.h +17 -2
  385. data/src/core/xds/grpc/xds_cluster_parser.cc +36 -11
  386. data/src/core/xds/grpc/xds_common_types.cc +45 -0
  387. data/src/core/xds/grpc/xds_common_types.h +31 -0
  388. data/src/core/xds/grpc/xds_common_types_parser.cc +274 -16
  389. data/src/core/xds/grpc/xds_common_types_parser.h +12 -0
  390. data/src/core/xds/grpc/xds_http_fault_filter.cc +128 -24
  391. data/src/core/xds/grpc/xds_http_fault_filter.h +19 -10
  392. data/src/core/xds/grpc/xds_http_filter.cc +38 -0
  393. data/src/core/xds/grpc/xds_http_filter.h +70 -47
  394. data/src/core/xds/grpc/xds_http_filter_registry.cc +48 -14
  395. data/src/core/xds/grpc/xds_http_filter_registry.h +29 -15
  396. data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +88 -22
  397. data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +22 -11
  398. data/src/core/xds/grpc/xds_http_rbac_filter.cc +36 -20
  399. data/src/core/xds/grpc/xds_http_rbac_filter.h +19 -10
  400. data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +143 -26
  401. data/src/core/xds/grpc/xds_http_stateful_session_filter.h +19 -10
  402. data/src/core/xds/grpc/xds_listener.cc +4 -1
  403. data/src/core/xds/grpc/xds_listener.h +10 -2
  404. data/src/core/xds/grpc/xds_listener_parser.cc +23 -18
  405. data/src/core/xds/grpc/xds_matcher.cc +40 -5
  406. data/src/core/xds/grpc/xds_matcher.h +13 -0
  407. data/src/core/xds/grpc/xds_matcher_action.h +1 -1
  408. data/src/core/xds/grpc/xds_matcher_parse.cc +60 -40
  409. data/src/core/xds/grpc/xds_matcher_parse.h +2 -1
  410. data/src/core/xds/grpc/xds_route_config.cc +12 -1
  411. data/src/core/xds/grpc/xds_route_config.h +15 -2
  412. data/src/core/xds/grpc/xds_route_config_parser.cc +11 -5
  413. data/src/core/xds/grpc/xds_routing.cc +181 -6
  414. data/src/core/xds/grpc/xds_routing.h +57 -0
  415. data/src/core/xds/grpc/xds_server_grpc.cc +55 -43
  416. data/src/core/xds/grpc/xds_server_grpc.h +13 -6
  417. data/src/core/xds/grpc/xds_server_grpc_interface.h +3 -2
  418. data/src/core/xds/grpc/xds_transport_grpc.cc +12 -6
  419. data/src/core/xds/grpc/xds_transport_grpc.h +5 -1
  420. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +12 -8
  421. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +18 -12
  422. data/src/ruby/lib/grpc/grpc.rb +7 -9
  423. data/src/ruby/lib/grpc/version.rb +1 -1
  424. data/src/ruby/pb/generate_proto_ruby.sh +1 -1
  425. data/src/ruby/spec/client_server_spec.rb +1 -1
  426. data/src/ruby/spec/generic/rpc_server_pool_spec.rb +1 -1
  427. data/src/ruby/spec/generic/rpc_server_spec.rb +3 -4
  428. data/src/ruby/spec/spec_helper.rb +1 -1
  429. metadata +64 -14
  430. data/src/core/ext/transport/chttp2/transport/security_frame.cc +0 -31
  431. data/src/core/handshaker/security/legacy_secure_endpoint.cc +0 -597
@@ -58,107 +58,12 @@
58
58
  #include "absl/container/flat_hash_set.h"
59
59
  #include "absl/status/status.h"
60
60
 
61
- /** This arg is intended for internal use only, primarily
62
- * for passing endpoint information during subchannel creation or connection.
63
- */
61
+ // This arg is intended for internal use only, primarily for passing
62
+ // endpoint information during subchannel creation or connection.
64
63
  #define GRPC_ARG_SUBCHANNEL_ENDPOINT "grpc.internal.subchannel_endpoint"
65
64
 
66
65
  namespace grpc_core {
67
66
 
68
- class SubchannelCall;
69
-
70
- class ConnectedSubchannel : public RefCounted<ConnectedSubchannel> {
71
- public:
72
- const ChannelArgs& args() const { return args_; }
73
-
74
- // TODO(roth): Remove this when transport_state_watcher experiment is removed.
75
- virtual void StartWatch(
76
- grpc_pollset_set* interested_parties,
77
- OrphanablePtr<ConnectivityStateWatcherInterface> watcher) = 0;
78
-
79
- // Methods for v3 stack.
80
- virtual void Ping(absl::AnyInvocable<void(absl::Status)> on_ack) = 0;
81
- virtual RefCountedPtr<UnstartedCallDestination> unstarted_call_destination()
82
- const = 0;
83
-
84
- // Methods for legacy stack.
85
- virtual grpc_channel_stack* channel_stack() const = 0;
86
- virtual size_t GetInitialCallSizeEstimate() const = 0;
87
- virtual void Ping(grpc_closure* on_initiate, grpc_closure* on_ack) = 0;
88
-
89
- virtual channelz::SubchannelNode* channelz_node() const = 0;
90
-
91
- protected:
92
- explicit ConnectedSubchannel(const ChannelArgs& args);
93
-
94
- private:
95
- ChannelArgs args_;
96
- };
97
-
98
- class LegacyConnectedSubchannel;
99
-
100
- // Implements the interface of RefCounted<>.
101
- class SubchannelCall final {
102
- public:
103
- struct Args {
104
- RefCountedPtr<ConnectedSubchannel> connected_subchannel;
105
- grpc_polling_entity* pollent;
106
- gpr_cycle_counter start_time;
107
- Timestamp deadline;
108
- Arena* arena;
109
- CallCombiner* call_combiner;
110
- };
111
- static RefCountedPtr<SubchannelCall> Create(Args args,
112
- grpc_error_handle* error);
113
-
114
- // Continues processing a transport stream op batch.
115
- void StartTransportStreamOpBatch(grpc_transport_stream_op_batch* batch);
116
-
117
- // Returns the call stack of the subchannel call.
118
- grpc_call_stack* GetCallStack();
119
-
120
- // Sets the 'then_schedule_closure' argument for call stack destruction.
121
- // Must be called once per call.
122
- void SetAfterCallStackDestroy(grpc_closure* closure);
123
-
124
- // Interface of RefCounted<>.
125
- GRPC_MUST_USE_RESULT RefCountedPtr<SubchannelCall> Ref();
126
- GRPC_MUST_USE_RESULT RefCountedPtr<SubchannelCall> Ref(
127
- const DebugLocation& location, const char* reason);
128
- // When refcount drops to 0, destroys itself and the associated call stack,
129
- // but does NOT free the memory because it's in the call arena.
130
- void Unref();
131
- void Unref(const DebugLocation& location, const char* reason);
132
-
133
- private:
134
- // Allow RefCountedPtr<> to access IncrementRefCount().
135
- template <typename T>
136
- friend class RefCountedPtr;
137
-
138
- SubchannelCall(Args args, grpc_error_handle* error);
139
-
140
- // If channelz is enabled, intercepts recv_trailing so that we may check the
141
- // status and associate it to a subchannel.
142
- void MaybeInterceptRecvTrailingMetadata(
143
- grpc_transport_stream_op_batch* batch);
144
-
145
- static void RecvTrailingMetadataReady(void* arg, grpc_error_handle error);
146
-
147
- // Interface of RefCounted<>.
148
- void IncrementRefCount();
149
- void IncrementRefCount(const DebugLocation& location, const char* reason);
150
-
151
- static void Destroy(void* arg, grpc_error_handle error);
152
-
153
- RefCountedPtr<LegacyConnectedSubchannel> connected_subchannel_;
154
- grpc_closure* after_call_stack_destroy_ = nullptr;
155
- // State needed to support channelz interception of recv trailing metadata.
156
- grpc_closure recv_trailing_metadata_ready_;
157
- grpc_closure* original_recv_trailing_metadata_ = nullptr;
158
- grpc_metadata_batch* recv_trailing_metadata_ = nullptr;
159
- Timestamp deadline_;
160
- };
161
-
162
67
  // A subchannel that knows how to connect to exactly one target address. It
163
68
  // provides a target for load balancing.
164
69
  //
@@ -166,7 +71,7 @@ class SubchannelCall final {
166
71
  // different from the SubchannelInterface that is exposed to LB policy
167
72
  // implementations. The client channel provides an adaptor class
168
73
  // (SubchannelWrapper) that "converts" between the two.
169
- class Subchannel final : public DualRefCounted<Subchannel> {
74
+ class Subchannel : public DualRefCounted<Subchannel> {
170
75
  public:
171
76
  class ConnectivityStateWatcherInterface
172
77
  : public RefCounted<ConnectivityStateWatcherInterface> {
@@ -199,27 +104,153 @@ class Subchannel final : public DualRefCounted<Subchannel> {
199
104
  virtual UniqueTypeName type() const = 0;
200
105
  };
201
106
 
107
+ // A call object for the v1 stack.
108
+ // Provides the same interface as RefCounted<>.
109
+ class Call {
110
+ public:
111
+ virtual ~Call() = default;
112
+
113
+ // Continues processing a transport stream op batch.
114
+ virtual void StartTransportStreamOpBatch(
115
+ grpc_transport_stream_op_batch* batch) = 0;
116
+
117
+ // Sets the 'then_schedule_closure' argument for call stack destruction.
118
+ // Must be called once per call.
119
+ virtual void SetAfterCallStackDestroy(grpc_closure* closure) = 0;
120
+
121
+ // Interface of RefCounted<>.
122
+ GRPC_MUST_USE_RESULT RefCountedPtr<Call> Ref();
123
+ GRPC_MUST_USE_RESULT RefCountedPtr<Call> Ref(const DebugLocation& location,
124
+ const char* reason);
125
+ virtual void Unref() = 0;
126
+ virtual void Unref(const DebugLocation& location, const char* reason) = 0;
127
+
128
+ private:
129
+ // Allow RefCountedPtr<> to access IncrementRefCount().
130
+ template <typename T>
131
+ friend class RefCountedPtr;
132
+
133
+ // Interface of RefCounted<>.
134
+ virtual void IncrementRefCount() = 0;
135
+ virtual void IncrementRefCount(const DebugLocation& location,
136
+ const char* reason) = 0;
137
+ };
138
+
139
+ // Creates a subchannel.
140
+ static RefCountedPtr<Subchannel> Create(
141
+ OrphanablePtr<SubchannelConnector> connector,
142
+ const grpc_resolved_address& address, const ChannelArgs& args);
143
+
144
+ // Throttles keepalive time to \a new_keepalive_time iff \a new_keepalive_time
145
+ // is larger than the subchannel's current keepalive time. The updated value
146
+ // will have an affect when the subchannel creates a new ConnectedSubchannel.
147
+ virtual void ThrottleKeepaliveTime(Duration new_keepalive_time) = 0;
148
+
149
+ virtual grpc_pollset_set* pollset_set() const = 0;
150
+
151
+ virtual channelz::SubchannelNode* channelz_node() = 0;
152
+
153
+ virtual const ChannelArgs& args() const = 0;
154
+
155
+ virtual std::string address() const = 0;
156
+
157
+ // Starts watching the subchannel's connectivity state.
158
+ // The first callback to the watcher will be delivered ~immediately.
159
+ // Subsequent callbacks will be delivered as the subchannel's state
160
+ // changes.
161
+ // The watcher will be destroyed either when the subchannel is
162
+ // destroyed or when CancelConnectivityStateWatch() is called.
163
+ virtual void WatchConnectivityState(
164
+ RefCountedPtr<ConnectivityStateWatcherInterface> watcher) = 0;
165
+
166
+ // Cancels a connectivity state watch.
167
+ // If the watcher has already been destroyed, this is a no-op.
168
+ virtual void CancelConnectivityStateWatch(
169
+ ConnectivityStateWatcherInterface* watcher) = 0;
170
+
171
+ // Starts a call in the v1 stack.
172
+ // Returns null if there is no connected subchannel.
173
+ struct CreateCallArgs {
174
+ grpc_polling_entity* pollent;
175
+ gpr_cycle_counter start_time;
176
+ Timestamp deadline;
177
+ Arena* arena;
178
+ CallCombiner* call_combiner;
179
+ };
180
+ virtual RefCountedPtr<Call> CreateCall(CreateCallArgs args,
181
+ grpc_error_handle* error) = 0;
182
+
183
+ // Used for calls in the v3 stack.
184
+ virtual RefCountedPtr<UnstartedCallDestination> call_destination() = 0;
185
+
186
+ // Attempt to connect to the backend. Has no effect if already connected.
187
+ virtual void RequestConnection() = 0;
188
+
189
+ // Resets the connection backoff of the subchannel.
190
+ virtual void ResetBackoff() = 0;
191
+
192
+ // Access to data producer map.
193
+ // We do not hold refs to the data producer; the implementation is
194
+ // expected to register itself upon construction and remove itself
195
+ // upon destruction.
196
+ //
197
+ // Looks up the current data producer for type and invokes get_or_add()
198
+ // with a pointer to that producer in the map. The get_or_add() function
199
+ // can modify the pointed-to value to update the map. This provides a
200
+ // way to either re-use an existing producer or register a new one in
201
+ // a non-racy way.
202
+ virtual void GetOrAddDataProducer(
203
+ UniqueTypeName type,
204
+ std::function<void(DataProducerInterface**)> get_or_add) = 0;
205
+ // Removes the data producer from the map, if the current producer for
206
+ // this type is the specified producer.
207
+ virtual void RemoveDataProducer(DataProducerInterface* data_producer) = 0;
208
+
209
+ virtual std::shared_ptr<grpc_event_engine::experimental::EventEngine>
210
+ event_engine() = 0;
211
+
212
+ // Ping API for v3 stack.
213
+ virtual void Ping(absl::AnyInvocable<void(absl::Status)> on_ack) = 0;
214
+ // Ping API for v1 stack.
215
+ // TODO(roth): Remove this when v3 migration is done.
216
+ virtual absl::Status Ping(grpc_closure* on_initiate,
217
+ grpc_closure* on_ack) = 0;
218
+
219
+ // Exposed for testing purposes only.
220
+ static ChannelArgs MakeSubchannelArgs(
221
+ const ChannelArgs& channel_args, const ChannelArgs& address_args,
222
+ const RefCountedPtr<SubchannelPoolInterface>& subchannel_pool,
223
+ const std::string& channel_default_authority);
224
+
225
+ protected:
226
+ Subchannel();
227
+ };
228
+
229
+ class OldSubchannel final : public Subchannel {
230
+ public:
202
231
  // Creates a subchannel.
203
232
  static RefCountedPtr<Subchannel> Create(
204
233
  OrphanablePtr<SubchannelConnector> connector,
205
234
  const grpc_resolved_address& address, const ChannelArgs& args);
206
235
 
207
236
  // The ctor and dtor are not intended to use directly.
208
- Subchannel(SubchannelKey key, OrphanablePtr<SubchannelConnector> connector,
209
- const ChannelArgs& args);
210
- ~Subchannel() override;
237
+ OldSubchannel(SubchannelKey key, OrphanablePtr<SubchannelConnector> connector,
238
+ const ChannelArgs& args);
239
+ ~OldSubchannel() override;
211
240
 
212
241
  // Throttles keepalive time to \a new_keepalive_time iff \a new_keepalive_time
213
242
  // is larger than the subchannel's current keepalive time. The updated value
214
243
  // will have an affect when the subchannel creates a new ConnectedSubchannel.
215
- void ThrottleKeepaliveTime(Duration new_keepalive_time)
244
+ void ThrottleKeepaliveTime(Duration new_keepalive_time) override
216
245
  ABSL_LOCKS_EXCLUDED(mu_);
217
246
 
218
- grpc_pollset_set* pollset_set() const { return pollset_set_; }
247
+ grpc_pollset_set* pollset_set() const override { return pollset_set_; }
219
248
 
220
- channelz::SubchannelNode* channelz_node();
249
+ channelz::SubchannelNode* channelz_node() override;
221
250
 
222
- std::string address() const {
251
+ const ChannelArgs& args() const override { return args_; }
252
+
253
+ std::string address() const override {
223
254
  return grpc_sockaddr_to_uri(&key_.address())
224
255
  .value_or("<unknown address type>");
225
256
  }
@@ -231,31 +262,27 @@ class Subchannel final : public DualRefCounted<Subchannel> {
231
262
  // The watcher will be destroyed either when the subchannel is
232
263
  // destroyed or when CancelConnectivityStateWatch() is called.
233
264
  void WatchConnectivityState(
234
- RefCountedPtr<ConnectivityStateWatcherInterface> watcher)
265
+ RefCountedPtr<ConnectivityStateWatcherInterface> watcher) override
235
266
  ABSL_LOCKS_EXCLUDED(mu_);
236
267
 
237
268
  // Cancels a connectivity state watch.
238
269
  // If the watcher has already been destroyed, this is a no-op.
239
270
  void CancelConnectivityStateWatch(ConnectivityStateWatcherInterface* watcher)
240
- ABSL_LOCKS_EXCLUDED(mu_);
271
+ override ABSL_LOCKS_EXCLUDED(mu_);
241
272
 
242
- RefCountedPtr<ConnectedSubchannel> connected_subchannel()
243
- ABSL_LOCKS_EXCLUDED(mu_) {
244
- MutexLock lock(&mu_);
245
- return connected_subchannel_;
246
- }
273
+ // Starts a call in the v1 stack.
274
+ // Returns null if there is no connected subchannel.
275
+ RefCountedPtr<Call> CreateCall(CreateCallArgs args,
276
+ grpc_error_handle* error) override;
247
277
 
248
- RefCountedPtr<UnstartedCallDestination> call_destination() {
249
- MutexLock lock(&mu_);
250
- if (connected_subchannel_ == nullptr) return nullptr;
251
- return connected_subchannel_->unstarted_call_destination();
252
- }
278
+ // Used for calls in the v3 stack.
279
+ RefCountedPtr<UnstartedCallDestination> call_destination() override;
253
280
 
254
281
  // Attempt to connect to the backend. Has no effect if already connected.
255
- void RequestConnection() ABSL_LOCKS_EXCLUDED(mu_);
282
+ void RequestConnection() override ABSL_LOCKS_EXCLUDED(mu_);
256
283
 
257
284
  // Resets the connection backoff of the subchannel.
258
- void ResetBackoff() ABSL_LOCKS_EXCLUDED(mu_);
285
+ void ResetBackoff() override ABSL_LOCKS_EXCLUDED(mu_);
259
286
 
260
287
  // Access to data producer map.
261
288
  // We do not hold refs to the data producer; the implementation is
@@ -269,32 +296,30 @@ class Subchannel final : public DualRefCounted<Subchannel> {
269
296
  // a non-racy way.
270
297
  void GetOrAddDataProducer(
271
298
  UniqueTypeName type,
272
- std::function<void(DataProducerInterface**)> get_or_add)
299
+ std::function<void(DataProducerInterface**)> get_or_add) override
273
300
  ABSL_LOCKS_EXCLUDED(mu_);
274
301
  // Removes the data producer from the map, if the current producer for
275
302
  // this type is the specified producer.
276
- void RemoveDataProducer(DataProducerInterface* data_producer)
303
+ void RemoveDataProducer(DataProducerInterface* data_producer) override
277
304
  ABSL_LOCKS_EXCLUDED(mu_);
278
305
 
279
- std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine() {
306
+ std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine()
307
+ override {
280
308
  return event_engine_;
281
309
  }
282
310
 
283
- // Exposed for testing purposes only.
284
- static ChannelArgs MakeSubchannelArgs(
285
- const ChannelArgs& channel_args, const ChannelArgs& address_args,
286
- const RefCountedPtr<SubchannelPoolInterface>& subchannel_pool,
287
- const std::string& channel_default_authority);
311
+ // Ping API for v3 stack.
312
+ void Ping(absl::AnyInvocable<void(absl::Status)> on_ack) override;
313
+ // Ping API for v1 stack.
314
+ // TODO(roth): Remove this when v3 migration is done.
315
+ absl::Status Ping(grpc_closure* on_initiate, grpc_closure* on_ack) override;
288
316
 
289
317
  private:
290
- // Tears down any existing connection, and arranges for destruction
291
- void Orphaned() override ABSL_LOCKS_EXCLUDED(mu_);
292
-
293
318
  // A linked list of ConnectivityStateWatcherInterfaces that are monitoring
294
319
  // the subchannel's state.
295
320
  class ConnectivityStateWatcherList final {
296
321
  public:
297
- explicit ConnectivityStateWatcherList(Subchannel* subchannel)
322
+ explicit ConnectivityStateWatcherList(OldSubchannel* subchannel)
298
323
  : subchannel_(subchannel) {}
299
324
 
300
325
  ~ConnectivityStateWatcherList() { Clear(); }
@@ -317,17 +342,25 @@ class Subchannel final : public DualRefCounted<Subchannel> {
317
342
  uint32_t GetMaxConnectionsPerSubchannel() const;
318
343
 
319
344
  private:
320
- Subchannel* subchannel_;
345
+ OldSubchannel* subchannel_;
321
346
  absl::flat_hash_set<RefCountedPtr<ConnectivityStateWatcherInterface>,
322
347
  RefCountedPtrHash<ConnectivityStateWatcherInterface>,
323
348
  RefCountedPtrEq<ConnectivityStateWatcherInterface>>
324
349
  watchers_;
325
350
  };
326
351
 
327
- // TODO(roth): Remove this when transport_state_watcher experiment is removed.
352
+ // A ConnectedSubchannel represents a connection.
353
+ // There are concrete subclasses for the v1 and v3 stacks.
354
+ class ConnectedSubchannel;
355
+ class LegacyConnectedSubchannel;
356
+ class NewConnectedSubchannel;
357
+
328
358
  class ConnectedSubchannelStateWatcher;
329
359
 
330
- class ConnectionStateWatcher;
360
+ // Tears down any existing connection, and arranges for destruction
361
+ void Orphaned() override ABSL_LOCKS_EXCLUDED(mu_);
362
+
363
+ RefCountedPtr<ConnectedSubchannel> GetConnectedSubchannel();
331
364
 
332
365
  // Sets the subchannel's connectivity state to \a state.
333
366
  void SetConnectivityStateLocked(grpc_connectivity_state state,
@@ -408,6 +441,250 @@ class Subchannel final : public DualRefCounted<Subchannel> {
408
441
  std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine_;
409
442
  };
410
443
 
444
+ class NewSubchannel final : public Subchannel {
445
+ public:
446
+ // Creates a subchannel.
447
+ static RefCountedPtr<Subchannel> Create(
448
+ OrphanablePtr<SubchannelConnector> connector,
449
+ const grpc_resolved_address& address, const ChannelArgs& args);
450
+
451
+ // The ctor and dtor are not intended to use directly.
452
+ NewSubchannel(SubchannelKey key, OrphanablePtr<SubchannelConnector> connector,
453
+ const ChannelArgs& args);
454
+ ~NewSubchannel() override;
455
+
456
+ // Throttles keepalive time to \a new_keepalive_time iff \a new_keepalive_time
457
+ // is larger than the subchannel's current keepalive time. The updated value
458
+ // will have an affect when the subchannel creates a new ConnectedSubchannel.
459
+ void ThrottleKeepaliveTime(Duration new_keepalive_time) override
460
+ ABSL_LOCKS_EXCLUDED(mu_);
461
+
462
+ grpc_pollset_set* pollset_set() const override { return pollset_set_; }
463
+
464
+ channelz::SubchannelNode* channelz_node() override;
465
+
466
+ const ChannelArgs& args() const override { return args_; }
467
+
468
+ std::string address() const override {
469
+ return grpc_sockaddr_to_uri(&key_.address())
470
+ .value_or("<unknown address type>");
471
+ }
472
+
473
+ // Starts watching the subchannel's connectivity state.
474
+ // The first callback to the watcher will be delivered ~immediately.
475
+ // Subsequent callbacks will be delivered as the subchannel's state
476
+ // changes.
477
+ // The watcher will be destroyed either when the subchannel is
478
+ // destroyed or when CancelConnectivityStateWatch() is called.
479
+ void WatchConnectivityState(
480
+ RefCountedPtr<ConnectivityStateWatcherInterface> watcher) override
481
+ ABSL_LOCKS_EXCLUDED(mu_);
482
+
483
+ // Cancels a connectivity state watch.
484
+ // If the watcher has already been destroyed, this is a no-op.
485
+ void CancelConnectivityStateWatch(ConnectivityStateWatcherInterface* watcher)
486
+ override ABSL_LOCKS_EXCLUDED(mu_);
487
+
488
+ // Starts a call in the v1 stack.
489
+ // Returns null if there is no connected subchannel.
490
+ RefCountedPtr<Call> CreateCall(CreateCallArgs args,
491
+ grpc_error_handle* error) override;
492
+
493
+ // Used for calls in the v3 stack.
494
+ RefCountedPtr<UnstartedCallDestination> call_destination() override;
495
+
496
+ // Attempt to connect to the backend. Has no effect if already connected.
497
+ void RequestConnection() override ABSL_LOCKS_EXCLUDED(mu_);
498
+
499
+ // Resets the connection backoff of the subchannel.
500
+ void ResetBackoff() override ABSL_LOCKS_EXCLUDED(mu_);
501
+
502
+ // Access to data producer map.
503
+ // We do not hold refs to the data producer; the implementation is
504
+ // expected to register itself upon construction and remove itself
505
+ // upon destruction.
506
+ //
507
+ // Looks up the current data producer for type and invokes get_or_add()
508
+ // with a pointer to that producer in the map. The get_or_add() function
509
+ // can modify the pointed-to value to update the map. This provides a
510
+ // way to either re-use an existing producer or register a new one in
511
+ // a non-racy way.
512
+ void GetOrAddDataProducer(
513
+ UniqueTypeName type,
514
+ std::function<void(DataProducerInterface**)> get_or_add) override
515
+ ABSL_LOCKS_EXCLUDED(mu_);
516
+ // Removes the data producer from the map, if the current producer for
517
+ // this type is the specified producer.
518
+ void RemoveDataProducer(DataProducerInterface* data_producer) override
519
+ ABSL_LOCKS_EXCLUDED(mu_);
520
+
521
+ std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine()
522
+ override {
523
+ return event_engine_;
524
+ }
525
+
526
+ // Ping API for v3 stack.
527
+ void Ping(absl::AnyInvocable<void(absl::Status)> on_ack) override;
528
+ // Ping API for v1 stack.
529
+ // TODO(roth): Remove this when v3 migration is done.
530
+ absl::Status Ping(grpc_closure* on_initiate, grpc_closure* on_ack) override;
531
+
532
+ private:
533
+ // A linked list of ConnectivityStateWatcherInterfaces that are monitoring
534
+ // the subchannel's state.
535
+ class ConnectivityStateWatcherList final {
536
+ public:
537
+ explicit ConnectivityStateWatcherList(NewSubchannel* subchannel)
538
+ : subchannel_(subchannel) {}
539
+
540
+ ~ConnectivityStateWatcherList() { Clear(); }
541
+
542
+ void AddWatcherLocked(
543
+ RefCountedPtr<ConnectivityStateWatcherInterface> watcher);
544
+ void RemoveWatcherLocked(ConnectivityStateWatcherInterface* watcher);
545
+
546
+ // Notifies all watchers in the list about a change to state.
547
+ void NotifyLocked(grpc_connectivity_state state,
548
+ const absl::Status& status);
549
+
550
+ // Notifies all watchers about a keepalive update.
551
+ void NotifyOnKeepaliveUpdateLocked(Duration new_keepalive_time);
552
+
553
+ void Clear() { watchers_.clear(); }
554
+
555
+ bool empty() const { return watchers_.empty(); }
556
+
557
+ uint32_t GetMaxConnectionsPerSubchannel() const;
558
+
559
+ private:
560
+ NewSubchannel* subchannel_;
561
+ absl::flat_hash_set<RefCountedPtr<ConnectivityStateWatcherInterface>,
562
+ RefCountedPtrHash<ConnectivityStateWatcherInterface>,
563
+ RefCountedPtrEq<ConnectivityStateWatcherInterface>>
564
+ watchers_;
565
+ };
566
+
567
+ class ConnectedSubchannel;
568
+ class LegacyConnectedSubchannel;
569
+ class NewConnectedSubchannel;
570
+
571
+ class ConnectionStateWatcher;
572
+
573
+ class QueuedCall;
574
+
575
+ // Tears down any existing connection, and arranges for destruction
576
+ void Orphaned() override ABSL_LOCKS_EXCLUDED(mu_);
577
+
578
+ RefCountedPtr<ConnectedSubchannel> ChooseConnectionLocked()
579
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
580
+ void RetryQueuedRpcs() ABSL_LOCKS_EXCLUDED(mu_);
581
+ void RetryQueuedRpcsLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
582
+ void MaybeFailAllQueuedRpcsLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
583
+ void FailAllQueuedRpcsLocked(absl::Status status)
584
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
585
+
586
+ // Updates the subchannel's connectivity state.
587
+ void SetLastFailureLocked(const absl::Status& status)
588
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
589
+ grpc_connectivity_state ComputeConnectivityStateLocked() const
590
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
591
+ absl::Status ConnectivityStatusToReportLocked() const
592
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
593
+ void MaybeUpdateConnectivityStateLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
594
+
595
+ // Returns true if the connection was removed.
596
+ bool RemoveConnectionLocked(ConnectedSubchannel* connected_subchannel)
597
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
598
+
599
+ void ThrottleKeepaliveTimeLocked(Duration new_keepalive_time)
600
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
601
+
602
+ // Methods for connection.
603
+ void OnRetryTimer() ABSL_LOCKS_EXCLUDED(mu_);
604
+ void OnRetryTimerLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
605
+ void StartConnectingLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
606
+ static void OnConnectingFinished(void* arg, grpc_error_handle error)
607
+ ABSL_LOCKS_EXCLUDED(mu_);
608
+ void OnConnectingFinishedLocked(grpc_error_handle error)
609
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
610
+ bool PublishTransportLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
611
+
612
+ // The subchannel pool this subchannel is in.
613
+ RefCountedPtr<SubchannelPoolInterface> subchannel_pool_;
614
+ // Subchannel key that identifies this subchannel in the subchannel pool.
615
+ const SubchannelKey key_;
616
+ // boolean value that identifies this subchannel is created from event engine
617
+ // endpoint.
618
+ const bool created_from_endpoint_;
619
+ // Actual address to connect to. May be different than the address in
620
+ // key_ if overridden by proxy mapper.
621
+ grpc_resolved_address address_for_connect_;
622
+ // Channel args.
623
+ ChannelArgs args_;
624
+ // pollset_set tracking who's interested in a connection being setup.
625
+ grpc_pollset_set* pollset_set_;
626
+ // Channelz tracking.
627
+ RefCountedPtr<channelz::SubchannelNode> channelz_node_;
628
+ // Minimum connection timeout.
629
+ Duration min_connect_timeout_;
630
+
631
+ // Connection state.
632
+ OrphanablePtr<SubchannelConnector> connector_;
633
+ SubchannelConnector::Result connecting_result_;
634
+ grpc_closure on_connecting_finished_;
635
+
636
+ // Protects the other members.
637
+ Mutex mu_;
638
+
639
+ bool connection_attempt_in_flight_ ABSL_GUARDED_BY(mu_) = false;
640
+ bool shutdown_ ABSL_GUARDED_BY(mu_) = false;
641
+
642
+ // Connectivity state tracking.
643
+ // Note that the connectivity state implies the state of the
644
+ // Subchannel object:
645
+ // - IDLE: no retry timer pending, can start a connection attempt at any time
646
+ // - CONNECTING: connection attempt in progress
647
+ // - READY: connection attempt succeeded, connected_subchannel_ created
648
+ // - TRANSIENT_FAILURE: connection attempt failed, retry timer pending
649
+ grpc_connectivity_state state_ ABSL_GUARDED_BY(mu_) = GRPC_CHANNEL_IDLE;
650
+ absl::Status last_failure_status_ ABSL_GUARDED_BY(mu_);
651
+ // The list of connectivity state watchers.
652
+ ConnectivityStateWatcherList watcher_list_ ABSL_GUARDED_BY(mu_);
653
+ // Used for sending connectivity state notifications.
654
+ WorkSerializer work_serializer_;
655
+
656
+ // Established connections.
657
+ std::vector<RefCountedPtr<ConnectedSubchannel>> connections_
658
+ ABSL_GUARDED_BY(mu_);
659
+
660
+ // Backoff state.
661
+ BackOff backoff_ ABSL_GUARDED_BY(mu_);
662
+ Timestamp next_attempt_time_ ABSL_GUARDED_BY(mu_);
663
+ std::optional<grpc_event_engine::experimental::EventEngine::TaskHandle>
664
+ retry_timer_handle_ ABSL_GUARDED_BY(mu_);
665
+
666
+ // Keepalive time period
667
+ Duration keepalive_time_ ABSL_GUARDED_BY(mu_);
668
+
669
+ // Data producer map.
670
+ std::map<UniqueTypeName, DataProducerInterface*> data_producer_map_
671
+ ABSL_GUARDED_BY(mu_);
672
+ std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine_;
673
+
674
+ // A queue of calls waiting to be dispatched to a connection.
675
+ // If a call is cancelled while in the queue, its entry will be reset
676
+ // to null, so we ignore null values when draining the queue.
677
+ //
678
+ // Note that each queued call holds a C++ reference to its entry in the
679
+ // queue, which it will set to null if it gets cancelled. Therefore,
680
+ // this data structure must guarantee that references to entries are not
681
+ // invalidated as entries are added or removed from the queue (i.e.,
682
+ // std::vector<> would not work).
683
+ std::deque<QueuedCall*> queued_calls_ ABSL_GUARDED_BY(mu_);
684
+ };
685
+
686
+ void TestOnlySetSubchannelAlwaysSendCallsToTransport(bool enabled);
687
+
411
688
  } // namespace grpc_core
412
689
 
413
690
  #endif // GRPC_SRC_CORE_CLIENT_CHANNEL_SUBCHANNEL_H