grpc 1.41.1 → 1.44.0.pre2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (1156) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +185 -102
  3. data/include/grpc/event_engine/event_engine.h +118 -54
  4. data/include/grpc/event_engine/internal/memory_allocator_impl.h +68 -0
  5. data/include/grpc/event_engine/memory_allocator.h +226 -0
  6. data/include/grpc/event_engine/memory_request.h +57 -0
  7. data/include/grpc/grpc.h +4 -0
  8. data/include/grpc/grpc_security.h +304 -145
  9. data/include/grpc/grpc_security_constants.h +2 -14
  10. data/include/grpc/impl/codegen/compression_types.h +0 -2
  11. data/include/grpc/impl/codegen/grpc_types.h +6 -0
  12. data/include/grpc/impl/codegen/port_platform.h +14 -3
  13. data/src/core/ext/filters/client_channel/backend_metric.cc +21 -23
  14. data/src/core/ext/filters/client_channel/backend_metric.h +4 -3
  15. data/src/core/ext/filters/client_channel/backup_poller.cc +2 -1
  16. data/src/core/ext/filters/client_channel/channel_connectivity.cc +71 -89
  17. data/src/core/ext/filters/client_channel/client_channel.cc +305 -335
  18. data/src/core/ext/filters/client_channel/client_channel.h +84 -36
  19. data/src/core/ext/filters/client_channel/client_channel_factory.cc +1 -1
  20. data/src/core/ext/filters/client_channel/client_channel_factory.h +17 -19
  21. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +8 -15
  22. data/src/core/ext/filters/client_channel/config_selector.cc +1 -1
  23. data/src/core/ext/filters/client_channel/config_selector.h +5 -6
  24. data/src/core/ext/filters/client_channel/connector.h +18 -18
  25. data/src/core/ext/filters/client_channel/dynamic_filters.cc +5 -5
  26. data/src/core/ext/filters/client_channel/dynamic_filters.h +1 -1
  27. data/src/core/ext/filters/client_channel/global_subchannel_pool.h +0 -1
  28. data/src/core/ext/filters/client_channel/health/health_check_client.cc +25 -22
  29. data/src/core/ext/filters/client_channel/health/health_check_client.h +4 -4
  30. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +13 -15
  31. data/src/core/ext/filters/client_channel/http_connect_handshaker.h +1 -1
  32. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +4 -3
  33. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +6 -5
  34. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +4 -0
  35. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +5 -18
  36. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +198 -116
  37. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +3 -6
  38. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +1 -1
  39. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +1 -1
  40. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +1 -1
  41. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +1 -1
  42. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +1 -2
  43. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +2 -2
  44. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +2 -4
  45. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +66 -36
  46. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +21 -12
  47. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +124 -74
  48. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +2514 -0
  49. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +68 -62
  50. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +16 -11
  51. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +18 -6
  52. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +51 -96
  53. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +1 -1
  54. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +1 -1
  55. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +101 -46
  56. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +11 -3
  57. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +101 -209
  58. data/src/core/ext/filters/client_channel/lb_policy.cc +15 -14
  59. data/src/core/ext/filters/client_channel/lb_policy.h +105 -63
  60. data/src/core/ext/filters/client_channel/lb_policy_factory.h +1 -0
  61. data/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc +139 -0
  62. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +220 -88
  63. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +22 -12
  64. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +19 -15
  65. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +31 -50
  66. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +124 -240
  67. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +38 -25
  68. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +1 -1
  69. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +90 -77
  70. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +13 -11
  71. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +2 -1
  72. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +7 -16
  73. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +5 -5
  74. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +423 -396
  75. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +2 -2
  76. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +2 -2
  77. data/src/core/ext/filters/client_channel/retry_filter.cc +66 -131
  78. data/src/core/ext/filters/client_channel/retry_service_config.cc +1 -1
  79. data/src/core/ext/filters/client_channel/retry_service_config.h +1 -1
  80. data/src/core/ext/filters/client_channel/retry_throttle.cc +17 -48
  81. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +49 -36
  82. data/src/core/ext/filters/client_channel/subchannel.cc +99 -161
  83. data/src/core/ext/filters/client_channel/subchannel.h +31 -52
  84. data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +22 -7
  85. data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +11 -2
  86. data/src/core/ext/filters/client_idle/client_idle_filter.cc +27 -210
  87. data/src/core/ext/filters/client_idle/idle_filter_state.cc +96 -0
  88. data/src/core/ext/filters/client_idle/idle_filter_state.h +66 -0
  89. data/src/core/ext/filters/deadline/deadline_filter.cc +23 -26
  90. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +42 -53
  91. data/src/core/ext/filters/fault_injection/service_config_parser.cc +6 -9
  92. data/src/core/ext/filters/fault_injection/service_config_parser.h +1 -1
  93. data/src/core/ext/filters/http/client/http_client_filter.cc +70 -160
  94. data/src/core/ext/filters/http/client_authority_filter.cc +19 -36
  95. data/src/core/ext/filters/http/http_filters_plugin.cc +51 -71
  96. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +46 -139
  97. data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +5 -25
  98. data/src/core/ext/filters/http/server/http_server_filter.cc +84 -183
  99. data/src/core/ext/filters/max_age/max_age_filter.cc +24 -26
  100. data/src/core/ext/filters/message_size/message_size_filter.cc +19 -16
  101. data/src/core/ext/filters/message_size/message_size_filter.h +1 -1
  102. data/src/core/ext/filters/rbac/rbac_filter.cc +157 -0
  103. data/src/core/ext/filters/rbac/rbac_filter.h +74 -0
  104. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +605 -0
  105. data/src/core/ext/filters/rbac/rbac_service_config_parser.h +70 -0
  106. data/src/core/ext/filters/server_config_selector/server_config_selector.cc +67 -0
  107. data/src/core/ext/filters/server_config_selector/server_config_selector.h +71 -0
  108. data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +270 -0
  109. data/src/core/ext/{transport/chttp2/transport/hpack_utils.h → filters/server_config_selector/server_config_selector_filter.h} +9 -7
  110. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +4 -23
  111. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +0 -2
  112. data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +26 -28
  113. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +11 -14
  114. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +33 -53
  115. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +146 -113
  116. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +2 -3
  117. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +9 -13
  118. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +6 -6
  119. data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +0 -1
  120. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +129 -278
  121. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -2
  122. data/src/core/ext/transport/chttp2/transport/context_list.cc +2 -3
  123. data/src/core/ext/transport/chttp2/transport/context_list.h +2 -3
  124. data/src/core/ext/transport/chttp2/transport/flow_control.cc +26 -23
  125. data/src/core/ext/transport/chttp2/transport/flow_control.h +6 -6
  126. data/src/core/ext/transport/chttp2/transport/frame_data.cc +4 -5
  127. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +2 -1
  128. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -1
  129. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -3
  130. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +2 -2
  131. data/src/core/ext/transport/chttp2/transport/hpack_constants.h +1 -1
  132. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +384 -218
  133. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +89 -143
  134. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +1 -1
  135. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +2 -0
  136. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +201 -202
  137. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +27 -9
  138. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +106 -26
  139. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +29 -44
  140. data/src/core/ext/transport/chttp2/transport/internal.h +10 -38
  141. data/src/core/ext/transport/chttp2/transport/parsing.cc +30 -179
  142. data/src/core/ext/transport/chttp2/transport/writing.cc +65 -127
  143. data/src/core/ext/transport/inproc/inproc_plugin.cc +0 -4
  144. data/src/core/ext/transport/inproc/inproc_transport.cc +114 -161
  145. data/src/core/ext/transport/inproc/inproc_transport.h +1 -4
  146. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +197 -165
  147. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +2 -0
  148. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.c +41 -0
  149. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +18 -0
  150. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +26 -2
  151. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +7 -0
  152. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +107 -82
  153. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +2 -0
  154. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +188 -160
  155. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +2 -0
  156. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +35 -22
  157. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +2 -0
  158. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +277 -208
  159. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +141 -1
  160. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +16 -5
  161. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +2 -0
  162. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +36 -25
  163. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +2 -0
  164. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +56 -39
  165. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +2 -0
  166. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +16 -5
  167. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +2 -0
  168. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +171 -125
  169. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +55 -4
  170. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +51 -36
  171. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +2 -0
  172. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +15 -4
  173. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +2 -0
  174. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +25 -13
  175. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +2 -0
  176. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +114 -90
  177. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +2 -0
  178. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +90 -71
  179. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +17 -0
  180. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +17 -6
  181. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +2 -0
  182. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +121 -92
  183. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +25 -0
  184. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +13 -2
  185. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +2 -0
  186. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.c +21 -9
  187. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.h +2 -0
  188. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +18 -7
  189. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +2 -0
  190. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +22 -11
  191. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +2 -0
  192. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.c +17 -6
  193. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.h +2 -0
  194. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +41 -27
  195. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +2 -0
  196. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +59 -44
  197. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +2 -0
  198. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +58 -43
  199. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +2 -0
  200. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +15 -4
  201. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +2 -0
  202. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +73 -57
  203. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +2 -0
  204. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +81 -64
  205. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +2 -0
  206. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +25 -14
  207. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +2 -0
  208. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +19 -7
  209. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +2 -0
  210. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +63 -45
  211. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +2 -0
  212. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +66 -47
  213. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +2 -0
  214. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +99 -78
  215. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +19 -0
  216. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +41 -28
  217. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +2 -0
  218. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +508 -442
  219. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +51 -19
  220. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +26 -13
  221. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +2 -0
  222. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +21 -9
  223. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +2 -0
  224. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.c +13 -2
  225. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +2 -0
  226. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +35 -20
  227. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +2 -0
  228. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +44 -31
  229. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +2 -0
  230. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.c +61 -0
  231. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +146 -0
  232. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +22 -11
  233. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +2 -0
  234. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +210 -181
  235. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +2 -0
  236. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +7 -0
  237. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +5 -3
  238. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +64 -48
  239. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +2 -0
  240. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +33 -20
  241. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +2 -0
  242. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +81 -65
  243. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +2 -0
  244. data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.c +12 -1
  245. data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.h +2 -0
  246. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.c +12 -1
  247. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +2 -0
  248. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +75 -58
  249. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +2 -0
  250. data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.c +12 -1
  251. data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.h +2 -0
  252. data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.c +12 -1
  253. data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.h +2 -0
  254. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +25 -13
  255. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +2 -0
  256. data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.c +12 -1
  257. data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.h +2 -0
  258. data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.c +12 -1
  259. data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.h +2 -0
  260. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +61 -46
  261. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +2 -0
  262. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.c +26 -12
  263. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.h +2 -0
  264. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +22 -10
  265. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +2 -0
  266. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +17 -6
  267. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +2 -0
  268. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +16 -5
  269. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +2 -0
  270. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +15 -4
  271. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +2 -0
  272. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +27 -14
  273. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +2 -0
  274. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +25 -13
  275. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +2 -0
  276. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +20 -8
  277. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +2 -0
  278. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +30 -17
  279. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +2 -0
  280. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +38 -21
  281. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +2 -0
  282. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +41 -26
  283. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +2 -0
  284. data/src/core/ext/upb-generated/envoy/type/v3/http.upb.c +7 -0
  285. data/src/core/ext/upb-generated/envoy/type/v3/http.upb.h +2 -0
  286. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +17 -5
  287. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +2 -0
  288. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +22 -9
  289. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +2 -0
  290. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.c +15 -4
  291. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +2 -0
  292. data/src/core/ext/upb-generated/google/api/annotations.upb.c +20 -0
  293. data/src/core/ext/upb-generated/google/api/annotations.upb.h +7 -0
  294. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +116 -93
  295. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +2 -0
  296. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/eval.upb.c +102 -0
  297. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/eval.upb.h +306 -0
  298. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/explain.upb.c +56 -0
  299. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/explain.upb.h +135 -0
  300. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +122 -98
  301. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +2 -0
  302. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/value.upb.c +115 -0
  303. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/value.upb.h +371 -0
  304. data/src/core/ext/upb-generated/google/api/http.upb.c +35 -22
  305. data/src/core/ext/upb-generated/google/api/http.upb.h +2 -0
  306. data/src/core/ext/upb-generated/google/protobuf/any.upb.c +14 -3
  307. data/src/core/ext/upb-generated/google/protobuf/any.upb.h +2 -0
  308. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +247 -210
  309. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +2 -0
  310. data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +14 -3
  311. data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +2 -0
  312. data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +12 -1
  313. data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +2 -0
  314. data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +37 -23
  315. data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +2 -0
  316. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +14 -3
  317. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +2 -0
  318. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +37 -18
  319. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +2 -0
  320. data/src/core/ext/upb-generated/google/rpc/status.upb.c +17 -6
  321. data/src/core/ext/upb-generated/google/rpc/status.upb.h +2 -0
  322. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +26 -14
  323. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +2 -0
  324. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +105 -83
  325. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +2 -0
  326. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +20 -8
  327. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +2 -0
  328. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +16 -4
  329. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +2 -0
  330. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +65 -47
  331. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +34 -36
  332. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c +68 -0
  333. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h +156 -0
  334. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +67 -7
  335. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +27 -0
  336. data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +27 -5
  337. data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +7 -0
  338. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c +19 -0
  339. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +7 -0
  340. data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +27 -3
  341. data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +7 -0
  342. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +26 -2
  343. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +7 -0
  344. data/src/core/ext/upb-generated/validate/validate.upb.c +320 -251
  345. data/src/core/ext/upb-generated/validate/validate.upb.h +20 -0
  346. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.c +103 -0
  347. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.h +199 -0
  348. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.c +14 -3
  349. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.h +2 -0
  350. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +25 -13
  351. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.h +2 -0
  352. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +20 -8
  353. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.h +2 -0
  354. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.c +19 -8
  355. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.h +2 -0
  356. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +28 -16
  357. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.h +2 -0
  358. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +19 -8
  359. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.h +2 -0
  360. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +71 -0
  361. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +132 -0
  362. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.c +44 -0
  363. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.h +85 -0
  364. data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.c +2 -49
  365. data/src/core/ext/upbdefs-generated/envoy/annotations/deprecation.upbdefs.c +2 -2
  366. data/src/core/ext/upbdefs-generated/envoy/annotations/resource.upbdefs.c +2 -7
  367. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +2 -35
  368. data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +2 -41
  369. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/circuit_breaker.upbdefs.c +2 -11
  370. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +307 -336
  371. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.h +10 -0
  372. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/filter.upbdefs.c +2 -7
  373. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/outlier_detection.upbdefs.c +2 -7
  374. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.c +2 -19
  375. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/backoff.upbdefs.c +2 -7
  376. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +100 -138
  377. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.h +5 -0
  378. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +2 -15
  379. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/event_service_config.upbdefs.c +2 -7
  380. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/extension.upbdefs.c +2 -9
  381. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.c +2 -33
  382. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +61 -77
  383. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/http_uri.upbdefs.c +2 -7
  384. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +61 -79
  385. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/proxy_protocol.upbdefs.c +2 -7
  386. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/resolver.upbdefs.c +2 -9
  387. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.c +2 -7
  388. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.c +2 -7
  389. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/udp_socket_config.upbdefs.c +2 -7
  390. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint.upbdefs.c +2 -13
  391. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +80 -99
  392. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/load_report.upbdefs.c +2 -15
  393. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/api_listener.upbdefs.c +2 -7
  394. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.c +2 -17
  395. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.c +2 -19
  396. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.c +2 -7
  397. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.c +2 -9
  398. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.c +2 -21
  399. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +2 -23
  400. data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.c +188 -0
  401. data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.h +70 -0
  402. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +2 -11
  403. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +325 -427
  404. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/scoped_route.upbdefs.c +2 -11
  405. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/http_tracer.upbdefs.c +2 -9
  406. data/src/core/ext/upbdefs-generated/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.c +2 -7
  407. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.c +2 -15
  408. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +2 -11
  409. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.c +56 -0
  410. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.h +40 -0
  411. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +2 -7
  412. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +2 -43
  413. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.c +2 -2
  414. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +2 -17
  415. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.c +2 -11
  416. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +2 -17
  417. data/src/core/ext/upbdefs-generated/envoy/service/cluster/v3/cds.upbdefs.c +2 -7
  418. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/ads.upbdefs.c +2 -7
  419. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.c +2 -19
  420. data/src/core/ext/upbdefs-generated/envoy/service/endpoint/v3/eds.upbdefs.c +2 -7
  421. data/src/core/ext/upbdefs-generated/envoy/service/listener/v3/lds.upbdefs.c +2 -7
  422. data/src/core/ext/upbdefs-generated/envoy/service/load_stats/v3/lrs.upbdefs.c +2 -9
  423. data/src/core/ext/upbdefs-generated/envoy/service/route/v3/rds.upbdefs.c +2 -7
  424. data/src/core/ext/upbdefs-generated/envoy/service/route/v3/srds.upbdefs.c +2 -7
  425. data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.c +2 -15
  426. data/src/core/ext/upbdefs-generated/envoy/type/http/v3/path_transformation.upbdefs.c +2 -13
  427. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/metadata.upbdefs.c +2 -9
  428. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.c +2 -7
  429. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/number.upbdefs.c +2 -7
  430. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/path.upbdefs.c +2 -7
  431. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +2 -11
  432. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/string.upbdefs.c +2 -9
  433. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.c +2 -9
  434. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/value.upbdefs.c +2 -11
  435. data/src/core/ext/upbdefs-generated/envoy/type/metadata/v3/metadata.upbdefs.c +2 -19
  436. data/src/core/ext/upbdefs-generated/envoy/type/tracing/v3/custom_tag.upbdefs.c +2 -15
  437. data/src/core/ext/upbdefs-generated/envoy/type/v3/http.upbdefs.c +2 -2
  438. data/src/core/ext/upbdefs-generated/envoy/type/v3/percent.upbdefs.c +2 -9
  439. data/src/core/ext/upbdefs-generated/envoy/type/v3/range.upbdefs.c +2 -11
  440. data/src/core/ext/upbdefs-generated/envoy/type/v3/semantic_version.upbdefs.c +2 -7
  441. data/src/core/ext/upbdefs-generated/google/api/annotations.upbdefs.c +2 -2
  442. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/checked.upbdefs.c +154 -0
  443. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/checked.upbdefs.h +95 -0
  444. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/eval.upbdefs.c +58 -0
  445. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/eval.upbdefs.h +55 -0
  446. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/explain.upbdefs.c +44 -0
  447. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/explain.upbdefs.h +40 -0
  448. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/syntax.upbdefs.c +153 -0
  449. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/syntax.upbdefs.h +100 -0
  450. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/value.upbdefs.c +75 -0
  451. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/value.upbdefs.h +55 -0
  452. data/src/core/ext/upbdefs-generated/google/api/http.upbdefs.c +2 -11
  453. data/src/core/ext/upbdefs-generated/google/protobuf/any.upbdefs.c +2 -7
  454. data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c +2 -59
  455. data/src/core/ext/upbdefs-generated/google/protobuf/duration.upbdefs.c +2 -7
  456. data/src/core/ext/upbdefs-generated/google/protobuf/empty.upbdefs.c +2 -7
  457. data/src/core/ext/upbdefs-generated/google/protobuf/struct.upbdefs.c +2 -13
  458. data/src/core/ext/upbdefs-generated/google/protobuf/timestamp.upbdefs.c +2 -7
  459. data/src/core/ext/upbdefs-generated/google/protobuf/wrappers.upbdefs.c +2 -23
  460. data/src/core/ext/upbdefs-generated/google/rpc/status.upbdefs.c +2 -7
  461. data/src/core/ext/upbdefs-generated/udpa/annotations/migrate.upbdefs.c +7 -15
  462. data/src/core/ext/upbdefs-generated/udpa/annotations/security.upbdefs.c +21 -30
  463. data/src/core/ext/upbdefs-generated/udpa/annotations/sensitive.upbdefs.c +6 -5
  464. data/src/core/ext/upbdefs-generated/udpa/annotations/status.upbdefs.c +7 -10
  465. data/src/core/ext/upbdefs-generated/udpa/annotations/versioning.upbdefs.c +7 -11
  466. data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.c +2 -51
  467. data/src/core/ext/upbdefs-generated/xds/annotations/v3/status.upbdefs.c +64 -0
  468. data/src/core/ext/upbdefs-generated/xds/annotations/v3/status.upbdefs.h +50 -0
  469. data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.c +15 -19
  470. data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.c +27 -33
  471. data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.c +18 -24
  472. data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.c +19 -23
  473. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.c +35 -41
  474. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.c +21 -25
  475. data/src/core/ext/upbdefs-generated/xds/type/v3/typed_struct.upbdefs.c +40 -0
  476. data/src/core/ext/upbdefs-generated/xds/type/v3/typed_struct.upbdefs.h +35 -0
  477. data/src/core/ext/xds/certificate_provider_registry.cc +1 -1
  478. data/src/core/ext/xds/certificate_provider_store.h +1 -1
  479. data/src/core/ext/xds/upb_utils.h +65 -0
  480. data/src/core/ext/xds/xds_api.cc +159 -3468
  481. data/src/core/ext/xds/xds_api.h +57 -558
  482. data/src/core/ext/xds/xds_bootstrap.cc +189 -122
  483. data/src/core/ext/xds/xds_bootstrap.h +30 -15
  484. data/src/core/ext/xds/xds_certificate_provider.cc +3 -3
  485. data/src/core/ext/xds/xds_certificate_provider.h +2 -2
  486. data/src/core/ext/xds/xds_channel_creds.cc +108 -0
  487. data/src/core/ext/xds/xds_channel_creds.h +50 -0
  488. data/src/core/ext/xds/xds_channel_stack_modifier.cc +112 -0
  489. data/src/core/ext/xds/xds_channel_stack_modifier.h +52 -0
  490. data/src/core/ext/xds/xds_client.cc +751 -844
  491. data/src/core/ext/xds/xds_client.h +100 -143
  492. data/src/core/ext/xds/xds_client_stats.h +1 -1
  493. data/src/core/ext/xds/xds_cluster.cc +451 -0
  494. data/src/core/ext/xds/xds_cluster.h +111 -0
  495. data/src/core/ext/xds/xds_common_types.cc +388 -0
  496. data/src/core/ext/xds/xds_common_types.h +110 -0
  497. data/src/core/ext/xds/xds_endpoint.cc +364 -0
  498. data/src/core/ext/xds/xds_endpoint.h +135 -0
  499. data/src/core/ext/xds/xds_http_filters.cc +5 -0
  500. data/src/core/ext/xds/xds_http_rbac_filter.cc +563 -0
  501. data/src/core/ext/xds/xds_http_rbac_filter.h +54 -0
  502. data/src/core/ext/xds/xds_listener.cc +1036 -0
  503. data/src/core/ext/xds/xds_listener.h +220 -0
  504. data/src/core/ext/{filters/workarounds/workaround_cronet_compression_filter.h → xds/xds_resource_type.cc} +14 -8
  505. data/src/core/ext/xds/xds_resource_type.h +98 -0
  506. data/src/core/ext/xds/xds_resource_type_impl.h +87 -0
  507. data/src/core/ext/xds/xds_route_config.cc +993 -0
  508. data/src/core/ext/xds/xds_route_config.h +215 -0
  509. data/src/core/ext/xds/xds_routing.cc +250 -0
  510. data/src/core/ext/xds/xds_routing.h +101 -0
  511. data/src/core/ext/xds/xds_server_config_fetcher.cc +1061 -289
  512. data/src/core/lib/address_utils/parse_address.cc +22 -0
  513. data/src/core/lib/address_utils/parse_address.h +5 -0
  514. data/src/core/lib/address_utils/sockaddr_utils.cc +33 -36
  515. data/src/core/lib/address_utils/sockaddr_utils.h +1 -16
  516. data/src/core/lib/avl/avl.h +389 -88
  517. data/src/core/lib/backoff/backoff.cc +6 -32
  518. data/src/core/lib/backoff/backoff.h +3 -3
  519. data/src/core/lib/channel/channel_args.cc +25 -8
  520. data/src/core/lib/channel/channel_args.h +11 -1
  521. data/src/core/lib/channel/channel_args_preconditioning.cc +47 -0
  522. data/src/core/lib/channel/channel_args_preconditioning.h +62 -0
  523. data/src/core/lib/channel/channel_stack.cc +8 -0
  524. data/src/core/lib/channel/channel_stack.h +1 -1
  525. data/src/core/lib/channel/channel_stack_builder.cc +8 -14
  526. data/src/core/lib/channel/channel_stack_builder.h +4 -7
  527. data/src/core/lib/channel/channel_trace.cc +7 -7
  528. data/src/core/lib/channel/channel_trace.h +1 -1
  529. data/src/core/lib/channel/channelz.cc +4 -3
  530. data/src/core/lib/channel/channelz.h +2 -2
  531. data/src/core/lib/channel/channelz_registry.cc +1 -1
  532. data/src/core/lib/channel/channelz_registry.h +1 -1
  533. data/src/core/lib/channel/connected_channel.cc +1 -3
  534. data/src/core/lib/channel/connected_channel.h +1 -2
  535. data/src/core/lib/compression/compression.cc +21 -113
  536. data/src/core/lib/compression/compression_internal.cc +142 -202
  537. data/src/core/lib/compression/compression_internal.h +64 -69
  538. data/src/core/lib/compression/message_compress.cc +11 -11
  539. data/src/core/lib/compression/message_compress.h +2 -2
  540. data/src/core/lib/config/core_configuration.cc +46 -2
  541. data/src/core/lib/config/core_configuration.h +50 -1
  542. data/src/core/lib/debug/stats.cc +1 -1
  543. data/src/core/lib/debug/stats_data.cc +13 -13
  544. data/src/core/lib/debug/trace.h +2 -2
  545. data/src/core/lib/event_engine/{endpoint_config.cc → channel_args_endpoint_config.cc} +2 -1
  546. data/src/core/lib/event_engine/{endpoint_config_internal.h → channel_args_endpoint_config.h} +3 -3
  547. data/src/core/lib/event_engine/event_engine.cc +0 -13
  548. data/src/core/lib/event_engine/event_engine_factory.cc +49 -0
  549. data/src/core/lib/event_engine/event_engine_factory.h +33 -0
  550. data/src/core/lib/event_engine/memory_allocator.cc +70 -0
  551. data/src/core/lib/gpr/atm.cc +1 -1
  552. data/src/core/lib/gpr/cpu_posix.cc +1 -1
  553. data/src/core/lib/gpr/string.cc +2 -2
  554. data/src/core/lib/gpr/tls.h +7 -1
  555. data/src/core/lib/gpr/useful.h +83 -32
  556. data/src/core/lib/gprpp/bitset.h +45 -16
  557. data/src/core/lib/gprpp/chunked_vector.h +253 -0
  558. data/src/core/lib/gprpp/construct_destruct.h +1 -1
  559. data/src/core/lib/gprpp/cpp_impl_of.h +45 -0
  560. data/src/core/lib/gprpp/global_config_env.cc +7 -7
  561. data/src/core/lib/gprpp/global_config_env.h +2 -2
  562. data/src/core/lib/gprpp/manual_constructor.h +2 -3
  563. data/src/core/lib/gprpp/memory.h +6 -0
  564. data/src/core/lib/gprpp/orphanable.h +1 -1
  565. data/src/core/lib/gprpp/ref_counted.h +1 -1
  566. data/src/core/lib/gprpp/ref_counted_ptr.h +2 -4
  567. data/src/core/lib/gprpp/status_helper.cc +35 -23
  568. data/src/core/lib/gprpp/status_helper.h +14 -16
  569. data/src/core/lib/gprpp/table.h +434 -0
  570. data/src/core/lib/http/httpcli.cc +215 -202
  571. data/src/core/lib/http/httpcli.h +17 -27
  572. data/src/core/lib/http/parser.cc +2 -2
  573. data/src/core/lib/iomgr/buffer_list.cc +9 -9
  574. data/src/core/lib/iomgr/buffer_list.h +13 -13
  575. data/src/core/lib/iomgr/call_combiner.cc +44 -16
  576. data/src/core/lib/iomgr/closure.h +29 -9
  577. data/src/core/lib/iomgr/combiner.cc +31 -24
  578. data/src/core/lib/iomgr/endpoint.h +0 -1
  579. data/src/core/lib/iomgr/endpoint_cfstream.cc +14 -30
  580. data/src/core/lib/iomgr/endpoint_cfstream.h +4 -4
  581. data/src/core/lib/iomgr/endpoint_pair_posix.cc +9 -11
  582. data/src/core/lib/iomgr/endpoint_pair_windows.cc +5 -14
  583. data/src/core/lib/iomgr/error.cc +115 -52
  584. data/src/core/lib/iomgr/error.h +53 -9
  585. data/src/core/lib/iomgr/error_cfstream.cc +5 -0
  586. data/src/core/lib/iomgr/ev_epoll1_linux.cc +3 -2
  587. data/src/core/lib/iomgr/ev_epollex_linux.cc +7 -7
  588. data/src/core/lib/iomgr/ev_poll_posix.cc +29 -20
  589. data/src/core/lib/iomgr/event_engine/closure.cc +41 -18
  590. data/src/core/lib/iomgr/event_engine/closure.h +10 -1
  591. data/src/core/lib/iomgr/event_engine/endpoint.cc +5 -6
  592. data/src/core/lib/iomgr/event_engine/iomgr.cc +9 -28
  593. data/src/core/lib/iomgr/event_engine/pollset.cc +5 -4
  594. data/src/core/lib/iomgr/event_engine/resolved_address_internal.cc +6 -0
  595. data/src/core/lib/iomgr/event_engine/resolved_address_internal.h +2 -0
  596. data/src/core/lib/iomgr/event_engine/resolver.cc +68 -46
  597. data/src/core/lib/iomgr/event_engine/resolver.h +56 -0
  598. data/src/core/lib/iomgr/event_engine/tcp.cc +16 -13
  599. data/src/core/lib/iomgr/event_engine/timer.cc +10 -4
  600. data/src/core/lib/iomgr/exec_ctx.cc +23 -18
  601. data/src/core/lib/iomgr/exec_ctx.h +11 -11
  602. data/src/core/lib/iomgr/executor/mpmcqueue.cc +5 -7
  603. data/src/core/lib/iomgr/executor/mpmcqueue.h +3 -8
  604. data/src/core/lib/iomgr/executor.cc +26 -34
  605. data/src/core/lib/iomgr/executor.h +1 -1
  606. data/src/core/lib/iomgr/fork_posix.cc +3 -2
  607. data/src/core/lib/iomgr/iomgr.cc +3 -1
  608. data/src/core/lib/iomgr/iomgr_custom.cc +4 -1
  609. data/src/core/lib/iomgr/iomgr_internal.cc +4 -9
  610. data/src/core/lib/iomgr/iomgr_internal.h +3 -2
  611. data/src/core/lib/iomgr/iomgr_posix.cc +2 -2
  612. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +2 -2
  613. data/src/core/lib/iomgr/iomgr_windows.cc +2 -2
  614. data/src/core/lib/iomgr/load_file.cc +2 -2
  615. data/src/core/lib/iomgr/lockfree_event.cc +18 -0
  616. data/src/core/lib/iomgr/pollset_custom.cc +1 -1
  617. data/src/core/lib/iomgr/pollset_custom.h +1 -1
  618. data/src/core/lib/iomgr/port.h +2 -2
  619. data/src/core/lib/iomgr/resolve_address.cc +5 -24
  620. data/src/core/lib/iomgr/resolve_address.h +47 -44
  621. data/src/core/lib/iomgr/resolve_address_custom.cc +131 -109
  622. data/src/core/lib/iomgr/resolve_address_custom.h +101 -19
  623. data/src/core/lib/iomgr/resolve_address_impl.h +59 -0
  624. data/src/core/lib/iomgr/resolve_address_posix.cc +87 -73
  625. data/src/core/lib/iomgr/resolve_address_posix.h +47 -0
  626. data/src/core/lib/iomgr/resolve_address_windows.cc +93 -74
  627. data/src/core/lib/iomgr/resolve_address_windows.h +47 -0
  628. data/src/core/lib/iomgr/resolved_address.h +39 -0
  629. data/src/core/lib/iomgr/socket_factory_posix.cc +2 -2
  630. data/src/core/lib/iomgr/socket_mutator.cc +2 -2
  631. data/src/core/lib/iomgr/socket_utils_common_posix.cc +1 -2
  632. data/src/core/lib/iomgr/tcp_client.cc +2 -4
  633. data/src/core/lib/iomgr/tcp_client.h +1 -3
  634. data/src/core/lib/iomgr/tcp_client_cfstream.cc +6 -12
  635. data/src/core/lib/iomgr/tcp_client_custom.cc +5 -11
  636. data/src/core/lib/iomgr/tcp_client_posix.cc +16 -41
  637. data/src/core/lib/iomgr/tcp_client_posix.h +3 -4
  638. data/src/core/lib/iomgr/tcp_client_windows.cc +3 -13
  639. data/src/core/lib/iomgr/tcp_custom.cc +9 -36
  640. data/src/core/lib/iomgr/tcp_custom.h +0 -1
  641. data/src/core/lib/iomgr/tcp_posix.cc +32 -38
  642. data/src/core/lib/iomgr/tcp_posix.h +1 -3
  643. data/src/core/lib/iomgr/tcp_server.cc +4 -6
  644. data/src/core/lib/iomgr/tcp_server.h +6 -8
  645. data/src/core/lib/iomgr/tcp_server_custom.cc +7 -16
  646. data/src/core/lib/iomgr/tcp_server_posix.cc +20 -25
  647. data/src/core/lib/iomgr/tcp_server_utils_posix.h +19 -18
  648. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +1 -0
  649. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +1 -0
  650. data/src/core/lib/iomgr/tcp_server_windows.cc +9 -17
  651. data/src/core/lib/iomgr/tcp_windows.cc +4 -9
  652. data/src/core/lib/iomgr/tcp_windows.h +1 -2
  653. data/src/core/lib/iomgr/timer_generic.cc +13 -13
  654. data/src/core/lib/iomgr/timer_heap.cc +1 -1
  655. data/src/core/lib/iomgr/unix_sockets_posix.cc +22 -34
  656. data/src/core/lib/iomgr/unix_sockets_posix.h +4 -7
  657. data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +6 -15
  658. data/src/core/lib/iomgr/work_serializer.cc +115 -44
  659. data/src/core/lib/iomgr/work_serializer.h +16 -4
  660. data/src/core/lib/json/json_reader.cc +83 -35
  661. data/src/core/lib/json/json_util.cc +69 -1
  662. data/src/core/lib/json/json_util.h +57 -99
  663. data/src/core/lib/json/json_writer.cc +0 -3
  664. data/src/core/lib/matchers/matchers.cc +1 -1
  665. data/src/core/lib/promise/activity.cc +115 -0
  666. data/src/core/lib/promise/activity.h +528 -0
  667. data/src/core/lib/promise/context.h +86 -0
  668. data/src/core/lib/promise/detail/basic_seq.h +407 -0
  669. data/src/core/lib/promise/detail/promise_factory.h +189 -0
  670. data/src/core/lib/promise/detail/promise_like.h +85 -0
  671. data/src/core/lib/promise/detail/status.h +49 -0
  672. data/src/core/lib/promise/detail/switch.h +1455 -0
  673. data/src/core/lib/promise/exec_ctx_wakeup_scheduler.h +48 -0
  674. data/src/core/lib/promise/loop.h +108 -0
  675. data/src/core/lib/promise/map.h +88 -0
  676. data/src/core/lib/promise/poll.h +60 -0
  677. data/src/core/lib/promise/race.h +84 -0
  678. data/src/core/lib/promise/seq.h +71 -0
  679. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver.cc +17 -25
  680. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver.h +43 -44
  681. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver_factory.h +12 -5
  682. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver_registry.cc +15 -17
  683. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver_registry.h +5 -7
  684. data/src/core/{ext/filters/client_channel → lib/resolver}/server_address.cc +1 -1
  685. data/src/core/{ext/filters/client_channel → lib/resolver}/server_address.h +5 -5
  686. data/src/core/lib/resource_quota/api.cc +108 -0
  687. data/src/core/lib/resource_quota/api.h +40 -0
  688. data/src/core/lib/{gprpp → resource_quota}/arena.cc +16 -13
  689. data/src/core/lib/{gprpp → resource_quota}/arena.h +32 -11
  690. data/src/core/lib/resource_quota/memory_quota.cc +454 -0
  691. data/src/core/lib/resource_quota/memory_quota.h +421 -0
  692. data/src/core/lib/resource_quota/resource_quota.cc +33 -0
  693. data/src/core/lib/resource_quota/resource_quota.h +58 -0
  694. data/src/core/lib/{transport/authority_override.h → resource_quota/thread_quota.cc} +22 -16
  695. data/src/core/lib/resource_quota/thread_quota.h +57 -0
  696. data/src/core/lib/resource_quota/trace.cc +19 -0
  697. data/src/core/lib/resource_quota/trace.h +24 -0
  698. data/src/core/lib/security/authorization/authorization_policy_provider.h +1 -1
  699. data/src/core/lib/security/authorization/authorization_policy_provider_vtable.cc +1 -1
  700. data/src/core/lib/security/authorization/evaluate_args.cc +41 -30
  701. data/src/core/lib/security/authorization/evaluate_args.h +3 -1
  702. data/src/core/lib/security/authorization/grpc_authorization_engine.cc +60 -0
  703. data/src/core/lib/security/authorization/grpc_authorization_engine.h +62 -0
  704. data/src/core/lib/security/authorization/matchers.cc +227 -0
  705. data/src/core/lib/security/authorization/matchers.h +211 -0
  706. data/src/core/lib/security/authorization/rbac_policy.cc +442 -0
  707. data/src/core/lib/security/authorization/rbac_policy.h +170 -0
  708. data/src/core/lib/security/authorization/sdk_server_authz_filter.cc +15 -1
  709. data/src/core/lib/security/context/security_context.cc +8 -4
  710. data/src/core/lib/security/context/security_context.h +1 -1
  711. data/src/core/lib/security/credentials/composite/composite_credentials.cc +6 -6
  712. data/src/core/lib/security/credentials/composite/composite_credentials.h +4 -3
  713. data/src/core/lib/security/credentials/credentials.cc +4 -2
  714. data/src/core/lib/security/credentials/credentials.h +16 -21
  715. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +8 -12
  716. data/src/core/lib/security/credentials/external/external_account_credentials.cc +57 -24
  717. data/src/core/lib/security/credentials/external/external_account_credentials.h +3 -7
  718. data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +2 -4
  719. data/src/core/lib/security/credentials/fake/fake_credentials.cc +5 -4
  720. data/src/core/lib/security/credentials/fake/fake_credentials.h +8 -7
  721. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +4 -9
  722. data/src/core/lib/security/credentials/iam/iam_credentials.cc +16 -19
  723. data/src/core/lib/security/credentials/iam/iam_credentials.h +6 -5
  724. data/src/core/lib/security/credentials/jwt/json_token.cc +4 -6
  725. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +17 -29
  726. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +8 -8
  727. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +11 -24
  728. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +53 -70
  729. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +13 -15
  730. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +8 -9
  731. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +5 -4
  732. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +1 -10
  733. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +11 -12
  734. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +7 -8
  735. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc +201 -0
  736. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +106 -0
  737. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +15 -88
  738. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +26 -82
  739. data/src/core/lib/security/credentials/tls/tls_credentials.cc +21 -10
  740. data/src/core/lib/security/credentials/xds/xds_credentials.cc +28 -33
  741. data/src/core/lib/security/credentials/xds/xds_credentials.h +1 -1
  742. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +3 -3
  743. data/src/core/lib/security/security_connector/alts/alts_security_connector.h +2 -2
  744. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +5 -6
  745. data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +2 -2
  746. data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +7 -7
  747. data/src/core/lib/security/security_connector/load_system_roots_linux.cc +1 -2
  748. data/src/core/lib/security/security_connector/local/local_security_connector.cc +4 -1
  749. data/src/core/lib/security/security_connector/security_connector.cc +9 -8
  750. data/src/core/lib/security/security_connector/security_connector.h +6 -2
  751. data/src/core/lib/security/security_connector/ssl_utils.cc +25 -27
  752. data/src/core/lib/security/security_connector/ssl_utils.h +6 -15
  753. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +347 -198
  754. data/src/core/lib/security/security_connector/tls/tls_security_connector.h +64 -43
  755. data/src/core/lib/security/transport/auth_filters.h +7 -0
  756. data/src/core/lib/security/transport/client_auth_filter.cc +53 -33
  757. data/src/core/lib/security/transport/security_handshaker.cc +75 -45
  758. data/src/core/lib/security/transport/server_auth_filter.cc +40 -37
  759. data/src/core/lib/security/transport/tsi_error.cc +3 -5
  760. data/src/core/{ext/filters/client_channel → lib/service_config}/service_config.cc +2 -2
  761. data/src/core/{ext/filters/client_channel → lib/service_config}/service_config.h +4 -4
  762. data/src/core/lib/service_config/service_config_call_data.h +72 -0
  763. data/src/core/{ext/filters/client_channel → lib/service_config}/service_config_parser.cc +3 -3
  764. data/src/core/{ext/filters/client_channel → lib/service_config}/service_config_parser.h +8 -6
  765. data/src/core/lib/slice/percent_encoding.cc +30 -86
  766. data/src/core/lib/slice/percent_encoding.h +5 -11
  767. data/src/core/lib/slice/slice.cc +10 -24
  768. data/src/core/lib/slice/slice.h +371 -0
  769. data/src/core/lib/{compression/stream_compression_gzip.h → slice/slice_api.cc} +18 -7
  770. data/src/core/lib/slice/slice_buffer.cc +9 -5
  771. data/src/core/lib/slice/slice_intern.cc +4 -107
  772. data/src/core/lib/slice/slice_internal.h +2 -246
  773. data/src/core/lib/slice/slice_refcount.cc +17 -0
  774. data/src/core/lib/slice/slice_refcount.h +116 -0
  775. data/src/core/lib/slice/slice_refcount_base.h +165 -0
  776. data/src/core/lib/slice/slice_split.cc +100 -0
  777. data/src/core/lib/slice/slice_split.h +40 -0
  778. data/src/core/lib/slice/slice_string_helpers.cc +0 -83
  779. data/src/core/lib/slice/slice_string_helpers.h +0 -11
  780. data/src/core/lib/surface/builtins.cc +49 -0
  781. data/src/core/lib/surface/builtins.h +26 -0
  782. data/src/core/lib/surface/call.cc +249 -482
  783. data/src/core/lib/surface/call.h +4 -10
  784. data/src/core/lib/surface/channel.cc +53 -93
  785. data/src/core/lib/surface/channel.h +6 -25
  786. data/src/core/lib/surface/channel_init.cc +23 -76
  787. data/src/core/lib/surface/channel_init.h +52 -44
  788. data/src/core/lib/surface/completion_queue.cc +8 -7
  789. data/src/core/lib/surface/init.cc +0 -42
  790. data/src/core/lib/surface/init_secure.cc +17 -14
  791. data/src/core/lib/surface/lame_client.cc +41 -28
  792. data/src/core/lib/surface/lame_client.h +1 -1
  793. data/src/core/lib/surface/server.cc +46 -55
  794. data/src/core/lib/surface/server.h +27 -21
  795. data/src/core/lib/surface/validate_metadata.cc +7 -4
  796. data/src/core/lib/surface/version.cc +2 -2
  797. data/src/core/lib/transport/bdp_estimator.cc +2 -2
  798. data/src/core/lib/transport/byte_stream.cc +4 -0
  799. data/src/core/lib/transport/error_utils.cc +42 -17
  800. data/src/core/lib/transport/error_utils.h +15 -1
  801. data/src/core/lib/transport/metadata_batch.h +1167 -176
  802. data/src/core/lib/transport/{authority_override.cc → parsed_metadata.cc} +14 -17
  803. data/src/core/lib/transport/parsed_metadata.h +385 -0
  804. data/src/core/lib/transport/pid_controller.cc +4 -4
  805. data/src/core/lib/transport/timeout_encoding.cc +200 -66
  806. data/src/core/lib/transport/timeout_encoding.h +40 -10
  807. data/src/core/lib/transport/transport.cc +8 -31
  808. data/src/core/lib/transport/transport.h +1 -2
  809. data/src/core/lib/transport/transport_op_string.cc +7 -20
  810. data/src/core/lib/uri/uri_parser.cc +233 -63
  811. data/src/core/lib/uri/uri_parser.h +38 -23
  812. data/src/core/plugin_registry/grpc_plugin_registry.cc +69 -45
  813. data/src/core/tsi/alts/crypt/aes_gcm.cc +3 -1
  814. data/src/core/tsi/alts/frame_protector/alts_frame_protector.cc +13 -12
  815. data/src/core/tsi/alts/frame_protector/frame_handler.cc +10 -11
  816. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +3 -4
  817. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +12 -2
  818. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +1 -1
  819. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +2 -2
  820. data/src/core/tsi/fake_transport_security.cc +15 -7
  821. data/src/core/tsi/local_transport_security.cc +43 -80
  822. data/src/core/tsi/ssl/session_cache/ssl_session.h +2 -4
  823. data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +16 -50
  824. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +6 -7
  825. data/src/core/tsi/ssl_transport_security.cc +93 -16
  826. data/src/core/tsi/ssl_transport_security.h +19 -6
  827. data/src/core/tsi/transport_security.cc +12 -0
  828. data/src/core/tsi/transport_security.h +16 -1
  829. data/src/core/tsi/transport_security_interface.h +26 -0
  830. data/src/ruby/ext/grpc/extconf.rb +21 -11
  831. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +12 -10
  832. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +18 -15
  833. data/src/ruby/lib/grpc/version.rb +1 -1
  834. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +1 -0
  835. data/src/ruby/spec/client_server_spec.rb +1 -1
  836. data/third_party/abseil-cpp/absl/algorithm/container.h +101 -91
  837. data/third_party/abseil-cpp/absl/base/attributes.h +64 -31
  838. data/third_party/abseil-cpp/absl/base/config.h +67 -37
  839. data/third_party/abseil-cpp/absl/base/dynamic_annotations.h +1 -26
  840. data/third_party/abseil-cpp/absl/base/internal/fast_type_id.h +48 -0
  841. data/third_party/abseil-cpp/absl/base/internal/spinlock.h +3 -1
  842. data/third_party/abseil-cpp/absl/base/internal/spinlock_wait.h +2 -0
  843. data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +69 -0
  844. data/third_party/abseil-cpp/absl/base/internal/thread_identity.cc +4 -4
  845. data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +15 -10
  846. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +16 -0
  847. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +4 -4
  848. data/third_party/abseil-cpp/absl/base/options.h +1 -1
  849. data/third_party/abseil-cpp/absl/container/fixed_array.h +0 -5
  850. data/third_party/abseil-cpp/absl/container/inlined_vector.h +105 -97
  851. data/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h +17 -15
  852. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +18 -102
  853. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +37 -78
  854. data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +388 -423
  855. data/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h +3 -2
  856. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +14 -8
  857. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +251 -120
  858. data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +11 -1
  859. data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc +12 -11
  860. data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h +6 -2
  861. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h +12 -5
  862. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_emscripten-inl.inc +110 -0
  863. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_riscv-inl.inc +234 -0
  864. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +25 -7
  865. data/third_party/abseil-cpp/absl/debugging/internal/symbolize.h +8 -2
  866. data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc +21 -3
  867. data/third_party/abseil-cpp/absl/debugging/stacktrace.cc +2 -0
  868. data/third_party/abseil-cpp/absl/debugging/symbolize.cc +2 -0
  869. data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +14 -0
  870. data/third_party/abseil-cpp/absl/debugging/symbolize_emscripten.inc +72 -0
  871. data/third_party/abseil-cpp/absl/functional/function_ref.h +4 -1
  872. data/third_party/abseil-cpp/absl/hash/hash.h +22 -0
  873. data/third_party/abseil-cpp/absl/hash/internal/hash.cc +15 -16
  874. data/third_party/abseil-cpp/absl/hash/internal/hash.h +88 -37
  875. data/third_party/abseil-cpp/absl/hash/internal/{wyhash.cc → low_level_hash.cc} +23 -11
  876. data/third_party/abseil-cpp/absl/hash/internal/{wyhash.h → low_level_hash.h} +14 -12
  877. data/third_party/abseil-cpp/absl/memory/memory.h +1 -1
  878. data/third_party/abseil-cpp/absl/meta/type_traits.h +32 -2
  879. data/third_party/abseil-cpp/absl/numeric/int128.cc +3 -10
  880. data/third_party/abseil-cpp/absl/numeric/int128.h +146 -73
  881. data/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc +19 -25
  882. data/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc +73 -70
  883. data/third_party/abseil-cpp/absl/{base → profiling}/internal/exponential_biased.cc +4 -4
  884. data/third_party/abseil-cpp/absl/{base → profiling}/internal/exponential_biased.h +6 -6
  885. data/third_party/abseil-cpp/absl/profiling/internal/sample_recorder.h +230 -0
  886. data/third_party/abseil-cpp/absl/random/bernoulli_distribution.h +200 -0
  887. data/third_party/abseil-cpp/absl/random/beta_distribution.h +427 -0
  888. data/third_party/abseil-cpp/absl/random/discrete_distribution.cc +98 -0
  889. data/third_party/abseil-cpp/absl/random/discrete_distribution.h +247 -0
  890. data/third_party/abseil-cpp/absl/random/distributions.h +452 -0
  891. data/third_party/abseil-cpp/absl/random/exponential_distribution.h +165 -0
  892. data/third_party/abseil-cpp/absl/random/gaussian_distribution.cc +104 -0
  893. data/third_party/abseil-cpp/absl/random/gaussian_distribution.h +275 -0
  894. data/third_party/abseil-cpp/absl/random/internal/distribution_caller.h +92 -0
  895. data/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h +268 -0
  896. data/third_party/abseil-cpp/absl/random/internal/fastmath.h +57 -0
  897. data/third_party/abseil-cpp/absl/random/internal/generate_real.h +144 -0
  898. data/third_party/abseil-cpp/absl/random/internal/iostream_state_saver.h +245 -0
  899. data/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h +150 -0
  900. data/third_party/abseil-cpp/absl/random/internal/pcg_engine.h +308 -0
  901. data/third_party/abseil-cpp/absl/random/internal/platform.h +171 -0
  902. data/third_party/abseil-cpp/absl/random/internal/pool_urbg.cc +253 -0
  903. data/third_party/abseil-cpp/absl/random/internal/pool_urbg.h +131 -0
  904. data/third_party/abseil-cpp/absl/random/internal/randen.cc +91 -0
  905. data/third_party/abseil-cpp/absl/random/internal/randen.h +102 -0
  906. data/third_party/abseil-cpp/absl/random/internal/randen_detect.cc +221 -0
  907. data/third_party/abseil-cpp/absl/random/internal/randen_detect.h +33 -0
  908. data/third_party/abseil-cpp/absl/random/internal/randen_engine.h +239 -0
  909. data/third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc +526 -0
  910. data/third_party/abseil-cpp/absl/random/internal/randen_hwaes.h +50 -0
  911. data/third_party/abseil-cpp/absl/random/internal/randen_round_keys.cc +462 -0
  912. data/third_party/abseil-cpp/absl/random/internal/randen_slow.cc +471 -0
  913. data/third_party/abseil-cpp/absl/random/internal/randen_slow.h +40 -0
  914. data/third_party/abseil-cpp/absl/random/internal/randen_traits.h +88 -0
  915. data/third_party/abseil-cpp/absl/random/internal/salted_seed_seq.h +167 -0
  916. data/third_party/abseil-cpp/absl/random/internal/seed_material.cc +267 -0
  917. data/third_party/abseil-cpp/absl/random/internal/seed_material.h +104 -0
  918. data/third_party/abseil-cpp/absl/random/internal/traits.h +101 -0
  919. data/third_party/abseil-cpp/absl/random/internal/uniform_helper.h +244 -0
  920. data/third_party/abseil-cpp/absl/random/internal/wide_multiply.h +111 -0
  921. data/third_party/abseil-cpp/absl/random/log_uniform_int_distribution.h +257 -0
  922. data/third_party/abseil-cpp/absl/random/poisson_distribution.h +258 -0
  923. data/third_party/abseil-cpp/absl/random/random.h +189 -0
  924. data/third_party/abseil-cpp/absl/random/seed_gen_exception.cc +46 -0
  925. data/third_party/abseil-cpp/absl/random/seed_gen_exception.h +55 -0
  926. data/third_party/abseil-cpp/absl/random/seed_sequences.cc +29 -0
  927. data/third_party/abseil-cpp/absl/random/seed_sequences.h +110 -0
  928. data/third_party/abseil-cpp/absl/random/uniform_int_distribution.h +275 -0
  929. data/third_party/abseil-cpp/absl/random/uniform_real_distribution.h +202 -0
  930. data/third_party/abseil-cpp/absl/random/zipf_distribution.h +271 -0
  931. data/third_party/abseil-cpp/absl/status/internal/status_internal.h +5 -5
  932. data/third_party/abseil-cpp/absl/status/status.cc +9 -17
  933. data/third_party/abseil-cpp/absl/status/status.h +19 -15
  934. data/third_party/abseil-cpp/absl/status/statusor.cc +34 -2
  935. data/third_party/abseil-cpp/absl/status/statusor.h +31 -21
  936. data/third_party/abseil-cpp/absl/strings/charconv.cc +3 -3
  937. data/third_party/abseil-cpp/absl/strings/charconv.h +3 -2
  938. data/third_party/abseil-cpp/absl/strings/cord.cc +453 -359
  939. data/third_party/abseil-cpp/absl/strings/cord.h +197 -70
  940. data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc +1 -1
  941. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.cc +6 -0
  942. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +140 -63
  943. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc +1128 -0
  944. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.h +939 -0
  945. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc +185 -0
  946. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.h +265 -0
  947. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.cc +68 -0
  948. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.h +211 -0
  949. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.cc +129 -0
  950. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.h +50 -0
  951. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_flat.h +7 -7
  952. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.cc +55 -181
  953. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.h +42 -24
  954. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring_reader.h +4 -0
  955. data/third_party/abseil-cpp/absl/strings/internal/cordz_functions.cc +96 -0
  956. data/third_party/abseil-cpp/absl/strings/internal/cordz_functions.h +85 -0
  957. data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.cc +139 -0
  958. data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.h +131 -0
  959. data/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc +445 -0
  960. data/third_party/abseil-cpp/absl/strings/internal/cordz_info.h +298 -0
  961. data/third_party/abseil-cpp/absl/strings/internal/cordz_statistics.h +87 -0
  962. data/third_party/abseil-cpp/absl/strings/internal/cordz_update_scope.h +71 -0
  963. data/third_party/abseil-cpp/absl/strings/internal/cordz_update_tracker.h +121 -0
  964. data/third_party/abseil-cpp/absl/strings/internal/resize_uninitialized.h +48 -2
  965. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +8 -0
  966. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +3 -4
  967. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +1 -1
  968. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +6 -6
  969. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +36 -18
  970. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc +62 -73
  971. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +24 -16
  972. data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +35 -35
  973. data/third_party/abseil-cpp/absl/strings/numbers.cc +1 -1
  974. data/third_party/abseil-cpp/absl/strings/numbers.h +34 -0
  975. data/third_party/abseil-cpp/absl/strings/str_cat.cc +4 -4
  976. data/third_party/abseil-cpp/absl/strings/str_format.h +1 -2
  977. data/third_party/abseil-cpp/absl/strings/string_view.cc +16 -21
  978. data/third_party/abseil-cpp/absl/strings/string_view.h +120 -39
  979. data/third_party/abseil-cpp/absl/strings/substitute.cc +2 -1
  980. data/third_party/abseil-cpp/absl/strings/substitute.h +99 -74
  981. data/third_party/abseil-cpp/absl/synchronization/blocking_counter.cc +25 -15
  982. data/third_party/abseil-cpp/absl/synchronization/blocking_counter.h +5 -3
  983. data/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc +1 -1
  984. data/third_party/abseil-cpp/absl/synchronization/mutex.h +3 -3
  985. data/third_party/abseil-cpp/absl/time/civil_time.cc +1 -3
  986. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +93 -20
  987. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc +1 -1
  988. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h +2 -1
  989. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +83 -21
  990. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +49 -0
  991. data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +1 -1
  992. data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +2 -3
  993. data/third_party/abseil-cpp/absl/time/time.h +67 -36
  994. data/third_party/abseil-cpp/absl/types/bad_optional_access.h +1 -1
  995. data/third_party/abseil-cpp/absl/types/bad_variant_access.h +2 -2
  996. data/third_party/abseil-cpp/absl/types/span.h +3 -3
  997. data/third_party/address_sorting/address_sorting_posix.c +1 -0
  998. data/third_party/boringssl-with-bazel/err_data.c +681 -677
  999. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bitstr.c +19 -11
  1000. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bool.c +20 -21
  1001. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +41 -30
  1002. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +104 -114
  1003. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +1 -1
  1004. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +59 -47
  1005. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn_pack.c +24 -28
  1006. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_int.c +5 -0
  1007. data/third_party/boringssl-with-bazel/src/crypto/asn1/internal.h +41 -0
  1008. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +48 -272
  1009. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +1 -0
  1010. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_typ.c +8 -6
  1011. data/third_party/boringssl-with-bazel/src/crypto/base64/base64.c +13 -0
  1012. data/third_party/boringssl-with-bazel/src/crypto/blake2/blake2.c +4 -6
  1013. data/third_party/boringssl-with-bazel/src/crypto/bytestring/ber.c +3 -1
  1014. data/third_party/boringssl-with-bazel/src/crypto/chacha/chacha.c +38 -47
  1015. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +21 -0
  1016. data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +2 -2
  1017. data/third_party/boringssl-with-bazel/src/crypto/evp/scrypt.c +32 -34
  1018. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/sqrt.c +5 -9
  1019. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/cipher.c +12 -0
  1020. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/des/des.c +10 -11
  1021. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/des/internal.h +1 -3
  1022. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +1 -2
  1023. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md4/md4.c +3 -6
  1024. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/md5.c +4 -7
  1025. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +7 -7
  1026. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha1.c +35 -35
  1027. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha256.c +11 -10
  1028. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +10 -37
  1029. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +2 -2
  1030. data/third_party/boringssl-with-bazel/src/crypto/internal.h +39 -0
  1031. data/third_party/boringssl-with-bazel/src/crypto/mem.c +18 -0
  1032. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7.c +29 -0
  1033. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +0 -1
  1034. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8.c +1 -1
  1035. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +1 -1
  1036. data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +5 -1
  1037. data/third_party/boringssl-with-bazel/src/crypto/pool/pool.c +59 -23
  1038. data/third_party/boringssl-with-bazel/src/crypto/siphash/siphash.c +6 -6
  1039. data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.c +2 -18
  1040. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +8 -2
  1041. data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +216 -11
  1042. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_cache.c +1 -1
  1043. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_data.c +1 -1
  1044. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_lib.c +1 -1
  1045. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_map.c +1 -1
  1046. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_node.c +1 -1
  1047. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_tree.c +1 -1
  1048. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +1 -0
  1049. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +0 -1
  1050. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +21 -4
  1051. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +0 -1
  1052. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +1019 -274
  1053. data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +3 -3
  1054. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +5 -2
  1055. data/third_party/boringssl-with-bazel/src/include/openssl/base64.h +8 -0
  1056. data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +13 -1
  1057. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +4 -12
  1058. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +27 -41
  1059. data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +12 -27
  1060. data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +8 -10
  1061. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +29 -55
  1062. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +1 -1
  1063. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +12 -13
  1064. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs8.h +6 -1
  1065. data/third_party/boringssl-with-bazel/src/include/openssl/pool.h +7 -1
  1066. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +24 -28
  1067. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +31 -13
  1068. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +491 -58
  1069. data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +16 -564
  1070. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +4 -3
  1071. data/third_party/boringssl-with-bazel/src/ssl/internal.h +3 -3
  1072. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +4 -0
  1073. data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +4 -0
  1074. data/third_party/boringssl-with-bazel/src/ssl/ssl_x509.cc +0 -1
  1075. data/third_party/re2/re2/compile.cc +91 -109
  1076. data/third_party/re2/re2/dfa.cc +27 -39
  1077. data/third_party/re2/re2/filtered_re2.cc +18 -2
  1078. data/third_party/re2/re2/filtered_re2.h +10 -5
  1079. data/third_party/re2/re2/nfa.cc +1 -1
  1080. data/third_party/re2/re2/parse.cc +42 -23
  1081. data/third_party/re2/re2/perl_groups.cc +34 -34
  1082. data/third_party/re2/re2/prefilter.cc +3 -2
  1083. data/third_party/re2/re2/prog.cc +182 -4
  1084. data/third_party/re2/re2/prog.h +28 -9
  1085. data/third_party/re2/re2/re2.cc +87 -118
  1086. data/third_party/re2/re2/re2.h +156 -141
  1087. data/third_party/re2/re2/regexp.cc +12 -5
  1088. data/third_party/re2/re2/regexp.h +8 -2
  1089. data/third_party/re2/re2/set.cc +31 -9
  1090. data/third_party/re2/re2/set.h +9 -4
  1091. data/third_party/re2/re2/simplify.cc +11 -3
  1092. data/third_party/re2/re2/tostring.cc +1 -1
  1093. data/third_party/re2/re2/walker-inl.h +1 -1
  1094. data/third_party/re2/util/mutex.h +2 -2
  1095. data/third_party/re2/util/pcre.h +3 -3
  1096. data/third_party/upb/upb/decode.c +309 -178
  1097. data/third_party/upb/upb/decode_fast.c +1 -1
  1098. data/third_party/upb/upb/decode_internal.h +1 -0
  1099. data/third_party/upb/upb/def.c +330 -85
  1100. data/third_party/upb/upb/def.h +45 -14
  1101. data/third_party/upb/upb/def.hpp +17 -4
  1102. data/third_party/upb/upb/encode.c +100 -40
  1103. data/third_party/upb/upb/msg.c +22 -9
  1104. data/third_party/upb/upb/msg_internal.h +90 -8
  1105. data/third_party/upb/upb/reflection.c +98 -58
  1106. data/third_party/upb/upb/reflection.h +6 -2
  1107. data/third_party/upb/upb/text_encode.c +3 -3
  1108. data/third_party/upb/upb/upb.c +8 -0
  1109. data/third_party/xxhash/xxhash.h +607 -352
  1110. metadata +259 -115
  1111. data/include/grpc/event_engine/slice_allocator.h +0 -71
  1112. data/src/core/ext/filters/client_channel/service_config_call_data.h +0 -126
  1113. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +0 -211
  1114. data/src/core/ext/filters/workarounds/workaround_utils.cc +0 -53
  1115. data/src/core/ext/filters/workarounds/workaround_utils.h +0 -39
  1116. data/src/core/ext/transport/chttp2/client/authority.cc +0 -42
  1117. data/src/core/ext/transport/chttp2/client/authority.h +0 -36
  1118. data/src/core/ext/transport/chttp2/transport/chttp2_slice_allocator.cc +0 -67
  1119. data/src/core/ext/transport/chttp2/transport/chttp2_slice_allocator.h +0 -74
  1120. data/src/core/ext/transport/chttp2/transport/hpack_encoder_index.h +0 -107
  1121. data/src/core/ext/transport/chttp2/transport/hpack_utils.cc +0 -46
  1122. data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +0 -66
  1123. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +0 -58
  1124. data/src/core/ext/transport/chttp2/transport/popularity_count.h +0 -60
  1125. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +0 -58
  1126. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +0 -130
  1127. data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.c +0 -33
  1128. data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.h +0 -83
  1129. data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.c +0 -44
  1130. data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.h +0 -35
  1131. data/src/core/lib/avl/avl.cc +0 -306
  1132. data/src/core/lib/compression/algorithm_metadata.h +0 -62
  1133. data/src/core/lib/compression/compression_args.cc +0 -136
  1134. data/src/core/lib/compression/compression_args.h +0 -56
  1135. data/src/core/lib/compression/stream_compression.cc +0 -81
  1136. data/src/core/lib/compression/stream_compression.h +0 -117
  1137. data/src/core/lib/compression/stream_compression_gzip.cc +0 -231
  1138. data/src/core/lib/compression/stream_compression_identity.cc +0 -91
  1139. data/src/core/lib/compression/stream_compression_identity.h +0 -29
  1140. data/src/core/lib/gprpp/match.h +0 -73
  1141. data/src/core/lib/gprpp/overload.h +0 -59
  1142. data/src/core/lib/iomgr/event_engine/iomgr.h +0 -42
  1143. data/src/core/lib/iomgr/resource_quota.cc +0 -1104
  1144. data/src/core/lib/iomgr/resource_quota.h +0 -226
  1145. data/src/core/lib/iomgr/udp_server.cc +0 -747
  1146. data/src/core/lib/iomgr/udp_server.h +0 -103
  1147. data/src/core/lib/security/credentials/credentials_metadata.cc +0 -61
  1148. data/src/core/lib/transport/metadata.cc +0 -693
  1149. data/src/core/lib/transport/metadata.h +0 -448
  1150. data/src/core/lib/transport/metadata_batch.cc +0 -430
  1151. data/src/core/lib/transport/static_metadata.cc +0 -1249
  1152. data/src/core/lib/transport/static_metadata.h +0 -604
  1153. data/src/core/lib/transport/status_metadata.cc +0 -62
  1154. data/src/core/lib/transport/status_metadata.h +0 -48
  1155. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_enum.c +0 -93
  1156. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_int.h +0 -217
