grpc 1.34.0 → 1.42.0

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

Potentially problematic release.


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

Files changed (1545) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +978 -2868
  3. data/etc/roots.pem +592 -899
  4. data/include/grpc/byte_buffer.h +1 -1
  5. data/include/grpc/byte_buffer_reader.h +1 -1
  6. data/include/grpc/compression.h +1 -1
  7. data/include/grpc/event_engine/README.md +38 -0
  8. data/include/grpc/event_engine/endpoint_config.h +43 -0
  9. data/include/grpc/event_engine/event_engine.h +375 -0
  10. data/include/grpc/event_engine/internal/memory_allocator_impl.h +98 -0
  11. data/include/grpc/event_engine/memory_allocator.h +210 -0
  12. data/include/grpc/event_engine/port.h +39 -0
  13. data/include/grpc/fork.h +1 -1
  14. data/include/grpc/grpc.h +49 -4
  15. data/include/grpc/grpc_posix.h +5 -2
  16. data/include/grpc/grpc_security.h +127 -14
  17. data/include/grpc/grpc_security_constants.h +16 -0
  18. data/include/grpc/impl/codegen/atm.h +5 -3
  19. data/include/grpc/impl/codegen/atm_gcc_atomic.h +2 -0
  20. data/include/grpc/impl/codegen/atm_gcc_sync.h +2 -0
  21. data/include/grpc/impl/codegen/atm_windows.h +6 -0
  22. data/include/grpc/impl/codegen/byte_buffer.h +3 -1
  23. data/include/grpc/impl/codegen/byte_buffer_reader.h +2 -0
  24. data/include/grpc/impl/codegen/compression_types.h +2 -0
  25. data/include/grpc/impl/codegen/connectivity_state.h +2 -0
  26. data/include/grpc/impl/codegen/fork.h +2 -0
  27. data/include/grpc/impl/codegen/gpr_slice.h +2 -0
  28. data/include/grpc/impl/codegen/gpr_types.h +2 -0
  29. data/include/grpc/impl/codegen/grpc_types.h +49 -25
  30. data/include/grpc/impl/codegen/log.h +2 -2
  31. data/include/grpc/impl/codegen/port_platform.h +81 -22
  32. data/include/grpc/impl/codegen/propagation_bits.h +2 -0
  33. data/include/grpc/impl/codegen/slice.h +2 -0
  34. data/include/grpc/impl/codegen/status.h +2 -0
  35. data/include/grpc/impl/codegen/sync.h +8 -5
  36. data/include/grpc/impl/codegen/sync_abseil.h +2 -0
  37. data/include/grpc/impl/codegen/sync_custom.h +2 -0
  38. data/include/grpc/impl/codegen/sync_generic.h +3 -0
  39. data/include/grpc/impl/codegen/sync_posix.h +4 -2
  40. data/include/grpc/impl/codegen/sync_windows.h +6 -0
  41. data/include/grpc/module.modulemap +14 -14
  42. data/include/grpc/slice.h +1 -1
  43. data/include/grpc/slice_buffer.h +3 -3
  44. data/include/grpc/status.h +1 -1
  45. data/include/grpc/support/atm.h +1 -1
  46. data/include/grpc/support/atm_gcc_atomic.h +1 -1
  47. data/include/grpc/support/atm_gcc_sync.h +1 -1
  48. data/include/grpc/support/atm_windows.h +1 -1
  49. data/include/grpc/support/log.h +1 -1
  50. data/include/grpc/support/port_platform.h +1 -1
  51. data/include/grpc/support/sync.h +4 -4
  52. data/include/grpc/support/sync_abseil.h +1 -1
  53. data/include/grpc/support/sync_custom.h +1 -1
  54. data/include/grpc/support/sync_generic.h +1 -1
  55. data/include/grpc/support/sync_posix.h +1 -1
  56. data/include/grpc/support/sync_windows.h +1 -1
  57. data/include/grpc/support/time.h +9 -9
  58. data/src/core/ext/filters/census/grpc_context.cc +1 -0
  59. data/src/core/ext/filters/client_channel/backend_metric.cc +20 -24
  60. data/src/core/ext/filters/client_channel/backup_poller.cc +5 -4
  61. data/src/core/ext/filters/client_channel/backup_poller.h +1 -0
  62. data/src/core/ext/filters/client_channel/channel_connectivity.cc +158 -202
  63. data/src/core/ext/filters/client_channel/client_channel.cc +2009 -3145
  64. data/src/core/ext/filters/client_channel/client_channel.h +559 -60
  65. data/src/core/ext/filters/client_channel/client_channel_channelz.cc +6 -5
  66. data/src/core/ext/filters/client_channel/client_channel_channelz.h +2 -2
  67. data/src/core/ext/filters/client_channel/client_channel_factory.cc +2 -1
  68. data/src/core/ext/filters/client_channel/client_channel_factory.h +18 -19
  69. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +18 -14
  70. data/src/core/ext/filters/client_channel/config_selector.cc +2 -1
  71. data/src/core/ext/filters/client_channel/config_selector.h +33 -9
  72. data/src/core/ext/filters/client_channel/connector.h +19 -19
  73. data/src/core/ext/filters/client_channel/dynamic_filters.cc +190 -0
  74. data/src/core/ext/filters/client_channel/dynamic_filters.h +99 -0
  75. data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +24 -142
  76. data/src/core/ext/filters/client_channel/global_subchannel_pool.h +15 -11
  77. data/src/core/ext/filters/client_channel/health/health_check_client.cc +53 -50
  78. data/src/core/ext/filters/client_channel/health/health_check_client.h +35 -33
  79. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +37 -34
  80. data/src/core/ext/filters/client_channel/http_connect_handshaker.h +10 -2
  81. data/src/core/ext/filters/client_channel/http_proxy.cc +36 -20
  82. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +6 -2
  83. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +12 -21
  84. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +246 -166
  85. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +4 -0
  86. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +1 -1
  87. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +1 -2
  88. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +3 -5
  89. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +2 -2
  90. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +4 -3
  91. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +5 -6
  92. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +1 -1
  93. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +37 -30
  94. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +53 -55
  95. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +757 -0
  96. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +37 -0
  97. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +2502 -0
  98. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +16 -18
  99. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +3 -3
  100. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +24 -27
  101. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +385 -135
  102. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +0 -8
  103. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +29 -0
  104. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +57 -71
  105. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +43 -64
  106. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +1362 -0
  107. data/src/core/ext/filters/client_channel/lb_policy.cc +6 -17
  108. data/src/core/ext/filters/client_channel/lb_policy.h +93 -93
  109. data/src/core/ext/filters/client_channel/lb_policy_factory.h +2 -1
  110. data/src/core/ext/filters/client_channel/lb_policy_registry.cc +8 -11
  111. data/src/core/ext/filters/client_channel/lb_policy_registry.h +1 -1
  112. data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +27 -67
  113. data/src/core/ext/filters/client_channel/local_subchannel_pool.h +10 -9
  114. data/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc +139 -0
  115. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +76 -88
  116. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +3 -33
  117. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_event_engine.cc +31 -0
  118. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +10 -9
  119. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +26 -23
  120. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +473 -74
  121. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +27 -2
  122. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_event_engine.cc +28 -0
  123. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +1 -1
  124. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +45 -35
  125. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +43 -46
  126. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +7 -5
  127. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +384 -0
  128. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +22 -35
  129. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +466 -254
  130. data/src/core/ext/filters/client_channel/resolver.cc +5 -5
  131. data/src/core/ext/filters/client_channel/resolver.h +4 -15
  132. data/src/core/ext/filters/client_channel/resolver_factory.h +8 -6
  133. data/src/core/ext/filters/client_channel/resolver_registry.cc +43 -44
  134. data/src/core/ext/filters/client_channel/resolver_registry.h +2 -2
  135. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +42 -252
  136. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +25 -54
  137. data/src/core/ext/filters/client_channel/retry_filter.cc +2573 -0
  138. data/src/core/ext/filters/{workarounds/workaround_cronet_compression_filter.h → client_channel/retry_filter.h} +9 -6
  139. data/src/core/ext/filters/client_channel/retry_service_config.cc +316 -0
  140. data/src/core/ext/filters/client_channel/retry_service_config.h +96 -0
  141. data/src/core/ext/filters/client_channel/retry_throttle.cc +20 -49
  142. data/src/core/ext/filters/client_channel/retry_throttle.h +3 -1
  143. data/src/core/ext/filters/client_channel/server_address.cc +10 -1
  144. data/src/core/ext/filters/client_channel/server_address.h +31 -0
  145. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +54 -40
  146. data/src/core/ext/filters/client_channel/subchannel.cc +179 -329
  147. data/src/core/ext/filters/client_channel/subchannel.h +101 -158
  148. data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +38 -9
  149. data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +21 -10
  150. data/src/core/ext/filters/client_idle/client_idle_filter.cc +47 -223
  151. data/src/core/ext/filters/client_idle/idle_filter_state.cc +96 -0
  152. data/src/core/ext/filters/client_idle/idle_filter_state.h +66 -0
  153. data/src/core/ext/filters/deadline/deadline_filter.cc +33 -34
  154. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +503 -0
  155. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +39 -0
  156. data/src/core/ext/filters/fault_injection/service_config_parser.cc +181 -0
  157. data/src/core/ext/filters/fault_injection/service_config_parser.h +85 -0
  158. data/src/core/ext/filters/http/client/http_client_filter.cc +77 -69
  159. data/src/core/ext/filters/http/client_authority_filter.cc +19 -19
  160. data/src/core/ext/filters/http/http_filters_plugin.cc +53 -68
  161. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +42 -35
  162. data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +29 -30
  163. data/src/core/ext/filters/http/server/http_server_filter.cc +104 -95
  164. data/src/core/ext/filters/max_age/max_age_filter.cc +71 -68
  165. data/src/core/ext/filters/message_size/message_size_filter.cc +43 -41
  166. data/src/core/ext/filters/message_size/message_size_filter.h +2 -2
  167. data/src/core/ext/{filters/client_channel → service_config}/service_config.cc +17 -16
  168. data/src/core/ext/{filters/client_channel → service_config}/service_config.h +11 -10
  169. data/src/core/ext/{filters/client_channel → service_config}/service_config_call_data.h +23 -19
  170. data/src/core/ext/{filters/client_channel → service_config}/service_config_parser.cc +9 -9
  171. data/src/core/ext/{filters/client_channel → service_config}/service_config_parser.h +15 -10
  172. data/src/core/ext/transport/chttp2/alpn/alpn.cc +2 -1
  173. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +37 -23
  174. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +9 -7
  175. data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +42 -35
  176. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +32 -16
  177. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +51 -62
  178. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +664 -236
  179. data/src/core/ext/transport/chttp2/server/chttp2_server.h +11 -2
  180. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +13 -5
  181. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +25 -11
  182. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +61 -22
  183. data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +4 -2
  184. data/src/core/ext/transport/chttp2/transport/bin_decoder.h +2 -1
  185. data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +1 -0
  186. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +264 -223
  187. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +16 -2
  188. data/src/core/ext/transport/chttp2/transport/context_list.cc +4 -5
  189. data/src/core/ext/transport/chttp2/transport/context_list.h +5 -6
  190. data/src/core/ext/transport/chttp2/transport/flow_control.cc +59 -40
  191. data/src/core/ext/transport/chttp2/transport/flow_control.h +23 -17
  192. data/src/core/ext/transport/chttp2/transport/frame_data.cc +28 -24
  193. data/src/core/ext/transport/chttp2/transport/frame_data.h +11 -10
  194. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +21 -20
  195. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +7 -6
  196. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +13 -13
  197. data/src/core/ext/transport/chttp2/transport/frame_ping.h +8 -6
  198. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +12 -15
  199. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +7 -6
  200. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +49 -17
  201. data/src/core/ext/transport/chttp2/transport/frame_settings.h +9 -7
  202. data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +22 -19
  203. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +5 -6
  204. data/src/core/ext/transport/chttp2/transport/hpack_constants.h +41 -0
  205. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +311 -665
  206. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +240 -70
  207. data/src/core/ext/transport/chttp2/transport/hpack_encoder_index.h +107 -0
  208. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +86 -0
  209. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +69 -0
  210. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +865 -1172
  211. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +100 -81
  212. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +146 -0
  213. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +137 -0
  214. data/src/core/ext/transport/chttp2/transport/hpack_utils.cc +46 -0
  215. data/src/core/{lib/transport/authority_override.h → ext/transport/chttp2/transport/hpack_utils.h} +8 -12
  216. data/src/core/ext/transport/chttp2/transport/internal.h +40 -33
  217. data/src/core/ext/transport/chttp2/transport/parsing.cc +156 -286
  218. data/src/core/ext/transport/chttp2/transport/popularity_count.h +60 -0
  219. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +2 -2
  220. data/src/core/ext/transport/chttp2/transport/varint.cc +13 -7
  221. data/src/core/ext/transport/chttp2/transport/varint.h +39 -28
  222. data/src/core/ext/transport/chttp2/transport/writing.cc +69 -54
  223. data/src/core/ext/transport/inproc/inproc_transport.cc +204 -160
  224. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +406 -0
  225. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +1591 -0
  226. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.c +1 -1
  227. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +2 -1
  228. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +3 -3
  229. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +15 -2
  230. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +48 -49
  231. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +245 -56
  232. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +371 -0
  233. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +1554 -0
  234. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +16 -16
  235. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +66 -21
  236. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +178 -142
  237. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +795 -314
  238. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +4 -4
  239. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +21 -7
  240. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +25 -24
  241. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +70 -23
  242. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +29 -29
  243. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +138 -47
  244. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +5 -5
  245. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +23 -8
  246. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +147 -75
  247. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +522 -96
  248. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +27 -27
  249. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +116 -49
  250. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +3 -3
  251. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +15 -2
  252. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +9 -9
  253. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +42 -14
  254. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +63 -63
  255. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +228 -63
  256. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +57 -56
  257. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +244 -98
  258. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +5 -5
  259. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +25 -11
  260. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +125 -57
  261. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +533 -89
  262. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +3 -4
  263. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +15 -2
  264. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.c +46 -0
  265. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.h +133 -0
  266. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +8 -8
  267. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +17 -4
  268. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +15 -8
  269. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +56 -9
  270. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.c +35 -0
  271. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.h +96 -0
  272. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +16 -17
  273. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +81 -40
  274. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +56 -22
  275. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +223 -34
  276. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +32 -32
  277. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +137 -72
  278. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +3 -3
  279. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +19 -5
  280. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +48 -38
  281. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +276 -103
  282. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +51 -45
  283. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +203 -62
  284. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +48 -0
  285. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +177 -0
  286. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +10 -9
  287. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +55 -22
  288. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +144 -0
  289. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +536 -0
  290. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +153 -0
  291. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +550 -0
  292. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +51 -44
  293. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +165 -43
  294. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +35 -16
  295. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +148 -40
  296. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +339 -279
  297. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +1466 -543
  298. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +10 -10
  299. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +48 -10
  300. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +6 -7
  301. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +32 -6
  302. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.c +29 -0
  303. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +73 -0
  304. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +79 -0
  305. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +298 -0
  306. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +79 -0
  307. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +303 -0
  308. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +42 -0
  309. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +123 -0
  310. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +151 -112
  311. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +693 -244
  312. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +1 -2
  313. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +2 -1
  314. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +52 -32
  315. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +231 -59
  316. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +15 -18
  317. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +51 -28
  318. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +45 -44
  319. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +178 -74
  320. data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.c +2 -2
  321. data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.h +15 -2
  322. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.c +2 -2
  323. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +15 -2
  324. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +58 -51
  325. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +221 -135
  326. data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.c +2 -5
  327. data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.h +15 -2
  328. data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.c +2 -5
  329. data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.h +15 -2
  330. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +9 -10
  331. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +46 -19
  332. data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.c +2 -4
  333. data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.h +15 -2
  334. data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.c +2 -2
  335. data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.h +15 -2
  336. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +121 -0
  337. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +468 -0
  338. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.c +60 -0
  339. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.h +205 -0
  340. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +9 -8
  341. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +44 -14
  342. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +36 -0
  343. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +96 -0
  344. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +4 -4
  345. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +15 -2
  346. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +3 -3
  347. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +15 -2
  348. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +10 -9
  349. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +51 -12
  350. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +10 -11
  351. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +31 -6
  352. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +46 -0
  353. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +136 -0
  354. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +11 -11
  355. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +41 -4
  356. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +15 -15
  357. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +96 -11
  358. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +19 -19
  359. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +77 -14
  360. data/src/core/ext/upb-generated/envoy/type/v3/http.upb.c +1 -1
  361. data/src/core/ext/upb-generated/envoy/type/v3/http.upb.h +2 -1
  362. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +6 -6
  363. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +30 -5
  364. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +10 -10
  365. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +41 -4
  366. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.c +5 -5
  367. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +15 -2
  368. data/src/core/ext/upb-generated/google/api/annotations.upb.c +1 -1
  369. data/src/core/ext/upb-generated/google/api/annotations.upb.h +2 -1
  370. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +62 -62
  371. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +227 -84
  372. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +86 -69
  373. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +256 -72
  374. data/src/core/ext/upb-generated/google/api/http.upb.c +18 -18
  375. data/src/core/ext/upb-generated/google/api/http.upb.h +47 -10
  376. data/src/core/ext/upb-generated/google/protobuf/any.upb.c +4 -4
  377. data/src/core/ext/upb-generated/google/protobuf/any.upb.h +15 -2
  378. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +154 -154
  379. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +645 -320
  380. data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +4 -4
  381. data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +15 -2
  382. data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +2 -2
  383. data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +15 -2
  384. data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +15 -15
  385. data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +44 -7
  386. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +4 -4
  387. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +15 -2
  388. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +19 -19
  389. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +119 -10
  390. data/src/core/ext/upb-generated/google/rpc/status.upb.c +5 -5
  391. data/src/core/ext/upb-generated/google/rpc/status.upb.h +18 -5
  392. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +12 -12
  393. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +19 -5
  394. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +63 -63
  395. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +220 -87
  396. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +8 -8
  397. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +36 -9
  398. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +5 -5
  399. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +28 -3
  400. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +31 -31
  401. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +146 -35
  402. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c +55 -0
  403. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h +154 -0
  404. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +8 -8
  405. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +41 -4
  406. data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +4 -6
  407. data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +15 -2
  408. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c +1 -1
  409. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +2 -1
  410. data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +4 -4
  411. data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +17 -4
  412. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +3 -3
  413. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +15 -2
  414. data/src/core/ext/upb-generated/validate/validate.upb.c +243 -227
  415. data/src/core/ext/upb-generated/validate/validate.upb.h +626 -253
  416. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.c +58 -0
  417. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.h +182 -0
  418. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.c +28 -0
  419. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.h +66 -0
  420. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +52 -0
  421. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.h +155 -0
  422. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +42 -0
  423. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.h +90 -0
  424. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.c +36 -0
  425. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.h +100 -0
  426. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +54 -0
  427. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.h +178 -0
  428. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +36 -0
  429. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.h +91 -0
  430. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +58 -0
  431. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +130 -0
  432. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.c +33 -0
  433. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.h +83 -0
  434. data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.c +354 -0
  435. data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.h +140 -0
  436. data/src/core/ext/upbdefs-generated/envoy/annotations/deprecation.upbdefs.c +15 -7
  437. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +168 -170
  438. data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +424 -0
  439. data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.h +120 -0
  440. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +467 -429
  441. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.h +12 -2
  442. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/outlier_detection.upbdefs.c +12 -9
  443. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +156 -109
  444. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.h +25 -0
  445. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +89 -88
  446. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +156 -153
  447. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +240 -168
  448. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.h +20 -0
  449. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/proxy_protocol.upbdefs.c +4 -7
  450. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/resolver.upbdefs.c +59 -0
  451. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/resolver.upbdefs.h +40 -0
  452. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.c +37 -20
  453. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/udp_socket_config.upbdefs.c +52 -0
  454. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/udp_socket_config.upbdefs.h +35 -0
  455. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint.upbdefs.c +56 -59
  456. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +90 -63
  457. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.h +10 -0
  458. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.c +137 -122
  459. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.h +5 -0
  460. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.c +136 -120
  461. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.c +90 -0
  462. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.h +35 -0
  463. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.c +31 -26
  464. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.c +141 -0
  465. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.h +70 -0
  466. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +152 -0
  467. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +75 -0
  468. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +69 -51
  469. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.h +5 -0
  470. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +748 -681
  471. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +15 -0
  472. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/http_tracer.upbdefs.c +22 -25
  473. data/src/core/ext/upbdefs-generated/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.c +51 -0
  474. data/src/core/ext/upbdefs-generated/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.h +35 -0
  475. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.c +102 -0
  476. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.h +55 -0
  477. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +123 -0
  478. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.h +45 -0
  479. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +79 -0
  480. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.h +35 -0
  481. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +435 -379
  482. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +10 -0
  483. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.c +12 -16
  484. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +121 -91
  485. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.h +5 -0
  486. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.c +45 -53
  487. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +182 -180
  488. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.c +92 -102
  489. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.h +5 -0
  490. data/src/core/ext/upbdefs-generated/envoy/service/endpoint/v3/eds.upbdefs.c +32 -42
  491. data/src/core/ext/upbdefs-generated/envoy/service/listener/v3/lds.upbdefs.c +30 -40
  492. data/src/core/ext/upbdefs-generated/envoy/service/load_stats/v3/lrs.upbdefs.c +4 -7
  493. data/src/core/ext/upbdefs-generated/envoy/service/route/v3/rds.upbdefs.c +38 -44
  494. data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.c +163 -0
  495. data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.h +55 -0
  496. data/src/core/ext/upbdefs-generated/envoy/type/http/v3/path_transformation.upbdefs.c +64 -0
  497. data/src/core/ext/upbdefs-generated/envoy/type/http/v3/path_transformation.upbdefs.h +50 -0
  498. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/metadata.upbdefs.c +14 -13
  499. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.c +56 -0
  500. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.h +35 -0
  501. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +35 -32
  502. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/string.upbdefs.c +30 -33
  503. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.c +63 -0
  504. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.h +40 -0
  505. data/src/core/ext/upbdefs-generated/google/protobuf/any.upbdefs.c +8 -7
  506. data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c +100 -100
  507. data/src/core/ext/upbdefs-generated/google/protobuf/duration.upbdefs.c +9 -8
  508. data/src/core/ext/upbdefs-generated/google/protobuf/empty.upbdefs.c +8 -8
  509. data/src/core/ext/upbdefs-generated/google/protobuf/struct.upbdefs.c +8 -8
  510. data/src/core/ext/upbdefs-generated/google/protobuf/timestamp.upbdefs.c +9 -8
  511. data/src/core/ext/upbdefs-generated/google/protobuf/wrappers.upbdefs.c +8 -8
  512. data/src/core/ext/upbdefs-generated/google/rpc/status.upbdefs.c +4 -4
  513. data/src/core/ext/upbdefs-generated/udpa/annotations/migrate.upbdefs.c +5 -4
  514. data/src/core/ext/upbdefs-generated/udpa/annotations/security.upbdefs.c +19 -23
  515. data/src/core/ext/upbdefs-generated/udpa/annotations/sensitive.upbdefs.c +4 -3
  516. data/src/core/ext/upbdefs-generated/udpa/annotations/status.upbdefs.c +5 -3
  517. data/src/core/ext/upbdefs-generated/udpa/annotations/versioning.upbdefs.c +5 -4
  518. data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.c +182 -157
  519. data/src/core/ext/upbdefs-generated/xds/annotations/v3/status.upbdefs.c +75 -0
  520. data/src/core/ext/upbdefs-generated/xds/annotations/v3/status.upbdefs.h +50 -0
  521. data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.c +43 -0
  522. data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.h +35 -0
  523. data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.c +63 -0
  524. data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.h +40 -0
  525. data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.c +46 -0
  526. data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.h +40 -0
  527. data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.c +50 -0
  528. data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.h +35 -0
  529. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.c +68 -0
  530. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.h +40 -0
  531. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.c +51 -0
  532. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.h +35 -0
  533. data/src/core/ext/upbdefs-generated/xds/type/v3/typed_struct.upbdefs.c +45 -0
  534. data/src/core/ext/upbdefs-generated/xds/type/v3/typed_struct.upbdefs.h +35 -0
  535. data/src/core/ext/xds/certificate_provider_factory.h +1 -1
  536. data/src/core/ext/xds/certificate_provider_registry.cc +2 -2
  537. data/src/core/ext/xds/certificate_provider_store.cc +10 -7
  538. data/src/core/ext/xds/certificate_provider_store.h +15 -10
  539. data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +28 -3
  540. data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +3 -6
  541. data/src/core/ext/xds/xds_api.cc +2654 -808
  542. data/src/core/ext/xds/xds_api.h +460 -154
  543. data/src/core/ext/xds/xds_bootstrap.cc +139 -188
  544. data/src/core/ext/xds/xds_bootstrap.h +34 -18
  545. data/src/core/ext/xds/xds_certificate_provider.cc +237 -72
  546. data/src/core/ext/xds/xds_certificate_provider.h +104 -27
  547. data/src/core/ext/xds/xds_channel_args.h +5 -2
  548. data/src/core/ext/xds/xds_channel_stack_modifier.cc +113 -0
  549. data/src/core/ext/xds/xds_channel_stack_modifier.h +52 -0
  550. data/src/core/ext/xds/xds_client.cc +985 -429
  551. data/src/core/ext/xds/xds_client.h +100 -51
  552. data/src/core/ext/xds/xds_client_stats.cc +18 -16
  553. data/src/core/ext/xds/xds_client_stats.h +12 -11
  554. data/src/core/ext/xds/xds_http_fault_filter.cc +227 -0
  555. data/src/core/ext/xds/xds_http_fault_filter.h +64 -0
  556. data/src/core/ext/xds/xds_http_filters.cc +116 -0
  557. data/src/core/ext/xds/xds_http_filters.h +133 -0
  558. data/src/core/ext/xds/xds_server_config_fetcher.cc +544 -0
  559. data/src/core/lib/{iomgr → address_utils}/parse_address.cc +72 -68
  560. data/src/core/lib/{iomgr → address_utils}/parse_address.h +20 -16
  561. data/src/core/lib/{iomgr → address_utils}/sockaddr_utils.cc +131 -15
  562. data/src/core/lib/{iomgr → address_utils}/sockaddr_utils.h +37 -7
  563. data/src/core/lib/avl/avl.cc +5 -5
  564. data/src/core/lib/backoff/backoff.cc +1 -1
  565. data/src/core/lib/channel/call_tracer.h +85 -0
  566. data/src/core/lib/channel/channel_args.cc +34 -15
  567. data/src/core/lib/channel/channel_args.h +9 -0
  568. data/src/core/lib/channel/channel_stack.cc +27 -12
  569. data/src/core/lib/channel/channel_stack.h +18 -10
  570. data/src/core/lib/channel/channel_stack_builder.cc +6 -16
  571. data/src/core/lib/channel/channel_stack_builder.h +1 -9
  572. data/src/core/lib/channel/channel_trace.cc +5 -4
  573. data/src/core/lib/channel/channel_trace.h +3 -2
  574. data/src/core/lib/channel/channelz.cc +162 -63
  575. data/src/core/lib/channel/channelz.h +62 -31
  576. data/src/core/lib/channel/channelz_registry.cc +22 -7
  577. data/src/core/lib/channel/channelz_registry.h +1 -2
  578. data/src/core/lib/channel/connected_channel.cc +6 -7
  579. data/src/core/lib/channel/connected_channel.h +1 -2
  580. data/src/core/lib/channel/context.h +3 -0
  581. data/src/core/lib/channel/handshaker.cc +13 -53
  582. data/src/core/lib/channel/handshaker.h +7 -25
  583. data/src/core/lib/channel/handshaker_factory.h +10 -2
  584. data/src/core/lib/channel/handshaker_registry.cc +15 -70
  585. data/src/core/lib/channel/handshaker_registry.h +29 -12
  586. data/src/core/lib/channel/status_util.cc +12 -2
  587. data/src/core/lib/channel/status_util.h +11 -2
  588. data/src/core/lib/compression/algorithm_metadata.h +1 -0
  589. data/src/core/lib/compression/compression.cc +2 -2
  590. data/src/core/lib/compression/compression_args.cc +11 -7
  591. data/src/core/lib/compression/compression_internal.cc +4 -6
  592. data/src/core/lib/compression/compression_internal.h +1 -1
  593. data/src/core/lib/compression/message_compress.cc +2 -2
  594. data/src/core/lib/compression/stream_compression.cc +2 -1
  595. data/src/core/lib/compression/stream_compression.h +3 -2
  596. data/src/core/lib/compression/stream_compression_gzip.cc +2 -1
  597. data/src/core/lib/compression/stream_compression_gzip.h +1 -1
  598. data/src/core/lib/compression/stream_compression_identity.cc +2 -1
  599. data/src/core/lib/compression/stream_compression_identity.h +1 -1
  600. data/src/core/lib/config/core_configuration.cc +96 -0
  601. data/src/core/lib/config/core_configuration.h +146 -0
  602. data/src/core/lib/debug/stats.cc +1 -1
  603. data/src/core/lib/debug/stats.h +4 -3
  604. data/src/core/lib/debug/stats_data.cc +15 -14
  605. data/src/core/lib/debug/stats_data.h +14 -13
  606. data/src/core/lib/debug/trace.cc +1 -0
  607. data/src/core/lib/debug/trace.h +2 -1
  608. data/src/core/lib/event_engine/endpoint_config.cc +45 -0
  609. data/src/core/lib/event_engine/endpoint_config_internal.h +42 -0
  610. data/src/core/lib/event_engine/event_engine.cc +50 -0
  611. data/src/core/lib/event_engine/sockaddr.cc +40 -0
  612. data/src/core/lib/event_engine/sockaddr.h +44 -0
  613. data/src/core/lib/gpr/alloc.cc +7 -5
  614. data/src/core/lib/gpr/atm.cc +1 -1
  615. data/src/core/lib/gpr/cpu_posix.cc +1 -1
  616. data/src/core/lib/gpr/env_linux.cc +1 -2
  617. data/src/core/lib/gpr/env_posix.cc +2 -3
  618. data/src/core/lib/gpr/log.cc +61 -19
  619. data/src/core/lib/gpr/log_android.cc +3 -2
  620. data/src/core/lib/gpr/log_linux.cc +10 -5
  621. data/src/core/lib/gpr/log_posix.cc +9 -4
  622. data/src/core/lib/gpr/log_windows.cc +3 -1
  623. data/src/core/lib/gpr/murmur_hash.cc +4 -2
  624. data/src/core/lib/gpr/spinlock.h +10 -2
  625. data/src/core/lib/gpr/string.cc +24 -23
  626. data/src/core/lib/gpr/string.h +7 -8
  627. data/src/core/lib/gpr/sync.cc +6 -6
  628. data/src/core/lib/gpr/sync_abseil.cc +10 -12
  629. data/src/core/lib/gpr/sync_posix.cc +3 -3
  630. data/src/core/lib/gpr/sync_windows.cc +2 -2
  631. data/src/core/lib/gpr/time.cc +15 -14
  632. data/src/core/lib/gpr/time_windows.cc +3 -2
  633. data/src/core/lib/gpr/tls.h +119 -40
  634. data/src/core/lib/gpr/tmpfile_posix.cc +1 -2
  635. data/src/core/lib/gpr/useful.h +79 -32
  636. data/src/core/lib/gpr/wrap_memcpy.cc +2 -1
  637. data/src/core/lib/gprpp/arena.cc +2 -1
  638. data/src/core/lib/gprpp/arena.h +18 -7
  639. data/src/core/lib/gprpp/atomic_utils.h +47 -0
  640. data/src/core/lib/gprpp/bitset.h +188 -0
  641. data/src/core/lib/gprpp/chunked_vector.h +211 -0
  642. data/src/core/lib/gprpp/construct_destruct.h +39 -0
  643. data/src/core/lib/gprpp/dual_ref_counted.h +28 -29
  644. data/src/core/lib/gprpp/fork.cc +14 -12
  645. data/src/core/lib/gprpp/fork.h +4 -4
  646. data/src/core/lib/gprpp/global_config.h +1 -2
  647. data/src/core/lib/gprpp/global_config_env.cc +7 -7
  648. data/src/core/lib/gprpp/global_config_generic.h +2 -2
  649. data/src/core/lib/gprpp/manual_constructor.h +9 -6
  650. data/src/core/lib/gprpp/match.h +73 -0
  651. data/src/core/lib/gprpp/memory.h +9 -3
  652. data/src/core/lib/gprpp/mpscq.cc +9 -9
  653. data/src/core/lib/gprpp/mpscq.h +6 -5
  654. data/src/core/lib/gprpp/orphanable.h +6 -6
  655. data/src/core/lib/gprpp/overload.h +59 -0
  656. data/src/core/lib/gprpp/ref_counted.h +48 -34
  657. data/src/core/lib/gprpp/ref_counted_ptr.h +11 -1
  658. data/src/core/lib/gprpp/status_helper.cc +427 -0
  659. data/src/core/lib/gprpp/status_helper.h +194 -0
  660. data/src/core/lib/gprpp/sync.h +106 -43
  661. data/src/core/lib/gprpp/table.h +411 -0
  662. data/src/core/lib/gprpp/thd.h +1 -1
  663. data/src/core/lib/gprpp/thd_posix.cc +11 -6
  664. data/src/core/lib/gprpp/thd_windows.cc +7 -12
  665. data/src/core/lib/gprpp/time_util.cc +77 -0
  666. data/src/core/lib/gprpp/time_util.h +42 -0
  667. data/src/core/lib/http/format_request.cc +1 -0
  668. data/src/core/lib/http/format_request.h +1 -0
  669. data/src/core/lib/http/httpcli.cc +203 -185
  670. data/src/core/lib/http/httpcli.h +5 -3
  671. data/src/core/lib/http/httpcli_security_connector.cc +19 -18
  672. data/src/core/lib/http/parser.cc +19 -20
  673. data/src/core/lib/http/parser.h +5 -4
  674. data/src/core/lib/iomgr/buffer_list.cc +10 -11
  675. data/src/core/lib/iomgr/buffer_list.h +6 -8
  676. data/src/core/lib/iomgr/call_combiner.cc +46 -21
  677. data/src/core/lib/iomgr/call_combiner.h +12 -14
  678. data/src/core/lib/iomgr/cfstream_handle.cc +6 -6
  679. data/src/core/lib/iomgr/cfstream_handle.h +1 -1
  680. data/src/core/lib/iomgr/closure.h +7 -6
  681. data/src/core/lib/iomgr/combiner.cc +25 -36
  682. data/src/core/lib/iomgr/combiner.h +3 -2
  683. data/src/core/lib/iomgr/dualstack_socket_posix.cc +1 -0
  684. data/src/core/lib/iomgr/endpoint.cc +1 -5
  685. data/src/core/lib/iomgr/endpoint.h +3 -5
  686. data/src/core/lib/iomgr/endpoint_cfstream.cc +27 -39
  687. data/src/core/lib/iomgr/endpoint_cfstream.h +1 -1
  688. data/src/core/lib/iomgr/endpoint_pair.h +1 -0
  689. data/src/core/lib/iomgr/endpoint_pair_event_engine.cc +32 -0
  690. data/src/core/lib/iomgr/endpoint_pair_posix.cc +15 -11
  691. data/src/core/lib/iomgr/endpoint_pair_windows.cc +17 -9
  692. data/src/core/lib/iomgr/error.cc +277 -105
  693. data/src/core/lib/iomgr/error.h +280 -114
  694. data/src/core/lib/iomgr/error_cfstream.cc +10 -4
  695. data/src/core/lib/iomgr/error_cfstream.h +2 -2
  696. data/src/core/lib/iomgr/error_internal.h +7 -2
  697. data/src/core/lib/iomgr/ev_apple.cc +16 -13
  698. data/src/core/lib/iomgr/ev_apple.h +1 -1
  699. data/src/core/lib/iomgr/ev_epoll1_linux.cc +53 -53
  700. data/src/core/lib/iomgr/ev_epollex_linux.cc +81 -81
  701. data/src/core/lib/iomgr/ev_poll_posix.cc +70 -68
  702. data/src/core/lib/iomgr/ev_posix.cc +13 -13
  703. data/src/core/lib/iomgr/ev_posix.h +9 -9
  704. data/src/core/lib/iomgr/event_engine/closure.cc +77 -0
  705. data/src/core/lib/iomgr/event_engine/closure.h +42 -0
  706. data/src/core/lib/iomgr/event_engine/endpoint.cc +173 -0
  707. data/src/core/lib/iomgr/event_engine/endpoint.h +52 -0
  708. data/src/core/lib/iomgr/event_engine/iomgr.cc +104 -0
  709. data/src/core/lib/iomgr/event_engine/iomgr.h +42 -0
  710. data/src/core/lib/iomgr/event_engine/pollset.cc +88 -0
  711. data/src/core/lib/iomgr/event_engine/pollset.h +25 -0
  712. data/src/core/lib/iomgr/event_engine/promise.h +51 -0
  713. data/src/core/lib/iomgr/event_engine/resolved_address_internal.cc +41 -0
  714. data/src/core/lib/iomgr/event_engine/resolved_address_internal.h +35 -0
  715. data/src/core/lib/iomgr/event_engine/resolver.cc +114 -0
  716. data/src/core/lib/iomgr/event_engine/tcp.cc +293 -0
  717. data/src/core/lib/iomgr/event_engine/timer.cc +62 -0
  718. data/src/core/lib/iomgr/exec_ctx.cc +14 -11
  719. data/src/core/lib/iomgr/exec_ctx.h +21 -28
  720. data/src/core/lib/iomgr/executor/mpmcqueue.cc +15 -16
  721. data/src/core/lib/iomgr/executor/mpmcqueue.h +7 -11
  722. data/src/core/lib/iomgr/executor/threadpool.cc +4 -5
  723. data/src/core/lib/iomgr/executor/threadpool.h +5 -4
  724. data/src/core/lib/iomgr/executor.cc +19 -33
  725. data/src/core/lib/iomgr/executor.h +3 -3
  726. data/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc +2 -2
  727. data/src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc +2 -2
  728. data/src/core/lib/iomgr/internal_errqueue.cc +3 -2
  729. data/src/core/lib/iomgr/iocp_windows.cc +1 -0
  730. data/src/core/lib/iomgr/iomgr.cc +6 -4
  731. data/src/core/lib/iomgr/iomgr.h +3 -3
  732. data/src/core/lib/iomgr/iomgr_custom.cc +3 -3
  733. data/src/core/lib/iomgr/iomgr_custom.h +2 -2
  734. data/src/core/lib/iomgr/iomgr_internal.cc +8 -12
  735. data/src/core/lib/iomgr/iomgr_internal.h +6 -5
  736. data/src/core/lib/iomgr/iomgr_posix.cc +3 -2
  737. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +42 -13
  738. data/src/core/lib/iomgr/iomgr_windows.cc +2 -3
  739. data/src/core/lib/iomgr/is_epollexclusive_available.cc +4 -4
  740. data/src/core/lib/iomgr/load_file.cc +6 -6
  741. data/src/core/lib/iomgr/load_file.h +2 -2
  742. data/src/core/lib/iomgr/lockfree_event.cc +38 -15
  743. data/src/core/lib/iomgr/lockfree_event.h +2 -2
  744. data/src/core/lib/iomgr/polling_entity.cc +2 -2
  745. data/src/core/lib/iomgr/pollset.cc +5 -5
  746. data/src/core/lib/iomgr/pollset.h +9 -9
  747. data/src/core/lib/iomgr/pollset_custom.cc +10 -11
  748. data/src/core/lib/iomgr/pollset_custom.h +3 -1
  749. data/src/core/lib/iomgr/pollset_set_custom.cc +2 -3
  750. data/src/core/lib/iomgr/pollset_set_windows.cc +1 -0
  751. data/src/core/lib/iomgr/pollset_windows.cc +5 -5
  752. data/src/core/lib/iomgr/port.h +7 -10
  753. data/src/core/lib/iomgr/python_util.h +4 -3
  754. data/src/core/lib/iomgr/resolve_address.cc +14 -9
  755. data/src/core/lib/iomgr/resolve_address.h +12 -10
  756. data/src/core/lib/iomgr/resolve_address_custom.cc +14 -13
  757. data/src/core/lib/iomgr/resolve_address_custom.h +3 -4
  758. data/src/core/lib/iomgr/resolve_address_posix.cc +10 -14
  759. data/src/core/lib/iomgr/resolve_address_windows.cc +10 -12
  760. data/src/core/lib/iomgr/resource_quota.cc +152 -62
  761. data/src/core/lib/iomgr/resource_quota.h +66 -17
  762. data/src/core/lib/iomgr/sockaddr.h +2 -1
  763. data/src/core/lib/iomgr/socket_factory_posix.cc +8 -7
  764. data/src/core/lib/iomgr/socket_factory_posix.h +1 -0
  765. data/src/core/lib/iomgr/socket_mutator.cc +20 -6
  766. data/src/core/lib/iomgr/socket_mutator.h +27 -3
  767. data/src/core/lib/iomgr/socket_utils_common_posix.cc +29 -27
  768. data/src/core/lib/iomgr/socket_utils_linux.cc +4 -4
  769. data/src/core/lib/iomgr/socket_utils_posix.cc +2 -2
  770. data/src/core/lib/iomgr/socket_utils_posix.h +22 -22
  771. data/src/core/lib/iomgr/socket_utils_windows.cc +2 -2
  772. data/src/core/lib/iomgr/tcp_client.cc +5 -3
  773. data/src/core/lib/iomgr/tcp_client.h +4 -0
  774. data/src/core/lib/iomgr/tcp_client_cfstream.cc +18 -26
  775. data/src/core/lib/iomgr/tcp_client_custom.cc +19 -27
  776. data/src/core/lib/iomgr/tcp_client_posix.cc +56 -47
  777. data/src/core/lib/iomgr/tcp_client_posix.h +8 -6
  778. data/src/core/lib/iomgr/tcp_client_windows.cc +23 -14
  779. data/src/core/lib/iomgr/tcp_custom.cc +46 -55
  780. data/src/core/lib/iomgr/tcp_custom.h +15 -13
  781. data/src/core/lib/iomgr/tcp_posix.cc +119 -145
  782. data/src/core/lib/iomgr/tcp_posix.h +19 -12
  783. data/src/core/lib/iomgr/tcp_server.cc +9 -7
  784. data/src/core/lib/iomgr/tcp_server.h +18 -14
  785. data/src/core/lib/iomgr/tcp_server_custom.cc +63 -73
  786. data/src/core/lib/iomgr/tcp_server_posix.cc +49 -35
  787. data/src/core/lib/iomgr/tcp_server_utils_posix.h +16 -12
  788. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +22 -20
  789. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +11 -12
  790. data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc +4 -4
  791. data/src/core/lib/iomgr/tcp_server_windows.cc +40 -36
  792. data/src/core/lib/iomgr/tcp_windows.cc +21 -40
  793. data/src/core/lib/iomgr/tcp_windows.h +4 -3
  794. data/src/core/lib/iomgr/timer.cc +1 -0
  795. data/src/core/lib/iomgr/timer.h +7 -3
  796. data/src/core/lib/iomgr/timer_custom.cc +7 -6
  797. data/src/core/lib/iomgr/timer_custom.h +1 -1
  798. data/src/core/lib/iomgr/timer_generic.cc +32 -62
  799. data/src/core/lib/iomgr/timer_generic.h +1 -0
  800. data/src/core/lib/iomgr/timer_heap.cc +2 -3
  801. data/src/core/lib/iomgr/timer_manager.cc +4 -4
  802. data/src/core/lib/iomgr/unix_sockets_posix.cc +21 -24
  803. data/src/core/lib/iomgr/unix_sockets_posix.h +4 -5
  804. data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +10 -7
  805. data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +3 -3
  806. data/src/core/lib/iomgr/wakeup_fd_nospecial.cc +2 -1
  807. data/src/core/lib/iomgr/wakeup_fd_pipe.cc +6 -7
  808. data/src/core/lib/iomgr/wakeup_fd_posix.cc +4 -3
  809. data/src/core/lib/iomgr/wakeup_fd_posix.h +8 -6
  810. data/src/core/lib/iomgr/work_serializer.cc +4 -4
  811. data/src/core/lib/iomgr/work_serializer.h +18 -2
  812. data/src/core/lib/json/json.h +11 -1
  813. data/src/core/lib/json/json_reader.cc +14 -23
  814. data/src/core/lib/json/json_util.cc +68 -0
  815. data/src/core/lib/json/json_util.h +65 -115
  816. data/src/core/lib/json/json_writer.cc +0 -3
  817. data/src/core/lib/matchers/matchers.cc +327 -0
  818. data/src/core/lib/matchers/matchers.h +160 -0
  819. data/src/core/lib/profiling/basic_timers.cc +8 -6
  820. data/src/core/lib/profiling/stap_timers.cc +2 -2
  821. data/src/core/lib/security/authorization/authorization_engine.h +13 -53
  822. data/src/core/lib/security/authorization/authorization_policy_provider.h +33 -0
  823. data/src/core/lib/security/authorization/authorization_policy_provider_vtable.cc +46 -0
  824. data/src/core/lib/security/authorization/evaluate_args.cc +126 -66
  825. data/src/core/lib/security/authorization/evaluate_args.h +47 -15
  826. data/src/core/lib/security/authorization/sdk_server_authz_filter.cc +171 -0
  827. data/src/core/lib/security/authorization/sdk_server_authz_filter.h +67 -0
  828. data/src/core/lib/security/context/security_context.cc +15 -11
  829. data/src/core/lib/security/credentials/alts/alts_credentials.cc +2 -1
  830. data/src/core/lib/security/credentials/alts/alts_credentials.h +1 -1
  831. data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +1 -1
  832. data/src/core/lib/security/credentials/alts/check_gcp_environment_linux.cc +2 -2
  833. data/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc +2 -2
  834. data/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc +2 -2
  835. data/src/core/lib/security/credentials/composite/composite_credentials.cc +9 -8
  836. data/src/core/lib/security/credentials/composite/composite_credentials.h +2 -2
  837. data/src/core/lib/security/credentials/credentials.cc +16 -14
  838. data/src/core/lib/security/credentials/credentials.h +11 -5
  839. data/src/core/lib/security/credentials/credentials_metadata.cc +2 -3
  840. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +404 -0
  841. data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +81 -0
  842. data/src/core/lib/security/credentials/external/aws_request_signer.cc +20 -14
  843. data/src/core/lib/security/credentials/external/aws_request_signer.h +2 -3
  844. data/src/core/lib/security/credentials/external/external_account_credentials.cc +270 -54
  845. data/src/core/lib/security/credentials/external/external_account_credentials.h +16 -12
  846. data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +8 -8
  847. data/src/core/lib/security/credentials/external/file_external_account_credentials.h +6 -6
  848. data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +26 -26
  849. data/src/core/lib/security/credentials/external/url_external_account_credentials.h +13 -12
  850. data/src/core/lib/security/credentials/fake/fake_credentials.cc +5 -4
  851. data/src/core/lib/security/credentials/fake/fake_credentials.h +2 -2
  852. data/src/core/lib/security/credentials/google_default/credentials_generic.cc +1 -2
  853. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +92 -31
  854. data/src/core/lib/security/credentials/iam/iam_credentials.cc +4 -3
  855. data/src/core/lib/security/credentials/iam/iam_credentials.h +2 -2
  856. data/src/core/lib/security/credentials/insecure/insecure_credentials.cc +18 -5
  857. data/src/core/lib/security/credentials/jwt/json_token.cc +4 -7
  858. data/src/core/lib/security/credentials/jwt/json_token.h +2 -1
  859. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +34 -17
  860. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +13 -5
  861. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +15 -22
  862. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +3 -3
  863. data/src/core/lib/security/credentials/local/local_credentials.cc +2 -1
  864. data/src/core/lib/security/credentials/local/local_credentials.h +1 -1
  865. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +57 -66
  866. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +11 -9
  867. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +10 -12
  868. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -2
  869. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +11 -10
  870. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +2 -3
  871. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +12 -15
  872. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +20 -21
  873. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +382 -5
  874. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +74 -1
  875. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +5 -1
  876. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +2 -3
  877. data/src/core/lib/security/credentials/tls/tls_credentials.cc +3 -2
  878. data/src/core/lib/security/credentials/tls/tls_credentials.h +1 -1
  879. data/src/core/lib/security/credentials/tls/tls_utils.cc +123 -0
  880. data/src/core/lib/security/credentials/tls/tls_utils.h +51 -0
  881. data/src/core/lib/security/credentials/xds/xds_credentials.cc +209 -10
  882. data/src/core/lib/security/credentials/xds/xds_credentials.h +27 -9
  883. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +14 -4
  884. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +20 -12
  885. data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +50 -17
  886. data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +35 -8
  887. data/src/core/lib/security/security_connector/load_system_roots_fallback.cc +1 -0
  888. data/src/core/lib/security/security_connector/load_system_roots_linux.cc +4 -4
  889. data/src/core/lib/security/security_connector/local/local_security_connector.cc +23 -10
  890. data/src/core/lib/security/security_connector/security_connector.cc +12 -6
  891. data/src/core/lib/security/security_connector/security_connector.h +10 -5
  892. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +24 -17
  893. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +1 -2
  894. data/src/core/lib/security/security_connector/ssl_utils.cc +41 -14
  895. data/src/core/lib/security/security_connector/ssl_utils.h +16 -23
  896. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +156 -113
  897. data/src/core/lib/security/security_connector/tls/tls_security_connector.h +67 -52
  898. data/src/core/lib/security/transport/auth_filters.h +1 -0
  899. data/src/core/lib/security/transport/client_auth_filter.cc +27 -21
  900. data/src/core/lib/security/transport/secure_endpoint.cc +10 -20
  901. data/src/core/lib/security/transport/secure_endpoint.h +1 -0
  902. data/src/core/lib/security/transport/security_handshaker.cc +158 -90
  903. data/src/core/lib/security/transport/security_handshaker.h +2 -1
  904. data/src/core/lib/security/transport/server_auth_filter.cc +20 -16
  905. data/src/core/lib/security/transport/tsi_error.cc +5 -6
  906. data/src/core/lib/security/transport/tsi_error.h +2 -1
  907. data/src/core/lib/security/util/json_util.cc +8 -10
  908. data/src/core/lib/security/util/json_util.h +1 -1
  909. data/src/core/lib/slice/percent_encoding.cc +73 -30
  910. data/src/core/lib/slice/percent_encoding.h +29 -28
  911. data/src/core/lib/slice/slice.cc +14 -21
  912. data/src/core/lib/{gpr/tls_pthread.cc → slice/slice_api.cc} +15 -6
  913. data/src/core/lib/slice/slice_buffer.cc +6 -7
  914. data/src/core/lib/slice/slice_intern.cc +19 -27
  915. data/src/core/lib/slice/slice_internal.h +4 -246
  916. data/src/core/lib/slice/slice_refcount.cc +17 -0
  917. data/src/core/lib/slice/slice_refcount.h +121 -0
  918. data/src/core/lib/slice/slice_refcount_base.h +173 -0
  919. data/src/core/lib/slice/slice_split.cc +100 -0
  920. data/src/core/lib/slice/slice_split.h +40 -0
  921. data/src/core/lib/slice/slice_string_helpers.cc +0 -83
  922. data/src/core/lib/slice/slice_string_helpers.h +0 -11
  923. data/src/core/lib/slice/static_slice.cc +529 -0
  924. data/src/core/lib/slice/static_slice.h +331 -0
  925. data/src/core/lib/surface/api_trace.cc +2 -1
  926. data/src/core/lib/surface/api_trace.h +1 -0
  927. data/src/core/lib/surface/builtins.cc +49 -0
  928. data/src/core/lib/surface/builtins.h +26 -0
  929. data/src/core/lib/surface/byte_buffer_reader.cc +1 -1
  930. data/src/core/lib/surface/call.cc +198 -186
  931. data/src/core/lib/surface/call.h +10 -5
  932. data/src/core/lib/surface/call_details.cc +10 -10
  933. data/src/core/lib/surface/call_log_batch.cc +2 -2
  934. data/src/core/lib/surface/channel.cc +57 -51
  935. data/src/core/lib/surface/channel.h +19 -14
  936. data/src/core/lib/surface/channel_init.cc +23 -76
  937. data/src/core/lib/surface/channel_init.h +52 -44
  938. data/src/core/lib/surface/channel_ping.cc +2 -3
  939. data/src/core/lib/surface/channel_stack_type.cc +2 -1
  940. data/src/core/lib/surface/completion_queue.cc +140 -145
  941. data/src/core/lib/surface/completion_queue.h +18 -17
  942. data/src/core/lib/surface/completion_queue_factory.cc +3 -3
  943. data/src/core/lib/surface/completion_queue_factory.h +1 -0
  944. data/src/core/lib/surface/event_string.cc +1 -0
  945. data/src/core/lib/surface/init.cc +18 -65
  946. data/src/core/lib/surface/init.h +10 -2
  947. data/src/core/lib/surface/init_secure.cc +36 -14
  948. data/src/core/lib/surface/lame_client.cc +62 -61
  949. data/src/core/lib/surface/lame_client.h +5 -0
  950. data/src/core/lib/surface/metadata_array.cc +2 -2
  951. data/src/core/lib/surface/server.cc +167 -116
  952. data/src/core/lib/surface/server.h +140 -40
  953. data/src/core/lib/surface/validate_metadata.cc +55 -24
  954. data/src/core/lib/surface/validate_metadata.h +3 -2
  955. data/src/core/lib/surface/version.cc +2 -2
  956. data/src/core/lib/transport/bdp_estimator.cc +1 -1
  957. data/src/core/lib/transport/byte_stream.cc +5 -5
  958. data/src/core/lib/transport/byte_stream.h +9 -8
  959. data/src/core/lib/transport/connectivity_state.cc +9 -6
  960. data/src/core/lib/transport/connectivity_state.h +8 -6
  961. data/src/core/lib/transport/error_utils.cc +64 -27
  962. data/src/core/lib/transport/error_utils.h +13 -7
  963. data/src/core/lib/transport/metadata.cc +47 -22
  964. data/src/core/lib/transport/metadata.h +15 -12
  965. data/src/core/lib/transport/metadata_batch.cc +41 -339
  966. data/src/core/lib/transport/metadata_batch.h +932 -68
  967. data/src/core/lib/transport/parsed_metadata.h +263 -0
  968. data/src/core/lib/transport/pid_controller.cc +4 -4
  969. data/src/core/lib/transport/static_metadata.cc +715 -847
  970. data/src/core/lib/transport/static_metadata.h +115 -379
  971. data/src/core/lib/transport/status_metadata.cc +5 -3
  972. data/src/core/lib/transport/transport.cc +8 -8
  973. data/src/core/lib/transport/transport.h +12 -10
  974. data/src/core/lib/transport/transport_op_string.cc +46 -26
  975. data/src/core/lib/uri/uri_parser.cc +131 -249
  976. data/src/core/lib/uri/uri_parser.h +57 -21
  977. data/src/core/plugin_registry/grpc_plugin_registry.cc +101 -44
  978. data/src/core/tsi/alts/crypt/aes_gcm.cc +6 -3
  979. data/src/core/tsi/alts/crypt/gsec.cc +5 -4
  980. data/src/core/tsi/alts/crypt/gsec.h +5 -0
  981. data/src/core/tsi/alts/frame_protector/alts_frame_protector.cc +13 -12
  982. data/src/core/tsi/alts/frame_protector/frame_handler.cc +18 -17
  983. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +27 -33
  984. data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +2 -3
  985. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +57 -51
  986. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +1 -1
  987. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +2 -1
  988. data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +1 -3
  989. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +2 -2
  990. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +1 -1
  991. data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc +8 -6
  992. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +6 -6
  993. data/src/core/tsi/fake_transport_security.cc +31 -12
  994. data/src/core/tsi/local_transport_security.cc +36 -73
  995. data/src/core/tsi/ssl/session_cache/ssl_session.h +0 -3
  996. data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -1
  997. data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +20 -55
  998. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +6 -7
  999. data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +2 -2
  1000. data/src/core/tsi/ssl_transport_security.cc +115 -77
  1001. data/src/core/tsi/ssl_transport_security.h +12 -14
  1002. data/src/core/tsi/transport_security.cc +21 -9
  1003. data/src/core/tsi/transport_security.h +16 -1
  1004. data/src/core/tsi/transport_security_grpc.h +1 -0
  1005. data/src/core/tsi/transport_security_interface.h +27 -1
  1006. data/src/ruby/bin/math_services_pb.rb +1 -1
  1007. data/src/ruby/ext/grpc/extconf.rb +21 -8
  1008. data/src/ruby/ext/grpc/rb_byte_buffer.c +2 -1
  1009. data/src/ruby/ext/grpc/rb_call.c +5 -5
  1010. data/src/ruby/ext/grpc/rb_call_credentials.c +5 -5
  1011. data/src/ruby/ext/grpc/rb_channel.c +19 -8
  1012. data/src/ruby/ext/grpc/rb_channel_args.c +2 -2
  1013. data/src/ruby/ext/grpc/rb_channel_credentials.c +15 -5
  1014. data/src/ruby/ext/grpc/rb_channel_credentials.h +5 -0
  1015. data/src/ruby/ext/grpc/rb_completion_queue.c +3 -2
  1016. data/src/ruby/ext/grpc/rb_compression_options.c +6 -5
  1017. data/src/ruby/ext/grpc/rb_enable_cpp.cc +1 -1
  1018. data/src/ruby/ext/grpc/rb_event_thread.c +4 -2
  1019. data/src/ruby/ext/grpc/rb_grpc.c +9 -4
  1020. data/src/ruby/ext/grpc/rb_grpc.h +1 -0
  1021. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +24 -0
  1022. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +50 -14
  1023. data/src/ruby/ext/grpc/rb_server.c +19 -6
  1024. data/src/ruby/ext/grpc/rb_server_credentials.c +22 -6
  1025. data/src/ruby/ext/grpc/rb_server_credentials.h +5 -0
  1026. data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +218 -0
  1027. data/src/ruby/ext/grpc/rb_xds_channel_credentials.h +37 -0
  1028. data/src/ruby/ext/grpc/rb_xds_server_credentials.c +170 -0
  1029. data/src/ruby/ext/grpc/rb_xds_server_credentials.h +37 -0
  1030. data/src/ruby/lib/grpc/generic/client_stub.rb +4 -2
  1031. data/src/ruby/lib/grpc/version.rb +1 -1
  1032. data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +1 -1
  1033. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +35 -0
  1034. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +2 -2
  1035. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +23 -5
  1036. data/src/ruby/spec/call_spec.rb +1 -1
  1037. data/src/ruby/spec/channel_credentials_spec.rb +32 -0
  1038. data/src/ruby/spec/channel_spec.rb +17 -6
  1039. data/src/ruby/spec/client_auth_spec.rb +27 -1
  1040. data/src/ruby/spec/client_server_spec.rb +1 -1
  1041. data/src/ruby/spec/errors_spec.rb +1 -1
  1042. data/src/ruby/spec/generic/active_call_spec.rb +2 -2
  1043. data/src/ruby/spec/generic/client_stub_spec.rb +4 -4
  1044. data/src/ruby/spec/generic/rpc_server_spec.rb +1 -1
  1045. data/src/ruby/spec/pb/codegen/package_option_spec.rb +2 -6
  1046. data/src/ruby/spec/server_credentials_spec.rb +25 -0
  1047. data/src/ruby/spec/server_spec.rb +22 -0
  1048. data/third_party/abseil-cpp/absl/algorithm/container.h +3 -3
  1049. data/third_party/abseil-cpp/absl/base/attributes.h +24 -4
  1050. data/third_party/abseil-cpp/absl/base/call_once.h +2 -9
  1051. data/third_party/abseil-cpp/absl/base/config.h +37 -9
  1052. data/third_party/abseil-cpp/absl/base/dynamic_annotations.h +24 -10
  1053. data/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +4 -1
  1054. data/third_party/abseil-cpp/absl/base/internal/endian.h +61 -0
  1055. data/third_party/abseil-cpp/absl/base/internal/low_level_scheduling.h +2 -3
  1056. data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +34 -32
  1057. data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +16 -6
  1058. data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +11 -2
  1059. data/third_party/abseil-cpp/absl/base/internal/spinlock.h +14 -5
  1060. data/third_party/abseil-cpp/absl/base/internal/spinlock_akaros.inc +2 -2
  1061. data/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc +3 -3
  1062. data/third_party/abseil-cpp/absl/base/internal/spinlock_posix.inc +2 -2
  1063. data/third_party/abseil-cpp/absl/base/internal/spinlock_wait.h +11 -11
  1064. data/third_party/abseil-cpp/absl/base/internal/spinlock_win32.inc +5 -5
  1065. data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +1 -1
  1066. data/third_party/abseil-cpp/absl/base/internal/thread_identity.cc +9 -6
  1067. data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +54 -48
  1068. data/third_party/abseil-cpp/absl/base/internal/throw_delegate.cc +111 -7
  1069. data/third_party/abseil-cpp/absl/base/internal/unaligned_access.h +0 -76
  1070. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +1 -3
  1071. data/third_party/abseil-cpp/absl/base/log_severity.h +4 -4
  1072. data/third_party/abseil-cpp/absl/base/macros.h +11 -0
  1073. data/third_party/abseil-cpp/absl/base/optimization.h +10 -7
  1074. data/third_party/abseil-cpp/absl/base/options.h +1 -1
  1075. data/third_party/abseil-cpp/absl/base/port.h +0 -1
  1076. data/third_party/abseil-cpp/absl/base/thread_annotations.h +1 -1
  1077. data/third_party/abseil-cpp/absl/container/fixed_array.h +2 -2
  1078. data/third_party/abseil-cpp/absl/container/flat_hash_map.h +606 -0
  1079. data/third_party/abseil-cpp/absl/container/inlined_vector.h +5 -3
  1080. data/third_party/abseil-cpp/absl/container/internal/compressed_tuple.h +1 -1
  1081. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +5 -1
  1082. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +2 -1
  1083. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc +2 -1
  1084. data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +141 -66
  1085. data/third_party/abseil-cpp/absl/container/internal/layout.h +4 -4
  1086. data/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h +197 -0
  1087. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +14 -1
  1088. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +136 -136
  1089. data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +16 -12
  1090. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +5 -2
  1091. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h +3 -12
  1092. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +6 -1
  1093. data/third_party/abseil-cpp/absl/debugging/internal/symbolize.h +3 -5
  1094. data/third_party/abseil-cpp/absl/debugging/symbolize_darwin.inc +2 -2
  1095. data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +2 -2
  1096. data/third_party/abseil-cpp/absl/hash/internal/city.cc +15 -12
  1097. data/third_party/abseil-cpp/absl/hash/internal/city.h +1 -19
  1098. data/third_party/abseil-cpp/absl/hash/internal/hash.cc +25 -10
  1099. data/third_party/abseil-cpp/absl/hash/internal/hash.h +86 -37
  1100. data/third_party/abseil-cpp/absl/hash/internal/wyhash.cc +111 -0
  1101. data/third_party/abseil-cpp/absl/hash/internal/wyhash.h +48 -0
  1102. data/third_party/abseil-cpp/absl/meta/type_traits.h +16 -2
  1103. data/third_party/abseil-cpp/absl/numeric/bits.h +177 -0
  1104. data/third_party/abseil-cpp/absl/numeric/int128.cc +3 -3
  1105. data/third_party/abseil-cpp/absl/numeric/internal/bits.h +358 -0
  1106. data/third_party/abseil-cpp/absl/numeric/internal/representation.h +55 -0
  1107. data/third_party/abseil-cpp/absl/status/internal/status_internal.h +18 -0
  1108. data/third_party/abseil-cpp/absl/status/internal/statusor_internal.h +396 -0
  1109. data/third_party/abseil-cpp/absl/status/status.cc +29 -22
  1110. data/third_party/abseil-cpp/absl/status/status.h +81 -20
  1111. data/third_party/abseil-cpp/absl/status/statusor.cc +71 -0
  1112. data/third_party/abseil-cpp/absl/status/statusor.h +760 -0
  1113. data/third_party/abseil-cpp/absl/strings/charconv.cc +5 -5
  1114. data/third_party/abseil-cpp/absl/strings/cord.cc +326 -371
  1115. data/third_party/abseil-cpp/absl/strings/cord.h +182 -64
  1116. data/third_party/abseil-cpp/absl/strings/escaping.cc +4 -4
  1117. data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc +6 -6
  1118. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.cc +83 -0
  1119. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +387 -17
  1120. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_flat.h +146 -0
  1121. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.cc +897 -0
  1122. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.h +589 -0
  1123. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring_reader.h +114 -0
  1124. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +14 -0
  1125. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +14 -0
  1126. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +15 -1
  1127. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +19 -4
  1128. data/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h +14 -0
  1129. data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +36 -18
  1130. data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.h +14 -0
  1131. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc +14 -0
  1132. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +14 -0
  1133. data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +15 -40
  1134. data/third_party/abseil-cpp/absl/strings/internal/string_constant.h +64 -0
  1135. data/third_party/abseil-cpp/absl/strings/match.cc +6 -3
  1136. data/third_party/abseil-cpp/absl/strings/match.h +16 -6
  1137. data/third_party/abseil-cpp/absl/strings/numbers.cc +132 -4
  1138. data/third_party/abseil-cpp/absl/strings/numbers.h +10 -10
  1139. data/third_party/abseil-cpp/absl/strings/str_join.h +1 -1
  1140. data/third_party/abseil-cpp/absl/strings/str_split.h +38 -4
  1141. data/third_party/abseil-cpp/absl/synchronization/internal/futex.h +154 -0
  1142. data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +1 -0
  1143. data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +2 -1
  1144. data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc +2 -2
  1145. data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.h +4 -4
  1146. data/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc +1 -65
  1147. data/third_party/abseil-cpp/absl/synchronization/internal/waiter.h +2 -6
  1148. data/third_party/abseil-cpp/absl/synchronization/mutex.cc +71 -59
  1149. data/third_party/abseil-cpp/absl/synchronization/mutex.h +79 -62
  1150. data/third_party/abseil-cpp/absl/time/clock.cc +146 -130
  1151. data/third_party/abseil-cpp/absl/time/clock.h +2 -2
  1152. data/third_party/abseil-cpp/absl/time/duration.cc +3 -2
  1153. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +7 -11
  1154. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +7 -1
  1155. data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +4 -4
  1156. data/third_party/abseil-cpp/absl/time/time.cc +4 -3
  1157. data/third_party/abseil-cpp/absl/time/time.h +26 -24
  1158. data/third_party/abseil-cpp/absl/types/internal/variant.h +1 -1
  1159. data/third_party/abseil-cpp/absl/types/variant.h +9 -4
  1160. data/third_party/address_sorting/address_sorting_posix.c +1 -0
  1161. data/third_party/boringssl-with-bazel/err_data.c +756 -724
  1162. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bitstr.c +55 -50
  1163. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bool.c +22 -23
  1164. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_d2i_fp.c +0 -2
  1165. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_enum.c +2 -2
  1166. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_gentm.c +6 -1
  1167. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_int.c +5 -5
  1168. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_mbstr.c +16 -23
  1169. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +26 -24
  1170. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_octet.c +3 -3
  1171. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_print.c +19 -29
  1172. data/third_party/boringssl-with-bazel/src/crypto/{x509 → asn1}/a_strex.c +269 -272
  1173. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +106 -153
  1174. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +3 -3
  1175. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_type.c +22 -10
  1176. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +3 -42
  1177. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utf8.c +1 -1
  1178. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +16 -16
  1179. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_par.c +1 -1
  1180. data/third_party/boringssl-with-bazel/src/crypto/{x509 → asn1}/charmap.h +0 -0
  1181. data/third_party/boringssl-with-bazel/src/crypto/asn1/internal.h +196 -0
  1182. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +35 -86
  1183. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +326 -281
  1184. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_fre.c +15 -26
  1185. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_new.c +20 -75
  1186. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_typ.c +0 -2
  1187. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_utl.c +3 -2
  1188. data/third_party/boringssl-with-bazel/src/crypto/asn1/time_support.c +1 -1
  1189. data/third_party/boringssl-with-bazel/src/crypto/base64/base64.c +11 -8
  1190. data/third_party/boringssl-with-bazel/src/crypto/bio/bio_mem.c +1 -7
  1191. data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +1 -5
  1192. data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +0 -4
  1193. data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +1 -7
  1194. data/third_party/boringssl-with-bazel/src/crypto/bio/pair.c +1 -6
  1195. data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +3 -17
  1196. data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +4 -0
  1197. data/third_party/boringssl-with-bazel/src/crypto/blake2/blake2.c +156 -0
  1198. data/third_party/boringssl-with-bazel/src/crypto/bn_extra/bn_asn1.c +3 -10
  1199. data/third_party/boringssl-with-bazel/src/crypto/bytestring/ber.c +8 -9
  1200. data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbb.c +9 -0
  1201. data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.c +68 -45
  1202. data/third_party/boringssl-with-bazel/src/crypto/chacha/chacha.c +38 -47
  1203. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/cipher_extra.c +49 -65
  1204. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_chacha20poly1305.c +6 -81
  1205. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_tls.c +1 -88
  1206. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/internal.h +101 -3
  1207. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/tls_cbc.c +119 -273
  1208. data/third_party/boringssl-with-bazel/src/crypto/conf/conf.c +14 -3
  1209. data/third_party/boringssl-with-bazel/src/crypto/cpu-aarch64-win.c +41 -0
  1210. data/third_party/boringssl-with-bazel/src/crypto/cpu-arm-linux.c +11 -2
  1211. data/third_party/boringssl-with-bazel/src/crypto/cpu-arm.c +3 -3
  1212. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +1 -1
  1213. data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +1 -1
  1214. data/third_party/boringssl-with-bazel/src/crypto/{dh → dh_extra}/dh_asn1.c +0 -0
  1215. data/third_party/boringssl-with-bazel/src/crypto/{dh → dh_extra}/params.c +179 -0
  1216. data/third_party/boringssl-with-bazel/src/crypto/digest_extra/digest_extra.c +31 -3
  1217. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_asn1.c +2 -17
  1218. data/third_party/boringssl-with-bazel/src/crypto/err/err.c +87 -80
  1219. data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +9 -0
  1220. data/third_party/boringssl-with-bazel/src/crypto/evp/scrypt.c +32 -34
  1221. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +4 -1
  1222. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/bn.c +13 -20
  1223. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +28 -12
  1224. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd_extra.c +3 -2
  1225. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +15 -4
  1226. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/prime.c +0 -4
  1227. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/sqrt.c +5 -9
  1228. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/cipher.c +32 -16
  1229. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/e_aes.c +35 -2
  1230. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/des/des.c +10 -11
  1231. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/des/internal.h +1 -3
  1232. data/third_party/boringssl-with-bazel/src/crypto/{dh → fipsmodule/dh}/check.c +0 -0
  1233. data/third_party/boringssl-with-bazel/src/crypto/{dh → fipsmodule/dh}/dh.c +136 -213
  1234. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digest.c +9 -0
  1235. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digests.c +10 -2
  1236. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/md32_common.h +87 -160
  1237. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +16 -0
  1238. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +9 -2
  1239. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +0 -4
  1240. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +104 -93
  1241. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/internal.h +39 -0
  1242. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md4/md4.c +56 -72
  1243. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/md5.c +56 -73
  1244. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/cbc.c +33 -22
  1245. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/cfb.c +9 -8
  1246. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ctr.c +9 -8
  1247. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm.c +17 -13
  1248. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm_nohw.c +1 -1
  1249. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/internal.h +1 -22
  1250. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ofb.c +2 -1
  1251. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +30 -9
  1252. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +123 -44
  1253. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +30 -20
  1254. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +50 -33
  1255. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +65 -41
  1256. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/fips.c +79 -0
  1257. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +161 -9
  1258. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha1.c +93 -107
  1259. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha256.c +91 -113
  1260. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +50 -86
  1261. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +400 -325
  1262. data/third_party/boringssl-with-bazel/src/crypto/hrss/hrss.c +219 -121
  1263. data/third_party/boringssl-with-bazel/src/crypto/hrss/internal.h +9 -2
  1264. data/third_party/boringssl-with-bazel/src/crypto/internal.h +125 -0
  1265. data/third_party/boringssl-with-bazel/src/crypto/lhash/internal.h +253 -0
  1266. data/third_party/boringssl-with-bazel/src/crypto/lhash/lhash.c +28 -23
  1267. data/third_party/boringssl-with-bazel/src/crypto/mem.c +28 -9
  1268. data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +10 -6
  1269. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_all.c +0 -9
  1270. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_info.c +0 -2
  1271. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_lib.c +0 -8
  1272. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pk8.c +0 -2
  1273. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pkey.c +0 -4
  1274. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/internal.h +16 -7
  1275. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7.c +9 -4
  1276. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7_x509.c +156 -15
  1277. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +95 -48
  1278. data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305.c +11 -8
  1279. data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305_arm.c +13 -11
  1280. data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305_vec.c +4 -0
  1281. data/third_party/boringssl-with-bazel/src/crypto/pool/pool.c +1 -0
  1282. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +4 -0
  1283. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/fuchsia.c +4 -0
  1284. data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/is_fips.c → rand_extra/passive.c} +16 -11
  1285. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/rand_extra.c +5 -1
  1286. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +4 -0
  1287. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/rsa_asn1.c +1 -2
  1288. data/third_party/boringssl-with-bazel/src/crypto/siphash/siphash.c +6 -6
  1289. data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +7 -13
  1290. data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +0 -28
  1291. data/third_party/boringssl-with-bazel/src/crypto/x509/a_verify.c +15 -11
  1292. data/third_party/boringssl-with-bazel/src/crypto/x509/algorithm.c +1 -1
  1293. data/third_party/boringssl-with-bazel/src/crypto/x509/by_dir.c +1 -0
  1294. data/third_party/boringssl-with-bazel/src/crypto/x509/by_file.c +2 -0
  1295. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +345 -13
  1296. data/third_party/boringssl-with-bazel/src/crypto/x509/name_print.c +246 -0
  1297. data/third_party/boringssl-with-bazel/src/crypto/x509/rsa_pss.c +20 -5
  1298. data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.c +10 -5
  1299. data/third_party/boringssl-with-bazel/src/crypto/x509/t_req.c +2 -0
  1300. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +0 -179
  1301. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509a.c +7 -2
  1302. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +24 -47
  1303. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +4 -31
  1304. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_ext.c +12 -9
  1305. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_lu.c +1 -5
  1306. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_obj.c +1 -0
  1307. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +42 -89
  1308. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +17 -24
  1309. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +2 -0
  1310. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +26 -23
  1311. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +25 -69
  1312. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vpm.c +54 -74
  1313. data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +61 -23
  1314. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +2 -4
  1315. data/third_party/boringssl-with-bazel/src/crypto/x509/x509rset.c +3 -0
  1316. data/third_party/boringssl-with-bazel/src/crypto/x509/x_algor.c +21 -19
  1317. data/third_party/boringssl-with-bazel/src/crypto/x509/x_all.c +3 -16
  1318. data/third_party/boringssl-with-bazel/src/crypto/x509/x_attrib.c +21 -34
  1319. data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +15 -13
  1320. data/third_party/boringssl-with-bazel/src/crypto/x509/x_exten.c +2 -0
  1321. data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +23 -21
  1322. data/third_party/boringssl-with-bazel/src/crypto/x509/x_pkey.c +2 -2
  1323. data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +25 -22
  1324. data/third_party/boringssl-with-bazel/src/crypto/x509/x_req.c +5 -8
  1325. data/third_party/boringssl-with-bazel/src/crypto/x509/x_sig.c +5 -0
  1326. data/third_party/boringssl-with-bazel/src/crypto/x509/x_val.c +2 -0
  1327. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +50 -14
  1328. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509a.c +5 -2
  1329. data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +23 -0
  1330. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_cache.c +1 -0
  1331. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_data.c +1 -1
  1332. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_int.h +1 -1
  1333. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_map.c +1 -0
  1334. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_tree.c +4 -3
  1335. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_akey.c +27 -8
  1336. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +28 -18
  1337. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_bitst.c +6 -3
  1338. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +26 -25
  1339. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +10 -12
  1340. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_crld.c +4 -2
  1341. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_enum.c +7 -1
  1342. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_genn.c +40 -20
  1343. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_ia5.c +3 -4
  1344. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +27 -36
  1345. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_ncons.c +112 -55
  1346. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_pci.c +2 -1
  1347. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +14 -13
  1348. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +2 -2
  1349. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +7 -6
  1350. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +86 -44
  1351. data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +1 -4
  1352. data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +69 -4
  1353. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +1026 -615
  1354. data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +2 -176
  1355. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +63 -13
  1356. data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +3 -1
  1357. data/third_party/boringssl-with-bazel/src/include/openssl/blake2.h +62 -0
  1358. data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +3 -3
  1359. data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +32 -7
  1360. data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +1 -1
  1361. data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +23 -6
  1362. data/third_party/boringssl-with-bazel/src/include/openssl/conf.h +8 -5
  1363. data/third_party/boringssl-with-bazel/src/include/openssl/cpu.h +22 -32
  1364. data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +24 -4
  1365. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +56 -26
  1366. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +10 -2
  1367. data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +20 -2
  1368. data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +33 -0
  1369. data/third_party/boringssl-with-bazel/src/include/openssl/err.h +3 -2
  1370. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +38 -51
  1371. data/third_party/boringssl-with-bazel/src/{crypto/x509/x509_r2x.c → include/openssl/evp_errors.h} +41 -58
  1372. data/third_party/boringssl-with-bazel/src/include/openssl/hkdf.h +4 -0
  1373. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +350 -0
  1374. data/third_party/boringssl-with-bazel/src/include/openssl/hrss.h +14 -12
  1375. data/third_party/boringssl-with-bazel/src/include/openssl/lhash.h +4 -205
  1376. data/third_party/boringssl-with-bazel/src/include/openssl/mem.h +12 -3
  1377. data/third_party/boringssl-with-bazel/src/include/openssl/obj.h +26 -6
  1378. data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +0 -20
  1379. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +33 -8
  1380. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs8.h +9 -1
  1381. data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +5 -2
  1382. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +104 -63
  1383. data/third_party/boringssl-with-bazel/src/include/openssl/span.h +39 -16
  1384. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +406 -108
  1385. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +48 -36
  1386. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +1425 -377
  1387. data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +16 -679
  1388. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +188 -49
  1389. data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +16 -18
  1390. data/third_party/boringssl-with-bazel/src/ssl/d1_srtp.cc +1 -1
  1391. data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +1084 -0
  1392. data/third_party/boringssl-with-bazel/src/ssl/{t1_lib.cc → extensions.cc} +847 -622
  1393. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +298 -22
  1394. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +92 -44
  1395. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +314 -217
  1396. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +177 -35
  1397. data/third_party/boringssl-with-bazel/src/ssl/internal.h +491 -152
  1398. data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +9 -3
  1399. data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +0 -2
  1400. data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +14 -19
  1401. data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +7 -8
  1402. data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +4 -6
  1403. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +2 -2
  1404. data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +34 -31
  1405. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +60 -112
  1406. data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +2 -0
  1407. data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +136 -104
  1408. data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +3 -0
  1409. data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +12 -17
  1410. data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +7 -3
  1411. data/third_party/boringssl-with-bazel/src/ssl/ssl_x509.cc +28 -23
  1412. data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +5 -7
  1413. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +79 -34
  1414. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +235 -178
  1415. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +160 -91
  1416. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +269 -118
  1417. data/third_party/boringssl-with-bazel/src/ssl/tls_method.cc +4 -2
  1418. data/third_party/re2/re2/compile.cc +91 -109
  1419. data/third_party/re2/re2/dfa.cc +27 -39
  1420. data/third_party/re2/re2/filtered_re2.cc +18 -2
  1421. data/third_party/re2/re2/filtered_re2.h +10 -5
  1422. data/third_party/re2/re2/nfa.cc +1 -1
  1423. data/third_party/re2/re2/parse.cc +42 -23
  1424. data/third_party/re2/re2/perl_groups.cc +34 -34
  1425. data/third_party/re2/re2/prefilter.cc +3 -2
  1426. data/third_party/re2/re2/prog.cc +182 -4
  1427. data/third_party/re2/re2/prog.h +28 -9
  1428. data/third_party/re2/re2/re2.cc +87 -118
  1429. data/third_party/re2/re2/re2.h +156 -141
  1430. data/third_party/re2/re2/regexp.cc +12 -5
  1431. data/third_party/re2/re2/regexp.h +8 -2
  1432. data/third_party/re2/re2/set.cc +31 -9
  1433. data/third_party/re2/re2/set.h +9 -4
  1434. data/third_party/re2/re2/simplify.cc +11 -3
  1435. data/third_party/re2/re2/tostring.cc +1 -1
  1436. data/third_party/re2/re2/walker-inl.h +1 -1
  1437. data/third_party/re2/util/mutex.h +2 -2
  1438. data/third_party/re2/util/pcre.h +3 -3
  1439. data/third_party/upb/upb/decode.c +354 -204
  1440. data/third_party/upb/upb/decode.h +50 -3
  1441. data/third_party/upb/upb/decode_fast.c +1053 -0
  1442. data/third_party/upb/upb/decode_fast.h +153 -0
  1443. data/third_party/upb/upb/decode_internal.h +193 -0
  1444. data/third_party/upb/upb/def.c +609 -610
  1445. data/third_party/upb/upb/def.h +57 -50
  1446. data/third_party/upb/upb/def.hpp +66 -123
  1447. data/third_party/upb/upb/encode.c +267 -176
  1448. data/third_party/upb/upb/encode.h +56 -4
  1449. data/third_party/upb/upb/msg.c +304 -84
  1450. data/third_party/upb/upb/msg.h +76 -441
  1451. data/third_party/upb/upb/msg_internal.h +687 -0
  1452. data/third_party/upb/upb/port_def.inc +156 -82
  1453. data/third_party/upb/upb/port_undef.inc +41 -8
  1454. data/third_party/upb/upb/reflection.c +64 -55
  1455. data/third_party/upb/upb/reflection.h +36 -8
  1456. data/third_party/upb/upb/reflection.hpp +37 -0
  1457. data/third_party/upb/upb/table.c +238 -276
  1458. data/third_party/upb/upb/{table.int.h → table_internal.h} +66 -181
  1459. data/third_party/upb/upb/text_encode.c +77 -26
  1460. data/third_party/upb/upb/text_encode.h +30 -1
  1461. data/third_party/upb/upb/upb.c +75 -47
  1462. data/third_party/upb/upb/upb.h +72 -13
  1463. data/third_party/upb/upb/upb.hpp +28 -4
  1464. data/third_party/upb/upb/upb_internal.h +58 -0
  1465. data/third_party/xxhash/xxhash.h +5325 -0
  1466. metadata +287 -137
  1467. data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +0 -909
  1468. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +0 -485
  1469. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +0 -179
  1470. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +0 -68
  1471. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc +0 -38
  1472. data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +0 -355
  1473. data/src/core/ext/filters/client_channel/resolving_lb_policy.h +0 -138
  1474. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +0 -210
  1475. data/src/core/ext/filters/workarounds/workaround_utils.cc +0 -53
  1476. data/src/core/ext/filters/workarounds/workaround_utils.h +0 -39
  1477. data/src/core/ext/transport/chttp2/client/authority.cc +0 -42
  1478. data/src/core/ext/transport/chttp2/client/authority.h +0 -36
  1479. data/src/core/ext/transport/chttp2/transport/hpack_table.cc +0 -242
  1480. data/src/core/ext/transport/chttp2/transport/hpack_table.h +0 -148
  1481. data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +0 -66
  1482. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +0 -58
  1483. data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.c +0 -28
  1484. data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.h +0 -53
  1485. data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.c +0 -52
  1486. data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.h +0 -129
  1487. data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.c +0 -42
  1488. data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.h +0 -77
  1489. data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.c +0 -36
  1490. data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.h +0 -85
  1491. data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.c +0 -54
  1492. data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.h +0 -160
  1493. data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.c +0 -36
  1494. data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.h +0 -84
  1495. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +0 -58
  1496. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +0 -117
  1497. data/src/core/ext/upbdefs-generated/udpa/core/v1/authority.upbdefs.c +0 -42
  1498. data/src/core/ext/upbdefs-generated/udpa/core/v1/authority.upbdefs.h +0 -35
  1499. data/src/core/ext/upbdefs-generated/udpa/core/v1/collection_entry.upbdefs.c +0 -62
  1500. data/src/core/ext/upbdefs-generated/udpa/core/v1/collection_entry.upbdefs.h +0 -40
  1501. data/src/core/ext/upbdefs-generated/udpa/core/v1/context_params.upbdefs.c +0 -45
  1502. data/src/core/ext/upbdefs-generated/udpa/core/v1/context_params.upbdefs.h +0 -40
  1503. data/src/core/ext/upbdefs-generated/udpa/core/v1/resource.upbdefs.c +0 -49
  1504. data/src/core/ext/upbdefs-generated/udpa/core/v1/resource.upbdefs.h +0 -35
  1505. data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_locator.upbdefs.c +0 -68
  1506. data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_locator.upbdefs.h +0 -40
  1507. data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_name.upbdefs.c +0 -51
  1508. data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_name.upbdefs.h +0 -35
  1509. data/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.cc +0 -265
  1510. data/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.h +0 -104
  1511. data/src/core/lib/gpr/arena.h +0 -47
  1512. data/src/core/lib/gpr/tls_gcc.h +0 -52
  1513. data/src/core/lib/gpr/tls_msvc.h +0 -54
  1514. data/src/core/lib/gpr/tls_pthread.h +0 -56
  1515. data/src/core/lib/gpr/tls_stdcpp.h +0 -48
  1516. data/src/core/lib/gprpp/atomic.h +0 -104
  1517. data/src/core/lib/gprpp/map.h +0 -53
  1518. data/src/core/lib/iomgr/endpoint_pair_uv.cc +0 -40
  1519. data/src/core/lib/iomgr/iomgr_posix.h +0 -26
  1520. data/src/core/lib/iomgr/iomgr_uv.cc +0 -43
  1521. data/src/core/lib/iomgr/poller/eventmanager_libuv.cc +0 -88
  1522. data/src/core/lib/iomgr/poller/eventmanager_libuv.h +0 -88
  1523. data/src/core/lib/iomgr/pollset_uv.cc +0 -93
  1524. data/src/core/lib/iomgr/pollset_uv.h +0 -32
  1525. data/src/core/lib/iomgr/sockaddr_custom.h +0 -54
  1526. data/src/core/lib/iomgr/socket_utils_uv.cc +0 -49
  1527. data/src/core/lib/iomgr/tcp_uv.cc +0 -419
  1528. data/src/core/lib/iomgr/timer_uv.cc +0 -66
  1529. data/src/core/lib/iomgr/udp_server.cc +0 -748
  1530. data/src/core/lib/iomgr/udp_server.h +0 -104
  1531. data/src/core/lib/security/authorization/authorization_engine.cc +0 -177
  1532. data/src/core/lib/security/authorization/mock_cel/activation.h +0 -57
  1533. data/src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h +0 -44
  1534. data/src/core/lib/security/authorization/mock_cel/cel_expression.h +0 -69
  1535. data/src/core/lib/security/authorization/mock_cel/cel_value.h +0 -97
  1536. data/src/core/lib/security/authorization/mock_cel/evaluator_core.h +0 -67
  1537. data/src/core/lib/security/authorization/mock_cel/flat_expr_builder.h +0 -57
  1538. data/src/core/lib/transport/authority_override.cc +0 -38
  1539. data/third_party/abseil-cpp/absl/base/internal/bits.h +0 -219
  1540. data/third_party/abseil-cpp/absl/container/flat_hash_set.h +0 -504
  1541. data/third_party/abseil-cpp/absl/synchronization/internal/mutex_nonprod.inc +0 -249
  1542. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_locl.h +0 -104
  1543. data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +0 -237
  1544. data/third_party/boringssl-with-bazel/src/crypto/x509/vpm_int.h +0 -71
  1545. data/third_party/upb/upb/port.c +0 -26