@@ -33,12 +33,15 @@
33
33
  #include <grpc/support/time.h>
34
34
 
35
35
  #include "src/core/ext/filters/client_channel/client_channel.h"
36
- #include "src/core/ext/filters/client_channel/service_config.h"
37
36
  #include "src/core/ext/xds/xds_api.h"
38
37
  #include "src/core/ext/xds/xds_bootstrap.h"
39
38
  #include "src/core/ext/xds/xds_channel_args.h"
39
+ #include "src/core/ext/xds/xds_channel_creds.h"
40
40
  #include "src/core/ext/xds/xds_client_stats.h"
41
+ #include "src/core/ext/xds/xds_cluster.h"
42
+ #include "src/core/ext/xds/xds_endpoint.h"
41
43
  #include "src/core/ext/xds/xds_http_filters.h"
44
+ #include "src/core/ext/xds/xds_listener.h"
42
45
  #include "src/core/lib/address_utils/sockaddr_utils.h"
43
46
  #include "src/core/lib/backoff/backoff.h"
44
47
  #include "src/core/lib/channel/channel_args.h"
@@ -55,8 +58,7 @@
55
58
  #include "src/core/lib/slice/slice_string_helpers.h"
56
59
  #include "src/core/lib/surface/call.h"
57
60
  #include "src/core/lib/surface/channel.h"