@@ -1,23 +1,23 @@
1
- /*
2
- *
3
- * Copyright 2018 gRPC authors.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- *
17
- */
1
+ //
2
+ // Copyright 2018 gRPC authors.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
18
16
 
19
17
  #include <grpc/support/port_platform.h>
20
18
 
19
+ #include "src/core/ext/xds/xds_client.h"
20
+
21
21
  #include <inttypes.h>
22
22
  #include <limits.h>
23
23
  #include <string.h>
@@ -33,29 +33,29 @@
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"
37
+ #include "src/core/ext/xds/xds_bootstrap.h"
38
38
  #include "src/core/ext/xds/xds_channel_args.h"
39
- #include "src/core/ext/xds/xds_client.h"
40
39
  #include "src/core/ext/xds/xds_client_stats.h"
40
+ #include "src/core/ext/xds/xds_http_filters.h"
41
+ #include "src/core/lib/address_utils/sockaddr_utils.h"
41
42
  #include "src/core/lib/backoff/backoff.h"
42
43
  #include "src/core/lib/channel/channel_args.h"
43
44
  #include "src/core/lib/channel/channel_stack.h"
45
+ #include "src/core/lib/gpr/env.h"
44
46
  #include "src/core/lib/gpr/string.h"
45
- #include "src/core/lib/gprpp/map.h"
46
47
  #include "src/core/lib/gprpp/memory.h"
47
48
  #include "src/core/lib/gprpp/orphanable.h"
48
49
  #include "src/core/lib/gprpp/ref_counted_ptr.h"
49
50
  #include "src/core/lib/gprpp/sync.h"
50
51
  #include "src/core/lib/iomgr/sockaddr.h"
51
- #include "src/core/lib/iomgr/sockaddr_utils.h"
52
52
  #include "src/core/lib/iomgr/timer.h"
53
53
  #include "src/core/lib/slice/slice_internal.h"
54
54
  #include "src/core/lib/slice/slice_string_helpers.h"
55
55
  #include "src/core/lib/surface/call.h"
56
56
  #include "src/core/lib/surface/channel.h"
57
- #include "src/core/lib/surface/channel_init.h"
58
57
  #include "src/core/lib/transport/static_metadata.h"
58
+ #include "src/core/lib/uri/uri_parser.h"
59
59
 
60
60
  #define GRPC_XDS_INITIAL_CONNECT_BACKOFF_SECONDS 1
61
61
  #define GRPC_XDS_RECONNECT_BACKOFF_MULTIPLIER 1.6
@@ -66,12 +66,15 @@
66
66
  namespace grpc_core {
67
67
 
68
68
  TraceFlag grpc_xds_client_trace(false, "xds_client");
69
+ TraceFlag grpc_xds_client_refcount_trace(false, "xds_client_refcount");
69
70
 
70
71
  namespace {
71
72
 
72
73
  Mutex* g_mu = nullptr;
73
- const grpc_channel_args* g_channel_args = nullptr;
74
- XdsClient* g_xds_client = nullptr;
74
+
75
+ const grpc_channel_args* g_channel_args ABSL_GUARDED_BY(*g_mu) = nullptr;
76
+ XdsClient* g_xds_client ABSL_GUARDED_BY(*g_mu) = nullptr;
77
+ char* g_fallback_bootstrap_config ABSL_GUARDED_BY(*g_mu) = nullptr;
75
78
 
76
79
  } // namespace
77
80
 
@@ -85,7 +88,7 @@ template <typename T>
85
88
  class XdsClient::ChannelState::RetryableCall
86
89
  : public InternallyRefCounted<RetryableCall<T>> {
87
90
  public:
88
- explicit RetryableCall(RefCountedPtr<ChannelState> chand);
91
+ explicit RetryableCall(WeakRefCountedPtr<ChannelState> chand);
89
92
 
90
93
  void Orphan() override;
91
94
 
@@ -99,14 +102,14 @@ class XdsClient::ChannelState::RetryableCall
99
102
  private:
100
103
  void StartNewCallLocked();
101
104
  void StartRetryTimerLocked();
102
- static void OnRetryTimer(void* arg, grpc_error* error);
103
- void OnRetryTimerLocked(grpc_error* error);
105
+ static void OnRetryTimer(void* arg, grpc_error_handle error);
106
+ void OnRetryTimerLocked(grpc_error_handle error);
104
107
 
105
108
  // The wrapped xds call that talks to the xds server. It's instantiated
106
109
  // every time we start a new call. It's null during call retry backoff.
107
110
  OrphanablePtr<T> calld_;
108
111
  // The owning xds channel.
109
- RefCountedPtr<ChannelState> chand_;
112
+ WeakRefCountedPtr<ChannelState> chand_;
110
113
 
111
114
  // Retry state.
112
115
  BackOff backoff_;
@@ -132,19 +135,24 @@ class XdsClient::ChannelState::AdsCallState
132
135
  XdsClient* xds_client() const { return chand()->xds_client(); }
133
136
  bool seen_response() const { return seen_response_; }
134
137
 
135
- void Subscribe(const std::string& type_url, const std::string& name);
136
- void Unsubscribe(const std::string& type_url, const std::string& name,
137
- bool delay_unsubscription);
138
+ void SubscribeLocked(const std::string& type_url,
139
+ const XdsApi::ResourceName& resource)
140
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
141
+ void UnsubscribeLocked(const std::string& type_url,
142
+ const XdsApi::ResourceName& resource,
143
+ bool delay_unsubscription)
144
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
138
145
 
139
146
  bool HasSubscribedResources() const;
140
147
 
141
148
  private:
142
149
  class ResourceState : public InternallyRefCounted<ResourceState> {
143
150
  public:
144
- ResourceState(const std::string& type_url, const std::string& name,
151
+ ResourceState(const std::string& type_url,
152
+ const XdsApi::ResourceName& resource,
145
153
  bool sent_initial_request)
146
154
  : type_url_(type_url),
147
- name_(name),
155
+ resource_(resource),
148
156
  sent_initial_request_(sent_initial_request) {
149
157
  GRPC_CLOSURE_INIT(&timer_callback_, OnTimer, this,
150
158
  grpc_schedule_on_exec_ctx);
@@ -175,7 +183,7 @@ class XdsClient::ChannelState::AdsCallState
175
183
  }
176
184
 
177
185
  private:
178
- static void OnTimer(void* arg, grpc_error* error) {
186
+ static void OnTimer(void* arg, grpc_error_handle error) {
179
187
  ResourceState* self = static_cast<ResourceState*>(arg);
180
188
  {
181
189
  MutexLock lock(&self->ads_calld_->xds_client()->mu_);
@@ -185,36 +193,46 @@ class XdsClient::ChannelState::AdsCallState
185
193
  self->Unref(DEBUG_LOCATION, "timer");
186
194
  }
187
195
 
188
- void OnTimerLocked(grpc_error* error) {
196
+ void OnTimerLocked(grpc_error_handle error)
197
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_) {
189
198
  if (error == GRPC_ERROR_NONE && timer_pending_) {
190
199
  timer_pending_ = false;
191
- grpc_error* watcher_error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
192
- absl::StrFormat(
200
+ grpc_error_handle watcher_error =
201
+ GRPC_ERROR_CREATE_FROM_CPP_STRING(absl::StrFormat(
193
202
  "timeout obtaining resource {type=%s name=%s} from xds server",
194
- type_url_, name_)
195
- .c_str());
203
+ type_url_,
204
+ XdsApi::ConstructFullResourceName(resource_.authority,
205
+ type_url_, resource_.id)));
206
+ watcher_error = grpc_error_set_int(
207
+ watcher_error, GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
196
208
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
197
209
  gpr_log(GPR_INFO, "[xds_client %p] %s", ads_calld_->xds_client(),
198
- grpc_error_string(watcher_error));
210
+ grpc_error_std_string(watcher_error).c_str());
199
211
  }
212
+ auto& authority_state =
213
+ ads_calld_->xds_client()->authority_state_map_[resource_.authority];
200
214
  if (type_url_ == XdsApi::kLdsTypeUrl) {
201
- ListenerState& state = ads_calld_->xds_client()->listener_map_[name_];
215
+ ListenerState& state = authority_state.listener_map[resource_.id];
216
+ state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
202
217
  for (const auto& p : state.watchers) {
203
218
  p.first->OnError(GRPC_ERROR_REF(watcher_error));
204
219
  }
205
220
  } else if (type_url_ == XdsApi::kRdsTypeUrl) {
206
221
  RouteConfigState& state =
207
- ads_calld_->xds_client()->route_config_map_[name_];
222
+ authority_state.route_config_map[resource_.id];
223
+ state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
208
224
  for (const auto& p : state.watchers) {
209
225
  p.first->OnError(GRPC_ERROR_REF(watcher_error));
210
226
  }
211
227
  } else if (type_url_ == XdsApi::kCdsTypeUrl) {
212
- ClusterState& state = ads_calld_->xds_client()->cluster_map_[name_];
228
+ ClusterState& state = authority_state.cluster_map[resource_.id];
229
+ state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
213
230
  for (const auto& p : state.watchers) {
214
231
  p.first->OnError(GRPC_ERROR_REF(watcher_error));
215
232
  }
216
233
  } else if (type_url_ == XdsApi::kEdsTypeUrl) {
217
- EndpointState& state = ads_calld_->xds_client()->endpoint_map_[name_];
234
+ EndpointState& state = authority_state.endpoint_map[resource_.id];
235
+ state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
218
236
  for (const auto& p : state.watchers) {
219
237
  p.first->OnError(GRPC_ERROR_REF(watcher_error));
220
238
  }
@@ -227,7 +245,7 @@ class XdsClient::ChannelState::AdsCallState
227
245
  }
228
246
 
229
247
  const std::string type_url_;
230
- const std::string name_;
248
+ const XdsApi::ResourceName resource_;
231
249
 
232
250
  RefCountedPtr<AdsCallState> ads_calld_;
233
251
  bool sent_initial_request_;
@@ -241,31 +259,61 @@ class XdsClient::ChannelState::AdsCallState
241
259
 
242
260
  // Nonce and error for this resource type.
243
261
  std::string nonce;
244
- grpc_error* error = GRPC_ERROR_NONE;
262
+ grpc_error_handle error = GRPC_ERROR_NONE;
245
263
 
246
264
  // Subscribed resources of this type.
247
- std::map<std::string /* name */, OrphanablePtr<ResourceState>>
265
+ std::map<std::string /*authority*/,
266
+ std::map<std::string /*name*/, OrphanablePtr<ResourceState>>>
248
267
  subscribed_resources;
249
268
  };
250
269
 
251
- void SendMessageLocked(const std::string& type_url);
252
-
253
- void AcceptLdsUpdate(XdsApi::LdsUpdateMap lds_update_map);
254
- void AcceptRdsUpdate(XdsApi::RdsUpdateMap rds_update_map);
255
- void AcceptCdsUpdate(XdsApi::CdsUpdateMap cds_update_map);
256
- void AcceptEdsUpdate(XdsApi::EdsUpdateMap eds_update_map);
257
-
258
- static void OnRequestSent(void* arg, grpc_error* error);
259
- void OnRequestSentLocked(grpc_error* error);
260
- static void OnResponseReceived(void* arg, grpc_error* error);
261
- bool OnResponseReceivedLocked();
262
- static void OnStatusReceived(void* arg, grpc_error* error);
263
- void OnStatusReceivedLocked(grpc_error* error);
270
+ void SendMessageLocked(const std::string& type_url)
271
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
272
+
273
+ void AcceptLdsUpdateLocked(
274
+ std::string version, grpc_millis update_time,
275
+ XdsApi::LdsUpdateMap lds_update_map,
276
+ const std::set<XdsApi::ResourceName>& resource_names_failed)
277
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
278
+ void AcceptRdsUpdateLocked(std::string version, grpc_millis update_time,
279
+ XdsApi::RdsUpdateMap rds_update_map)
280
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
281
+ void AcceptCdsUpdateLocked(
282
+ std::string version, grpc_millis update_time,
283
+ XdsApi::CdsUpdateMap cds_update_map,
284
+ const std::set<XdsApi::ResourceName>& resource_names_failed)
285
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
286
+ void AcceptEdsUpdateLocked(std::string version, grpc_millis update_time,
287
+ XdsApi::EdsUpdateMap eds_update_map)
288
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
289
+
290
+ template <typename StateMap>
291
+ void RejectAdsUpdateHelperLocked(const std::string& resource_name,
292
+ grpc_millis update_time,
293
+ const XdsApi::AdsParseResult& result,
294
+ const std::string& error_details,
295
+ StateMap* state_map)
296
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
297
+
298
+ void RejectAdsUpdateLocked(grpc_millis update_time,
299
+ const XdsApi::AdsParseResult& result)
300
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
301
+
302
+ static void OnRequestSent(void* arg, grpc_error_handle error);
303
+ void OnRequestSentLocked(grpc_error_handle error)
304
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
305
+ static void OnResponseReceived(void* arg, grpc_error_handle error);
306
+ bool OnResponseReceivedLocked()
307
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
308
+ static void OnStatusReceived(void* arg, grpc_error_handle error);
309
+ void OnStatusReceivedLocked(grpc_error_handle error)
310
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
264
311
 
265
312
  bool IsCurrentCallOnChannel() const;
266
313
 
267
- std::set<absl::string_view> ResourceNamesForRequest(
268
- const std::string& type_url);
314
+ std::map<absl::string_view /*authority*/,
315
+ std::set<absl::string_view /*name*/>>
316
+ ResourceNamesForRequest(const std::string& type_url);
269
317
 
270
318
  // The owning RetryableCall<>.
271
319
  RefCountedPtr<RetryableCall<AdsCallState>> parent_;
@@ -333,12 +381,15 @@ class XdsClient::ChannelState::LrsCallState
333
381
  void Orphan() override;
334
382
 
335
383
  private:
336
- void ScheduleNextReportLocked();
337
- static void OnNextReportTimer(void* arg, grpc_error* error);
338
- bool OnNextReportTimerLocked(grpc_error* error);
339
- bool SendReportLocked();
340
- static void OnReportDone(void* arg, grpc_error* error);
341
- bool OnReportDoneLocked(grpc_error* error);
384
+ void ScheduleNextReportLocked()
385
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
386
+ static void OnNextReportTimer(void* arg, grpc_error_handle error);
387
+ bool OnNextReportTimerLocked(grpc_error_handle error)
388
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
389
+ bool SendReportLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
390
+ static void OnReportDone(void* arg, grpc_error_handle error);
391
+ bool OnReportDoneLocked(grpc_error_handle error)
392
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
342
393
 
343
394
  bool IsCurrentReporterOnCall() const {
344
395
  return this == parent_->reporter_.get();
@@ -357,12 +408,15 @@ class XdsClient::ChannelState::LrsCallState
357
408
  grpc_closure on_report_done_;
358
409
  };
359
410
 
360
- static void OnInitialRequestSent(void* arg, grpc_error* error);
361
- void OnInitialRequestSentLocked();
362
- static void OnResponseReceived(void* arg, grpc_error* error);
363
- bool OnResponseReceivedLocked();
364
- static void OnStatusReceived(void* arg, grpc_error* error);
365
- void OnStatusReceivedLocked(grpc_error* error);
411
+ static void OnInitialRequestSent(void* arg, grpc_error_handle error);
412
+ void OnInitialRequestSentLocked()
413
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
414
+ static void OnResponseReceived(void* arg, grpc_error_handle error);
415
+ bool OnResponseReceivedLocked()
416
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
417
+ static void OnStatusReceived(void* arg, grpc_error_handle error);
418
+ void OnStatusReceivedLocked(grpc_error_handle error)
419
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
366
420
 
367
421
  bool IsCurrentCallOnChannel() const;
368
422
 
@@ -404,7 +458,7 @@ class XdsClient::ChannelState::LrsCallState
404
458
  class XdsClient::ChannelState::StateWatcher
405
459
  : public AsyncConnectivityStateWatcherInterface {
406
460
  public:
407
- explicit StateWatcher(RefCountedPtr<ChannelState> parent)
461
+ explicit StateWatcher(WeakRefCountedPtr<ChannelState> parent)
408
462
  : parent_(std::move(parent)) {}
409
463
 
410
464
  private:
@@ -418,13 +472,13 @@ class XdsClient::ChannelState::StateWatcher
418
472
  "[xds_client %p] xds channel in state:TRANSIENT_FAILURE "
419
473
  "status_message:(%s)",
420
474
  parent_->xds_client(), status.ToString().c_str());
421
- parent_->xds_client()->NotifyOnErrorLocked(
475
+ parent_->xds_client_->NotifyOnErrorLocked(
422
476
  GRPC_ERROR_CREATE_FROM_STATIC_STRING(
423
477
  "xds channel in TRANSIENT_FAILURE"));
424
478
  }
425
479
  }
426
480
 
427
- RefCountedPtr<ChannelState> parent_;
481
+ WeakRefCountedPtr<ChannelState> parent_;
428
482
  };
429
483
 
430
484
  //
@@ -433,42 +487,30 @@ class XdsClient::ChannelState::StateWatcher
433
487
 
434
488
  namespace {
435
489
 
436
- grpc_channel* CreateXdsChannel(const XdsBootstrap::XdsServer& server) {
437
- // Build channel args.
438
- absl::InlinedVector<grpc_arg, 2> args_to_add = {
439
- grpc_channel_arg_integer_create(
440
- const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS),
441
- 5 * 60 * GPR_MS_PER_SEC),
442
- grpc_channel_arg_integer_create(
443
- const_cast<char*>(GRPC_ARG_CHANNELZ_IS_INTERNAL_CHANNEL), 1),
444
- };
445
- grpc_channel_args* new_args = grpc_channel_args_copy_and_add(
446
- g_channel_args, args_to_add.data(), args_to_add.size());
447
- // Create channel creds.
490
+ grpc_channel* CreateXdsChannel(grpc_channel_args* args,
491
+ const XdsBootstrap::XdsServer& server) {
448
492
  RefCountedPtr<grpc_channel_credentials> channel_creds =
449
493
  XdsChannelCredsRegistry::MakeChannelCreds(server.channel_creds_type,
450
494
  server.channel_creds_config);
451
- // Create channel.
452
- grpc_channel* channel = grpc_secure_channel_create(
453
- channel_creds.get(), server.server_uri.c_str(), new_args, nullptr);
454
- grpc_channel_args_destroy(new_args);
455
- return channel;
495
+ return grpc_secure_channel_create(channel_creds.get(),
496
+ server.server_uri.c_str(), args, nullptr);
456
497
  }
457
498
 
458
499
  } // namespace
459
500
 
460
501
  XdsClient::ChannelState::ChannelState(WeakRefCountedPtr<XdsClient> xds_client,
461
502
  const XdsBootstrap::XdsServer& server)
462
- : InternallyRefCounted<ChannelState>(
463
- GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace) ? "ChannelState"
464
- : nullptr),
503
+ : DualRefCounted<ChannelState>(
504
+ GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_refcount_trace)
505
+ ? "ChannelState"
506
+ : nullptr),
465
507
  xds_client_(std::move(xds_client)),
466
508
  server_(server) {
467
509
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
468
510
  gpr_log(GPR_INFO, "[xds_client %p] creating channel to %s",
469
511
  xds_client_.get(), server.server_uri.c_str());
470
512
  }
471
- channel_ = CreateXdsChannel(server);
513
+ channel_ = CreateXdsChannel(xds_client_->args_, server);
472
514
  GPR_ASSERT(channel_ != nullptr);
473
515
  StartConnectivityWatchLocked();
474
516
  }