58
- #include "src/core/lib/surface/channel_init.h"
59
- #include "src/core/lib/transport/static_metadata.h"
61
+ #include "src/core/lib/uri/uri_parser.h"
60
62
 
61
63
  #define GRPC_XDS_INITIAL_CONNECT_BACKOFF_SECONDS 1
62
64
  #define GRPC_XDS_RECONNECT_BACKOFF_MULTIPLIER 1.6
@@ -72,12 +74,50 @@ TraceFlag grpc_xds_client_refcount_trace(false, "xds_client_refcount");
72
74
  namespace {
73
75
 
74
76
  Mutex* g_mu = nullptr;
77
+
75
78
  const grpc_channel_args* g_channel_args ABSL_GUARDED_BY(*g_mu) = nullptr;
76
79
  XdsClient* g_xds_client ABSL_GUARDED_BY(*g_mu) = nullptr;
77
80
  char* g_fallback_bootstrap_config ABSL_GUARDED_BY(*g_mu) = nullptr;
78
81
 
79
82
  } // namespace
80
83
 
84
+ class XdsClient::Notifier {
85
+ public:
86
+ // Helper template function to invoke `OnError()` on a list of watchers \a
87
+ // watchers_list within \a work_serializer. Works with all 4 resource types.
88
+ template <class T>
89
+ static void ScheduleNotifyWatchersOnErrorInWorkSerializer(
90
+ XdsClient* xds_client, const T& watchers_list, grpc_error_handle error,
91
+ const DebugLocation& location) {
92
+ xds_client->work_serializer_.Schedule(
93
+ [watchers_list, error]()
94
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&xds_client->work_serializer_) {
95
+ for (const auto& p : watchers_list) {
96
+ p.first->OnError(GRPC_ERROR_REF(error));
97
+ }
98
+ GRPC_ERROR_UNREF(error);
99
+ },
100
+ location);
101
+ }
102
+
103
+ // Helper template function to invoke `OnResourceDoesNotExist()` on a list of
104
+ // watchers \a watchers_list within \a work_serializer. Works with all 4
105
+ // resource types.
106
+ template <class T>
107
+ static void ScheduleNotifyWatchersOnResourceDoesNotExistInWorkSerializer(
108
+ XdsClient* xds_client, const T& watchers_list,
109
+ const DebugLocation& location) {
110
+ xds_client->work_serializer_.Schedule(
111
+ [watchers_list]()
112
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&xds_client->work_serializer_) {
113
+ for (const auto& p : watchers_list) {
114
+ p.first->OnResourceDoesNotExist();
115
+ }
116
+ },
117
+ location);
118
+ }
119
+ };
120
+
81
121
  //