@@ -482,12 +524,19 @@ XdsClient::ChannelState::~ChannelState() {
482
524
  xds_client_.reset(DEBUG_LOCATION, "ChannelState");
483
525
  }
484
526
 
485
- void XdsClient::ChannelState::Orphan() {
527
+ // This method should only ever be called when holding the lock, but we can't
528
+ // use a ABSL_EXCLUSIVE_LOCKS_REQUIRED annotation, because Orphan() will be
529
+ // called from DualRefCounted::Unref, which cannot have a lock annotation for a
530
+ // lock in this subclass.
531
+ void XdsClient::ChannelState::Orphan() ABSL_NO_THREAD_SAFETY_ANALYSIS {
486
532
  shutting_down_ = true;
487
533
  CancelConnectivityWatchLocked();
534
+ // At this time, all strong refs are removed, remove from channel map to
535
+ // prevent subsequent subscription from trying to use this ChannelState as it
536
+ // is shutting down.
537
+ xds_client_->xds_server_channel_map_.erase(server_);
488
538
  ads_calld_.reset();
489
539
  lrs_calld_.reset();
490
- Unref(DEBUG_LOCATION, "ChannelState+orphaned");
491
540
  }
492
541
 
493
542
  XdsClient::ChannelState::AdsCallState* XdsClient::ChannelState::ads_calld()
@@ -501,40 +550,38 @@ XdsClient::ChannelState::LrsCallState* XdsClient::ChannelState::lrs_calld()
501
550
  }
502
551
 
503
552
  bool XdsClient::ChannelState::HasActiveAdsCall() const {
504
- return ads_calld_->calld() != nullptr;
553
+ return ads_calld_ != nullptr && ads_calld_->calld() != nullptr;
505
554
  }
506
555
 
507
556
  void XdsClient::ChannelState::MaybeStartLrsCall() {
508
557
  if (lrs_calld_ != nullptr) return;
509
- lrs_calld_.reset(
510
- new RetryableCall<LrsCallState>(Ref(DEBUG_LOCATION, "ChannelState+lrs")));
558
+ lrs_calld_.reset(new RetryableCall<LrsCallState>(
559
+ WeakRef(DEBUG_LOCATION, "ChannelState+lrs")));
511
560
  }
512
561
 
513
562
  void XdsClient::ChannelState::StopLrsCall() { lrs_calld_.reset(); }
514
563
 
515
564
  void XdsClient::ChannelState::StartConnectivityWatchLocked() {
516
- grpc_channel_element* client_channel_elem =
517
- grpc_channel_stack_last_element(grpc_channel_get_channel_stack(channel_));
518
- GPR_ASSERT(client_channel_elem->filter == &grpc_client_channel_filter);
519
- watcher_ = new StateWatcher(Ref(DEBUG_LOCATION, "ChannelState+watch"));
520
- grpc_client_channel_start_connectivity_watch(
521
- client_channel_elem, GRPC_CHANNEL_IDLE,
565
+ ClientChannel* client_channel = ClientChannel::GetFromChannel(channel_);
566
+ GPR_ASSERT(client_channel != nullptr);
567
+ watcher_ = new StateWatcher(WeakRef(DEBUG_LOCATION, "ChannelState+watch"));
568
+ client_channel->AddConnectivityWatcher(
569
+ GRPC_CHANNEL_IDLE,
522
570
  OrphanablePtr<AsyncConnectivityStateWatcherInterface>(watcher_));
523
571
  }
524
572
 
525
573
  void XdsClient::ChannelState::CancelConnectivityWatchLocked() {
526
- grpc_channel_element* client_channel_elem =
527
- grpc_channel_stack_last_element(grpc_channel_get_channel_stack(channel_));
528
- GPR_ASSERT(client_channel_elem->filter == &grpc_client_channel_filter);
529
- grpc_client_channel_stop_connectivity_watch(client_channel_elem, watcher_);
574
+ ClientChannel* client_channel = ClientChannel::GetFromChannel(channel_);
575
+ GPR_ASSERT(client_channel != nullptr);
576
+ client_channel->RemoveConnectivityWatcher(watcher_);
530
577
  }
531
578
 
532
- void XdsClient::ChannelState::Subscribe(const std::string& type_url,
533
- const std::string& name) {
579
+ void XdsClient::ChannelState::SubscribeLocked(
580
+ const std::string& type_url, const XdsApi::ResourceName& resource) {
534
581
  if (ads_calld_ == nullptr) {
535
582
  // Start the ADS call if this is the first request.
536
583
  ads_calld_.reset(new RetryableCall<AdsCallState>(
537
- Ref(DEBUG_LOCATION, "ChannelState+ads")));
584
+ WeakRef(DEBUG_LOCATION, "ChannelState+ads")));
538
585
  // Note: AdsCallState's ctor will automatically subscribe to all
539
586
  // resources that the XdsClient already has watchers for, so we can
540
587
  // return here.
@@ -544,17 +591,19 @@ void XdsClient::ChannelState::Subscribe(const std::string& type_url,
544
591
  // because when the call is restarted it will resend all necessary requests.
545
592
  if (ads_calld() == nullptr) return;
546
593
  // Subscribe to this resource if the ADS call is active.
547
- ads_calld()->Subscribe(type_url, name);
594
+ ads_calld()->SubscribeLocked(type_url, resource);
548
595
  }
549
596
 
550
- void XdsClient::ChannelState::Unsubscribe(const std::string& type_url,
551
- const std::string& name,
552
- bool delay_unsubscription) {
597
+ void XdsClient::ChannelState::UnsubscribeLocked(
598
+ const std::string& type_url, const XdsApi::ResourceName& resource,
599
+ bool delay_unsubscription) {
553
600
  if (ads_calld_ != nullptr) {
554
601
  auto* calld = ads_calld_->calld();
555
602
  if (calld != nullptr) {
556
- calld->Unsubscribe(type_url, name, delay_unsubscription);
557
- if (!calld->HasSubscribedResources()) ads_calld_.reset();
603
+ calld->UnsubscribeLocked(type_url, resource, delay_unsubscription);
604
+ if (!calld->HasSubscribedResources()) {
605
+ ads_calld_.reset();
606
+ }
558
607
  }
559
608
  }
560
609
  }
@@ -565,7 +614,7 @@ void XdsClient::ChannelState::Unsubscribe(const std::string& type_url,
565
614
 
566
615
  template <typename T>
567
616
  XdsClient::ChannelState::RetryableCall<T>::RetryableCall(
568
- RefCountedPtr<ChannelState> chand)
617
+ WeakRefCountedPtr<ChannelState> chand)
569
618
  : chand_(std::move(chand)),
570
619
  backoff_(
571
620
  BackOff::Options()
@@ -623,7 +672,8 @@ void XdsClient::ChannelState::RetryableCall<T>::StartRetryTimerLocked() {
623
672
  if (shutting_down_) return;
624
673
  const grpc_millis next_attempt_time = backoff_.NextAttemptTime();
625
674
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
626
- grpc_millis timeout = GPR_MAX(next_attempt_time - ExecCtx::Get()->Now(), 0);
675
+ grpc_millis timeout =
676
+ std::max(next_attempt_time - ExecCtx::Get()->Now(), grpc_millis(0));
627
677
  gpr_log(GPR_INFO,
628
678
  "[xds_client %p] Failed to connect to xds server (chand: %p) "
629
679
  "retry timer will fire in %" PRId64 "ms.",
@@ -636,7 +686,7 @@ void XdsClient::ChannelState::RetryableCall<T>::StartRetryTimerLocked() {
636
686
 
637
687
  template <typename T>
638
688
  void XdsClient::ChannelState::RetryableCall<T>::OnRetryTimer(
639
- void* arg, grpc_error* error) {
689
+ void* arg, grpc_error_handle error) {
640
690
  RetryableCall* calld = static_cast<RetryableCall*>(arg);
641
691
  {
642
692
  MutexLock lock(&calld->chand_->xds_client()->mu_);
@@ -647,7 +697,7 @@ void XdsClient::ChannelState::RetryableCall<T>::OnRetryTimer(
647
697
 
648
698
  template <typename T>
649
699
  void XdsClient::ChannelState::RetryableCall<T>::OnRetryTimerLocked(
650
- grpc_error* error) {
700
+ grpc_error_handle error) {
651
701
  retry_timer_callback_pending_ = false;
652
702
  if (!shutting_down_ && error == GRPC_ERROR_NONE) {
653
703
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
@@ -668,8 +718,9 @@ void XdsClient::ChannelState::RetryableCall<T>::OnRetryTimerLocked(
668
718
  XdsClient::ChannelState::AdsCallState::AdsCallState(
669
719
  RefCountedPtr<RetryableCall<AdsCallState>> parent)
670
720
  : InternallyRefCounted<AdsCallState>(
671
- GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace) ? "AdsCallState"
672
- : nullptr),
721
+ GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_refcount_trace)
722
+ ? "AdsCallState"
723
+ : nullptr),
673
724
  parent_(std::move(parent)) {
674
725
  // Init the ADS call. Note that the call will progress every time there's
675
726
  // activity in xds_client()->interested_parties_, which is comprised of
@@ -707,23 +758,32 @@ XdsClient::ChannelState::AdsCallState::AdsCallState(
707
758
  GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET;
708
759
  op->reserved = nullptr;
709
760
  op++;
710
- call_error = grpc_call_start_batch_and_execute(call_, ops, (size_t)(op - ops),
711
- nullptr);
761
+ call_error = grpc_call_start_batch_and_execute(
762
+ call_, ops, static_cast<size_t>(op - ops), nullptr);
712
763
  GPR_ASSERT(GRPC_CALL_OK == call_error);
713
764
  // Op: send request message.
714
765
  GRPC_CLOSURE_INIT(&on_request_sent_, OnRequestSent, this,
715
766
  grpc_schedule_on_exec_ctx);
716
- for (const auto& p : xds_client()->listener_map_) {
717
- Subscribe(XdsApi::kLdsTypeUrl, std::string(p.first));
718
- }
719
- for (const auto& p : xds_client()->route_config_map_) {
720
- Subscribe(XdsApi::kRdsTypeUrl, std::string(p.first));
721
- }
722
- for (const auto& p : xds_client()->cluster_map_) {
723
- Subscribe(XdsApi::kCdsTypeUrl, std::string(p.first));
724
- }
725
- for (const auto& p : xds_client()->endpoint_map_) {
726
- Subscribe(XdsApi::kEdsTypeUrl, std::string(p.first));
767
+ for (const auto& a : xds_client()->authority_state_map_) {
768
+ const std::string& authority = a.first;
769
+ // Skip authorities that are not using this xDS channel.
770
+ if (a.second.channel_state != chand()) continue;
771
+ for (const auto& l : a.second.listener_map) {
772
+ const std::string& listener_name = l.first;
773
+ SubscribeLocked(XdsApi::kLdsTypeUrl, {authority, listener_name});
774
+ }
775
+ for (const auto& r : a.second.route_config_map) {
776
+ const std::string& route_config_name = r.first;
777
+ SubscribeLocked(XdsApi::kRdsTypeUrl, {authority, route_config_name});
778
+ }
779
+ for (const auto& c : a.second.cluster_map) {
780
+ const std::string& cluster_name = c.first;
781
+ SubscribeLocked(XdsApi::kCdsTypeUrl, {authority, cluster_name});
782
+ }
783
+ for (const auto& e : a.second.endpoint_map) {
784
+ const std::string& endpoint_name = e.first;
785
+ SubscribeLocked(XdsApi::kEdsTypeUrl, {authority, endpoint_name});
786
+ }
727
787
  }
728
788
  // Op: recv initial metadata.
729
789
  op = ops;
@@ -742,8 +802,8 @@ XdsClient::ChannelState::AdsCallState::AdsCallState(
742
802
  Ref(DEBUG_LOCATION, "ADS+OnResponseReceivedLocked").release();
743
803
  GRPC_CLOSURE_INIT(&on_response_received_, OnResponseReceived, this,
744
804
  grpc_schedule_on_exec_ctx);
745
- call_error = grpc_call_start_batch_and_execute(call_, ops, (size_t)(op - ops),
746
- &on_response_received_);
805
+ call_error = grpc_call_start_batch_and_execute(
806
+ call_, ops, static_cast<size_t>(op - ops), &on_response_received_);
747
807
  GPR_ASSERT(GRPC_CALL_OK == call_error);
748
808
  // Op: recv server status.
749
809
  op = ops;
@@ -759,8 +819,8 @@ XdsClient::ChannelState::AdsCallState::AdsCallState(
759
819
  // unreffed.
760
820
  GRPC_CLOSURE_INIT(&on_status_received_, OnStatusReceived, this,
761
821
  grpc_schedule_on_exec_ctx);
762
- call_error = grpc_call_start_batch_and_execute(call_, ops, (size_t)(op - ops),
763
- &on_status_received_);
822
+ call_error = grpc_call_start_batch_and_execute(
823
+ call_, ops, static_cast<size_t>(op - ops), &on_status_received_);
764
824
  GPR_ASSERT(GRPC_CALL_OK == call_error);
765
825
  }
766
826
 
@@ -787,7 +847,8 @@ void XdsClient::ChannelState::AdsCallState::Orphan() {
787
847
  }
788
848
 
789
849
  void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
790
- const std::string& type_url) {
850
+ const std::string& type_url)
851
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_) {
791
852
  // Buffer message sending if an existing message is in flight.
792
853
  if (send_message_payload_ != nullptr) {
793
854
  buffered_requests_.insert(type_url);
@@ -795,11 +856,12 @@ void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
795
856
  }
796
857
  auto& state = state_map_[type_url];
797
858
  grpc_slice request_payload_slice;
798
- std::set<absl::string_view> resource_names =
799
- ResourceNamesForRequest(type_url);
859
+ std::map<absl::string_view /*authority*/,
860
+ std::set<absl::string_view /*name*/>>
861
+ resource_map = ResourceNamesForRequest(type_url);
800
862
  request_payload_slice = xds_client()->api_.CreateAdsRequest(
801
- chand()->server_, type_url, resource_names,
802
- xds_client()->resource_version_map_[type_url], state.nonce,
863
+ chand()->server_, type_url, resource_map,
864
+ chand()->resource_type_version_map_[type_url], state.nonce,
803
865
  GRPC_ERROR_REF(state.error), !sent_initial_message_);
804
866
  if (type_url != XdsApi::kLdsTypeUrl && type_url != XdsApi::kRdsTypeUrl &&
805
867
  type_url != XdsApi::kCdsTypeUrl && type_url != XdsApi::kEdsTypeUrl) {
@@ -809,11 +871,10 @@ void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
809
871
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
810
872
  gpr_log(GPR_INFO,
811
873
  "[xds_client %p] sending ADS request: type=%s version=%s nonce=%s "
812
- "error=%s resources=%s",
874
+ "error=%s",
813
875
  xds_client(), type_url.c_str(),
814
- xds_client()->resource_version_map_[type_url].c_str(),
815
- state.nonce.c_str(), grpc_error_string(state.error),
816
- absl::StrJoin(resource_names, " ").c_str());
876
+ chand()->resource_type_version_map_[type_url].c_str(),
877
+ state.nonce.c_str(), grpc_error_std_string(state.error).c_str());
817
878
  }
818
879
  GRPC_ERROR_UNREF(state.error);
819
880
  state.error = GRPC_ERROR_NONE;
@@ -839,20 +900,27 @@ void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
839
900
  }
840
901
  }
841
902
 
842
- void XdsClient::ChannelState::AdsCallState::Subscribe(
843
- const std::string& type_url, const std::string& name) {
844
- auto& state = state_map_[type_url].subscribed_resources[name];
903
+ void XdsClient::ChannelState::AdsCallState::SubscribeLocked(
904
+ const std::string& type_url, const XdsApi::ResourceName& resource) {
905
+ auto& state = state_map_[type_url]
906
+ .subscribed_resources[resource.authority][resource.id];
845
907
  if (state == nullptr) {
846
908
  state = MakeOrphanable<ResourceState>(
847
- type_url, name, !xds_client()->resource_version_map_[type_url].empty());
909
+ type_url, resource,
910
+ !chand()->resource_type_version_map_[type_url].empty());
848
911
  SendMessageLocked(type_url);
849
912
  }
850
913
  }
851
914
 
852
- void XdsClient::ChannelState::AdsCallState::Unsubscribe(
853
- const std::string& type_url, const std::string& name,
915
+ void XdsClient::ChannelState::AdsCallState::UnsubscribeLocked(
916
+ const std::string& type_url, const XdsApi::ResourceName& resource,
854
917
  bool delay_unsubscription) {
855
- state_map_[type_url].subscribed_resources.erase(name);
918
+ auto& type_state_map = state_map_[type_url];
919
+ auto& authority_map = type_state_map.subscribed_resources[resource.authority];
920
+ authority_map.erase(resource.id);
921
+ if (authority_map.empty()) {
922
+ type_state_map.subscribed_resources.erase(resource.authority);
923
+ }
856
924
  if (!delay_unsubscription) SendMessageLocked(type_url);
857
925
  }
858
926
 
@@ -863,8 +931,26 @@ bool XdsClient::ChannelState::AdsCallState::HasSubscribedResources() const {
863
931
  return false;
864
932
  }
865
933
 
866
- void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate(
867
- XdsApi::LdsUpdateMap lds_update_map) {
934
+ namespace {
935
+
936
+ // Build a resource metadata struct for ADS result accepting methods and CSDS.
937
+ XdsApi::ResourceMetadata CreateResourceMetadataAcked(
938
+ std::string serialized_proto, std::string version,
939
+ grpc_millis update_time) {
940
+ XdsApi::ResourceMetadata resource_metadata;
941
+ resource_metadata.serialized_proto = std::move(serialized_proto);
942
+ resource_metadata.update_time = update_time;
943
+ resource_metadata.version = std::move(version);
944
+ resource_metadata.client_status = XdsApi::ResourceMetadata::ACKED;
945
+ return resource_metadata;
946
+ }
947
+
948
+ } // namespace
949
+
950
+ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdateLocked(
951
+ std::string version, grpc_millis update_time,
952
+ XdsApi::LdsUpdateMap lds_update_map,
953
+ const std::set<XdsApi::ResourceName>& resource_names_failed) {
868
954
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
869
955
  gpr_log(GPR_INFO,
870
956
  "[xds_client %p] LDS update received containing %" PRIuPTR
@@ -874,61 +960,90 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate(
874
960
  auto& lds_state = state_map_[XdsApi::kLdsTypeUrl];
875
961
  std::set<std::string> rds_resource_names_seen;
876
962
  for (auto& p : lds_update_map) {
877
- const std::string& listener_name = p.first;
878
- XdsApi::LdsUpdate& lds_update = p.second;
879
- auto& state = lds_state.subscribed_resources[listener_name];
963
+ const XdsApi::ResourceName& resource = p.first;
964
+ XdsApi::LdsUpdate& lds_update = p.second.resource;
965
+ auto& state =
966
+ lds_state.subscribed_resources[resource.authority][resource.id];
880
967
  if (state != nullptr) state->Finish();
881
968
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
882
- gpr_log(GPR_INFO, "[xds_client %p] LDS resource %s: route_config_name=%s",
883
- xds_client(), listener_name.c_str(),
884
- (!lds_update.route_config_name.empty()
885
- ? lds_update.route_config_name.c_str()
886
- : "<inlined>"));
887
- if (lds_update.rds_update.has_value()) {
888
- gpr_log(GPR_INFO, "RouteConfiguration: %s",
889
- lds_update.rds_update->ToString().c_str());
890
- }
969
+ gpr_log(GPR_INFO, "[xds_client %p] LDS resource %s: %s", xds_client(),
970
+ XdsApi::ConstructFullResourceName(
971
+ resource.authority, XdsApi::kLdsTypeUrl, resource.id)
972
+ .c_str(),
973
+ lds_update.ToString().c_str());
891
974
  }
892
975
  // Record the RDS resource names seen.
893
- if (!lds_update.route_config_name.empty()) {
894
- rds_resource_names_seen.insert(lds_update.route_config_name);
976
+ if (!lds_update.http_connection_manager.route_config_name.empty()) {
977
+ rds_resource_names_seen.insert(
978
+ lds_update.http_connection_manager.route_config_name);
895
979
  }
980
+ ListenerState& listener_state =
981
+ xds_client()
982
+ ->authority_state_map_[resource.authority]
983
+ .listener_map[resource.id];
896
984
  // Ignore identical update.
897
- ListenerState& listener_state = xds_client()->listener_map_[listener_name];
898
985
  if (listener_state.update.has_value() &&
899
986
  *listener_state.update == lds_update) {
900
987
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
901
988
  gpr_log(GPR_INFO,
902
989
  "[xds_client %p] LDS update for %s identical to current, "
903
990
  "ignoring.",
904
- xds_client(), listener_name.c_str());
991
+ xds_client(),
992
+ XdsApi::ConstructFullResourceName(
993
+ resource.authority, XdsApi::kLdsTypeUrl, resource.id)
994
+ .c_str());
905
995
  }
906
996
  continue;
907
997
  }
908
998
  // Update the listener state.
909
999
  listener_state.update = std::move(lds_update);
1000
+ listener_state.meta = CreateResourceMetadataAcked(
1001
+ std::move(p.second.serialized_proto), version, update_time);
910
1002
  // Notify watchers.
911
1003
  for (const auto& p : listener_state.watchers) {
912
1004
  p.first->OnListenerChanged(*listener_state.update);
913
1005
  }
914
1006
  }
1007
+ // For invalid resources in the update, if they are already in the
1008
+ // cache, pretend that they are present in the update, so that we
1009
+ // don't incorrectly consider them deleted below.
1010
+ for (const auto& resource : resource_names_failed) {
1011
+ auto& listener_map =
1012
+ xds_client()->authority_state_map_[resource.authority].listener_map;
1013
+ auto it = listener_map.find(resource.id);
1014
+ if (it != listener_map.end()) {
1015
+ auto& update = it->second.update;
1016
+ if (!update.has_value()) continue;
1017
+ lds_update_map[resource];
1018
+ if (!update->http_connection_manager.route_config_name.empty()) {
1019
+ rds_resource_names_seen.insert(
1020
+ update->http_connection_manager.route_config_name);
1021
+ }
1022
+ }
1023
+ }
915
1024
  // For any subscribed resource that is not present in the update,
916
1025
  // remove it from the cache and notify watchers that it does not exist.
917
- for (const auto& p : lds_state.subscribed_resources) {
918
- const std::string& listener_name = p.first;
919
- if (lds_update_map.find(listener_name) == lds_update_map.end()) {
920
- ListenerState& listener_state =
921
- xds_client()->listener_map_[listener_name];
922
- // If the resource was newly requested but has not yet been received,
923
- // we don't want to generate an error for the watchers, because this LDS
924
- // response may be in reaction to an earlier request that did not yet
925
- // request the new resource, so its absence from the response does not
926
- // necessarily indicate that the resource does not exist.
927
- // For that case, we rely on the request timeout instead.
928
- if (!listener_state.update.has_value()) continue;
929
- listener_state.update.reset();
930
- for (const auto& p : listener_state.watchers) {
931
- p.first->OnResourceDoesNotExist();
1026
+ for (const auto& a : lds_state.subscribed_resources) {
1027
+ const std::string& authority_name = a.first;
1028
+ for (const auto& p : a.second) {
1029
+ const std::string& listener_name = p.first;
1030
+ if (lds_update_map.find({authority_name, listener_name}) ==
1031
+ lds_update_map.end()) {
1032
+ ListenerState& listener_state =
1033
+ xds_client()
1034
+ ->authority_state_map_[authority_name]
1035
+ .listener_map[listener_name];
1036
+ // If the resource was newly requested but has not yet been received,
1037
+ // we don't want to generate an error for the watchers, because this LDS
1038
+ // response may be in reaction to an earlier request that did not yet
1039
+ // request the new resource, so its absence from the response does not
1040
+ // necessarily indicate that the resource does not exist.
1041
+ // For that case, we rely on the request timeout instead.
1042
+ if (!listener_state.update.has_value()) continue;
1043
+ listener_state.update.reset();
1044
+ for (const auto& p : listener_state.watchers) {
1045
+ p.first->OnResourceDoesNotExist();
1046
+ }
932
1047
  }
933
1048
  }
934
1049
  }
@@ -936,21 +1051,28 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate(
936
1051
  // resources, remove it from the cache and notify watchers that it
937
1052
  // does not exist.
938
1053
  auto& rds_state = state_map_[XdsApi::kRdsTypeUrl];
939
- for (const auto& p : rds_state.subscribed_resources) {
940
- const std::string& rds_resource_name = p.first;
941
- if (rds_resource_names_seen.find(rds_resource_name) ==
942
- rds_resource_names_seen.end()) {
943
- RouteConfigState& route_config_state =
944
- xds_client()->route_config_map_[rds_resource_name];
945
- route_config_state.update.reset();
946
- for (const auto& p : route_config_state.watchers) {
947
- p.first->OnResourceDoesNotExist();
1054
+ for (const auto& a : rds_state.subscribed_resources) {
1055
+ const std::string& authority_name = a.first;
1056
+ for (const auto& p : a.second) {
1057
+ const std::string& listener_name = p.first;
1058
+ if (rds_resource_names_seen.find(XdsApi::ConstructFullResourceName(
1059
+ authority_name, XdsApi::kRdsTypeUrl, listener_name)) ==
1060
+ rds_resource_names_seen.end()) {
1061
+ RouteConfigState& route_config_state =
1062
+ xds_client()
1063
+ ->authority_state_map_[authority_name]
1064
+ .route_config_map[listener_name];
1065
+ route_config_state.update.reset();
1066
+ for (const auto& p : route_config_state.watchers) {
1067
+ p.first->OnResourceDoesNotExist();
1068
+ }
948
1069
  }
949
1070
  }
950
1071
  }
951
1072
  }
952
1073
 
953
- void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdate(
1074
+ void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdateLocked(
1075
+ std::string version, grpc_millis update_time,
954
1076
  XdsApi::RdsUpdateMap rds_update_map) {
955
1077
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
956
1078
  gpr_log(GPR_INFO,
@@ -960,16 +1082,19 @@ void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdate(
960
1082
  }
961
1083
  auto& rds_state = state_map_[XdsApi::kRdsTypeUrl];
962
1084
  for (auto& p : rds_update_map) {
963
- const std::string& route_config_name = p.first;
964
- XdsApi::RdsUpdate& rds_update = p.second;
965
- auto& state = rds_state.subscribed_resources[route_config_name];
1085
+ const XdsApi::ResourceName& resource = p.first;
1086
+ XdsApi::RdsUpdate& rds_update = p.second.resource;
1087
+ auto& state =
1088
+ rds_state.subscribed_resources[resource.authority][resource.id];
966
1089
  if (state != nullptr) state->Finish();
967
1090
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
968
1091
  gpr_log(GPR_INFO, "[xds_client %p] RDS resource:\n%s", xds_client(),
969
1092
  rds_update.ToString().c_str());
970
1093
  }
971
1094
  RouteConfigState& route_config_state =
972
- xds_client()->route_config_map_[route_config_name];
1095
+ xds_client()
1096
+ ->authority_state_map_[resource.authority]
1097
+ .route_config_map[resource.id];
973
1098
  // Ignore identical update.
974
1099
  if (route_config_state.update.has_value() &&
975
1100
  *route_config_state.update == rds_update) {
@@ -982,6 +1107,8 @@ void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdate(
982
1107
  }
983
1108
  // Update the cache.
984
1109
  route_config_state.update = std::move(rds_update);
1110
+ route_config_state.meta = CreateResourceMetadataAcked(
1111
+ std::move(p.second.serialized_proto), version, update_time);
985
1112
  // Notify all watchers.
986
1113
  for (const auto& p : route_config_state.watchers) {
987
1114
  p.first->OnRouteConfigChanged(*route_config_state.update);
@@ -989,8 +1116,10 @@ void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdate(
989
1116
  }
990
1117
  }
991
1118
 
992
- void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
993
- XdsApi::CdsUpdateMap cds_update_map) {
1119
+ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdateLocked(
1120
+ std::string version, grpc_millis update_time,
1121
+ XdsApi::CdsUpdateMap cds_update_map,
1122
+ const std::set<XdsApi::ResourceName>& resource_names_failed) {
994
1123
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
995
1124
  gpr_log(GPR_INFO,
996
1125
  "[xds_client %p] CDS update received containing %" PRIuPTR
@@ -1000,25 +1129,28 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
1000
1129
  auto& cds_state = state_map_[XdsApi::kCdsTypeUrl];
1001
1130
  std::set<std::string> eds_resource_names_seen;
1002
1131
  for (auto& p : cds_update_map) {
1003
- const char* cluster_name = p.first.c_str();
1004
- XdsApi::CdsUpdate& cds_update = p.second;
1005
- auto& state = cds_state.subscribed_resources[cluster_name];
1132
+ const XdsApi::ResourceName& resource = p.first;
1133
+ XdsApi::CdsUpdate& cds_update = p.second.resource;
1134
+ auto& state =
1135
+ cds_state.subscribed_resources[resource.authority][resource.id];
1006
1136
  if (state != nullptr) state->Finish();
1007
1137
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1008
- gpr_log(GPR_INFO,
1009
- "[xds_client %p] cluster=%s: eds_service_name=%s, "
1010
- "lrs_load_reporting_server_name=%s",
1011
- xds_client(), cluster_name, cds_update.eds_service_name.c_str(),
1012
- cds_update.lrs_load_reporting_server_name.has_value()
1013
- ? cds_update.lrs_load_reporting_server_name.value().c_str()
1014
- : "(N/A)");
1138
+ gpr_log(GPR_INFO, "[xds_client %p] cluster=%s: %s", xds_client(),
1139
+ XdsApi::ConstructFullResourceName(
1140
+ resource.authority, XdsApi::kCdsTypeUrl, resource.id)
1141
+ .c_str(),
1142
+ cds_update.ToString().c_str());
1015
1143
  }
1016
1144
  // Record the EDS resource names seen.
1017
- eds_resource_names_seen.insert(cds_update.eds_service_name.empty()
1018
- ? cluster_name
1019
- : cds_update.eds_service_name);
1145
+ eds_resource_names_seen.insert(
1146
+ cds_update.eds_service_name.empty()
1147
+ ? XdsApi::ConstructFullResourceName(
1148
+ resource.authority, XdsApi::kCdsTypeUrl, resource.id)
1149
+ : cds_update.eds_service_name);
1150
+ ClusterState& cluster_state = xds_client()
1151
+ ->authority_state_map_[resource.authority]
1152
+ .cluster_map[resource.id];
1020
1153
  // Ignore identical update.
1021
- ClusterState& cluster_state = xds_client()->cluster_map_[cluster_name];
1022
1154
  if (cluster_state.update.has_value() &&
1023
1155
  *cluster_state.update == cds_update) {
1024
1156
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
@@ -1030,27 +1162,53 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
1030
1162
  }
1031
1163
  // Update the cluster state.
1032
1164
  cluster_state.update = std::move(cds_update);
1165
+ cluster_state.meta = CreateResourceMetadataAcked(
1166
+ std::move(p.second.serialized_proto), version, update_time);
1033
1167
  // Notify all watchers.
1034
1168
  for (const auto& p : cluster_state.watchers) {
1035
1169
  p.first->OnClusterChanged(cluster_state.update.value());
1036
1170
  }
1037
1171
  }
1172
+ // For invalid resources in the update, if they are already in the
1173
+ // cache, pretend that they are present in the update, so that we
1174
+ // don't incorrectly consider them deleted below.
1175
+ for (const auto& resource : resource_names_failed) {
1176
+ auto& cluster_map =
1177
+ xds_client()->authority_state_map_[resource.authority].cluster_map;
1178
+ auto it = cluster_map.find(resource.id);
1179
+ if (it != cluster_map.end()) {
1180
+ auto& update = it->second.update;
1181
+ if (!update.has_value()) continue;
1182
+ cds_update_map[resource];
1183
+ eds_resource_names_seen.insert(
1184
+ update->eds_service_name.empty()
1185
+ ? XdsApi::ConstructFullResourceName(
1186
+ resource.authority, XdsApi::kCdsTypeUrl, resource.id)
1187
+ : update->eds_service_name);
1188
+ }
1189
+ }
1038
1190
  // For any subscribed resource that is not present in the update,
1039
1191
  // remove it from the cache and notify watchers that it does not exist.
1040
- for (const auto& p : cds_state.subscribed_resources) {
1041
- const std::string& cluster_name = p.first;
1042
- if (cds_update_map.find(cluster_name) == cds_update_map.end()) {
1043
- ClusterState& cluster_state = xds_client()->cluster_map_[cluster_name];
1044
- // If the resource was newly requested but has not yet been received,
1045
- // we don't want to generate an error for the watchers, because this CDS
1046
- // response may be in reaction to an earlier request that did not yet
1047
- // request the new resource, so its absence from the response does not
1048
- // necessarily indicate that the resource does not exist.
1049
- // For that case, we rely on the request timeout instead.
1050
- if (!cluster_state.update.has_value()) continue;
1051
- cluster_state.update.reset();
1052
- for (const auto& p : cluster_state.watchers) {
1053
- p.first->OnResourceDoesNotExist();
1192
+ for (const auto& a : cds_state.subscribed_resources) {
1193
+ const std::string& authority = a.first;
1194
+ for (const auto& p : a.second) {
1195
+ const std::string& cluster_name = p.first;
1196
+ if (cds_update_map.find({authority, cluster_name}) ==
1197
+ cds_update_map.end()) {
1198
+ ClusterState& cluster_state = xds_client()
1199
+ ->authority_state_map_[authority]
1200
+ .cluster_map[cluster_name];
1201
+ // If the resource was newly requested but has not yet been received,
1202
+ // we don't want to generate an error for the watchers, because this CDS
1203
+ // response may be in reaction to an earlier request that did not yet
1204
+ // request the new resource, so its absence from the response does not
1205
+ // necessarily indicate that the resource does not exist.
1206
+ // For that case, we rely on the request timeout instead.
1207
+ if (!cluster_state.update.has_value()) continue;
1208
+ cluster_state.update.reset();
1209
+ for (const auto& p : cluster_state.watchers) {
1210
+ p.first->OnResourceDoesNotExist();
1211
+ }
1054
1212
  }
1055
1213
  }
1056
1214
  }
@@ -1058,21 +1216,27 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
1058
1216
  // resources, remove it from the cache and notify watchers that it
1059
1217
  // does not exist.
1060
1218
  auto& eds_state = state_map_[XdsApi::kEdsTypeUrl];
1061
- for (const auto& p : eds_state.subscribed_resources) {
1062
- const std::string& eds_resource_name = p.first;
1063
- if (eds_resource_names_seen.find(eds_resource_name) ==
1064
- eds_resource_names_seen.end()) {
1065
- EndpointState& endpoint_state =
1066
- xds_client()->endpoint_map_[eds_resource_name];
1067
- endpoint_state.update.reset();
1068
- for (const auto& p : endpoint_state.watchers) {
1069
- p.first->OnResourceDoesNotExist();
1219
+ for (const auto& a : eds_state.subscribed_resources) {
1220
+ const std::string& authority = a.first;
1221
+ for (const auto& p : a.second) {
1222
+ const std::string& eds_resource_name = p.first;
1223
+ if (eds_resource_names_seen.find(XdsApi::ConstructFullResourceName(
1224
+ authority, XdsApi::kEdsTypeUrl, eds_resource_name)) ==
1225
+ eds_resource_names_seen.end()) {
1226
+ EndpointState& endpoint_state = xds_client()
1227
+ ->authority_state_map_[authority]
1228
+ .endpoint_map[eds_resource_name];
1229
+ endpoint_state.update.reset();
1230
+ for (const auto& p : endpoint_state.watchers) {
1231
+ p.first->OnResourceDoesNotExist();
1232
+ }
1070
1233
  }
1071
1234
  }
1072
1235
  }
1073
1236
  }
1074
1237
 
1075
- void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
1238
+ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdateLocked(
1239
+ std::string version, grpc_millis update_time,
1076
1240
  XdsApi::EdsUpdateMap eds_update_map) {
1077
1241
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1078
1242
  gpr_log(GPR_INFO,
@@ -1082,16 +1246,22 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
1082
1246
  }
1083
1247
  auto& eds_state = state_map_[XdsApi::kEdsTypeUrl];
1084
1248
  for (auto& p : eds_update_map) {
1085
- const char* eds_service_name = p.first.c_str();
1086
- XdsApi::EdsUpdate& eds_update = p.second;
1087
- auto& state = eds_state.subscribed_resources[eds_service_name];
1249
+ const XdsApi::ResourceName& resource = p.first;
1250
+ XdsApi::EdsUpdate& eds_update = p.second.resource;
1251
+ auto& state =
1252
+ eds_state.subscribed_resources[resource.authority][resource.id];
1088
1253
  if (state != nullptr) state->Finish();
1089
1254
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1090
1255
  gpr_log(GPR_INFO, "[xds_client %p] EDS resource %s: %s", xds_client(),
1091
- eds_service_name, eds_update.ToString().c_str());
1256
+ XdsApi::ConstructFullResourceName(
1257
+ resource.authority, XdsApi::kCdsTypeUrl, resource.id)
1258
+ .c_str(),
1259
+ eds_update.ToString().c_str());
1092
1260
  }
1093
1261
  EndpointState& endpoint_state =
1094
- xds_client()->endpoint_map_[eds_service_name];
1262
+ xds_client()
1263
+ ->authority_state_map_[resource.authority]
1264
+ .endpoint_map[resource.id];
1095
1265
  // Ignore identical update.
1096
1266
  if (endpoint_state.update.has_value() &&
1097
1267
  *endpoint_state.update == eds_update) {
@@ -1104,6 +1274,8 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
1104
1274
  }
1105
1275
  // Update the cluster state.
1106
1276
  endpoint_state.update = std::move(eds_update);
1277
+ endpoint_state.meta = CreateResourceMetadataAcked(
1278
+ std::move(p.second.serialized_proto), version, update_time);
1107
1279
  // Notify all watchers.
1108
1280
  for (const auto& p : endpoint_state.watchers) {
1109
1281
  p.first->OnEndpointChanged(endpoint_state.update.value());
@@ -1111,8 +1283,71 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
1111
1283
  }
1112
1284
  }
1113
1285
 
1114
- void XdsClient::ChannelState::AdsCallState::OnRequestSent(void* arg,
1115
- grpc_error* error) {
1286
+ namespace {
1287
+
1288
+ // Update resource_metadata for NACK.
1289
+ void UpdateResourceMetadataNacked(const std::string& version,
1290
+ const std::string& details,
1291
+ grpc_millis update_time,
1292
+ XdsApi::ResourceMetadata* resource_metadata) {
1293
+ resource_metadata->client_status = XdsApi::ResourceMetadata::NACKED;
1294
+ resource_metadata->failed_version = version;
1295
+ resource_metadata->failed_details = details;
1296
+ resource_metadata->failed_update_time = update_time;
1297
+ }
1298
+
1299
+ } // namespace
1300
+
1301
+ template <typename StateMap>
1302
+ void XdsClient::ChannelState::AdsCallState::RejectAdsUpdateHelperLocked(
1303
+ const std::string& resource_name, grpc_millis update_time,
1304
+ const XdsApi::AdsParseResult& result, const std::string& error_details,
1305
+ StateMap* state_map) {
1306
+ auto it = state_map->find(resource_name);
1307
+ if (it == state_map->end()) return;
1308
+ auto& state = it->second;
1309
+ for (const auto& p : state.watchers) {
1310
+ p.first->OnError(GRPC_ERROR_REF(result.parse_error));
1311
+ }
1312
+ UpdateResourceMetadataNacked(result.version, error_details, update_time,
1313
+ &state.meta);
1314
+ }
1315
+
1316
+ void XdsClient::ChannelState::AdsCallState::RejectAdsUpdateLocked(
1317
+ grpc_millis update_time, const XdsApi::AdsParseResult& result) {
1318
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1319
+ gpr_log(GPR_INFO,
1320
+ "[xds_client %p] %s update NACKed containing %" PRIuPTR
1321
+ " invalid resources",
1322
+ xds_client(), result.type_url.c_str(),
1323
+ result.resource_names_failed.size());
1324
+ }
1325
+ std::string details = grpc_error_std_string(result.parse_error);
1326
+ for (auto& resource : result.resource_names_failed) {
1327
+ auto authority_it =
1328
+ xds_client()->authority_state_map_.find(resource.authority);
1329
+ if (authority_it == xds_client()->authority_state_map_.end()) continue;
1330
+ AuthorityState& authority_state = authority_it->second;
1331
+ if (result.type_url == XdsApi::kLdsTypeUrl) {
1332
+ RejectAdsUpdateHelperLocked(resource.id, update_time, result, details,
1333
+ &authority_state.listener_map);
1334
+ } else if (result.type_url == XdsApi::kRdsTypeUrl) {
1335
+ RejectAdsUpdateHelperLocked(resource.id, update_time, result, details,
1336
+ &authority_state.route_config_map);
1337
+ } else if (result.type_url == XdsApi::kCdsTypeUrl) {
1338
+ RejectAdsUpdateHelperLocked(resource.id, update_time, result, details,
1339
+ &authority_state.cluster_map);
1340
+ } else if (result.type_url == XdsApi::kEdsTypeUrl) {
1341
+ RejectAdsUpdateHelperLocked(resource.id, update_time, result, details,
1342
+ &authority_state.endpoint_map);
1343
+ } else {
1344
+ GPR_ASSERT(0);
1345
+ }
1346
+ }
1347
+ }
1348
+
1349
+ void XdsClient::ChannelState::AdsCallState::OnRequestSent(
1350
+ void* arg, grpc_error_handle error) {
1116
1351
  AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
1117
1352
  {
1118
1353
  MutexLock lock(&ads_calld->xds_client()->mu_);
@@ -1122,7 +1357,7 @@ void XdsClient::ChannelState::AdsCallState::OnRequestSent(void* arg,
1122
1357
  }
1123
1358
 
1124
1359
  void XdsClient::ChannelState::AdsCallState::OnRequestSentLocked(
1125
- grpc_error* error) {
1360
+ grpc_error_handle error) {
1126
1361
  if (IsCurrentCallOnChannel() && error == GRPC_ERROR_NONE) {
1127
1362
  // Clean up the sent message.
1128
1363
  grpc_byte_buffer_destroy(send_message_payload_);
@@ -1146,7 +1381,7 @@ void XdsClient::ChannelState::AdsCallState::OnRequestSentLocked(
1146
1381
  }
1147
1382
 
1148
1383
  void XdsClient::ChannelState::AdsCallState::OnResponseReceived(
1149
- void* arg, grpc_error* /* error */) {
1384
+ void* arg, grpc_error_handle /* error */) {
1150
1385
  AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
1151
1386
  bool done;
1152
1387
  {
@@ -1170,7 +1405,8 @@ bool XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
1170
1405
  recv_message_payload_ = nullptr;
1171
1406
  // Parse and validate the response.
1172
1407
  XdsApi::AdsParseResult result = xds_client()->api_.ParseAdsResponse(
1173
- response_slice, ResourceNamesForRequest(XdsApi::kLdsTypeUrl),
1408
+ chand()->server_, response_slice,
1409
+ ResourceNamesForRequest(XdsApi::kLdsTypeUrl),
1174
1410
  ResourceNamesForRequest(XdsApi::kRdsTypeUrl),
1175
1411
  ResourceNamesForRequest(XdsApi::kCdsTypeUrl),
1176
1412
  ResourceNamesForRequest(XdsApi::kEdsTypeUrl));
@@ -1179,39 +1415,52 @@ bool XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
1179
1415
  // Ignore unparsable response.
1180
1416
  gpr_log(GPR_ERROR,
1181
1417
  "[xds_client %p] Error parsing ADS response (%s) -- ignoring",
1182
- xds_client(), grpc_error_string(result.parse_error));
1418
+ xds_client(), grpc_error_std_string(result.parse_error).c_str());
1183
1419
  GRPC_ERROR_UNREF(result.parse_error);
1184
1420
  } else {
1421
+ grpc_millis update_time = grpc_core::ExecCtx::Get()->Now();
1185
1422
  // Update nonce.
1186
1423
  auto& state = state_map_[result.type_url];
1187
1424
  state.nonce = std::move(result.nonce);
1188
- // NACK or ACK the response.
1425
+ // If we got an error, we'll NACK the update.
1189
1426
  if (result.parse_error != GRPC_ERROR_NONE) {
1190
- GRPC_ERROR_UNREF(state.error);
1191
- state.error = result.parse_error;
1192
- // NACK unacceptable update.
1193
1427
  gpr_log(GPR_ERROR,
1194
1428
  "[xds_client %p] ADS response invalid for resource type %s "
1195
1429
  "version %s, will NACK: nonce=%s error=%s",
1196
1430
  xds_client(), result.type_url.c_str(), result.version.c_str(),
1197
- state.nonce.c_str(), grpc_error_string(result.parse_error));
1198
- SendMessageLocked(result.type_url);
1199
- } else {
1431
+ state.nonce.c_str(),
1432
+ grpc_error_std_string(result.parse_error).c_str());
1433
+ result.parse_error =
1434
+ grpc_error_set_int(result.parse_error, GRPC_ERROR_INT_GRPC_STATUS,
1435
+ GRPC_STATUS_UNAVAILABLE);
1436
+ GRPC_ERROR_UNREF(state.error);
1437
+ state.error = result.parse_error;
1438
+ RejectAdsUpdateLocked(update_time, result);
1439
+ }
1440
+ // Process any valid resources.
1441
+ bool have_valid_resources = false;
1442
+ if (result.type_url == XdsApi::kLdsTypeUrl) {
1443
+ have_valid_resources = !result.lds_update_map.empty();
1444
+ AcceptLdsUpdateLocked(result.version, update_time,
1445
+ std::move(result.lds_update_map),
1446
+ result.resource_names_failed);
1447
+ } else if (result.type_url == XdsApi::kRdsTypeUrl) {
1448
+ have_valid_resources = !result.rds_update_map.empty();
1449
+ AcceptRdsUpdateLocked(result.version, update_time,
1450
+ std::move(result.rds_update_map));
1451
+ } else if (result.type_url == XdsApi::kCdsTypeUrl) {
1452
+ have_valid_resources = !result.cds_update_map.empty();
1453
+ AcceptCdsUpdateLocked(result.version, update_time,
1454
+ std::move(result.cds_update_map),
1455
+ result.resource_names_failed);
1456
+ } else if (result.type_url == XdsApi::kEdsTypeUrl) {
1457
+ have_valid_resources = !result.eds_update_map.empty();
1458
+ AcceptEdsUpdateLocked(result.version, update_time,
1459
+ std::move(result.eds_update_map));
1460
+ }
1461
+ if (have_valid_resources) {
1200
1462
  seen_response_ = true;
1201
- // Accept the ADS response according to the type_url.
1202
- if (result.type_url == XdsApi::kLdsTypeUrl) {
1203
- AcceptLdsUpdate(std::move(result.lds_update_map));
1204
- } else if (result.type_url == XdsApi::kRdsTypeUrl) {
1205
- AcceptRdsUpdate(std::move(result.rds_update_map));
1206
- } else if (result.type_url == XdsApi::kCdsTypeUrl) {
1207
- AcceptCdsUpdate(std::move(result.cds_update_map));
1208
- } else if (result.type_url == XdsApi::kEdsTypeUrl) {
1209
- AcceptEdsUpdate(std::move(result.eds_update_map));
1210
- }
1211
- xds_client()->resource_version_map_[result.type_url] =
1212
- std::move(result.version);
1213
- // ACK the update.
1214
- SendMessageLocked(result.type_url);
1463
+ chand()->resource_type_version_map_[result.type_url] = result.version;
1215
1464
  // Start load reporting if needed.
1216
1465
  auto& lrs_call = chand()->lrs_calld_;
1217
1466
  if (lrs_call != nullptr) {
@@ -1219,6 +1468,8 @@ bool XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
1219
1468
  if (lrs_calld != nullptr) lrs_calld->MaybeStartReportingLocked();
1220
1469
  }
1221
1470
  }
1471
+ // Send ACK or NACK.
1472
+ SendMessageLocked(result.type_url);
1222
1473
  }
1223
1474
  if (xds_client()->shutting_down_) return true;
1224
1475
  // Keep listening for updates.
@@ -1237,7 +1488,7 @@ bool XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
1237
1488
  }
1238
1489
 
1239
1490
  void XdsClient::ChannelState::AdsCallState::OnStatusReceived(
1240
- void* arg, grpc_error* error) {
1491
+ void* arg, grpc_error_handle error) {
1241
1492
  AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
1242
1493
  {
1243
1494
  MutexLock lock(&ads_calld->xds_client()->mu_);
@@ -1247,14 +1498,14 @@ void XdsClient::ChannelState::AdsCallState::OnStatusReceived(
1247
1498
  }
1248
1499
 
1249
1500
  void XdsClient::ChannelState::AdsCallState::OnStatusReceivedLocked(
1250
- grpc_error* error) {
1501
+ grpc_error_handle error) {
1251
1502
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1252
1503
  char* status_details = grpc_slice_to_c_string(status_details_);
1253
1504
  gpr_log(GPR_INFO,
1254
1505
  "[xds_client %p] ADS call status received. Status = %d, details "
1255
1506
  "= '%s', (chand: %p, ads_calld: %p, call: %p), error '%s'",
1256
1507
  xds_client(), status_code_, status_details, chand(), this, call_,
1257
- grpc_error_string(error));
1508
+ grpc_error_std_string(error).c_str());
1258
1509
  gpr_free(status_details);
1259
1510
  }
1260
1511
  // Ignore status from a stale call.
@@ -1275,19 +1526,23 @@ bool XdsClient::ChannelState::AdsCallState::IsCurrentCallOnChannel() const {
1275
1526
  return this == chand()->ads_calld_->calld();
1276
1527
  }
1277
1528
 
1278
- std::set<absl::string_view>
1529
+ std::map<absl::string_view /*authority*/, std::set<absl::string_view /*name*/>>
1279
1530
  XdsClient::ChannelState::AdsCallState::ResourceNamesForRequest(
1280
1531
  const std::string& type_url) {
1281
- std::set<absl::string_view> resource_names;
1532
+ std::map<absl::string_view /*authority*/,
1533
+ std::set<absl::string_view /*name*/>>
1534
+ resource_map;
1282
1535
  auto it = state_map_.find(type_url);
1283
1536
  if (it != state_map_.end()) {
1284
- for (auto& p : it->second.subscribed_resources) {
1285
- resource_names.insert(p.first);
1286
- OrphanablePtr<ResourceState>& state = p.second;
1287
- state->Start(Ref(DEBUG_LOCATION, "ResourceState"));
1537
+ for (auto& a : it->second.subscribed_resources) {
1538
+ for (auto& p : a.second) {
1539
+ resource_map[a.first].insert(p.first);
1540
+ OrphanablePtr<ResourceState>& state = p.second;
1541
+ state->Start(Ref(DEBUG_LOCATION, "ResourceState"));
1542
+ }
1288
1543
  }
1289
1544
  }
1290
- return resource_names;
1545
+ return resource_map;
1291
1546
  }
1292
1547
 
1293
1548
  //
@@ -1309,7 +1564,7 @@ void XdsClient::ChannelState::LrsCallState::Reporter::
1309
1564
  }
1310
1565
 
1311
1566
  void XdsClient::ChannelState::LrsCallState::Reporter::OnNextReportTimer(
1312
- void* arg, grpc_error* error) {
1567
+ void* arg, grpc_error_handle error) {
1313
1568
  Reporter* self = static_cast<Reporter*>(arg);
1314
1569
  bool done;
1315
1570
  {
@@ -1320,7 +1575,7 @@ void XdsClient::ChannelState::LrsCallState::Reporter::OnNextReportTimer(
1320
1575
  }
1321
1576
 
1322
1577
  bool XdsClient::ChannelState::LrsCallState::Reporter::OnNextReportTimerLocked(
1323
- grpc_error* error) {
1578
+ grpc_error_handle error) {
1324
1579
  next_report_timer_callback_pending_ = false;
1325
1580
  if (error != GRPC_ERROR_NONE || !IsCurrentReporterOnCall()) {
1326
1581
  GRPC_ERROR_UNREF(error);
@@ -1385,7 +1640,7 @@ bool XdsClient::ChannelState::LrsCallState::Reporter::SendReportLocked() {
1385
1640
  }
1386
1641
 
1387
1642
  void XdsClient::ChannelState::LrsCallState::Reporter::OnReportDone(
1388
- void* arg, grpc_error* error) {
1643
+ void* arg, grpc_error_handle error) {
1389
1644
  Reporter* self = static_cast<Reporter*>(arg);
1390
1645
  bool done;
1391
1646
  {
@@ -1396,7 +1651,7 @@ void XdsClient::ChannelState::LrsCallState::Reporter::OnReportDone(
1396
1651
  }
1397
1652
 
1398
1653
  bool XdsClient::ChannelState::LrsCallState::Reporter::OnReportDoneLocked(
1399
- grpc_error* error) {
1654
+ grpc_error_handle error) {
1400
1655
  grpc_byte_buffer_destroy(parent_->send_message_payload_);
1401
1656
  parent_->send_message_payload_ = nullptr;
1402
1657
  // If there are no more registered stats to report, cancel the call.
@@ -1425,8 +1680,9 @@ bool XdsClient::ChannelState::LrsCallState::Reporter::OnReportDoneLocked(
1425
1680
  XdsClient::ChannelState::LrsCallState::LrsCallState(
1426
1681
  RefCountedPtr<RetryableCall<LrsCallState>> parent)
1427
1682
  : InternallyRefCounted<LrsCallState>(
1428
- GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace) ? "LrsCallState"
1429
- : nullptr),
1683
+ GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_refcount_trace)
1684
+ ? "LrsCallState"
1685
+ : nullptr),
1430
1686
  parent_(std::move(parent)) {
1431
1687
  // Init the LRS call. Note that the call will progress every time there's
1432
1688
  // activity in xds_client()->interested_parties_, which is comprised of
@@ -1479,8 +1735,8 @@ XdsClient::ChannelState::LrsCallState::LrsCallState(
1479
1735
  Ref(DEBUG_LOCATION, "LRS+OnInitialRequestSentLocked").release();
1480
1736
  GRPC_CLOSURE_INIT(&on_initial_request_sent_, OnInitialRequestSent, this,
1481
1737
  grpc_schedule_on_exec_ctx);
1482
- call_error = grpc_call_start_batch_and_execute(call_, ops, (size_t)(op - ops),
1483
- &on_initial_request_sent_);
1738
+ call_error = grpc_call_start_batch_and_execute(
1739
+ call_, ops, static_cast<size_t>(op - ops), &on_initial_request_sent_);
1484
1740
  GPR_ASSERT(GRPC_CALL_OK == call_error);
1485
1741
  // Op: recv initial metadata.
1486
1742
  op = ops;
@@ -1499,8 +1755,8 @@ XdsClient::ChannelState::LrsCallState::LrsCallState(
1499
1755
  Ref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked").release();
1500
1756
  GRPC_CLOSURE_INIT(&on_response_received_, OnResponseReceived, this,
1501
1757
  grpc_schedule_on_exec_ctx);
1502
- call_error = grpc_call_start_batch_and_execute(call_, ops, (size_t)(op - ops),
1503
- &on_response_received_);
1758
+ call_error = grpc_call_start_batch_and_execute(
1759
+ call_, ops, static_cast<size_t>(op - ops), &on_response_received_);
1504
1760
  GPR_ASSERT(GRPC_CALL_OK == call_error);
1505
1761
  // Op: recv server status.
1506
1762
  op = ops;
@@ -1516,8 +1772,8 @@ XdsClient::ChannelState::LrsCallState::LrsCallState(
1516
1772
  // unreffed.
1517
1773
  GRPC_CLOSURE_INIT(&on_status_received_, OnStatusReceived, this,
1518
1774
  grpc_schedule_on_exec_ctx);
1519
- call_error = grpc_call_start_batch_and_execute(call_, ops, (size_t)(op - ops),
1520
- &on_status_received_);
1775
+ call_error = grpc_call_start_batch_and_execute(
1776
+ call_, ops, static_cast<size_t>(op - ops), &on_status_received_);
1521
1777
  GPR_ASSERT(GRPC_CALL_OK == call_error);
1522
1778
  }
1523
1779
 
@@ -1565,7 +1821,7 @@ void XdsClient::ChannelState::LrsCallState::MaybeStartReportingLocked() {
1565
1821
  }
1566
1822
 
1567
1823
  void XdsClient::ChannelState::LrsCallState::OnInitialRequestSent(
1568
- void* arg, grpc_error* /*error*/) {
1824
+ void* arg, grpc_error_handle /*error*/) {
1569
1825
  LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
1570
1826
  {
1571
1827
  MutexLock lock(&lrs_calld->xds_client()->mu_);
@@ -1582,7 +1838,7 @@ void XdsClient::ChannelState::LrsCallState::OnInitialRequestSentLocked() {
1582
1838
  }
1583
1839
 
1584
1840
  void XdsClient::ChannelState::LrsCallState::OnResponseReceived(
1585
- void* arg, grpc_error* /*error*/) {
1841
+ void* arg, grpc_error_handle /*error*/) {
1586
1842
  LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
1587
1843
  bool done;
1588
1844
  {
@@ -1610,13 +1866,13 @@ bool XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked() {
1610
1866
  bool send_all_clusters = false;
1611
1867
  std::set<std::string> new_cluster_names;
1612
1868
  grpc_millis new_load_reporting_interval;
1613
- grpc_error* parse_error = xds_client()->api_.ParseLrsResponse(
1869
+ grpc_error_handle parse_error = xds_client()->api_.ParseLrsResponse(
1614
1870
  response_slice, &send_all_clusters, &new_cluster_names,
1615
1871
  &new_load_reporting_interval);
1616
1872
  if (parse_error != GRPC_ERROR_NONE) {
1617
1873
  gpr_log(GPR_ERROR,
1618
1874
  "[xds_client %p] LRS response parsing failed. error=%s",
1619
- xds_client(), grpc_error_string(parse_error));
1875
+ xds_client(), grpc_error_std_string(parse_error).c_str());
1620
1876
  GRPC_ERROR_UNREF(parse_error);
1621
1877
  return;
1622
1878
  }
@@ -1685,7 +1941,7 @@ bool XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked() {
1685
1941
  }
1686
1942
 
1687
1943
  void XdsClient::ChannelState::LrsCallState::OnStatusReceived(
1688
- void* arg, grpc_error* error) {
1944
+ void* arg, grpc_error_handle error) {
1689
1945
  LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
1690
1946
  {
1691
1947
  MutexLock lock(&lrs_calld->xds_client()->mu_);
@@ -1695,7 +1951,7 @@ void XdsClient::ChannelState::LrsCallState::OnStatusReceived(
1695
1951
  }
1696
1952
 
1697
1953
  void XdsClient::ChannelState::LrsCallState::OnStatusReceivedLocked(
1698
- grpc_error* error) {
1954
+ grpc_error_handle error) {
1699
1955
  GPR_ASSERT(call_ != nullptr);
1700
1956
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1701
1957
  char* status_details = grpc_slice_to_c_string(status_details_);
@@ -1703,7 +1959,7 @@ void XdsClient::ChannelState::LrsCallState::OnStatusReceivedLocked(
1703
1959
  "[xds_client %p] LRS call status received. Status = %d, details "
1704
1960
  "= '%s', (chand: %p, calld: %p, call: %p), error '%s'",
1705
1961
  xds_client(), status_code_, status_details, chand(), this, call_,
1706
- grpc_error_string(error));
1962
+ grpc_error_std_string(error).c_str());
1707
1963
  gpr_free(status_details);
1708
1964
  }
1709
1965
  // Ignore status from a stale call.
@@ -1728,60 +1984,54 @@ bool XdsClient::ChannelState::LrsCallState::IsCurrentCallOnChannel() const {
1728
1984
 
1729
1985
  namespace {
1730
1986
 
1731
- grpc_millis GetRequestTimeout() {
1987
+ grpc_millis GetRequestTimeout(const grpc_channel_args* args) {
1732
1988
  return grpc_channel_args_find_integer(
1733
- g_channel_args, GRPC_ARG_XDS_RESOURCE_DOES_NOT_EXIST_TIMEOUT_MS,
1989
+ args, GRPC_ARG_XDS_RESOURCE_DOES_NOT_EXIST_TIMEOUT_MS,
1734
1990
  {15000, 0, INT_MAX});
1735
1991
  }
1736
1992
 
1993
+ grpc_channel_args* ModifyChannelArgs(const grpc_channel_args* args) {
1994
+ absl::InlinedVector<grpc_arg, 1> args_to_add = {
1995
+ grpc_channel_arg_integer_create(
1996
+ const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS),
1997
+ 5 * 60 * GPR_MS_PER_SEC),
1998
+ };
1999
+ return grpc_channel_args_copy_and_add(args, args_to_add.data(),
2000
+ args_to_add.size());
2001
+ }
2002
+
1737
2003
  } // namespace
1738
2004
 
1739
- XdsClient::XdsClient(grpc_error** error)
1740
- : DualRefCounted<XdsClient>(GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)
1741
- ? "XdsClient"
1742
- : nullptr),
1743
- request_timeout_(GetRequestTimeout()),
2005
+ XdsClient::XdsClient(std::unique_ptr<XdsBootstrap> bootstrap,
2006
+ const grpc_channel_args* args)
2007
+ : DualRefCounted<XdsClient>(
2008
+ GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_refcount_trace) ? "XdsClient"
2009
+ : nullptr),
2010
+ bootstrap_(std::move(bootstrap)),
2011
+ args_(ModifyChannelArgs(args)),
2012
+ request_timeout_(GetRequestTimeout(args)),
1744
2013
  interested_parties_(grpc_pollset_set_create()),
1745
- bootstrap_(
1746
- XdsBootstrap::ReadFromFile(this, &grpc_xds_client_trace, error)),
1747
- api_(this, &grpc_xds_client_trace,
1748
- bootstrap_ == nullptr ? nullptr : bootstrap_->node()) {
2014
+ certificate_provider_store_(MakeOrphanable<CertificateProviderStore>(
2015
+ bootstrap_->certificate_providers())),
2016
+ api_(this, &grpc_xds_client_trace, bootstrap_->node(),
2017
+ &bootstrap_->certificate_providers()) {
1749
2018
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1750
2019
  gpr_log(GPR_INFO, "[xds_client %p] creating xds client", this);
1751
2020
  }
1752
- if (*error != GRPC_ERROR_NONE) {
1753
- gpr_log(GPR_ERROR, "[xds_client %p] failed to read bootstrap file: %s",
1754
- this, grpc_error_string(*error));
1755
- return;
1756
- }
1757
- // Create ChannelState object.
1758
- chand_ = MakeOrphanable<ChannelState>(
1759
- WeakRef(DEBUG_LOCATION, "XdsClient+ChannelState"), bootstrap_->server());
2021
+ // Calling grpc_init to ensure gRPC does not shut down until the XdsClient is
2022
+ // destroyed.
2023
+ grpc_init();
1760
2024
  }
1761
2025
 
1762
2026
  XdsClient::~XdsClient() {
1763
2027
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1764
2028
  gpr_log(GPR_INFO, "[xds_client %p] destroying xds client", this);
1765
2029
  }
2030
+ grpc_channel_args_destroy(args_);
1766
2031
  grpc_pollset_set_destroy(interested_parties_);
1767
- }
1768
-
1769
- void XdsClient::AddChannelzLinkage(
1770
- channelz::ChannelNode* parent_channelz_node) {
1771
- channelz::ChannelNode* xds_channelz_node =
1772
- grpc_channel_get_channelz_node(chand_->channel());
1773
- if (xds_channelz_node != nullptr) {
1774
- parent_channelz_node->AddChildChannel(xds_channelz_node->uuid());
1775
- }
1776
- }
1777
-
1778
- void XdsClient::RemoveChannelzLinkage(
1779
- channelz::ChannelNode* parent_channelz_node) {
1780
- channelz::ChannelNode* xds_channelz_node =
1781
- grpc_channel_get_channelz_node(chand_->channel());
1782
- if (xds_channelz_node != nullptr) {
1783
- parent_channelz_node->RemoveChildChannel(xds_channelz_node->uuid());
1784
- }
2032
+ // Calling grpc_shutdown to ensure gRPC does not shut down until the XdsClient
2033
+ // is destroyed.
2034
+ grpc_shutdown();
1785
2035
  }
1786
2036
 
1787
2037
  void XdsClient::Orphan() {
@@ -1795,19 +2045,38 @@ void XdsClient::Orphan() {
1795
2045
  {
1796
2046
  MutexLock lock(&mu_);
1797
2047
  shutting_down_ = true;
1798
- // Orphan ChannelState object.
1799
- chand_.reset();
1800
2048
  // We do not clear cluster_map_ and endpoint_map_ if the xds client was
1801
2049
  // created by the XdsResolver because the maps contain refs for watchers
1802
2050
  // which in turn hold refs to the loadbalancing policies. At this point, it
1803
2051
  // is possible for ADS calls to be in progress. Unreffing the loadbalancing
1804
2052
  // policies before those calls are done would lead to issues such as
1805
2053
  // https://github.com/grpc/grpc/issues/20928.
1806
- if (!listener_map_.empty()) {
1807
- cluster_map_.clear();
1808
- endpoint_map_.clear();
2054
+ for (auto& a : authority_state_map_) {
2055
+ a.second.channel_state.reset();
2056
+ if (!a.second.listener_map.empty()) {
2057
+ a.second.cluster_map.clear();
2058
+ a.second.endpoint_map.clear();
2059
+ }
1809
2060
  }
2061
+ // We clear these invalid resource watchers as cancel never came.
2062
+ invalid_listener_watchers_.clear();
2063
+ invalid_route_config_watchers_.clear();
2064
+ invalid_cluster_watchers_.clear();
2065
+ invalid_endpoint_watchers_.clear();
2066
+ }
2067
+ }
2068
+
2069
+ RefCountedPtr<XdsClient::ChannelState> XdsClient::GetOrCreateChannelStateLocked(
2070
+ const XdsBootstrap::XdsServer& server) {
2071
+ auto it = xds_server_channel_map_.find(server);
2072
+ if (it != xds_server_channel_map_.end()) {
2073
+ return it->second->Ref(DEBUG_LOCATION, "Authority");
1810
2074
  }
2075
+ // Channel not found, so create a new one.
2076
+ auto channel_state = MakeRefCounted<ChannelState>(
2077
+ WeakRef(DEBUG_LOCATION, "ChannelState"), server);
2078
+ xds_server_channel_map_[server] = channel_state.get();
2079
+ return channel_state;
1811
2080
  }
1812
2081
 
1813
2082
  void XdsClient::WatchListenerData(
@@ -1815,8 +2084,17 @@ void XdsClient::WatchListenerData(
1815
2084
  std::unique_ptr<ListenerWatcherInterface> watcher) {
1816
2085
  std::string listener_name_str = std::string(listener_name);
1817
2086
  MutexLock lock(&mu_);
1818
- ListenerState& listener_state = listener_map_[listener_name_str];
1819
2087
  ListenerWatcherInterface* w = watcher.get();
2088
+ auto resource = XdsApi::ParseResourceName(listener_name, XdsApi::IsLds);
2089
+ if (!resource.ok()) {
2090
+ invalid_listener_watchers_[w] = std::move(watcher);
2091
+ grpc_error_handle error = GRPC_ERROR_CREATE_FROM_CPP_STRING(absl::StrFormat(
2092
+ "Unable to parse resource name for listener %s", listener_name));
2093
+ w->OnError(GRPC_ERROR_REF(error));
2094
+ return;
2095
+ }
2096
+ AuthorityState& authority_state = authority_state_map_[resource->authority];
2097
+ ListenerState& listener_state = authority_state.listener_map[resource->id];
1820
2098
  listener_state.watchers[w] = std::move(watcher);
1821
2099
  // If we've already received an LDS update, notify the new watcher
1822
2100
  // immediately.
@@ -1827,7 +2105,13 @@ void XdsClient::WatchListenerData(
1827
2105
  }
1828
2106
  w->OnListenerChanged(*listener_state.update);
1829
2107
  }
1830
- chand_->Subscribe(XdsApi::kLdsTypeUrl, listener_name_str);
2108
+ // If the authority doesn't yet have a channel, set it, creating it if needed.
2109
+ if (authority_state.channel_state == nullptr) {
2110
+ authority_state.channel_state =
2111
+ GetOrCreateChannelStateLocked(bootstrap_->server());
2112
+ }
2113
+ authority_state.channel_state->SubscribeLocked(XdsApi::kLdsTypeUrl,
2114
+ *resource);
1831
2115
  }
1832
2116
 
1833
2117
  void XdsClient::CancelListenerDataWatch(absl::string_view listener_name,
@@ -1835,16 +2119,22 @@ void XdsClient::CancelListenerDataWatch(absl::string_view listener_name,
1835
2119
  bool delay_unsubscription) {
1836
2120
  MutexLock lock(&mu_);
1837
2121
  if (shutting_down_) return;
1838
- std::string listener_name_str = std::string(listener_name);
1839
- ListenerState& listener_state = listener_map_[listener_name_str];
2122
+ auto resource = XdsApi::ParseResourceName(listener_name, XdsApi::IsLds);
2123
+ if (!resource.ok()) return;
2124
+ auto& authority_state = authority_state_map_[resource->authority];
2125
+ ListenerState& listener_state = authority_state.listener_map[resource->id];
1840
2126
  auto it = listener_state.watchers.find(watcher);
1841
- if (it != listener_state.watchers.end()) {
1842
- listener_state.watchers.erase(it);
1843
- if (listener_state.watchers.empty()) {
1844
- listener_map_.erase(listener_name_str);
1845
- chand_->Unsubscribe(XdsApi::kLdsTypeUrl, listener_name_str,
1846
- delay_unsubscription);
1847
- }
2127
+ if (it == listener_state.watchers.end()) {
2128
+ invalid_listener_watchers_.erase(watcher);
2129
+ return;
2130
+ }
2131
+ listener_state.watchers.erase(it);
2132
+ if (!listener_state.watchers.empty()) return;
2133
+ authority_state.listener_map.erase(resource->id);
2134
+ xds_server_channel_map_[bootstrap_->server()]->UnsubscribeLocked(
2135
+ XdsApi::kLdsTypeUrl, *resource, delay_unsubscription);
2136
+ if (!authority_state.HasSubscribedResources()) {
2137
+ authority_state.channel_state.reset();
1848
2138
  }
1849
2139
  }
1850
2140
 
@@ -1853,9 +2143,19 @@ void XdsClient::WatchRouteConfigData(
1853
2143
  std::unique_ptr<RouteConfigWatcherInterface> watcher) {
1854
2144
  std::string route_config_name_str = std::string(route_config_name);
1855
2145
  MutexLock lock(&mu_);
1856
- RouteConfigState& route_config_state =
1857
- route_config_map_[route_config_name_str];
1858
2146
  RouteConfigWatcherInterface* w = watcher.get();
2147
+ auto resource = XdsApi::ParseResourceName(route_config_name, XdsApi::IsRds);
2148
+ if (!resource.ok()) {
2149
+ invalid_route_config_watchers_[w] = std::move(watcher);
2150
+ grpc_error_handle error = GRPC_ERROR_CREATE_FROM_CPP_STRING(
2151
+ absl::StrFormat("Unable to parse resource name for route config %s",
2152
+ route_config_name));
2153
+ w->OnError(GRPC_ERROR_REF(error));
2154
+ return;
2155
+ }
2156
+ auto& authority_state = authority_state_map_[resource->authority];
2157
+ RouteConfigState& route_config_state =
2158
+ authority_state.route_config_map[resource->id];
1859
2159
  route_config_state.watchers[w] = std::move(watcher);
1860
2160
  // If we've already received an RDS update, notify the new watcher
1861
2161
  // immediately.
@@ -1867,7 +2167,13 @@ void XdsClient::WatchRouteConfigData(
1867
2167
  }
1868
2168
  w->OnRouteConfigChanged(*route_config_state.update);
1869
2169
  }
1870
- chand_->Subscribe(XdsApi::kRdsTypeUrl, route_config_name_str);
2170
+ // If the authority doesn't yet have a channel, set it, creating it if needed.
2171
+ if (authority_state.channel_state == nullptr) {
2172
+ authority_state.channel_state =
2173
+ GetOrCreateChannelStateLocked(bootstrap_->server());
2174
+ }
2175
+ authority_state.channel_state->SubscribeLocked(XdsApi::kRdsTypeUrl,
2176
+ *resource);
1871
2177
  }
1872
2178
 
1873
2179
  void XdsClient::CancelRouteConfigDataWatch(absl::string_view route_config_name,
@@ -1875,17 +2181,23 @@ void XdsClient::CancelRouteConfigDataWatch(absl::string_view route_config_name,
1875
2181
  bool delay_unsubscription) {
1876
2182
  MutexLock lock(&mu_);
1877
2183
  if (shutting_down_) return;
1878
- std::string route_config_name_str = std::string(route_config_name);
2184
+ auto resource = XdsApi::ParseResourceName(route_config_name, XdsApi::IsRds);
2185
+ if (!resource.ok()) return;
2186
+ auto& authority_state = authority_state_map_[resource->authority];
1879
2187
  RouteConfigState& route_config_state =
1880
- route_config_map_[route_config_name_str];
2188
+ authority_state.route_config_map[resource->id];
1881
2189
  auto it = route_config_state.watchers.find(watcher);
1882
- if (it != route_config_state.watchers.end()) {
1883
- route_config_state.watchers.erase(it);
1884
- if (route_config_state.watchers.empty()) {
1885
- route_config_map_.erase(route_config_name_str);
1886
- chand_->Unsubscribe(XdsApi::kRdsTypeUrl, route_config_name_str,
1887
- delay_unsubscription);
1888
- }
2190
+ if (it == route_config_state.watchers.end()) {
2191
+ invalid_route_config_watchers_.erase(watcher);
2192
+ return;
2193
+ }
2194
+ route_config_state.watchers.erase(it);
2195
+ if (!route_config_state.watchers.empty()) return;
2196
+ authority_state.route_config_map.erase(resource->id);
2197
+ xds_server_channel_map_[bootstrap_->server()]->UnsubscribeLocked(
2198
+ XdsApi::kRdsTypeUrl, *resource, delay_unsubscription);
2199
+ if (!authority_state.HasSubscribedResources()) {
2200
+ authority_state.channel_state.reset();
1889
2201
  }
1890
2202
  }
1891
2203
 
@@ -1894,8 +2206,17 @@ void XdsClient::WatchClusterData(
1894
2206
  std::unique_ptr<ClusterWatcherInterface> watcher) {
1895
2207
  std::string cluster_name_str = std::string(cluster_name);
1896
2208
  MutexLock lock(&mu_);
1897
- ClusterState& cluster_state = cluster_map_[cluster_name_str];
1898
2209
  ClusterWatcherInterface* w = watcher.get();
2210
+ auto resource = XdsApi::ParseResourceName(cluster_name, XdsApi::IsCds);
2211
+ if (!resource.ok()) {
2212
+ invalid_cluster_watchers_[w] = std::move(watcher);
2213
+ grpc_error_handle error = GRPC_ERROR_CREATE_FROM_CPP_STRING(absl::StrFormat(
2214
+ "Unable to parse resource name for cluster %s", cluster_name));
2215
+ w->OnError(GRPC_ERROR_REF(error));
2216
+ return;
2217
+ }
2218
+ auto& authority_state = authority_state_map_[resource->authority];
2219
+ ClusterState& cluster_state = authority_state.cluster_map[resource->id];
1899
2220
  cluster_state.watchers[w] = std::move(watcher);
1900
2221
  // If we've already received a CDS update, notify the new watcher
1901
2222
  // immediately.
@@ -1906,7 +2227,13 @@ void XdsClient::WatchClusterData(
1906
2227
  }
1907
2228
  w->OnClusterChanged(cluster_state.update.value());
1908
2229
  }
1909
- chand_->Subscribe(XdsApi::kCdsTypeUrl, cluster_name_str);
2230
+ // If the authority doesn't yet have a channel, set it, creating it if needed.
2231
+ if (authority_state.channel_state == nullptr) {
2232
+ authority_state.channel_state =
2233
+ GetOrCreateChannelStateLocked(bootstrap_->server());
2234
+ }
2235
+ authority_state.channel_state->SubscribeLocked(XdsApi::kCdsTypeUrl,
2236
+ *resource);
1910
2237
  }
1911
2238
 
1912
2239
  void XdsClient::CancelClusterDataWatch(absl::string_view cluster_name,
@@ -1914,16 +2241,22 @@ void XdsClient::CancelClusterDataWatch(absl::string_view cluster_name,
1914
2241
  bool delay_unsubscription) {
1915
2242
  MutexLock lock(&mu_);
1916
2243
  if (shutting_down_) return;
1917
- std::string cluster_name_str = std::string(cluster_name);
1918
- ClusterState& cluster_state = cluster_map_[cluster_name_str];
2244
+ auto resource = XdsApi::ParseResourceName(cluster_name, XdsApi::IsCds);
2245
+ if (!resource.ok()) return;
2246
+ auto& authority_state = authority_state_map_[resource->authority];
2247
+ ClusterState& cluster_state = authority_state.cluster_map[resource->id];
1919
2248
  auto it = cluster_state.watchers.find(watcher);
1920
- if (it != cluster_state.watchers.end()) {
1921
- cluster_state.watchers.erase(it);
1922
- if (cluster_state.watchers.empty()) {
1923
- cluster_map_.erase(cluster_name_str);
1924
- chand_->Unsubscribe(XdsApi::kCdsTypeUrl, cluster_name_str,
1925
- delay_unsubscription);
1926
- }
2249
+ if (it == cluster_state.watchers.end()) {
2250
+ invalid_cluster_watchers_.erase(watcher);
2251
+ return;
2252
+ }
2253
+ cluster_state.watchers.erase(it);
2254
+ if (!cluster_state.watchers.empty()) return;
2255
+ authority_state.cluster_map.erase(resource->id);
2256
+ xds_server_channel_map_[bootstrap_->server()]->UnsubscribeLocked(
2257
+ XdsApi::kCdsTypeUrl, *resource, delay_unsubscription);
2258
+ if (!authority_state.HasSubscribedResources()) {
2259
+ authority_state.channel_state.reset();
1927
2260
  }
1928
2261
  }
1929
2262
 
@@ -1932,8 +2265,18 @@ void XdsClient::WatchEndpointData(
1932
2265
  std::unique_ptr<EndpointWatcherInterface> watcher) {
1933
2266
  std::string eds_service_name_str = std::string(eds_service_name);
1934
2267
  MutexLock lock(&mu_);
1935
- EndpointState& endpoint_state = endpoint_map_[eds_service_name_str];
1936
2268
  EndpointWatcherInterface* w = watcher.get();
2269
+ auto resource = XdsApi::ParseResourceName(eds_service_name, XdsApi::IsEds);
2270
+ if (!resource.ok()) {
2271
+ invalid_endpoint_watchers_[w] = std::move(watcher);
2272
+ grpc_error_handle error = GRPC_ERROR_CREATE_FROM_CPP_STRING(
2273
+ absl::StrFormat("Unable to parse resource name for endpoint service %s",
2274
+ eds_service_name));
2275
+ w->OnError(GRPC_ERROR_REF(error));
2276
+ return;
2277
+ }
2278
+ auto& authority_state = authority_state_map_[resource->authority];
2279
+ EndpointState& endpoint_state = authority_state.endpoint_map[resource->id];
1937
2280
  endpoint_state.watchers[w] = std::move(watcher);
1938
2281
  // If we've already received an EDS update, notify the new watcher
1939
2282
  // immediately.
@@ -1944,7 +2287,13 @@ void XdsClient::WatchEndpointData(
1944
2287
  }
1945
2288
  w->OnEndpointChanged(endpoint_state.update.value());
1946
2289
  }
1947
- chand_->Subscribe(XdsApi::kEdsTypeUrl, eds_service_name_str);
2290
+ // If the authority doesn't yet have a channel, set it, creating it if needed.
2291
+ if (authority_state.channel_state == nullptr) {
2292
+ authority_state.channel_state =
2293
+ GetOrCreateChannelStateLocked(bootstrap_->server());
2294
+ }
2295
+ authority_state.channel_state->SubscribeLocked(XdsApi::kEdsTypeUrl,
2296
+ *resource);
1948
2297
  }
1949
2298
 
1950
2299
  void XdsClient::CancelEndpointDataWatch(absl::string_view eds_service_name,
@@ -1952,16 +2301,22 @@ void XdsClient::CancelEndpointDataWatch(absl::string_view eds_service_name,
1952
2301
  bool delay_unsubscription) {
1953
2302
  MutexLock lock(&mu_);
1954
2303
  if (shutting_down_) return;
1955
- std::string eds_service_name_str = std::string(eds_service_name);
1956
- EndpointState& endpoint_state = endpoint_map_[eds_service_name_str];
2304
+ auto resource = XdsApi::ParseResourceName(eds_service_name, XdsApi::IsEds);
2305
+ if (!resource.ok()) return;
2306
+ auto& authority_state = authority_state_map_[resource->authority];
2307
+ EndpointState& endpoint_state = authority_state.endpoint_map[resource->id];
1957
2308
  auto it = endpoint_state.watchers.find(watcher);
1958
- if (it != endpoint_state.watchers.end()) {
1959
- endpoint_state.watchers.erase(it);
1960
- if (endpoint_state.watchers.empty()) {
1961
- endpoint_map_.erase(eds_service_name_str);
1962
- chand_->Unsubscribe(XdsApi::kEdsTypeUrl, eds_service_name_str,
1963
- delay_unsubscription);
1964
- }
2309
+ if (it == endpoint_state.watchers.end()) {
2310
+ invalid_endpoint_watchers_.erase(watcher);
2311
+ return;
2312
+ }
2313
+ endpoint_state.watchers.erase(it);
2314
+ if (!endpoint_state.watchers.empty()) return;
2315
+ authority_state.endpoint_map.erase(resource->id);
2316
+ xds_server_channel_map_[bootstrap_->server()]->UnsubscribeLocked(
2317
+ XdsApi::kEdsTypeUrl, *resource, delay_unsubscription);
2318
+ if (!authority_state.HasSubscribedResources()) {
2319
+ authority_state.channel_state.reset();
1965
2320
  }
1966
2321
  }
1967
2322
 
@@ -1995,7 +2350,12 @@ RefCountedPtr<XdsClusterDropStats> XdsClient::AddClusterDropStats(
1995
2350
  it->first.second /*eds_service_name*/);
1996
2351
  load_report_state.drop_stats = cluster_drop_stats.get();
1997
2352
  }
1998
- chand_->MaybeStartLrsCall();
2353
+ auto resource = XdsApi::ParseResourceName(cluster_name, XdsApi::IsCds);
2354
+ GPR_ASSERT(resource.ok());
2355
+ auto a = authority_state_map_.find(resource->authority);
2356
+ if (a != authority_state_map_.end()) {
2357
+ a->second.channel_state->MaybeStartLrsCall();
2358
+ }
1999
2359
  return cluster_drop_stats;
2000
2360
  }
2001
2361
 
@@ -2052,7 +2412,12 @@ RefCountedPtr<XdsClusterLocalityStats> XdsClient::AddClusterLocalityStats(
2052
2412
  std::move(locality));
2053
2413
  locality_state.locality_stats = cluster_locality_stats.get();
2054
2414
  }
2055
- chand_->MaybeStartLrsCall();
2415
+ auto resource = XdsApi::ParseResourceName(cluster_name, XdsApi::IsCds);
2416
+ GPR_ASSERT(resource.ok());
2417
+ auto a = authority_state_map_.find(resource->authority);
2418
+ if (a != authority_state_map_.end()) {
2419
+ a->second.channel_state->MaybeStartLrsCall();
2420
+ }
2056
2421
  return cluster_locality_stats;
2057
2422
  }
2058
2423
 
@@ -2082,34 +2447,36 @@ void XdsClient::RemoveClusterLocalityStats(
2082
2447
 
2083
2448
  void XdsClient::ResetBackoff() {
2084
2449
  MutexLock lock(&mu_);
2085
- if (chand_ != nullptr) {
2086
- grpc_channel_reset_connect_backoff(chand_->channel());
2450
+ for (auto& p : xds_server_channel_map_) {
2451
+ grpc_channel_reset_connect_backoff(p.second->channel());
2087
2452
  }
2088
2453
  }
2089
2454
 
2090
- void XdsClient::NotifyOnErrorLocked(grpc_error* error) {
2091
- for (const auto& p : listener_map_) {
2092
- const ListenerState& listener_state = p.second;
2093
- for (const auto& p : listener_state.watchers) {
2094
- p.first->OnError(GRPC_ERROR_REF(error));
2455
+ void XdsClient::NotifyOnErrorLocked(grpc_error_handle error) {
2456
+ for (const auto& a : authority_state_map_) {
2457
+ for (const auto& p : a.second.listener_map) {
2458
+ const ListenerState& listener_state = p.second;
2459
+ for (const auto& p : listener_state.watchers) {
2460
+ p.first->OnError(GRPC_ERROR_REF(error));
2461
+ }
2095
2462
  }
2096
- }
2097
- for (const auto& p : route_config_map_) {
2098
- const RouteConfigState& route_config_state = p.second;
2099
- for (const auto& p : route_config_state.watchers) {
2100
- p.first->OnError(GRPC_ERROR_REF(error));
2463
+ for (const auto& p : a.second.route_config_map) {
2464
+ const RouteConfigState& route_config_state = p.second;
2465
+ for (const auto& p : route_config_state.watchers) {
2466
+ p.first->OnError(GRPC_ERROR_REF(error));
2467
+ }
2101
2468
  }
2102
- }
2103
- for (const auto& p : cluster_map_) {
2104
- const ClusterState& cluster_state = p.second;
2105
- for (const auto& p : cluster_state.watchers) {
2106
- p.first->OnError(GRPC_ERROR_REF(error));
2469
+ for (const auto& p : a.second.cluster_map) {
2470
+ const ClusterState& cluster_state = p.second;
2471
+ for (const auto& p : cluster_state.watchers) {
2472
+ p.first->OnError(GRPC_ERROR_REF(error));
2473
+ }
2107
2474
  }
2108
- }
2109
- for (const auto& p : endpoint_map_) {
2110
- const EndpointState& endpoint_state = p.second;
2111
- for (const auto& p : endpoint_state.watchers) {
2112
- p.first->OnError(GRPC_ERROR_REF(error));
2475
+ for (const auto& p : a.second.endpoint_map) {
2476
+ const EndpointState& endpoint_state = p.second;
2477
+ for (const auto& p : endpoint_state.watchers) {
2478
+ p.first->OnError(GRPC_ERROR_REF(error));
2479
+ }
2113
2480
  }
2114
2481
  }
2115
2482
  GRPC_ERROR_UNREF(error);
@@ -2196,25 +2563,154 @@ XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshotLocked(
2196
2563
  return snapshot_map;
2197
2564
  }
2198
2565
 
2566
+ std::string XdsClient::DumpClientConfigBinary() {
2567
+ MutexLock lock(&mu_);
2568
+ XdsApi::ResourceTypeMetadataMap resource_type_metadata_map;
2569
+ auto& lds_map = resource_type_metadata_map[XdsApi::kLdsTypeUrl];
2570
+ auto& rds_map = resource_type_metadata_map[XdsApi::kRdsTypeUrl];
2571
+ auto& cds_map = resource_type_metadata_map[XdsApi::kCdsTypeUrl];
2572
+ auto& eds_map = resource_type_metadata_map[XdsApi::kEdsTypeUrl];
2573
+ for (auto& a : authority_state_map_) {
2574
+ const std::string& authority = a.first;
2575
+ // Collect resource metadata from listeners
2576
+ for (auto& p : a.second.listener_map) {
2577
+ const std::string& listener_name = p.first;
2578
+ lds_map[XdsApi::ConstructFullResourceName(
2579
+ authority, XdsApi::kLdsTypeUrl, listener_name)] = &p.second.meta;
2580
+ }
2581
+ // Collect resource metadata from route configs
2582
+ for (auto& p : a.second.route_config_map) {
2583
+ const std::string& route_config_name = p.first;
2584
+ rds_map[XdsApi::ConstructFullResourceName(
2585
+ authority, XdsApi::kRdsTypeUrl, route_config_name)] = &p.second.meta;
2586
+ }
2587
+ // Collect resource metadata from clusters
2588
+ for (auto& p : a.second.cluster_map) {
2589
+ const std::string& cluster_name = p.first;
2590
+ cds_map[XdsApi::ConstructFullResourceName(authority, XdsApi::kCdsTypeUrl,
2591
+ cluster_name)] = &p.second.meta;
2592
+ }
2593
+ // Collect resource metadata from endpoints
2594
+ for (auto& p : a.second.endpoint_map) {
2595
+ const std::string& endpoint_name = p.first;
2596
+ eds_map[XdsApi::ConstructFullResourceName(
2597
+ authority, XdsApi::kEdsTypeUrl, endpoint_name)] = &p.second.meta;
2598
+ }
2599
+ }
2600
+ // Assemble config dump messages
2601
+ return api_.AssembleClientConfig(resource_type_metadata_map);
2602
+ }
2603
+
2199
2604
  //
2200
2605
  // accessors for global state
2201
2606
  //
2202
2607
 
2203
- void XdsClientGlobalInit() { g_mu = new Mutex; }
2608
+ void XdsClientGlobalInit() {
2609
+ g_mu = new Mutex;
2610
+ XdsHttpFilterRegistry::Init();
2611
+ }
2204
2612
 
2205
- void XdsClientGlobalShutdown() {
2613
+ // TODO(roth): Find a better way to clear the fallback config that does
2614
+ // not require using ABSL_NO_THREAD_SAFETY_ANALYSIS.
2615
+ void XdsClientGlobalShutdown() ABSL_NO_THREAD_SAFETY_ANALYSIS {
2616
+ gpr_free(g_fallback_bootstrap_config);
2617
+ g_fallback_bootstrap_config = nullptr;
2206
2618
  delete g_mu;
2207
2619
  g_mu = nullptr;
2620
+ XdsHttpFilterRegistry::Shutdown();
2208
2621
  }
2209
2622
 
2210
- RefCountedPtr<XdsClient> XdsClient::GetOrCreate(grpc_error** error) {
2211
- MutexLock lock(g_mu);
2212
- if (g_xds_client != nullptr) {
2213
- auto xds_client = g_xds_client->RefIfNonZero();
2214
- if (xds_client != nullptr) return xds_client;
2623
+ namespace {
2624
+
2625
+ std::string GetBootstrapContents(const char* fallback_config,
2626
+ grpc_error_handle* error) {
2627
+ // First, try GRPC_XDS_BOOTSTRAP env var.
2628
+ grpc_core::UniquePtr<char> path(gpr_getenv("GRPC_XDS_BOOTSTRAP"));
2629
+ if (path != nullptr) {
2630
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
2631
+ gpr_log(GPR_INFO,
2632
+ "Got bootstrap file location from GRPC_XDS_BOOTSTRAP "
2633
+ "environment variable: %s",
2634
+ path.get());
2635
+ }
2636
+ grpc_slice contents;
2637
+ *error =
2638
+ grpc_load_file(path.get(), /*add_null_terminator=*/true, &contents);
2639
+ if (*error != GRPC_ERROR_NONE) return "";
2640
+ std::string contents_str(StringViewFromSlice(contents));
2641
+ grpc_slice_unref_internal(contents);
2642
+ return contents_str;
2643
+ }
2644
+ // Next, try GRPC_XDS_BOOTSTRAP_CONFIG env var.
2645
+ grpc_core::UniquePtr<char> env_config(
2646
+ gpr_getenv("GRPC_XDS_BOOTSTRAP_CONFIG"));
2647
+ if (env_config != nullptr) {
2648
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
2649
+ gpr_log(GPR_INFO,
2650
+ "Got bootstrap contents from GRPC_XDS_BOOTSTRAP_CONFIG "
2651
+ "environment variable");
2652
+ }
2653
+ return env_config.get();
2654
+ }
2655
+ // Finally, try fallback config.
2656
+ if (fallback_config != nullptr) {
2657
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
2658
+ gpr_log(GPR_INFO, "Got bootstrap contents from fallback config");
2659
+ }
2660
+ return fallback_config;
2661
+ }
2662
+ // No bootstrap config found.
2663
+ *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2664
+ "Environment variables GRPC_XDS_BOOTSTRAP or GRPC_XDS_BOOTSTRAP_CONFIG "
2665
+ "not defined");
2666
+ return "";
2667
+ }
2668
+
2669
+ } // namespace
2670
+
2671
+ RefCountedPtr<XdsClient> XdsClient::GetOrCreate(const grpc_channel_args* args,
2672
+ grpc_error_handle* error) {
2673
+ RefCountedPtr<XdsClient> xds_client;
2674
+ // If getting bootstrap from channel args, create a local XdsClient
2675
+ // instance for the channel or server instead of using the global instance.
2676
+ const char* bootstrap_config = grpc_channel_args_find_string(
2677
+ args, GRPC_ARG_TEST_ONLY_DO_NOT_USE_IN_PROD_XDS_BOOTSTRAP_CONFIG);
2678
+ if (bootstrap_config != nullptr) {
2679
+ std::unique_ptr<XdsBootstrap> bootstrap =
2680
+ XdsBootstrap::Create(bootstrap_config, error);
2681
+ if (*error == GRPC_ERROR_NONE) {
2682
+ grpc_channel_args* xds_channel_args =
2683
+ grpc_channel_args_find_pointer<grpc_channel_args>(
2684
+ args,
2685
+ GRPC_ARG_TEST_ONLY_DO_NOT_USE_IN_PROD_XDS_CLIENT_CHANNEL_ARGS);
2686
+ return MakeRefCounted<XdsClient>(std::move(bootstrap), xds_channel_args);
2687
+ }
2688
+ return nullptr;
2689
+ }
2690
+ // Otherwise, use the global instance.
2691
+ {
2692
+ MutexLock lock(g_mu);
2693
+ if (g_xds_client != nullptr) {
2694
+ auto xds_client = g_xds_client->RefIfNonZero();
2695
+ if (xds_client != nullptr) return xds_client;
2696
+ }
2697
+ // Find bootstrap contents.
2698
+ std::string bootstrap_contents =
2699
+ GetBootstrapContents(g_fallback_bootstrap_config, error);
2700
+ if (*error != GRPC_ERROR_NONE) return nullptr;
2701
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
2702
+ gpr_log(GPR_INFO, "xDS bootstrap contents: %s",
2703
+ bootstrap_contents.c_str());
2704
+ }
2705
+ // Parse bootstrap.
2706
+ std::unique_ptr<XdsBootstrap> bootstrap =
2707
+ XdsBootstrap::Create(bootstrap_contents, error);
2708
+ if (*error != GRPC_ERROR_NONE) return nullptr;
2709
+ // Instantiate XdsClient.
2710
+ xds_client =
2711
+ MakeRefCounted<XdsClient>(std::move(bootstrap), g_channel_args);
2712
+ g_xds_client = xds_client.get();
2215
2713
  }
2216
- auto xds_client = MakeRefCounted<XdsClient>(error);
2217
- g_xds_client = xds_client.get();
2218
2714
  return xds_client;
2219
2715
  }
2220
2716
 
@@ -2230,6 +2726,66 @@ void UnsetGlobalXdsClientForTest() {
2230
2726
  g_xds_client = nullptr;
2231
2727
  }
2232
2728
 
2729
+ void SetXdsFallbackBootstrapConfig(const char* config) {
2730
+ MutexLock lock(g_mu);
2731
+ gpr_free(g_fallback_bootstrap_config);
2732
+ g_fallback_bootstrap_config = gpr_strdup(config);
2733
+ }
2734
+
2233
2735
  } // namespace internal
2234
2736
 
2737
+ //
2738
+ // embedding XdsClient in channel args
2739
+ //
2740
+
2741
+ #define GRPC_ARG_XDS_CLIENT "grpc.internal.xds_client"
2742
+
2743
+ namespace {
2744
+
2745
+ void* XdsClientArgCopy(void* p) {
2746
+ XdsClient* xds_client = static_cast<XdsClient*>(p);
2747
+ xds_client->Ref(DEBUG_LOCATION, "channel arg").release();
2748
+ return p;
2749
+ }
2750
+
2751
+ void XdsClientArgDestroy(void* p) {
2752
+ XdsClient* xds_client = static_cast<XdsClient*>(p);
2753
+ xds_client->Unref(DEBUG_LOCATION, "channel arg");
2754
+ }
2755
+
2756
+ int XdsClientArgCmp(void* p, void* q) { return QsortCompare(p, q); }
2757
+
2758
+ const grpc_arg_pointer_vtable kXdsClientArgVtable = {
2759
+ XdsClientArgCopy, XdsClientArgDestroy, XdsClientArgCmp};
2760
+
2761
+ } // namespace
2762
+
2763
+ grpc_arg XdsClient::MakeChannelArg() const {
2764
+ return grpc_channel_arg_pointer_create(const_cast<char*>(GRPC_ARG_XDS_CLIENT),
2765
+ const_cast<XdsClient*>(this),
2766
+ &kXdsClientArgVtable);
2767
+ }
2768
+
2769
+ RefCountedPtr<XdsClient> XdsClient::GetFromChannelArgs(
2770
+ const grpc_channel_args& args) {
2771
+ XdsClient* xds_client =
2772
+ grpc_channel_args_find_pointer<XdsClient>(&args, GRPC_ARG_XDS_CLIENT);
2773
+ if (xds_client == nullptr) return nullptr;
2774
+ return xds_client->Ref(DEBUG_LOCATION, "GetFromChannelArgs");
2775
+ }
2776
+
2235
2777
  } // namespace grpc_core
2778
+
2779
+ // The returned bytes may contain NULL(0), so we can't use c-string.
2780
+ grpc_slice grpc_dump_xds_configs() {
2781
+ grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
2782
+ grpc_core::ExecCtx exec_ctx;
2783
+ grpc_error_handle error = GRPC_ERROR_NONE;
2784
+ auto xds_client = grpc_core::XdsClient::GetOrCreate(nullptr, &error);
2785
+ if (error != GRPC_ERROR_NONE) {
2786
+ // If we isn't using xDS, just return an empty string.
2787
+ GRPC_ERROR_UNREF(error);
2788
+ return grpc_empty_slice();
2789
+ }
2790
+ return grpc_slice_from_cpp_string(xds_client->DumpClientConfigBinary());
2791
+ }