82
122
  // Internal class declarations
83
123
  //
@@ -88,7 +128,7 @@ template <typename T>
88
128
  class XdsClient::ChannelState::RetryableCall
89
129
  : public InternallyRefCounted<RetryableCall<T>> {
90
130
  public:
91
- explicit RetryableCall(RefCountedPtr<ChannelState> chand);
131
+ explicit RetryableCall(WeakRefCountedPtr<ChannelState> chand);
92
132
 
93
133
  void Orphan() override;
94
134
 
@@ -109,7 +149,7 @@ class XdsClient::ChannelState::RetryableCall
109
149
  // every time we start a new call. It's null during call retry backoff.
110
150
  OrphanablePtr<T> calld_;
111
151
  // The owning xds channel.
112
- RefCountedPtr<ChannelState> chand_;
152
+ WeakRefCountedPtr<ChannelState> chand_;
113
153
 
114
154
  // Retry state.
115
155
  BackOff backoff_;
@@ -135,34 +175,65 @@ class XdsClient::ChannelState::AdsCallState
135
175
  XdsClient* xds_client() const { return chand()->xds_client(); }
136
176
  bool seen_response() const { return seen_response_; }
137
177
 
138
- void SubscribeLocked(const std::string& type_url, const std::string& name)
178
+ void SubscribeLocked(const XdsResourceType* type, const XdsResourceName& name)
139
179
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
140
- void UnsubscribeLocked(const std::string& type_url, const std::string& name,
141
- bool delay_unsubscription)
180
+ void UnsubscribeLocked(const XdsResourceType* type,
181
+ const XdsResourceName& name, bool delay_unsubscription)
142
182
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
143
183
 
144
184
  bool HasSubscribedResources() const;
145
185
 
146
186
  private:
147
- class ResourceState : public InternallyRefCounted<ResourceState> {
187
+ class AdsResponseParser : public XdsApi::AdsResponseParserInterface {
188
+ public:
189
+ struct Result {
190
+ const XdsResourceType* type;
191
+ std::string type_url;
192
+ std::string version;
193
+ std::string nonce;
194
+ std::vector<std::string> errors;
195
+ std::map<std::string /*authority*/, std::set<XdsResourceKey>>
196
+ resources_seen;
197
+ bool have_valid_resources = false;
198
+ };
199
+
200
+ explicit AdsResponseParser(AdsCallState* ads_call_state)
201
+ : ads_call_state_(ads_call_state) {}
202
+
203
+ absl::Status ProcessAdsResponseFields(AdsResponseFields fields) override
204
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
205
+
206
+ void ParseResource(const XdsEncodingContext& context, size_t idx,
207
+ absl::string_view type_url,
208
+ absl::string_view serialized_resource) override
209
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
210
+
211
+ Result TakeResult() { return std::move(result_); }
212
+
213
+ private:
214
+ XdsClient* xds_client() const { return ads_call_state_->xds_client(); }
215
+
216
+ AdsCallState* ads_call_state_;
217
+ const grpc_millis update_time_ = ExecCtx::Get()->Now();
218
+ Result result_;
219
+ };
220
+
221
+ class ResourceTimer : public InternallyRefCounted<ResourceTimer> {
148
222
  public:
149
- ResourceState(const std::string& type_url, const std::string& name,
150
- bool sent_initial_request)
151
- : type_url_(type_url),
152
- name_(name),
153
- sent_initial_request_(sent_initial_request) {
223
+ ResourceTimer(const XdsResourceType* type, const XdsResourceName& name)
224
+ : type_(type), name_(name) {
154
225
  GRPC_CLOSURE_INIT(&timer_callback_, OnTimer, this,
155
226
  grpc_schedule_on_exec_ctx);
156
227
  }
157
228
 
158
229
  void Orphan() override {
159
- Finish();
230
+ MaybeCancelTimer();
160
231
  Unref(DEBUG_LOCATION, "Orphan");
161
232
  }
162
233
 
163
- void Start(RefCountedPtr<AdsCallState> ads_calld) {
164
- if (sent_initial_request_) return;
165
- sent_initial_request_ = true;
234
+ void MaybeStartTimer(RefCountedPtr<AdsCallState> ads_calld) {
235
+ if (timer_started_) return;
236
+ timer_started_ = true;
166
237
  ads_calld_ = std::move(ads_calld);
167
238
  Ref(DEBUG_LOCATION, "timer").release();
168
239
  timer_pending_ = true;
@@ -172,7 +243,7 @@ class XdsClient::ChannelState::AdsCallState
172
243
  &timer_callback_);
173
244
  }
174
245
 
175
- void Finish() {
246
+ void MaybeCancelTimer() {
176
247
  if (timer_pending_) {
177
248
  grpc_timer_cancel(&timer_);
178
249
  timer_pending_ = false;
@@ -181,11 +252,12 @@ class XdsClient::ChannelState::AdsCallState
181
252
 
182
253
  private:
183
254
  static void OnTimer(void* arg, grpc_error_handle error) {
184
- ResourceState* self = static_cast<ResourceState*>(arg);
255
+ ResourceTimer* self = static_cast<ResourceTimer*>(arg);
185
256
  {
186
257
  MutexLock lock(&self->ads_calld_->xds_client()->mu_);
187
258
  self->OnTimerLocked(GRPC_ERROR_REF(error));
188
259
  }
260
+ self->ads_calld_->xds_client()->work_serializer_.DrainQueue();
189
261
  self->ads_calld_.reset();
190
262
  self->Unref(DEBUG_LOCATION, "timer");
191
263
  }
@@ -197,51 +269,33 @@ class XdsClient::ChannelState::AdsCallState
197
269
  grpc_error_handle watcher_error =
198
270
  GRPC_ERROR_CREATE_FROM_CPP_STRING(absl::StrFormat(
199
271
  "timeout obtaining resource {type=%s name=%s} from xds server",
200
- type_url_, name_));
272
+ type_->type_url(),
273
+ XdsClient::ConstructFullXdsResourceName(
274
+ name_.authority, type_->type_url(), name_.key)));
201
275
  watcher_error = grpc_error_set_int(
202
276
  watcher_error, GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
203
277
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
204
- gpr_log(GPR_INFO, "[xds_client %p] %s", ads_calld_->xds_client(),
278
+ gpr_log(GPR_INFO, "[xds_client %p] xds server %s: %s",
279
+ ads_calld_->xds_client(),
280
+ ads_calld_->chand()->server_.server_uri.c_str(),
205
281
  grpc_error_std_string(watcher_error).c_str());
206
282
  }
207
- if (type_url_ == XdsApi::kLdsTypeUrl) {
208
- ListenerState& state = ads_calld_->xds_client()->listener_map_[name_];
209
- state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
210
- for (const auto& p : state.watchers) {
211
- p.first->OnError(GRPC_ERROR_REF(watcher_error));
212
- }
213
- } else if (type_url_ == XdsApi::kRdsTypeUrl) {
214
- RouteConfigState& state =
215
- ads_calld_->xds_client()->route_config_map_[name_];
216
- state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
217
- for (const auto& p : state.watchers) {
218
- p.first->OnError(GRPC_ERROR_REF(watcher_error));
219
- }
220
- } else if (type_url_ == XdsApi::kCdsTypeUrl) {
221
- ClusterState& state = ads_calld_->xds_client()->cluster_map_[name_];
222
- state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
223
- for (const auto& p : state.watchers) {
224
- p.first->OnError(GRPC_ERROR_REF(watcher_error));
225
- }
226
- } else if (type_url_ == XdsApi::kEdsTypeUrl) {
227
- EndpointState& state = ads_calld_->xds_client()->endpoint_map_[name_];
228
- state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
229
- for (const auto& p : state.watchers) {
230
- p.first->OnError(GRPC_ERROR_REF(watcher_error));
231
- }
232
- } else {
233
- GPR_UNREACHABLE_CODE(return );
234
- }
235
- GRPC_ERROR_UNREF(watcher_error);
283
+ auto& authority_state =
284
+ ads_calld_->xds_client()->authority_state_map_[name_.authority];
285
+ ResourceState& state = authority_state.resource_map[type_][name_.key];
286
+ state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
287
+ Notifier::ScheduleNotifyWatchersOnErrorInWorkSerializer(
288
+ ads_calld_->xds_client(), state.watchers, watcher_error,
289
+ DEBUG_LOCATION);
236
290
  }
237
291
  GRPC_ERROR_UNREF(error);
238
292
  }
239
293
 
240
- const std::string type_url_;
241
- const std::string name_;
294
+ const XdsResourceType* type_;
295
+ const XdsResourceName name_;
242
296
 
243
297
  RefCountedPtr<AdsCallState> ads_calld_;
244
- bool sent_initial_request_;
298
+ bool timer_started_ = false;
245
299
  bool timer_pending_ = false;
246
300
  grpc_timer timer_;
247
301
  grpc_closure timer_callback_;
@@ -255,32 +309,12 @@ class XdsClient::ChannelState::AdsCallState
255
309
  grpc_error_handle error = GRPC_ERROR_NONE;
256
310
 
257
311
  // Subscribed resources of this type.
258
- std::map<std::string /* name */, OrphanablePtr<ResourceState>>
312
+ std::map<std::string /*authority*/,
313
+ std::map<XdsResourceKey, OrphanablePtr<ResourceTimer>>>
259
314
  subscribed_resources;
260
315
  };
261
316
 
262
- void SendMessageLocked(const std::string& type_url)
263
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
264
-
265
- void AcceptLdsUpdateLocked(std::string version, grpc_millis update_time,
266
- XdsApi::LdsUpdateMap lds_update_map,
267
- const std::set<std::string>& resource_names_failed)
268
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
269
- void AcceptRdsUpdateLocked(std::string version, grpc_millis update_time,
270
- XdsApi::RdsUpdateMap rds_update_map)
271
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
272
- void AcceptCdsUpdateLocked(std::string version, grpc_millis update_time,
273
- XdsApi::CdsUpdateMap cds_update_map,
274
- const std::set<std::string>& resource_names_failed)
275
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
276
- void AcceptEdsUpdateLocked(std::string version, grpc_millis update_time,
277
- XdsApi::EdsUpdateMap eds_update_map)
278
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
279
-
280
- template <typename StateMap>
281
- void RejectAdsUpdateLocked(grpc_millis update_time,
282
- const XdsApi::AdsParseResult& result,
283
- StateMap* state_map)
317
+ void SendMessageLocked(const XdsResourceType* type)
284
318
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
285
319
 
286
320
  static void OnRequestSent(void* arg, grpc_error_handle error);
@@ -295,8 +329,9 @@ class XdsClient::ChannelState::AdsCallState
295
329
 
296
330
  bool IsCurrentCallOnChannel() const;
297
331
 
298
- std::set<absl::string_view> ResourceNamesForRequest(
299
- const std::string& type_url);
332
+ // Constructs a list of resource names of a given type for an ADS
333
+ // request. Also starts the timer for each resource if needed.
334
+ std::vector<std::string> ResourceNamesForRequest(const XdsResourceType* type);
300
335
 
301
336
  // The owning RetryableCall<>.
302
337
  RefCountedPtr<RetryableCall<AdsCallState>> parent_;
@@ -325,10 +360,10 @@ class XdsClient::ChannelState::AdsCallState
325
360
  grpc_closure on_status_received_;
326
361
 
327
362
  // Resource types for which requests need to be sent.
328
- std::set<std::string /*type_url*/> buffered_requests_;
363
+ std::set<const XdsResourceType*> buffered_requests_;
329
364
 
330
365
  // State for each resource type.
331
- std::map<std::string /*type_url*/, ResourceTypeState> state_map_;
366
+ std::map<const XdsResourceType*, ResourceTypeState> state_map_;
332
367
  };
333
368
 
334
369
  // Contains an LRS call to the xds server.
@@ -441,27 +476,31 @@ class XdsClient::ChannelState::LrsCallState
441
476
  class XdsClient::ChannelState::StateWatcher
442
477
  : public AsyncConnectivityStateWatcherInterface {
443
478
  public:
444
- explicit StateWatcher(RefCountedPtr<ChannelState> parent)
479
+ explicit StateWatcher(WeakRefCountedPtr<ChannelState> parent)
445
480
  : parent_(std::move(parent)) {}
446
481
 
447
482
  private:
448
483
  void OnConnectivityStateChange(grpc_connectivity_state new_state,
449
484
  const absl::Status& status) override {
450
- MutexLock lock(&parent_->xds_client_->mu_);
451
- if (!parent_->shutting_down_ &&
452
- new_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
453
- // In TRANSIENT_FAILURE. Notify all watchers of error.
454
- gpr_log(GPR_INFO,
455
- "[xds_client %p] xds channel in state:TRANSIENT_FAILURE "
456
- "status_message:(%s)",
457
- parent_->xds_client(), status.ToString().c_str());
458
- parent_->xds_client_->NotifyOnErrorLocked(
459
- GRPC_ERROR_CREATE_FROM_STATIC_STRING(
460
- "xds channel in TRANSIENT_FAILURE"));
485
+ {
486
+ MutexLock lock(&parent_->xds_client_->mu_);
487
+ if (!parent_->shutting_down_ &&
488
+ new_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
489
+ // In TRANSIENT_FAILURE. Notify all watchers of error.
490
+ gpr_log(GPR_INFO,
491
+ "[xds_client %p] xds channel for server %s in "
492
+ "state TRANSIENT_FAILURE: %s",
493
+ parent_->xds_client(), parent_->server_.server_uri.c_str(),
494
+ status.ToString().c_str());
495
+ parent_->xds_client_->NotifyOnErrorLocked(
496
+ GRPC_ERROR_CREATE_FROM_STATIC_STRING(
497
+ "xds channel in TRANSIENT_FAILURE"));
498
+ }
461
499
  }
500
+ parent_->xds_client()->work_serializer_.DrainQueue();
462
501
  }
463
502
 
464
- RefCountedPtr<ChannelState> parent_;
503
+ WeakRefCountedPtr<ChannelState> parent_;
465
504
  };
466
505
 
467
506
  //
@@ -473,8 +512,8 @@ namespace {
473
512
  grpc_channel* CreateXdsChannel(grpc_channel_args* args,
474
513
  const XdsBootstrap::XdsServer& server) {
475
514
  RefCountedPtr<grpc_channel_credentials> channel_creds =
476
- XdsChannelCredsRegistry::MakeChannelCreds(server.channel_creds_type,
477
- server.channel_creds_config);
515
+ XdsChannelCredsRegistry::CreateXdsChannelCreds(
516
+ server.channel_creds_type, server.channel_creds_config);
478
517
  return grpc_secure_channel_create(channel_creds.get(),
479
518
  server.server_uri.c_str(), args, nullptr);
480
519
  }
@@ -483,7 +522,7 @@ grpc_channel* CreateXdsChannel(grpc_channel_args* args,
483
522
 
484
523
  XdsClient::ChannelState::ChannelState(WeakRefCountedPtr<XdsClient> xds_client,
485
524
  const XdsBootstrap::XdsServer& server)
486
- : InternallyRefCounted<ChannelState>(
525
+ : DualRefCounted<ChannelState>(
487
526
  GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_refcount_trace)
488
527
  ? "ChannelState"
489
528
  : nullptr),
@@ -500,19 +539,26 @@ XdsClient::ChannelState::ChannelState(WeakRefCountedPtr<XdsClient> xds_client,
500
539
 
501
540
  XdsClient::ChannelState::~ChannelState() {
502
541
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
503
- gpr_log(GPR_INFO, "[xds_client %p] Destroying xds channel %p", xds_client(),
504
- this);
542
+ gpr_log(GPR_INFO, "[xds_client %p] destroying xds channel %p for server %s",
543
+ xds_client(), this, server_.server_uri.c_str());
505
544
  }
506
545
  grpc_channel_destroy(channel_);
507
546
  xds_client_.reset(DEBUG_LOCATION, "ChannelState");
508
547
  }
509
548
 
510
- void XdsClient::ChannelState::Orphan() {
549
+ // This method should only ever be called when holding the lock, but we can't
550
+ // use a ABSL_EXCLUSIVE_LOCKS_REQUIRED annotation, because Orphan() will be
551
+ // called from DualRefCounted::Unref, which cannot have a lock annotation for a
552
+ // lock in this subclass.
553
+ void XdsClient::ChannelState::Orphan() ABSL_NO_THREAD_SAFETY_ANALYSIS {
511
554
  shutting_down_ = true;
512
555
  CancelConnectivityWatchLocked();
556
+ // At this time, all strong refs are removed, remove from channel map to
557
+ // prevent subsequent subscription from trying to use this ChannelState as it
558
+ // is shutting down.
559
+ xds_client_->xds_server_channel_map_.erase(server_);
513
560
  ads_calld_.reset();
514
561
  lrs_calld_.reset();
515
- Unref(DEBUG_LOCATION, "ChannelState+orphaned");
516
562
  }
517
563
 
518
564
  XdsClient::ChannelState::AdsCallState* XdsClient::ChannelState::ads_calld()
@@ -531,8 +577,8 @@ bool XdsClient::ChannelState::HasActiveAdsCall() const {
531
577
 
532
578
  void XdsClient::ChannelState::MaybeStartLrsCall() {
533
579
  if (lrs_calld_ != nullptr) return;
534
- lrs_calld_.reset(
535
- new RetryableCall<LrsCallState>(Ref(DEBUG_LOCATION, "ChannelState+lrs")));
580
+ lrs_calld_.reset(new RetryableCall<LrsCallState>(
581
+ WeakRef(DEBUG_LOCATION, "ChannelState+lrs")));
536
582
  }
537
583
 
538
584
  void XdsClient::ChannelState::StopLrsCall() { lrs_calld_.reset(); }
@@ -540,7 +586,7 @@ void XdsClient::ChannelState::StopLrsCall() { lrs_calld_.reset(); }
540
586
  void XdsClient::ChannelState::StartConnectivityWatchLocked() {
541
587
  ClientChannel* client_channel = ClientChannel::GetFromChannel(channel_);
542
588
  GPR_ASSERT(client_channel != nullptr);
543
- watcher_ = new StateWatcher(Ref(DEBUG_LOCATION, "ChannelState+watch"));
589
+ watcher_ = new StateWatcher(WeakRef(DEBUG_LOCATION, "ChannelState+watch"));
544
590
  client_channel->AddConnectivityWatcher(
545
591
  GRPC_CHANNEL_IDLE,
546
592
  OrphanablePtr<AsyncConnectivityStateWatcherInterface>(watcher_));
@@ -552,12 +598,12 @@ void XdsClient::ChannelState::CancelConnectivityWatchLocked() {
552
598
  client_channel->RemoveConnectivityWatcher(watcher_);
553
599
  }
554
600
 
555
- void XdsClient::ChannelState::SubscribeLocked(const std::string& type_url,
556
- const std::string& name) {
601
+ void XdsClient::ChannelState::SubscribeLocked(const XdsResourceType* type,
602
+ const XdsResourceName& name) {
557
603
  if (ads_calld_ == nullptr) {
558
604
  // Start the ADS call if this is the first request.
559
605
  ads_calld_.reset(new RetryableCall<AdsCallState>(
560
- Ref(DEBUG_LOCATION, "ChannelState+ads")));
606
+ WeakRef(DEBUG_LOCATION, "ChannelState+ads")));
561
607
  // Note: AdsCallState's ctor will automatically subscribe to all
562
608
  // resources that the XdsClient already has watchers for, so we can
563
609
  // return here.
@@ -567,17 +613,19 @@ void XdsClient::ChannelState::SubscribeLocked(const std::string& type_url,
567
613
  // because when the call is restarted it will resend all necessary requests.
568
614
  if (ads_calld() == nullptr) return;
569
615
  // Subscribe to this resource if the ADS call is active.
570
- ads_calld()->SubscribeLocked(type_url, name);
616
+ ads_calld()->SubscribeLocked(type, name);
571
617
  }
572
618
 
573
- void XdsClient::ChannelState::UnsubscribeLocked(const std::string& type_url,
574
- const std::string& name,
619
+ void XdsClient::ChannelState::UnsubscribeLocked(const XdsResourceType* type,
620
+ const XdsResourceName& name,
575
621
  bool delay_unsubscription) {
576
622
  if (ads_calld_ != nullptr) {
577
623
  auto* calld = ads_calld_->calld();
578
624
  if (calld != nullptr) {
579
- calld->UnsubscribeLocked(type_url, name, delay_unsubscription);
580
- if (!calld->HasSubscribedResources()) ads_calld_.reset();
625
+ calld->UnsubscribeLocked(type, name, delay_unsubscription);
626
+ if (!calld->HasSubscribedResources()) {
627
+ ads_calld_.reset();
628
+ }
581
629
  }
582
630
  }
583
631
  }
@@ -588,7 +636,7 @@ void XdsClient::ChannelState::UnsubscribeLocked(const std::string& type_url,
588
636
 
589
637
  template <typename T>
590
638
  XdsClient::ChannelState::RetryableCall<T>::RetryableCall(
591
- RefCountedPtr<ChannelState> chand)
639
+ WeakRefCountedPtr<ChannelState> chand)
592
640
  : chand_(std::move(chand)),
593
641
  backoff_(
594
642
  BackOff::Options()
@@ -632,10 +680,10 @@ void XdsClient::ChannelState::RetryableCall<T>::StartNewCallLocked() {
632
680
  GPR_ASSERT(chand_->channel_ != nullptr);
633
681
  GPR_ASSERT(calld_ == nullptr);
634
682
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
635
- gpr_log(GPR_INFO,
636
- "[xds_client %p] Start new call from retryable call (chand: %p, "
637
- "retryable call: %p)",
638
- chand()->xds_client(), chand(), this);
683
+ gpr_log(
684
+ GPR_INFO,
685
+ "[xds_client %p] xds server %s: start new call from retryable call %p",
686
+ chand()->xds_client(), chand()->server_.server_uri.c_str(), this);
639
687
  }
640
688
  calld_ = MakeOrphanable<T>(
641
689
  this->Ref(DEBUG_LOCATION, "RetryableCall+start_new_call"));
@@ -646,11 +694,13 @@ void XdsClient::ChannelState::RetryableCall<T>::StartRetryTimerLocked() {
646
694
  if (shutting_down_) return;
647
695
  const grpc_millis next_attempt_time = backoff_.NextAttemptTime();
648
696
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
649
- grpc_millis timeout = GPR_MAX(next_attempt_time - ExecCtx::Get()->Now(), 0);
697
+ grpc_millis timeout =
698
+ std::max(next_attempt_time - ExecCtx::Get()->Now(), grpc_millis(0));
650
699
  gpr_log(GPR_INFO,
651
- "[xds_client %p] Failed to connect to xds server (chand: %p) "
700
+ "[xds_client %p] xds server %s: call attempt failed; "
652
701
  "retry timer will fire in %" PRId64 "ms.",
653
- chand()->xds_client(), chand(), timeout);
702
+ chand()->xds_client(), chand()->server_.server_uri.c_str(),
703
+ timeout);
654
704
  }
655
705
  this->Ref(DEBUG_LOCATION, "RetryableCall+retry_timer_start").release();
656
706
  grpc_timer_init(&retry_timer_, next_attempt_time, &on_retry_timer_);
@@ -674,16 +724,183 @@ void XdsClient::ChannelState::RetryableCall<T>::OnRetryTimerLocked(
674
724
  retry_timer_callback_pending_ = false;
675
725
  if (!shutting_down_ && error == GRPC_ERROR_NONE) {
676
726
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
677
- gpr_log(
678
- GPR_INFO,
679
- "[xds_client %p] Retry timer fires (chand: %p, retryable call: %p)",
680
- chand()->xds_client(), chand(), this);
727
+ gpr_log(GPR_INFO,
728
+ "[xds_client %p] xds server %s: retry timer fired (retryable "
729
+ "call: %p)",
730
+ chand()->xds_client(), chand()->server_.server_uri.c_str(), this);
681
731
  }
682
732
  StartNewCallLocked();
683
733
  }
684
734
  GRPC_ERROR_UNREF(error);
685
735
  }
686
736
 
737
+ //
738
+ // XdsClient::ChannelState::AdsCallState::AdsResponseParser
739
+ //
740
+
741
+ absl::Status XdsClient::ChannelState::AdsCallState::AdsResponseParser::
742
+ ProcessAdsResponseFields(AdsResponseFields fields) {
743
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
744
+ gpr_log(
745
+ GPR_INFO,
746
+ "[xds_client %p] xds server %s: received ADS response: type_url=%s, "
747
+ "version=%s, nonce=%s, num_resources=%" PRIuPTR,
748
+ ads_call_state_->xds_client(),
749
+ ads_call_state_->chand()->server_.server_uri.c_str(),
750
+ fields.type_url.c_str(), fields.version.c_str(), fields.nonce.c_str(),
751
+ fields.num_resources);
752
+ }
753
+ result_.type =
754
+ ads_call_state_->xds_client()->GetResourceTypeLocked(fields.type_url);
755
+ if (result_.type == nullptr) {
756
+ return absl::InvalidArgumentError(
757
+ absl::StrCat("unknown resource type ", fields.type_url));
758
+ }
759
+ result_.type_url = std::move(fields.type_url);
760
+ result_.version = std::move(fields.version);
761
+ result_.nonce = std::move(fields.nonce);
762
+ return absl::OkStatus();
763
+ }
764
+
765
+ namespace {
766
+
767
+ // Build a resource metadata struct for ADS result accepting methods and CSDS.
768
+ XdsApi::ResourceMetadata CreateResourceMetadataAcked(
769
+ std::string serialized_proto, std::string version,
770
+ grpc_millis update_time) {
771
+ XdsApi::ResourceMetadata resource_metadata;
772
+ resource_metadata.serialized_proto = std::move(serialized_proto);
773
+ resource_metadata.update_time = update_time;
774
+ resource_metadata.version = std::move(version);
775
+ resource_metadata.client_status = XdsApi::ResourceMetadata::ACKED;
776
+ return resource_metadata;
777
+ }
778
+
779
+ // Update resource_metadata for NACK.
780
+ void UpdateResourceMetadataNacked(const std::string& version,
781
+ const std::string& details,
782
+ grpc_millis update_time,
783
+ XdsApi::ResourceMetadata* resource_metadata) {
784
+ resource_metadata->client_status = XdsApi::ResourceMetadata::NACKED;
785
+ resource_metadata->failed_version = version;
786
+ resource_metadata->failed_details = details;
787
+ resource_metadata->failed_update_time = update_time;
788
+ }
789
+
790
+ } // namespace
791
+
792
+ void XdsClient::ChannelState::AdsCallState::AdsResponseParser::ParseResource(
793
+ const XdsEncodingContext& context, size_t idx, absl::string_view type_url,
794
+ absl::string_view serialized_resource) {
795
+ // Check the type_url of the resource.
796
+ bool is_v2 = false;
797
+ if (!result_.type->IsType(type_url, &is_v2)) {
798
+ result_.errors.emplace_back(
799
+ absl::StrCat("resource index ", idx, ": incorrect resource type ",
800
+ type_url, " (should be ", result_.type_url, ")"));
801
+ return;
802
+ }
803
+ // Parse the resource.
804
+ absl::StatusOr<XdsResourceType::DecodeResult> result =
805
+ result_.type->Decode(context, serialized_resource, is_v2);
806
+ if (!result.ok()) {
807
+ result_.errors.emplace_back(
808
+ absl::StrCat("resource index ", idx, ": ", result.status().ToString()));
809
+ return;
810
+ }
811
+ // Check the resource name.
812
+ auto resource_name =
813
+ XdsClient::ParseXdsResourceName(result->name, result_.type);
814
+ if (!resource_name.ok()) {
815
+ result_.errors.emplace_back(absl::StrCat(
816
+ "resource index ", idx, ": Cannot parse xDS resource name \"",
817
+ result->name, "\""));
818
+ return;
819
+ }
820
+ // Cancel resource-does-not-exist timer, if needed.
821
+ auto timer_it = ads_call_state_->state_map_.find(result_.type);
822
+ if (timer_it != ads_call_state_->state_map_.end()) {
823
+ auto it =
824
+ timer_it->second.subscribed_resources.find(resource_name->authority);
825
+ if (it != timer_it->second.subscribed_resources.end()) {
826
+ auto res_it = it->second.find(resource_name->key);
827
+ if (res_it != it->second.end()) {
828
+ res_it->second->MaybeCancelTimer();
829
+ }
830
+ }
831
+ }
832
+ // Lookup the authority in the cache.
833
+ auto authority_it =
834
+ xds_client()->authority_state_map_.find(resource_name->authority);
835
+ if (authority_it == xds_client()->authority_state_map_.end()) {
836
+ return; // Skip resource -- we don't have a subscription for it.
837
+ }
838
+ // Found authority, so look up type.
839
+ AuthorityState& authority_state = authority_it->second;
840
+ auto type_it = authority_state.resource_map.find(result_.type);
841
+ if (type_it == authority_state.resource_map.end()) {
842
+ return; // Skip resource -- we don't have a subscription for it.
843
+ }
844
+ auto& type_map = type_it->second;
845
+ // Found type, so look up resource key.
846
+ auto it = type_map.find(resource_name->key);
847
+ if (it == type_map.end()) {
848
+ return; // Skip resource -- we don't have a subscription for it.
849
+ }
850
+ ResourceState& resource_state = it->second;
851
+ // If needed, record that we've seen this resource.
852
+ if (result_.type->AllResourcesRequiredInSotW()) {
853
+ result_.resources_seen[resource_name->authority].insert(resource_name->key);
854
+ }
855
+ // Update resource state based on whether the resource is valid.
856
+ if (!result->resource.ok()) {
857
+ result_.errors.emplace_back(absl::StrCat(
858
+ "resource index ", idx, ": ", result->name,
859
+ ": validation error: ", result->resource.status().ToString()));
860
+ Notifier::ScheduleNotifyWatchersOnErrorInWorkSerializer(
861
+ xds_client(), resource_state.watchers,
862
+ grpc_error_set_int(
863
+ GRPC_ERROR_CREATE_FROM_CPP_STRING(absl::StrCat(
864
+ "invalid resource: ", result->resource.status().ToString())),
865
+ GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE),
866
+ DEBUG_LOCATION);
867
+ UpdateResourceMetadataNacked(result_.version,
868
+ result->resource.status().ToString(),
869
+ update_time_, &resource_state.meta);
870
+ return;
871
+ }
872
+ // Resource is valid.
873
+ result_.have_valid_resources = true;
874
+ // If it didn't change, ignore it.
875
+ if (resource_state.resource != nullptr &&
876
+ result_.type->ResourcesEqual(resource_state.resource.get(),
877
+ result->resource->get())) {
878
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
879
+ gpr_log(GPR_INFO,
880
+ "[xds_client %p] %s resource %s identical to current, ignoring.",
881
+ xds_client(), result_.type_url.c_str(), result->name.c_str());
882
+ }
883
+ return;
884
+ }
885
+ // Update the resource state.
886
+ resource_state.resource = std::move(*result->resource);
887
+ resource_state.meta = CreateResourceMetadataAcked(
888
+ std::string(serialized_resource), result_.version, update_time_);
889
+ // Notify watchers.
890
+ auto& watchers_list = resource_state.watchers;
891
+ auto* value =
892
+ result_.type->CopyResource(resource_state.resource.get()).release();
893
+ xds_client()->work_serializer_.Schedule(
894
+ [watchers_list, value]()
895
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&xds_client()->work_serializer_) {
896
+ for (const auto& p : watchers_list) {
897
+ p.first->OnGenericResourceChanged(value);
898
+ }
899
+ delete value;
900
+ },
901
+ DEBUG_LOCATION);
902
+ }
903
+
687
904
  //
688
905
  // XdsClient::ChannelState::AdsCallState
689
906
  //
@@ -700,13 +917,16 @@ XdsClient::ChannelState::AdsCallState::AdsCallState(
700
917
  // the polling entities from client_channel.
701
918
  GPR_ASSERT(xds_client() != nullptr);
702
919
  // Create a call with the specified method name.
703
- const auto& method =
920
+ const char* method =
704
921
  chand()->server_.ShouldUseV3()
705
- ? GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V3_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES
706
- : GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V2_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES;
922
+ ? "/envoy.service.discovery.v3.AggregatedDiscoveryService/"
923
+ "StreamAggregatedResources"
924
+ : "/envoy.service.discovery.v2.AggregatedDiscoveryService/"
925
+ "StreamAggregatedResources";
707
926
  call_ = grpc_channel_create_pollset_set_call(
708
927
  chand()->channel_, nullptr, GRPC_PROPAGATE_DEFAULTS,
709
- xds_client()->interested_parties_, method, nullptr,
928
+ xds_client()->interested_parties_,
929
+ StaticSlice::FromStaticString(method).c_slice(), nullptr,
710
930
  GRPC_MILLIS_INF_FUTURE, nullptr);
711
931
  GPR_ASSERT(call_ != nullptr);
712
932
  // Init data associated with the call.
@@ -715,9 +935,9 @@ XdsClient::ChannelState::AdsCallState::AdsCallState(
715
935
  // Start the call.
716
936
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
717
937
  gpr_log(GPR_INFO,
718
- "[xds_client %p] Starting ADS call (chand: %p, calld: %p, "
719
- "call: %p)",
720
- xds_client(), chand(), this, call_);
938
+ "[xds_client %p] xds server %s: starting ADS call "
939
+ "(calld: %p, call: %p)",
940
+ xds_client(), chand()->server_.server_uri.c_str(), this, call_);
721
941
  }
722
942
  // Create the ops.
723
943
  grpc_call_error call_error;
@@ -737,17 +957,17 @@ XdsClient::ChannelState::AdsCallState::AdsCallState(
737
957
  // Op: send request message.
738
958
  GRPC_CLOSURE_INIT(&on_request_sent_, OnRequestSent, this,
739
959
  grpc_schedule_on_exec_ctx);
740
- for (const auto& p : xds_client()->listener_map_) {
741
- SubscribeLocked(XdsApi::kLdsTypeUrl, std::string(p.first));
742
- }
743
- for (const auto& p : xds_client()->route_config_map_) {
744
- SubscribeLocked(XdsApi::kRdsTypeUrl, std::string(p.first));
745
- }
746
- for (const auto& p : xds_client()->cluster_map_) {
747
- SubscribeLocked(XdsApi::kCdsTypeUrl, std::string(p.first));
748
- }
749
- for (const auto& p : xds_client()->endpoint_map_) {
750
- SubscribeLocked(XdsApi::kEdsTypeUrl, std::string(p.first));
960
+ for (const auto& a : xds_client()->authority_state_map_) {
961
+ const std::string& authority = a.first;
962
+ // Skip authorities that are not using this xDS channel.
963
+ if (a.second.channel_state != chand()) continue;
964
+ for (const auto& t : a.second.resource_map) {
965
+ const XdsResourceType* type = t.first;
966
+ for (const auto& r : t.second) {
967
+ const XdsResourceKey& resource_key = r.first;
968
+ SubscribeLocked(type, {authority, resource_key});
969
+ }
970
+ }
751
971
  }
752
972
  // Op: recv initial metadata.
753
973
  op = ops;
@@ -811,34 +1031,30 @@ void XdsClient::ChannelState::AdsCallState::Orphan() {
811
1031
  }
812
1032
 
813
1033
  void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
814
- const std::string& type_url)
1034
+ const XdsResourceType* type)
815
1035
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_) {
816
1036
  // Buffer message sending if an existing message is in flight.
817
1037
  if (send_message_payload_ != nullptr) {
818
- buffered_requests_.insert(type_url);
1038
+ buffered_requests_.insert(type);
819
1039
  return;
820
1040
  }
821
- auto& state = state_map_[type_url];
1041
+ auto& state = state_map_[type];
822
1042
  grpc_slice request_payload_slice;
823
- std::set<absl::string_view> resource_names =
824
- ResourceNamesForRequest(type_url);
825
1043
  request_payload_slice = xds_client()->api_.CreateAdsRequest(
826
- chand()->server_, type_url, resource_names,
827
- xds_client()->resource_version_map_[type_url], state.nonce,
828
- GRPC_ERROR_REF(state.error), !sent_initial_message_);
829
- if (type_url != XdsApi::kLdsTypeUrl && type_url != XdsApi::kRdsTypeUrl &&
830
- type_url != XdsApi::kCdsTypeUrl && type_url != XdsApi::kEdsTypeUrl) {
831
- state_map_.erase(type_url);
832
- }
1044
+ chand()->server_,
1045
+ chand()->server_.ShouldUseV3() ? type->type_url() : type->v2_type_url(),
1046
+ chand()->resource_type_version_map_[type], state.nonce,
1047
+ ResourceNamesForRequest(type), GRPC_ERROR_REF(state.error),
1048
+ !sent_initial_message_);
833
1049
  sent_initial_message_ = true;
834
1050
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
835
1051
  gpr_log(GPR_INFO,
836
- "[xds_client %p] sending ADS request: type=%s version=%s nonce=%s "
837
- "error=%s resources=%s",
838
- xds_client(), type_url.c_str(),
839
- xds_client()->resource_version_map_[type_url].c_str(),
840
- state.nonce.c_str(), grpc_error_std_string(state.error).c_str(),
841
- absl::StrJoin(resource_names, " ").c_str());
1052
+ "[xds_client %p] xds server %s: sending ADS request: type=%s "
1053
+ "version=%s nonce=%s error=%s",
1054
+ xds_client(), chand()->server_.server_uri.c_str(),
1055
+ std::string(type->type_url()).c_str(),
1056
+ chand()->resource_type_version_map_[type].c_str(),
1057
+ state.nonce.c_str(), grpc_error_std_string(state.error).c_str());
842
1058
  }
843
1059
  GRPC_ERROR_UNREF(state.error);
844
1060
  state.error = GRPC_ERROR_NONE;
@@ -858,27 +1074,33 @@ void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
858
1074
  grpc_call_start_batch_and_execute(call_, &op, 1, &on_request_sent_);
859
1075
  if (GPR_UNLIKELY(call_error != GRPC_CALL_OK)) {
860
1076
  gpr_log(GPR_ERROR,
861
- "[xds_client %p] calld=%p call_error=%d sending ADS message",
862
- xds_client(), this, call_error);
1077
+ "[xds_client %p] xds server %s: error starting ADS send_message "
1078
+ "batch on calld=%p: call_error=%d",
1079
+ xds_client(), chand()->server_.server_uri.c_str(), this,
1080
+ call_error);
863
1081
  GPR_ASSERT(GRPC_CALL_OK == call_error);
864
1082
  }
865
1083
  }
866
1084
 
867
1085
  void XdsClient::ChannelState::AdsCallState::SubscribeLocked(
868
- const std::string& type_url, const std::string& name) {
869
- auto& state = state_map_[type_url].subscribed_resources[name];
1086
+ const XdsResourceType* type, const XdsResourceName& name) {
1087
+ auto& state = state_map_[type].subscribed_resources[name.authority][name.key];
870
1088
  if (state == nullptr) {
871
- state = MakeOrphanable<ResourceState>(
872
- type_url, name, !xds_client()->resource_version_map_[type_url].empty());
873
- SendMessageLocked(type_url);
1089
+ state = MakeOrphanable<ResourceTimer>(type, name);
1090
+ SendMessageLocked(type);
874
1091
  }
875
1092
  }
876
1093
 
877
1094
  void XdsClient::ChannelState::AdsCallState::UnsubscribeLocked(
878
- const std::string& type_url, const std::string& name,
1095
+ const XdsResourceType* type, const XdsResourceName& name,
879
1096
  bool delay_unsubscription) {
880
- state_map_[type_url].subscribed_resources.erase(name);
881
- if (!delay_unsubscription) SendMessageLocked(type_url);
1097
+ auto& type_state_map = state_map_[type];
1098
+ auto& authority_map = type_state_map.subscribed_resources[name.authority];
1099
+ authority_map.erase(name.key);
1100
+ if (authority_map.empty()) {
1101
+ type_state_map.subscribed_resources.erase(name.authority);
1102
+ }
1103
+ if (!delay_unsubscription) SendMessageLocked(type);
882
1104
  }
883
1105
 
884
1106
  bool XdsClient::ChannelState::AdsCallState::HasSubscribedResources() const {
@@ -888,343 +1110,6 @@ bool XdsClient::ChannelState::AdsCallState::HasSubscribedResources() const {
888
1110
  return false;
889
1111
  }
890
1112
 
891
- namespace {
892
-
893
- // Build a resource metadata struct for ADS result accepting methods and CSDS.
894
- XdsApi::ResourceMetadata CreateResourceMetadataAcked(
895
- std::string serialized_proto, std::string version,
896
- grpc_millis update_time) {
897
- XdsApi::ResourceMetadata resource_metadata;
898
- resource_metadata.serialized_proto = std::move(serialized_proto);
899
- resource_metadata.update_time = update_time;
900
- resource_metadata.version = std::move(version);
901
- resource_metadata.client_status = XdsApi::ResourceMetadata::ACKED;
902
- return resource_metadata;
903
- }
904
-
905
- } // namespace
906
-
907
- void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdateLocked(
908
- std::string version, grpc_millis update_time,
909
- XdsApi::LdsUpdateMap lds_update_map,
910
- const std::set<std::string>& resource_names_failed) {
911
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
912
- gpr_log(GPR_INFO,
913
- "[xds_client %p] LDS update received containing %" PRIuPTR
914
- " resources",
915
- xds_client(), lds_update_map.size());
916
- }
917
- auto& lds_state = state_map_[XdsApi::kLdsTypeUrl];
918
- std::set<std::string> rds_resource_names_seen;
919
- for (auto& p : lds_update_map) {
920
- const std::string& listener_name = p.first;
921
- XdsApi::LdsUpdate& lds_update = p.second.resource;
922
- auto& state = lds_state.subscribed_resources[listener_name];
923
- if (state != nullptr) state->Finish();
924
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
925
- gpr_log(GPR_INFO, "[xds_client %p] LDS resource %s: %s", xds_client(),
926
- listener_name.c_str(), lds_update.ToString().c_str());
927
- }
928
- // Record the RDS resource names seen.
929
- if (!lds_update.http_connection_manager.route_config_name.empty()) {
930
- rds_resource_names_seen.insert(
931
- lds_update.http_connection_manager.route_config_name);
932
- }
933
- // Ignore identical update.
934
- ListenerState& listener_state = xds_client()->listener_map_[listener_name];
935
- if (listener_state.update.has_value() &&
936
- *listener_state.update == lds_update) {
937
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
938
- gpr_log(GPR_INFO,
939
- "[xds_client %p] LDS update for %s identical to current, "
940
- "ignoring.",
941
- xds_client(), listener_name.c_str());
942
- }
943
- continue;
944
- }
945
- // Update the listener state.
946
- listener_state.update = std::move(lds_update);
947
- listener_state.meta = CreateResourceMetadataAcked(
948
- std::move(p.second.serialized_proto), version, update_time);
949
- // Notify watchers.
950
- for (const auto& p : listener_state.watchers) {
951
- p.first->OnListenerChanged(*listener_state.update);
952
- }
953
- }
954
- // For invalid resources in the update, if they are already in the
955
- // cache, pretend that they are present in the update, so that we
956
- // don't incorrectly consider them deleted below.
957
- for (const std::string& listener_name : resource_names_failed) {
958
- auto it = xds_client()->listener_map_.find(listener_name);
959
- if (it != xds_client()->listener_map_.end()) {
960
- auto& resource = it->second.update;
961
- if (!resource.has_value()) continue;
962
- lds_update_map[listener_name];
963
- if (!resource->http_connection_manager.route_config_name.empty()) {
964
- rds_resource_names_seen.insert(
965
- resource->http_connection_manager.route_config_name);
966
- }
967
- }
968
- }
969
- // For any subscribed resource that is not present in the update,
970
- // remove it from the cache and notify watchers that it does not exist.
971
- for (const auto& p : lds_state.subscribed_resources) {
972
- const std::string& listener_name = p.first;
973
- if (lds_update_map.find(listener_name) == lds_update_map.end()) {
974
- ListenerState& listener_state =
975
- xds_client()->listener_map_[listener_name];
976
- // If the resource was newly requested but has not yet been received,
977
- // we don't want to generate an error for the watchers, because this LDS
978
- // response may be in reaction to an earlier request that did not yet
979
- // request the new resource, so its absence from the response does not
980
- // necessarily indicate that the resource does not exist.
981
- // For that case, we rely on the request timeout instead.
982
- if (!listener_state.update.has_value()) continue;
983
- listener_state.update.reset();
984
- for (const auto& p : listener_state.watchers) {
985
- p.first->OnResourceDoesNotExist();
986
- }
987
- }
988
- }
989
- // For any RDS resource that is no longer referred to by any LDS
990
- // resources, remove it from the cache and notify watchers that it
991
- // does not exist.
992
- auto& rds_state = state_map_[XdsApi::kRdsTypeUrl];
993
- for (const auto& p : rds_state.subscribed_resources) {
994
- const std::string& rds_resource_name = p.first;
995
- if (rds_resource_names_seen.find(rds_resource_name) ==
996
- rds_resource_names_seen.end()) {
997
- RouteConfigState& route_config_state =
998
- xds_client()->route_config_map_[rds_resource_name];
999
- route_config_state.update.reset();
1000
- for (const auto& p : route_config_state.watchers) {
1001
- p.first->OnResourceDoesNotExist();
1002
- }
1003
- }
1004
- }
1005
- }
1006
-
1007
- void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdateLocked(
1008
- std::string version, grpc_millis update_time,
1009
- XdsApi::RdsUpdateMap rds_update_map) {
1010
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1011
- gpr_log(GPR_INFO,
1012
- "[xds_client %p] RDS update received containing %" PRIuPTR
1013
- " resources",
1014
- xds_client(), rds_update_map.size());
1015
- }
1016
- auto& rds_state = state_map_[XdsApi::kRdsTypeUrl];
1017
- for (auto& p : rds_update_map) {
1018
- const std::string& route_config_name = p.first;
1019
- XdsApi::RdsUpdate& rds_update = p.second.resource;
1020
- auto& state = rds_state.subscribed_resources[route_config_name];
1021
- if (state != nullptr) state->Finish();
1022
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1023
- gpr_log(GPR_INFO, "[xds_client %p] RDS resource:\n%s", xds_client(),
1024
- rds_update.ToString().c_str());
1025
- }
1026
- RouteConfigState& route_config_state =
1027
- xds_client()->route_config_map_[route_config_name];
1028
- // Ignore identical update.
1029
- if (route_config_state.update.has_value() &&
1030
- *route_config_state.update == rds_update) {
1031
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1032
- gpr_log(GPR_INFO,
1033
- "[xds_client %p] RDS resource identical to current, ignoring",
1034
- xds_client());
1035
- }
1036
- continue;
1037
- }
1038
- // Update the cache.
1039
- route_config_state.update = std::move(rds_update);
1040
- route_config_state.meta = CreateResourceMetadataAcked(
1041
- std::move(p.second.serialized_proto), version, update_time);
1042
- // Notify all watchers.
1043
- for (const auto& p : route_config_state.watchers) {
1044
- p.first->OnRouteConfigChanged(*route_config_state.update);
1045
- }
1046
- }
1047
- }
1048
-
1049
- void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdateLocked(
1050
- std::string version, grpc_millis update_time,
1051
- XdsApi::CdsUpdateMap cds_update_map,
1052
- const std::set<std::string>& resource_names_failed) {
1053
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1054
- gpr_log(GPR_INFO,
1055
- "[xds_client %p] CDS update received containing %" PRIuPTR
1056
- " resources",
1057
- xds_client(), cds_update_map.size());
1058
- }
1059
- auto& cds_state = state_map_[XdsApi::kCdsTypeUrl];
1060
- std::set<std::string> eds_resource_names_seen;
1061
- for (auto& p : cds_update_map) {
1062
- const char* cluster_name = p.first.c_str();
1063
- XdsApi::CdsUpdate& cds_update = p.second.resource;
1064
- auto& state = cds_state.subscribed_resources[cluster_name];
1065
- if (state != nullptr) state->Finish();
1066
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1067
- gpr_log(GPR_INFO, "[xds_client %p] cluster=%s: %s", xds_client(),
1068
- cluster_name, cds_update.ToString().c_str());
1069
- }
1070
- // Record the EDS resource names seen.
1071
- eds_resource_names_seen.insert(cds_update.eds_service_name.empty()
1072
- ? cluster_name
1073
- : cds_update.eds_service_name);
1074
- // Ignore identical update.
1075
- ClusterState& cluster_state = xds_client()->cluster_map_[cluster_name];
1076
- if (cluster_state.update.has_value() &&
1077
- *cluster_state.update == cds_update) {
1078
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1079
- gpr_log(GPR_INFO,
1080
- "[xds_client %p] CDS update identical to current, ignoring.",
1081
- xds_client());
1082
- }
1083
- continue;
1084
- }
1085
- // Update the cluster state.
1086
- cluster_state.update = std::move(cds_update);
1087
- cluster_state.meta = CreateResourceMetadataAcked(
1088
- std::move(p.second.serialized_proto), version, update_time);
1089
- // Notify all watchers.
1090
- for (const auto& p : cluster_state.watchers) {
1091
- p.first->OnClusterChanged(cluster_state.update.value());
1092
- }
1093
- }
1094
- // For invalid resources in the update, if they are already in the
1095
- // cache, pretend that they are present in the update, so that we
1096
- // don't incorrectly consider them deleted below.
1097
- for (const std::string& cluster_name : resource_names_failed) {
1098
- auto it = xds_client()->cluster_map_.find(cluster_name);
1099
- if (it != xds_client()->cluster_map_.end()) {
1100
- auto& resource = it->second.update;
1101
- if (!resource.has_value()) continue;
1102
- cds_update_map[cluster_name];
1103
- eds_resource_names_seen.insert(resource->eds_service_name.empty()
1104
- ? cluster_name
1105
- : resource->eds_service_name);
1106
- }
1107
- }
1108
- // For any subscribed resource that is not present in the update,
1109
- // remove it from the cache and notify watchers that it does not exist.
1110
- for (const auto& p : cds_state.subscribed_resources) {
1111
- const std::string& cluster_name = p.first;
1112
- if (cds_update_map.find(cluster_name) == cds_update_map.end()) {
1113
- ClusterState& cluster_state = xds_client()->cluster_map_[cluster_name];
1114
- // If the resource was newly requested but has not yet been received,
1115
- // we don't want to generate an error for the watchers, because this CDS
1116
- // response may be in reaction to an earlier request that did not yet
1117
- // request the new resource, so its absence from the response does not
1118
- // necessarily indicate that the resource does not exist.
1119
- // For that case, we rely on the request timeout instead.
1120
- if (!cluster_state.update.has_value()) continue;
1121
- cluster_state.update.reset();
1122
- for (const auto& p : cluster_state.watchers) {
1123
- p.first->OnResourceDoesNotExist();
1124
- }
1125
- }
1126
- }
1127
- // For any EDS resource that is no longer referred to by any CDS
1128
- // resources, remove it from the cache and notify watchers that it
1129
- // does not exist.
1130
- auto& eds_state = state_map_[XdsApi::kEdsTypeUrl];
1131
- for (const auto& p : eds_state.subscribed_resources) {
1132
- const std::string& eds_resource_name = p.first;
1133
- if (eds_resource_names_seen.find(eds_resource_name) ==
1134
- eds_resource_names_seen.end()) {
1135
- EndpointState& endpoint_state =
1136
- xds_client()->endpoint_map_[eds_resource_name];
1137
- endpoint_state.update.reset();
1138
- for (const auto& p : endpoint_state.watchers) {
1139
- p.first->OnResourceDoesNotExist();
1140
- }
1141
- }
1142
- }
1143
- }
1144
-
1145
- void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdateLocked(
1146
- std::string version, grpc_millis update_time,
1147
- XdsApi::EdsUpdateMap eds_update_map) {
1148
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1149
- gpr_log(GPR_INFO,
1150
- "[xds_client %p] EDS update received containing %" PRIuPTR
1151
- " resources",
1152
- xds_client(), eds_update_map.size());
1153
- }
1154
- auto& eds_state = state_map_[XdsApi::kEdsTypeUrl];
1155
- for (auto& p : eds_update_map) {
1156
- const char* eds_service_name = p.first.c_str();
1157
- XdsApi::EdsUpdate& eds_update = p.second.resource;
1158
- auto& state = eds_state.subscribed_resources[eds_service_name];
1159
- if (state != nullptr) state->Finish();
1160
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1161
- gpr_log(GPR_INFO, "[xds_client %p] EDS resource %s: %s", xds_client(),
1162
- eds_service_name, eds_update.ToString().c_str());
1163
- }
1164
- EndpointState& endpoint_state =
1165
- xds_client()->endpoint_map_[eds_service_name];
1166
- // Ignore identical update.
1167
- if (endpoint_state.update.has_value() &&
1168
- *endpoint_state.update == eds_update) {
1169
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1170
- gpr_log(GPR_INFO,
1171
- "[xds_client %p] EDS update identical to current, ignoring.",
1172
- xds_client());
1173
- }
1174
- continue;
1175
- }
1176
- // Update the cluster state.
1177
- endpoint_state.update = std::move(eds_update);
1178
- endpoint_state.meta = CreateResourceMetadataAcked(
1179
- std::move(p.second.serialized_proto), version, update_time);
1180
- // Notify all watchers.
1181
- for (const auto& p : endpoint_state.watchers) {
1182
- p.first->OnEndpointChanged(endpoint_state.update.value());
1183
- }
1184
- }
1185
- }
1186
-
1187
- namespace {
1188
-
1189
- // Update resource_metadata for NACK.
1190
- void UpdateResourceMetadataNacked(const std::string& version,
1191
- const std::string& details,
1192
- grpc_millis update_time,
1193
- XdsApi::ResourceMetadata* resource_metadata) {
1194
- resource_metadata->client_status = XdsApi::ResourceMetadata::NACKED;
1195
- resource_metadata->failed_version = version;
1196
- resource_metadata->failed_details = details;
1197
- resource_metadata->failed_update_time = update_time;
1198
- }
1199
-
1200
- } // namespace
1201
-
1202
- template <typename StateMap>
1203
- void XdsClient::ChannelState::AdsCallState::RejectAdsUpdateLocked(
1204
- grpc_millis update_time, const XdsApi::AdsParseResult& result,
1205
- StateMap* state_map) {
1206
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1207
- gpr_log(GPR_INFO,
1208
- "[xds_client %p] %s update NACKed containing %" PRIuPTR
1209
- " invalid resources",
1210
- xds_client(), result.type_url.c_str(),
1211
- result.resource_names_failed.size());
1212
- }
1213
- std::string details = grpc_error_std_string(result.parse_error);
1214
- for (auto& name : result.resource_names_failed) {
1215
- auto it = state_map->find(name);
1216
- if (it == state_map->end()) continue;
1217
- auto& state = it->second;
1218
- // Notify watchers of error.
1219
- for (const auto& p : state.watchers) {
1220
- p.first->OnError(GRPC_ERROR_REF(result.parse_error));
1221
- }
1222
- // Update resource metadata for CSDS.
1223
- UpdateResourceMetadataNacked(result.version, details, update_time,
1224
- &state.meta);
1225
- }
1226
- }
1227
-
1228
1113
  void XdsClient::ChannelState::AdsCallState::OnRequestSent(
1229
1114
  void* arg, grpc_error_handle error) {
1230
1115
  AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
@@ -1267,6 +1152,7 @@ void XdsClient::ChannelState::AdsCallState::OnResponseReceived(
1267
1152
  MutexLock lock(&ads_calld->xds_client()->mu_);
1268
1153
  done = ads_calld->OnResponseReceivedLocked();
1269
1154
  }
1155
+ ads_calld->xds_client()->work_serializer_.DrainQueue();
1270
1156
  if (done) ads_calld->Unref(DEBUG_LOCATION, "ADS+OnResponseReceivedLocked");
1271
1157
  }
1272
1158
 
@@ -1283,74 +1169,75 @@ bool XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
1283
1169
  grpc_byte_buffer_destroy(recv_message_payload_);
1284
1170
  recv_message_payload_ = nullptr;
1285
1171
  // Parse and validate the response.
1286
- XdsApi::AdsParseResult result = xds_client()->api_.ParseAdsResponse(
1287
- chand()->server_, response_slice,
1288
- ResourceNamesForRequest(XdsApi::kLdsTypeUrl),
1289
- ResourceNamesForRequest(XdsApi::kRdsTypeUrl),
1290
- ResourceNamesForRequest(XdsApi::kCdsTypeUrl),
1291
- ResourceNamesForRequest(XdsApi::kEdsTypeUrl));
1172
+ AdsResponseParser parser(this);
1173
+ absl::Status status = xds_client()->api_.ParseAdsResponse(
1174
+ chand()->server_, response_slice, &parser);
1292
1175
  grpc_slice_unref_internal(response_slice);
1293
- if (result.type_url.empty()) {
1176
+ if (!status.ok()) {
1294
1177
  // Ignore unparsable response.
1295
1178
  gpr_log(GPR_ERROR,
1296
- "[xds_client %p] Error parsing ADS response (%s) -- ignoring",
1297
- xds_client(), grpc_error_std_string(result.parse_error).c_str());
1298
- GRPC_ERROR_UNREF(result.parse_error);
1179
+ "[xds_client %p] xds server %s: error parsing ADS response (%s) "
1180
+ "-- ignoring",
1181
+ xds_client(), chand()->server_.server_uri.c_str(),
1182
+ status.ToString().c_str());
1299
1183
  } else {
1300
- grpc_millis update_time = grpc_core::ExecCtx::Get()->Now();
1184
+ AdsResponseParser::Result result = parser.TakeResult();
1301
1185
  // Update nonce.
1302
- auto& state = state_map_[result.type_url];
1303
- state.nonce = std::move(result.nonce);
1304
- // If we got an error, we'll NACK the update.
1305
- if (result.parse_error != GRPC_ERROR_NONE) {
1306
- gpr_log(GPR_ERROR,
1307
- "[xds_client %p] ADS response invalid for resource type %s "
1308
- "version %s, will NACK: nonce=%s error=%s",
1309
- xds_client(), result.type_url.c_str(), result.version.c_str(),
1310
- state.nonce.c_str(),
1311
- grpc_error_std_string(result.parse_error).c_str());
1312
- result.parse_error =
1313
- grpc_error_set_int(result.parse_error, GRPC_ERROR_INT_GRPC_STATUS,
1314
- GRPC_STATUS_UNAVAILABLE);
1186
+ auto& state = state_map_[result.type];
1187
+ state.nonce = result.nonce;
1188
+ // If we got an error, set state.error so that we'll NACK the update.
1189
+ if (!result.errors.empty()) {
1190
+ std::string error = absl::StrJoin(result.errors, "; ");
1191
+ gpr_log(
1192
+ GPR_ERROR,
1193
+ "[xds_client %p] xds server %s: ADS response invalid for resource "
1194
+ "type %s version %s, will NACK: nonce=%s error=%s",
1195
+ xds_client(), chand()->server_.server_uri.c_str(),
1196
+ result.type_url.c_str(), result.version.c_str(), state.nonce.c_str(),
1197
+ error.c_str());
1315
1198
  GRPC_ERROR_UNREF(state.error);
1316
- state.error = result.parse_error;
1317
- if (result.type_url == XdsApi::kLdsTypeUrl) {
1318
- RejectAdsUpdateLocked(update_time, result,
1319
- &xds_client()->listener_map_);
1320
- } else if (result.type_url == XdsApi::kRdsTypeUrl) {
1321
- RejectAdsUpdateLocked(update_time, result,
1322
- &xds_client()->route_config_map_);
1323
- } else if (result.type_url == XdsApi::kCdsTypeUrl) {
1324
- RejectAdsUpdateLocked(update_time, result, &xds_client()->cluster_map_);
1325
- } else if (result.type_url == XdsApi::kEdsTypeUrl) {
1326
- RejectAdsUpdateLocked(update_time, result,
1327
- &xds_client()->endpoint_map_);
1199
+ state.error = grpc_error_set_int(
1200
+ GRPC_ERROR_CREATE_FROM_CPP_STRING(std::move(error)),
1201
+ GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
1202
+ }
1203
+ // Delete resources not seen in update if needed.
1204
+ if (result.type->AllResourcesRequiredInSotW()) {
1205
+ for (auto& a : xds_client()->authority_state_map_) {
1206
+ const std::string& authority = a.first;
1207
+ AuthorityState& authority_state = a.second;
1208
+ // Skip authorities that are not using this xDS channel.
1209
+ if (authority_state.channel_state != chand()) continue;
1210
+ auto seen_authority_it = result.resources_seen.find(authority);
1211
+ // Find this resource type.
1212
+ auto type_it = authority_state.resource_map.find(result.type);
1213
+ if (type_it == authority_state.resource_map.end()) continue;
1214
+ // Iterate over resource ids.
1215
+ for (auto& r : type_it->second) {
1216
+ const XdsResourceKey& resource_key = r.first;
1217
+ ResourceState& resource_state = r.second;
1218
+ if (seen_authority_it == result.resources_seen.end() ||
1219
+ seen_authority_it->second.find(resource_key) ==
1220
+ seen_authority_it->second.end()) {
1221
+ // If the resource was newly requested but has not yet been
1222
+ // received, we don't want to generate an error for the watchers,
1223
+ // because this ADS response may be in reaction to an earlier
1224
+ // request that did not yet request the new resource, so its absence
1225
+ // from the response does not necessarily indicate that the resource
1226
+ // does not exist. For that case, we rely on the request timeout
1227
+ // instead.
1228
+ if (resource_state.resource == nullptr) continue;
1229
+ resource_state.resource.reset();
1230
+ Notifier::
1231
+ ScheduleNotifyWatchersOnResourceDoesNotExistInWorkSerializer(
1232
+ xds_client(), resource_state.watchers, DEBUG_LOCATION);
1233
+ }
1234
+ }
1328
1235
  }
1329
1236
  }
1330
- // Process any valid resources.
1331
- bool have_valid_resources = false;
1332
- if (result.type_url == XdsApi::kLdsTypeUrl) {
1333
- have_valid_resources = !result.lds_update_map.empty();
1334
- AcceptLdsUpdateLocked(result.version, update_time,
1335
- std::move(result.lds_update_map),
1336
- result.resource_names_failed);
1337
- } else if (result.type_url == XdsApi::kRdsTypeUrl) {
1338
- have_valid_resources = !result.rds_update_map.empty();
1339
- AcceptRdsUpdateLocked(result.version, update_time,
1340
- std::move(result.rds_update_map));
1341
- } else if (result.type_url == XdsApi::kCdsTypeUrl) {
1342
- have_valid_resources = !result.cds_update_map.empty();
1343
- AcceptCdsUpdateLocked(result.version, update_time,
1344
- std::move(result.cds_update_map),
1345
- result.resource_names_failed);
1346
- } else if (result.type_url == XdsApi::kEdsTypeUrl) {
1347
- have_valid_resources = !result.eds_update_map.empty();
1348
- AcceptEdsUpdateLocked(result.version, update_time,
1349
- std::move(result.eds_update_map));
1350
- }
1351
- if (have_valid_resources) {
1237
+ // If we had valid resources, update the version.
1238
+ if (result.have_valid_resources) {
1352
1239
  seen_response_ = true;
1353
- xds_client()->resource_version_map_[result.type_url] =
1240
+ chand()->resource_type_version_map_[result.type] =
1354
1241
  std::move(result.version);
1355
1242
  // Start load reporting if needed.
1356
1243
  auto& lrs_call = chand()->lrs_calld_;
@@ -1360,7 +1247,7 @@ bool XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
1360
1247
  }
1361
1248
  }
1362
1249
  // Send ACK or NACK.
1363
- SendMessageLocked(result.type_url);
1250
+ SendMessageLocked(result.type);
1364
1251
  }
1365
1252
  if (xds_client()->shutting_down_) return true;
1366
1253
  // Keep listening for updates.
@@ -1385,6 +1272,7 @@ void XdsClient::ChannelState::AdsCallState::OnStatusReceived(
1385
1272
  MutexLock lock(&ads_calld->xds_client()->mu_);
1386
1273
  ads_calld->OnStatusReceivedLocked(GRPC_ERROR_REF(error));
1387
1274
  }
1275
+ ads_calld->xds_client()->work_serializer_.DrainQueue();
1388
1276
  ads_calld->Unref(DEBUG_LOCATION, "ADS+OnStatusReceivedLocked");
1389
1277
  }
1390
1278
 
@@ -1393,9 +1281,11 @@ void XdsClient::ChannelState::AdsCallState::OnStatusReceivedLocked(
1393
1281
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1394
1282
  char* status_details = grpc_slice_to_c_string(status_details_);
1395
1283
  gpr_log(GPR_INFO,
1396
- "[xds_client %p] ADS call status received. Status = %d, details "
1397
- "= '%s', (chand: %p, ads_calld: %p, call: %p), error '%s'",
1398
- xds_client(), status_code_, status_details, chand(), this, call_,
1284
+ "[xds_client %p] xds server %s: ADS call status received "
1285
+ "(chand=%p, ads_calld=%p, call=%p): "
1286
+ "status=%d, details='%s', error='%s'",
1287
+ xds_client(), chand()->server_.server_uri.c_str(), chand(), this,
1288
+ call_, status_code_, status_details,
1399
1289
  grpc_error_std_string(error).c_str());
1400
1290
  gpr_free(status_details);
1401
1291
  }
@@ -1417,16 +1307,21 @@ bool XdsClient::ChannelState::AdsCallState::IsCurrentCallOnChannel() const {
1417
1307
  return this == chand()->ads_calld_->calld();
1418
1308
  }
1419
1309
 
1420
- std::set<absl::string_view>
1310
+ std::vector<std::string>
1421
1311
  XdsClient::ChannelState::AdsCallState::ResourceNamesForRequest(
1422
- const std::string& type_url) {
1423
- std::set<absl::string_view> resource_names;
1424
- auto it = state_map_.find(type_url);
1312
+ const XdsResourceType* type) {
1313
+ std::vector<std::string> resource_names;
1314
+ auto it = state_map_.find(type);
1425
1315
  if (it != state_map_.end()) {
1426
- for (auto& p : it->second.subscribed_resources) {
1427
- resource_names.insert(p.first);
1428
- OrphanablePtr<ResourceState>& state = p.second;
1429
- state->Start(Ref(DEBUG_LOCATION, "ResourceState"));
1316
+ for (auto& a : it->second.subscribed_resources) {
1317
+ const std::string& authority = a.first;
1318
+ for (auto& p : a.second) {
1319
+ const XdsResourceKey& resource_key = p.first;
1320
+ resource_names.emplace_back(XdsClient::ConstructFullXdsResourceName(
1321
+ authority, type->type_url(), resource_key));
1322
+ OrphanablePtr<ResourceTimer>& resource_timer = p.second;
1323
+ resource_timer->MaybeStartTimer(Ref(DEBUG_LOCATION, "ResourceTimer"));
1324
+ }
1430
1325
  }
1431
1326
  }
1432
1327
  return resource_names;
@@ -1519,8 +1414,10 @@ bool XdsClient::ChannelState::LrsCallState::Reporter::SendReportLocked() {
1519
1414
  parent_->call_, &op, 1, &on_report_done_);
1520
1415
  if (GPR_UNLIKELY(call_error != GRPC_CALL_OK)) {
1521
1416
  gpr_log(GPR_ERROR,
1522
- "[xds_client %p] calld=%p call_error=%d sending client load report",
1523
- xds_client(), this, call_error);
1417
+ "[xds_client %p] xds server %s: error starting LRS send_message "
1418
+ "batch on calld=%p: call_error=%d",
1419
+ xds_client(), parent_->chand()->server_.server_uri.c_str(), this,
1420
+ call_error);
1524
1421
  GPR_ASSERT(GRPC_CALL_OK == call_error);
1525
1422
  }
1526
1423
  return false;
@@ -1575,13 +1472,14 @@ XdsClient::ChannelState::LrsCallState::LrsCallState(
1575
1472
  // activity in xds_client()->interested_parties_, which is comprised of
1576
1473
  // the polling entities from client_channel.
1577
1474
  GPR_ASSERT(xds_client() != nullptr);
1578
- const auto& method =
1475
+ const char* method =
1579
1476
  chand()->server_.ShouldUseV3()
1580
- ? GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V3_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS
1581
- : GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V2_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS;
1477
+ ? "/envoy.service.load_stats.v3.LoadReportingService/StreamLoadStats"
1478
+ : "/envoy.service.load_stats.v2.LoadReportingService/StreamLoadStats";
1582
1479
  call_ = grpc_channel_create_pollset_set_call(
1583
1480
  chand()->channel_, nullptr, GRPC_PROPAGATE_DEFAULTS,
1584
- xds_client()->interested_parties_, method, nullptr,
1481
+ xds_client()->interested_parties_,
1482
+ StaticSlice::FromStaticString(method).c_slice(), nullptr,
1585
1483
  GRPC_MILLIS_INF_FUTURE, nullptr);
1586
1484
  GPR_ASSERT(call_ != nullptr);
1587
1485
  // Init the request payload.
@@ -1595,10 +1493,10 @@ XdsClient::ChannelState::LrsCallState::LrsCallState(
1595
1493
  grpc_metadata_array_init(&trailing_metadata_recv_);
1596
1494
  // Start the call.
1597
1495
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1598
- gpr_log(GPR_INFO,
1599
- "[xds_client %p] Starting LRS call (chand: %p, calld: %p, "
1600
- "call: %p)",
1601
- xds_client(), chand(), this, call_);
1496
+ gpr_log(
1497
+ GPR_INFO,
1498
+ "[xds_client %p] xds server %s: starting LRS call (calld=%p, call=%p)",
1499
+ xds_client(), chand()->server_.server_uri.c_str(), this, call_);
1602
1500
  }
1603
1501
  // Create the ops.
1604
1502
  grpc_call_error call_error;
@@ -1758,8 +1656,9 @@ bool XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked() {
1758
1656
  &new_load_reporting_interval);
1759
1657
  if (parse_error != GRPC_ERROR_NONE) {
1760
1658
  gpr_log(GPR_ERROR,
1761
- "[xds_client %p] LRS response parsing failed. error=%s",
1762
- xds_client(), grpc_error_std_string(parse_error).c_str());
1659
+ "[xds_client %p] xds server %s: LRS response parsing failed: %s",
1660
+ xds_client(), chand()->server_.server_uri.c_str(),
1661
+ grpc_error_std_string(parse_error).c_str());
1763
1662
  GRPC_ERROR_UNREF(parse_error);
1764
1663
  return;
1765
1664
  }
@@ -1767,10 +1666,11 @@ bool XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked() {
1767
1666
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1768
1667
  gpr_log(
1769
1668
  GPR_INFO,
1770
- "[xds_client %p] LRS response received, %" PRIuPTR
1669
+ "[xds_client %p] xds server %s: LRS response received, %" PRIuPTR
1771
1670
  " cluster names, send_all_clusters=%d, load_report_interval=%" PRId64
1772
1671
  "ms",
1773
- xds_client(), new_cluster_names.size(), send_all_clusters,
1672
+ xds_client(), chand()->server_.server_uri.c_str(),
1673
+ new_cluster_names.size(), send_all_clusters,
1774
1674
  new_load_reporting_interval);
1775
1675
  size_t i = 0;
1776
1676
  for (const auto& name : new_cluster_names) {
@@ -1784,9 +1684,10 @@ bool XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked() {
1784
1684
  GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS;
1785
1685
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1786
1686
  gpr_log(GPR_INFO,
1787
- "[xds_client %p] Increased load_report_interval to minimum "
1788
- "value %dms",
1789
- xds_client(), GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS);
1687
+ "[xds_client %p] xds server %s: increased load_report_interval "
1688
+ "to minimum value %dms",
1689
+ xds_client(), chand()->server_.server_uri.c_str(),
1690
+ GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS);
1790
1691
  }
1791
1692
  }
1792
1693
  // Ignore identical update.
@@ -1794,10 +1695,11 @@ bool XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked() {
1794
1695
  cluster_names_ == new_cluster_names &&
1795
1696
  load_reporting_interval_ == new_load_reporting_interval) {
1796
1697
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1797
- gpr_log(GPR_INFO,
1798
- "[xds_client %p] Incoming LRS response identical to current, "
1799
- "ignoring.",
1800
- xds_client());
1698
+ gpr_log(
1699
+ GPR_INFO,
1700
+ "[xds_client %p] xds server %s: incoming LRS response identical "
1701
+ "to current, ignoring.",
1702
+ xds_client(), chand()->server_.server_uri.c_str());
1801
1703
  }
1802
1704
  return;
1803
1705
  }
@@ -1843,9 +1745,11 @@ void XdsClient::ChannelState::LrsCallState::OnStatusReceivedLocked(
1843
1745
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1844
1746
  char* status_details = grpc_slice_to_c_string(status_details_);
1845
1747
  gpr_log(GPR_INFO,
1846
- "[xds_client %p] LRS call status received. Status = %d, details "
1847
- "= '%s', (chand: %p, calld: %p, call: %p), error '%s'",
1848
- xds_client(), status_code_, status_details, chand(), this, call_,
1748
+ "[xds_client %p] xds server %s: LRS call status received "
1749
+ "(chand=%p, calld=%p, call=%p): "
1750
+ "status=%d, details='%s', error='%s'",
1751
+ xds_client(), chand()->server_.server_uri.c_str(), chand(), this,
1752
+ call_, status_code_, status_details,
1849
1753
  grpc_error_std_string(error).c_str());
1850
1754
  gpr_free(status_details);
1851
1755
  }
@@ -1878,12 +1782,10 @@ grpc_millis GetRequestTimeout(const grpc_channel_args* args) {
1878
1782
  }
1879
1783
 
1880
1784
  grpc_channel_args* ModifyChannelArgs(const grpc_channel_args* args) {
1881
- absl::InlinedVector<grpc_arg, 2> args_to_add = {
1785
+ absl::InlinedVector<grpc_arg, 1> args_to_add = {
1882
1786
  grpc_channel_arg_integer_create(
1883
1787
  const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS),
1884
1788
  5 * 60 * GPR_MS_PER_SEC),
1885
- grpc_channel_arg_integer_create(
1886
- const_cast<char*>(GRPC_ARG_CHANNELZ_IS_INTERNAL_CHANNEL), 1),
1887
1789
  };
1888
1790
  return grpc_channel_args_copy_and_add(args, args_to_add.data(),
1889
1791
  args_to_add.size());
@@ -1903,13 +1805,13 @@ XdsClient::XdsClient(std::unique_ptr<XdsBootstrap> bootstrap,
1903
1805
  certificate_provider_store_(MakeOrphanable<CertificateProviderStore>(
1904
1806
  bootstrap_->certificate_providers())),
1905
1807
  api_(this, &grpc_xds_client_trace, bootstrap_->node(),
1906
- &bootstrap_->certificate_providers()) {
1808
+ &bootstrap_->certificate_providers(), &symtab_) {
1907
1809
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1908
1810
  gpr_log(GPR_INFO, "[xds_client %p] creating xds client", this);
1909
1811
  }
1910
- // Create ChannelState object.
1911
- chand_ = MakeOrphanable<ChannelState>(
1912
- WeakRef(DEBUG_LOCATION, "XdsClient+ChannelState"), bootstrap_->server());
1812
+ // Calling grpc_init to ensure gRPC does not shut down until the XdsClient is
1813
+ // destroyed.
1814
+ grpc_init();
1913
1815
  }
1914
1816
 
1915
1817
  XdsClient::~XdsClient() {
@@ -1918,26 +1820,9 @@ XdsClient::~XdsClient() {
1918
1820
  }
1919
1821
  grpc_channel_args_destroy(args_);
1920
1822
  grpc_pollset_set_destroy(interested_parties_);
1921
- }
1922
-
1923
- void XdsClient::AddChannelzLinkage(
1924
- channelz::ChannelNode* parent_channelz_node) {
1925
- MutexLock lock(&mu_);
1926
- channelz::ChannelNode* xds_channelz_node =
1927
- grpc_channel_get_channelz_node(chand_->channel());
1928
- if (xds_channelz_node != nullptr) {
1929
- parent_channelz_node->AddChildChannel(xds_channelz_node->uuid());
1930
- }
1931
- }
1932
-
1933
- void XdsClient::RemoveChannelzLinkage(
1934
- channelz::ChannelNode* parent_channelz_node) {
1935
- MutexLock lock(&mu_);
1936
- channelz::ChannelNode* xds_channelz_node =
1937
- grpc_channel_get_channelz_node(chand_->channel());
1938
- if (xds_channelz_node != nullptr) {
1939
- parent_channelz_node->RemoveChildChannel(xds_channelz_node->uuid());
1940
- }
1823
+ // Calling grpc_shutdown to ensure gRPC does not shut down until the XdsClient
1824
+ // is destroyed.
1825
+ grpc_shutdown();
1941
1826
  }
1942
1827
 
1943
1828
  void XdsClient::Orphan() {
@@ -1951,174 +1836,203 @@ void XdsClient::Orphan() {
1951
1836
  {
1952
1837
  MutexLock lock(&mu_);
1953
1838
  shutting_down_ = true;
1954
- // Orphan ChannelState object.
1955
- chand_.reset();
1956
- // We do not clear cluster_map_ and endpoint_map_ if the xds client was
1957
- // created by the XdsResolver because the maps contain refs for watchers
1958
- // which in turn hold refs to the loadbalancing policies. At this point, it
1959
- // is possible for ADS calls to be in progress. Unreffing the loadbalancing
1960
- // policies before those calls are done would lead to issues such as
1961
- // https://github.com/grpc/grpc/issues/20928.
1962
- if (!listener_map_.empty()) {
1963
- cluster_map_.clear();
1964
- endpoint_map_.clear();
1965
- }
1966
- }
1967
- }
1968
-
1969
- void XdsClient::WatchListenerData(
1970
- absl::string_view listener_name,
1971
- std::unique_ptr<ListenerWatcherInterface> watcher) {
1972
- std::string listener_name_str = std::string(listener_name);
1973
- MutexLock lock(&mu_);
1974
- ListenerState& listener_state = listener_map_[listener_name_str];
1975
- ListenerWatcherInterface* w = watcher.get();
1976
- listener_state.watchers[w] = std::move(watcher);
1977
- // If we've already received an LDS update, notify the new watcher
1978
- // immediately.
1979
- if (listener_state.update.has_value()) {
1980
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1981
- gpr_log(GPR_INFO, "[xds_client %p] returning cached listener data for %s",
1982
- this, listener_name_str.c_str());
1983
- }
1984
- w->OnListenerChanged(*listener_state.update);
1985
- }
1986
- chand_->SubscribeLocked(XdsApi::kLdsTypeUrl, listener_name_str);
1987
- }
1988
-
1989
- void XdsClient::CancelListenerDataWatch(absl::string_view listener_name,
1990
- ListenerWatcherInterface* watcher,
1991
- bool delay_unsubscription) {
1992
- MutexLock lock(&mu_);
1993
- if (shutting_down_) return;
1994
- std::string listener_name_str = std::string(listener_name);
1995
- ListenerState& listener_state = listener_map_[listener_name_str];
1996
- auto it = listener_state.watchers.find(watcher);
1997
- if (it != listener_state.watchers.end()) {
1998
- listener_state.watchers.erase(it);
1999
- if (listener_state.watchers.empty()) {
2000
- listener_map_.erase(listener_name_str);
2001
- chand_->UnsubscribeLocked(XdsApi::kLdsTypeUrl, listener_name_str,
2002
- delay_unsubscription);
2003
- }
1839
+ // Clear cache and any remaining watchers that may not have been cancelled.
1840
+ authority_state_map_.clear();
1841
+ invalid_watchers_.clear();
1842
+ }
1843
+ }
1844
+
1845
+ RefCountedPtr<XdsClient::ChannelState> XdsClient::GetOrCreateChannelStateLocked(
1846
+ const XdsBootstrap::XdsServer& server) {
1847
+ auto it = xds_server_channel_map_.find(server);
1848
+ if (it != xds_server_channel_map_.end()) {
1849
+ return it->second->Ref(DEBUG_LOCATION, "Authority");
1850
+ }
1851
+ // Channel not found, so create a new one.
1852
+ auto channel_state = MakeRefCounted<ChannelState>(
1853
+ WeakRef(DEBUG_LOCATION, "ChannelState"), server);
1854
+ xds_server_channel_map_[server] = channel_state.get();
1855
+ return channel_state;
1856
+ }
1857
+
1858
+ void XdsClient::WatchResource(const XdsResourceType* type,
1859
+ absl::string_view name,
1860
+ RefCountedPtr<ResourceWatcherInterface> watcher) {
1861
+ ResourceWatcherInterface* w = watcher.get();
1862
+ // Lambda for handling failure cases.
1863
+ auto fail = [&](grpc_error_handle error) mutable {
1864
+ {
1865
+ MutexLock lock(&mu_);
1866
+ MaybeRegisterResourceTypeLocked(type);
1867
+ invalid_watchers_[w] = watcher;
1868
+ }
1869
+ work_serializer_.Run(
1870
+ // TODO(yashykt): When we move to C++14, capture watcher using
1871
+ // std::move()
1872
+ [watcher, error]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(&work_serializer_) {
1873
+ watcher->OnError(error);
1874
+ },
1875
+ DEBUG_LOCATION);
1876
+ };
1877
+ auto resource_name = ParseXdsResourceName(name, type);
1878
+ if (!resource_name.ok()) {
1879
+ fail(GRPC_ERROR_CREATE_FROM_CPP_STRING(absl::StrFormat(
1880
+ "Unable to parse resource name for listener %s", name)));
1881
+ return;
2004
1882
  }
2005
- }
2006
-
2007
- void XdsClient::WatchRouteConfigData(
2008
- absl::string_view route_config_name,
2009
- std::unique_ptr<RouteConfigWatcherInterface> watcher) {
2010
- std::string route_config_name_str = std::string(route_config_name);
2011
- MutexLock lock(&mu_);
2012
- RouteConfigState& route_config_state =
2013
- route_config_map_[route_config_name_str];
2014
- RouteConfigWatcherInterface* w = watcher.get();
2015
- route_config_state.watchers[w] = std::move(watcher);
2016
- // If we've already received an RDS update, notify the new watcher
2017
- // immediately.
2018
- if (route_config_state.update.has_value()) {
2019
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
2020
- gpr_log(GPR_INFO,
2021
- "[xds_client %p] returning cached route config data for %s", this,
2022
- route_config_name_str.c_str());
1883
+ // Find server to use.
1884
+ const XdsBootstrap::XdsServer* xds_server = nullptr;
1885
+ absl::string_view authority_name = resource_name->authority;
1886
+ if (absl::ConsumePrefix(&authority_name, "xdstp:")) {
1887
+ auto* authority = bootstrap_->LookupAuthority(std::string(authority_name));
1888
+ if (authority == nullptr) {
1889
+ fail(GRPC_ERROR_CREATE_FROM_CPP_STRING(
1890
+ absl::StrCat("authority \"", authority_name,
1891
+ "\" not present in bootstrap config")));
1892
+ return;
2023
1893
  }
2024
- w->OnRouteConfigChanged(*route_config_state.update);
2025
- }
2026
- chand_->SubscribeLocked(XdsApi::kRdsTypeUrl, route_config_name_str);
2027
- }
2028
-
2029
- void XdsClient::CancelRouteConfigDataWatch(absl::string_view route_config_name,
2030
- RouteConfigWatcherInterface* watcher,
2031
- bool delay_unsubscription) {
2032
- MutexLock lock(&mu_);
2033
- if (shutting_down_) return;
2034
- std::string route_config_name_str = std::string(route_config_name);
2035
- RouteConfigState& route_config_state =
2036
- route_config_map_[route_config_name_str];
2037
- auto it = route_config_state.watchers.find(watcher);
2038
- if (it != route_config_state.watchers.end()) {
2039
- route_config_state.watchers.erase(it);
2040
- if (route_config_state.watchers.empty()) {
2041
- route_config_map_.erase(route_config_name_str);
2042
- chand_->UnsubscribeLocked(XdsApi::kRdsTypeUrl, route_config_name_str,
2043
- delay_unsubscription);
1894
+ if (!authority->xds_servers.empty()) {
1895
+ xds_server = &authority->xds_servers[0];
2044
1896
  }
2045
1897
  }
2046
- }
2047
-
2048
- void XdsClient::WatchClusterData(
2049
- absl::string_view cluster_name,
2050
- std::unique_ptr<ClusterWatcherInterface> watcher) {
2051
- std::string cluster_name_str = std::string(cluster_name);
1898
+ if (xds_server == nullptr) xds_server = &bootstrap_->server();
1899
+ {
1900
+ MutexLock lock(&mu_);
1901
+ MaybeRegisterResourceTypeLocked(type);
1902
+ // TODO(donnadionne): If we get a request for an authority that is not
1903
+ // configured in the bootstrap file, reject it.
1904
+ AuthorityState& authority_state =
1905
+ authority_state_map_[resource_name->authority];
1906
+ ResourceState& resource_state =
1907
+ authority_state.resource_map[type][resource_name->key];
1908
+ resource_state.watchers[w] = watcher;
1909
+ // If we already have a cached value for the resource, notify the new
1910
+ // watcher immediately.
1911
+ if (resource_state.resource != nullptr) {
1912
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1913
+ gpr_log(GPR_INFO,
1914
+ "[xds_client %p] returning cached listener data for %s", this,
1915
+ std::string(name).c_str());
1916
+ }
1917
+ auto* value = type->CopyResource(resource_state.resource.get()).release();
1918
+ work_serializer_.Schedule(
1919
+ [watcher, value]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(&work_serializer_) {
1920
+ watcher->OnGenericResourceChanged(value);
1921
+ delete value;
1922
+ },
1923
+ DEBUG_LOCATION);
1924
+ }
1925
+ // If the authority doesn't yet have a channel, set it, creating it if
1926
+ // needed.
1927
+ if (authority_state.channel_state == nullptr) {
1928
+ authority_state.channel_state =
1929
+ GetOrCreateChannelStateLocked(*xds_server);
1930
+ }
1931
+ authority_state.channel_state->SubscribeLocked(type, *resource_name);
1932
+ }
1933
+ work_serializer_.DrainQueue();
1934
+ }
1935
+
1936
+ void XdsClient::CancelResourceWatch(const XdsResourceType* type,
1937
+ absl::string_view name,
1938
+ ResourceWatcherInterface* watcher,
1939
+ bool delay_unsubscription) {
1940
+ auto resource_name = ParseXdsResourceName(name, type);
2052
1941
  MutexLock lock(&mu_);
2053
- ClusterState& cluster_state = cluster_map_[cluster_name_str];
2054
- ClusterWatcherInterface* w = watcher.get();
2055
- cluster_state.watchers[w] = std::move(watcher);
2056
- // If we've already received a CDS update, notify the new watcher
2057
- // immediately.
2058
- if (cluster_state.update.has_value()) {
2059
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
2060
- gpr_log(GPR_INFO, "[xds_client %p] returning cached cluster data for %s",
2061
- this, cluster_name_str.c_str());
2062
- }
2063
- w->OnClusterChanged(cluster_state.update.value());
1942
+ if (!resource_name.ok()) {
1943
+ invalid_watchers_.erase(watcher);
1944
+ return;
2064
1945
  }
2065
- chand_->SubscribeLocked(XdsApi::kCdsTypeUrl, cluster_name_str);
2066
- }
2067
-
2068
- void XdsClient::CancelClusterDataWatch(absl::string_view cluster_name,
2069
- ClusterWatcherInterface* watcher,
2070
- bool delay_unsubscription) {
2071
- MutexLock lock(&mu_);
2072
1946
  if (shutting_down_) return;
2073
- std::string cluster_name_str = std::string(cluster_name);
2074
- ClusterState& cluster_state = cluster_map_[cluster_name_str];
2075
- auto it = cluster_state.watchers.find(watcher);
2076
- if (it != cluster_state.watchers.end()) {
2077
- cluster_state.watchers.erase(it);
2078
- if (cluster_state.watchers.empty()) {
2079
- cluster_map_.erase(cluster_name_str);
2080
- chand_->UnsubscribeLocked(XdsApi::kCdsTypeUrl, cluster_name_str,
2081
- delay_unsubscription);
2082
- }
2083
- }
2084
- }
2085
-
2086
- void XdsClient::WatchEndpointData(
2087
- absl::string_view eds_service_name,
2088
- std::unique_ptr<EndpointWatcherInterface> watcher) {
2089
- std::string eds_service_name_str = std::string(eds_service_name);
2090
- MutexLock lock(&mu_);
2091
- EndpointState& endpoint_state = endpoint_map_[eds_service_name_str];
2092
- EndpointWatcherInterface* w = watcher.get();
2093
- endpoint_state.watchers[w] = std::move(watcher);
2094
- // If we've already received an EDS update, notify the new watcher
2095
- // immediately.
2096
- if (endpoint_state.update.has_value()) {
2097
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
2098
- gpr_log(GPR_INFO, "[xds_client %p] returning cached endpoint data for %s",
2099
- this, eds_service_name_str.c_str());
1947
+ // Find authority.
1948
+ auto authority_it = authority_state_map_.find(resource_name->authority);
1949
+ if (authority_it == authority_state_map_.end()) return;
1950
+ AuthorityState& authority_state = authority_it->second;
1951
+ // Find type map.
1952
+ auto type_it = authority_state.resource_map.find(type);
1953
+ if (type_it == authority_state.resource_map.end()) return;
1954
+ auto& type_map = type_it->second;
1955
+ // Find resource key.
1956
+ auto resource_it = type_map.find(resource_name->key);
1957
+ if (resource_it == type_map.end()) return;
1958
+ ResourceState& resource_state = resource_it->second;
1959
+ // Remove watcher.
1960
+ resource_state.watchers.erase(watcher);
1961
+ // Clean up empty map entries, if any.
1962
+ if (resource_state.watchers.empty()) {
1963
+ authority_state.channel_state->UnsubscribeLocked(type, *resource_name,
1964
+ delay_unsubscription);
1965
+ type_map.erase(resource_it);
1966
+ if (type_map.empty()) {
1967
+ authority_state.resource_map.erase(type_it);
1968
+ if (authority_state.resource_map.empty()) {
1969
+ authority_state.channel_state.reset();
1970
+ }
2100
1971
  }
2101
- w->OnEndpointChanged(endpoint_state.update.value());
2102
1972
  }
2103
- chand_->SubscribeLocked(XdsApi::kEdsTypeUrl, eds_service_name_str);
2104
1973
  }
2105
1974
 
2106
- void XdsClient::CancelEndpointDataWatch(absl::string_view eds_service_name,
2107
- EndpointWatcherInterface* watcher,
2108
- bool delay_unsubscription) {
2109
- MutexLock lock(&mu_);
2110
- if (shutting_down_) return;
2111
- std::string eds_service_name_str = std::string(eds_service_name);
2112
- EndpointState& endpoint_state = endpoint_map_[eds_service_name_str];
2113
- auto it = endpoint_state.watchers.find(watcher);
2114
- if (it != endpoint_state.watchers.end()) {
2115
- endpoint_state.watchers.erase(it);
2116
- if (endpoint_state.watchers.empty()) {
2117
- endpoint_map_.erase(eds_service_name_str);
2118
- chand_->UnsubscribeLocked(XdsApi::kEdsTypeUrl, eds_service_name_str,
2119
- delay_unsubscription);
2120
- }
1975
+ void XdsClient::MaybeRegisterResourceTypeLocked(
1976
+ const XdsResourceType* resource_type) {
1977
+ auto it = resource_types_.find(resource_type->type_url());
1978
+ if (it != resource_types_.end()) {
1979
+ GPR_ASSERT(it->second == resource_type);
1980
+ return;
2121
1981
  }
1982
+ resource_types_.emplace(resource_type->type_url(), resource_type);
1983
+ v2_resource_types_.emplace(resource_type->v2_type_url(), resource_type);
1984
+ resource_type->InitUpbSymtab(symtab_.ptr());
1985
+ }
1986
+
1987
+ const XdsResourceType* XdsClient::GetResourceTypeLocked(
1988
+ absl::string_view resource_type) {
1989
+ auto it = resource_types_.find(resource_type);
1990
+ if (it != resource_types_.end()) return it->second;
1991
+ auto it2 = v2_resource_types_.find(resource_type);
1992
+ if (it2 != v2_resource_types_.end()) return it2->second;
1993
+ return nullptr;
1994
+ }
1995
+
1996
+ absl::StatusOr<XdsClient::XdsResourceName> XdsClient::ParseXdsResourceName(
1997
+ absl::string_view name, const XdsResourceType* type) {
1998
+ // Old-style names use the empty string for authority.
1999
+ // authority is prefixed with "old:" to indicate that it's an old-style name.
2000
+ if (!absl::StartsWith(name, "xdstp:")) {
2001
+ return XdsResourceName{"old:", {std::string(name), {}}};
2002
+ }
2003
+ // New style name. Parse URI.
2004
+ auto uri = URI::Parse(name);
2005
+ if (!uri.ok()) return uri.status();
2006
+ // Split the resource type off of the path to get the id.
2007
+ std::pair<absl::string_view, absl::string_view> path_parts = absl::StrSplit(
2008
+ absl::StripPrefix(uri->path(), "/"), absl::MaxSplits('/', 1));
2009
+ if (!type->IsType(path_parts.first, nullptr)) {
2010
+ return absl::InvalidArgumentError(
2011
+ "xdstp URI path must indicate valid xDS resource type");
2012
+ }
2013
+ // Canonicalize order of query params.
2014
+ std::vector<URI::QueryParam> query_params;
2015
+ for (const auto& p : uri->query_parameter_map()) {
2016
+ query_params.emplace_back(
2017
+ URI::QueryParam{std::string(p.first), std::string(p.second)});
2018
+ }
2019
+ return XdsResourceName{
2020
+ absl::StrCat("xdstp:", uri->authority()),
2021
+ {std::string(path_parts.second), std::move(query_params)}};
2022
+ }
2023
+
2024
+ std::string XdsClient::ConstructFullXdsResourceName(
2025
+ absl::string_view authority, absl::string_view resource_type,
2026
+ const XdsResourceKey& key) {
2027
+ if (absl::ConsumePrefix(&authority, "xdstp:")) {
2028
+ auto uri = URI::Create("xdstp", std::string(authority),
2029
+ absl::StrCat("/", resource_type, "/", key.id),
2030
+ key.query_params, /*fragment=*/"");
2031
+ GPR_ASSERT(uri.ok());
2032
+ return uri->ToString();
2033
+ }
2034
+ // Old-style name.
2035
+ return key.id;
2122
2036
  }
2123
2037
 
2124
2038
  RefCountedPtr<XdsClusterDropStats> XdsClient::AddClusterDropStats(
@@ -2151,7 +2065,13 @@ RefCountedPtr<XdsClusterDropStats> XdsClient::AddClusterDropStats(
2151
2065
  it->first.second /*eds_service_name*/);
2152
2066
  load_report_state.drop_stats = cluster_drop_stats.get();
2153
2067
  }
2154
- chand_->MaybeStartLrsCall();
2068
+ auto resource_name =
2069
+ ParseXdsResourceName(cluster_name, XdsClusterResourceType::Get());
2070
+ GPR_ASSERT(resource_name.ok());
2071
+ auto a = authority_state_map_.find(resource_name->authority);
2072
+ if (a != authority_state_map_.end()) {
2073
+ a->second.channel_state->MaybeStartLrsCall();
2074
+ }
2155
2075
  return cluster_drop_stats;
2156
2076
  }
2157
2077
 
@@ -2208,7 +2128,13 @@ RefCountedPtr<XdsClusterLocalityStats> XdsClient::AddClusterLocalityStats(
2208
2128
  std::move(locality));
2209
2129
  locality_state.locality_stats = cluster_locality_stats.get();
2210
2130
  }
2211
- chand_->MaybeStartLrsCall();
2131
+ auto resource_name =
2132
+ ParseXdsResourceName(cluster_name, XdsClusterResourceType::Get());
2133
+ GPR_ASSERT(resource_name.ok());
2134
+ auto a = authority_state_map_.find(resource_name->authority);
2135
+ if (a != authority_state_map_.end()) {
2136
+ a->second.channel_state->MaybeStartLrsCall();
2137
+ }
2212
2138
  return cluster_locality_stats;
2213
2139
  }
2214
2140
 
@@ -2238,37 +2164,32 @@ void XdsClient::RemoveClusterLocalityStats(
2238
2164
 
2239
2165
  void XdsClient::ResetBackoff() {
2240
2166
  MutexLock lock(&mu_);
2241
- if (chand_ != nullptr) {
2242
- grpc_channel_reset_connect_backoff(chand_->channel());
2167
+ for (auto& p : xds_server_channel_map_) {
2168
+ grpc_channel_reset_connect_backoff(p.second->channel());
2243
2169
  }
2244
2170
  }
2245
2171
 
2246
2172
  void XdsClient::NotifyOnErrorLocked(grpc_error_handle error) {
2247
- for (const auto& p : listener_map_) {
2248
- const ListenerState& listener_state = p.second;
2249
- for (const auto& p : listener_state.watchers) {
2250
- p.first->OnError(GRPC_ERROR_REF(error));
2251
- }
2252
- }
2253
- for (const auto& p : route_config_map_) {
2254
- const RouteConfigState& route_config_state = p.second;
2255
- for (const auto& p : route_config_state.watchers) {
2256
- p.first->OnError(GRPC_ERROR_REF(error));
2257
- }
2258
- }
2259
- for (const auto& p : cluster_map_) {
2260
- const ClusterState& cluster_state = p.second;
2261
- for (const auto& p : cluster_state.watchers) {
2262
- p.first->OnError(GRPC_ERROR_REF(error));
2263
- }
2264
- }
2265
- for (const auto& p : endpoint_map_) {
2266
- const EndpointState& endpoint_state = p.second;
2267
- for (const auto& p : endpoint_state.watchers) {
2268
- p.first->OnError(GRPC_ERROR_REF(error));
2173
+ std::set<RefCountedPtr<ResourceWatcherInterface>> watchers;
2174
+ for (const auto& a : authority_state_map_) { // authority
2175
+ for (const auto& t : a.second.resource_map) { // type
2176
+ for (const auto& r : t.second) { // resource id
2177
+ for (const auto& w : r.second.watchers) { // watchers
2178
+ watchers.insert(w.second);
2179
+ }
2180
+ }
2269
2181
  }
2270
2182
  }
2271
- GRPC_ERROR_UNREF(error);
2183
+ work_serializer_.Schedule(
2184
+ // TODO(yashykt): When we move to C++14, capture watchers using
2185
+ // std::move()
2186
+ [watchers, error]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(work_serializer_) {
2187
+ for (const auto& watcher : watchers) {
2188
+ watcher->OnError(GRPC_ERROR_REF(error));
2189
+ }
2190
+ GRPC_ERROR_UNREF(error);
2191
+ },
2192
+ DEBUG_LOCATION);
2272
2193
  }
2273
2194
 
2274
2195
  XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshotLocked(
@@ -2355,34 +2276,19 @@ XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshotLocked(
2355
2276
  std::string XdsClient::DumpClientConfigBinary() {
2356
2277
  MutexLock lock(&mu_);
2357
2278
  XdsApi::ResourceTypeMetadataMap resource_type_metadata_map;
2358
- // Update per-xds-type version if available, this version corresponding to the
2359
- // last successful ADS update version.
2360
- for (auto& p : resource_version_map_) {
2361
- resource_type_metadata_map[p.first].version = p.second;
2362
- }
2363
- // Collect resource metadata from listeners
2364
- auto& lds_map =
2365
- resource_type_metadata_map[XdsApi::kLdsTypeUrl].resource_metadata_map;
2366
- for (auto& p : listener_map_) {
2367
- lds_map[p.first] = &p.second.meta;
2368
- }
2369
- // Collect resource metadata from route configs
2370
- auto& rds_map =
2371
- resource_type_metadata_map[XdsApi::kRdsTypeUrl].resource_metadata_map;
2372
- for (auto& p : route_config_map_) {
2373
- rds_map[p.first] = &p.second.meta;
2374
- }
2375
- // Collect resource metadata from clusters
2376
- auto& cds_map =
2377
- resource_type_metadata_map[XdsApi::kCdsTypeUrl].resource_metadata_map;
2378
- for (auto& p : cluster_map_) {
2379
- cds_map[p.first] = &p.second.meta;
2380
- }
2381
- // Collect resource metadata from endpoints
2382
- auto& eds_map =
2383
- resource_type_metadata_map[XdsApi::kEdsTypeUrl].resource_metadata_map;
2384
- for (auto& p : endpoint_map_) {
2385
- eds_map[p.first] = &p.second.meta;
2279
+ for (const auto& a : authority_state_map_) { // authority
2280
+ const std::string& authority = a.first;
2281
+ for (const auto& t : a.second.resource_map) { // type
2282
+ const XdsResourceType* type = t.first;
2283
+ auto& resource_metadata_map =
2284
+ resource_type_metadata_map[type->type_url()];
2285
+ for (const auto& r : t.second) { // resource id
2286
+ const XdsResourceKey& resource_key = r.first;
2287
+ const ResourceState& resource_state = r.second;
2288
+ resource_metadata_map[ConstructFullXdsResourceName(
2289
+ authority, type->type_url(), resource_key)] = &resource_state.meta;
2290
+ }
2291
+ }
2386
2292
  }
2387
2293
  // Assemble config dump messages
2388
2294
  return api_.AssembleClientConfig(resource_type_metadata_map);
@@ -2395,6 +2301,7 @@ std::string XdsClient::DumpClientConfigBinary() {
2395
2301
  void XdsClientGlobalInit() {
2396
2302
  g_mu = new Mutex;
2397
2303
  XdsHttpFilterRegistry::Init();
2304
+ XdsChannelCredsRegistry::Init();
2398
2305
  }
2399
2306
 
2400
2307
  // TODO(roth): Find a better way to clear the fallback config that does
@@ -2404,6 +2311,7 @@ void XdsClientGlobalShutdown() ABSL_NO_THREAD_SAFETY_ANALYSIS {
2404
2311
  g_fallback_bootstrap_config = nullptr;
2405
2312
  delete g_mu;
2406
2313
  g_mu = nullptr;
2314
+ XdsChannelCredsRegistry::Shutdown();
2407
2315
  XdsHttpFilterRegistry::Shutdown();
2408
2316
  }
2409
2317
 
@@ -2412,7 +2320,7 @@ namespace {
2412
2320
  std::string GetBootstrapContents(const char* fallback_config,
2413
2321
  grpc_error_handle* error) {
2414
2322
  // First, try GRPC_XDS_BOOTSTRAP env var.
2415
- grpc_core::UniquePtr<char> path(gpr_getenv("GRPC_XDS_BOOTSTRAP"));
2323
+ UniquePtr<char> path(gpr_getenv("GRPC_XDS_BOOTSTRAP"));
2416
2324
  if (path != nullptr) {
2417
2325
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
2418
2326
  gpr_log(GPR_INFO,
@@ -2429,8 +2337,7 @@ std::string GetBootstrapContents(const char* fallback_config,
2429
2337
  return contents_str;
2430
2338
  }
2431
2339
  // Next, try GRPC_XDS_BOOTSTRAP_CONFIG env var.
2432
- grpc_core::UniquePtr<char> env_config(
2433
- gpr_getenv("GRPC_XDS_BOOTSTRAP_CONFIG"));
2340
+ UniquePtr<char> env_config(gpr_getenv("GRPC_XDS_BOOTSTRAP_CONFIG"));
2434
2341
  if (env_config != nullptr) {
2435
2342
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
2436
2343
  gpr_log(GPR_INFO,
@@ -2540,7 +2447,7 @@ void XdsClientArgDestroy(void* p) {
2540
2447
  xds_client->Unref(DEBUG_LOCATION, "channel arg");
2541
2448
  }
2542
2449
 
2543
- int XdsClientArgCmp(void* p, void* q) { return GPR_ICMP(p, q); }
2450
+ int XdsClientArgCmp(void* p, void* q) { return QsortCompare(p, q); }
2544
2451
 
2545
2452
  const grpc_arg_pointer_vtable kXdsClientArgVtable = {
2546
2453
  XdsClientArgCopy, XdsClientArgDestroy, XdsClientArgCmp};