grpc 1.30.1 → 1.40.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 (1628) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +1195 -18269
  3. data/etc/roots.pem +257 -573
  4. data/include/grpc/compression.h +1 -1
  5. data/include/grpc/event_engine/README.md +38 -0
  6. data/include/grpc/event_engine/endpoint_config.h +48 -0
  7. data/include/grpc/event_engine/event_engine.h +330 -0
  8. data/include/grpc/event_engine/port.h +41 -0
  9. data/include/grpc/event_engine/slice_allocator.h +66 -0
  10. data/include/grpc/grpc.h +38 -9
  11. data/include/grpc/grpc_security.h +291 -186
  12. data/include/grpc/grpc_security_constants.h +18 -0
  13. data/include/grpc/impl/codegen/README.md +22 -0
  14. data/include/grpc/impl/codegen/atm_windows.h +4 -0
  15. data/include/grpc/impl/codegen/byte_buffer.h +1 -1
  16. data/include/grpc/impl/codegen/grpc_types.h +60 -31
  17. data/include/grpc/impl/codegen/log.h +0 -2
  18. data/include/grpc/impl/codegen/port_platform.h +75 -87
  19. data/include/grpc/impl/codegen/sync_windows.h +4 -0
  20. data/include/grpc/module.modulemap +14 -14
  21. data/include/grpc/slice_buffer.h +3 -3
  22. data/include/grpc/support/sync.h +3 -3
  23. data/include/grpc/support/time.h +7 -7
  24. data/src/core/ext/filters/client_channel/backend_metric.cc +14 -13
  25. data/src/core/ext/filters/client_channel/backup_poller.cc +6 -5
  26. data/src/core/ext/filters/client_channel/channel_connectivity.cc +177 -202
  27. data/src/core/ext/filters/client_channel/client_channel.cc +2112 -2959
  28. data/src/core/ext/filters/client_channel/client_channel.h +514 -62
  29. data/src/core/ext/filters/client_channel/client_channel_channelz.h +1 -4
  30. data/src/core/ext/filters/client_channel/client_channel_factory.h +2 -1
  31. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +4 -1
  32. data/src/core/ext/filters/client_channel/config_selector.cc +58 -0
  33. data/src/core/ext/filters/client_channel/config_selector.h +146 -0
  34. data/src/core/ext/filters/client_channel/connector.h +1 -1
  35. data/src/core/ext/filters/client_channel/dynamic_filters.cc +190 -0
  36. data/src/core/ext/filters/client_channel/dynamic_filters.h +99 -0
  37. data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +26 -122
  38. data/src/core/ext/filters/client_channel/global_subchannel_pool.h +15 -10
  39. data/src/core/ext/filters/client_channel/health/health_check_client.cc +46 -35
  40. data/src/core/ext/filters/client_channel/health/health_check_client.h +34 -33
  41. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +39 -37
  42. data/src/core/ext/filters/client_channel/http_proxy.cc +42 -24
  43. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +48 -35
  44. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +7 -5
  45. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +10 -7
  46. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +1 -1
  47. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +6 -6
  48. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +301 -267
  49. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +0 -13
  50. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +0 -3
  51. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +1 -2
  52. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +3 -40
  53. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +3 -1
  54. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +2 -1
  55. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +3 -3
  56. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +1 -1
  57. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +34 -37
  58. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +102 -51
  59. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +757 -0
  60. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +37 -0
  61. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +18 -24
  62. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +15 -37
  63. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +41 -34
  64. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +472 -145
  65. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +52 -24
  66. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +29 -0
  67. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +787 -0
  68. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +700 -0
  69. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +1372 -0
  70. data/src/core/ext/filters/client_channel/lb_policy.cc +11 -18
  71. data/src/core/ext/filters/client_channel/lb_policy.h +80 -53
  72. data/src/core/ext/filters/client_channel/lb_policy_factory.h +1 -1
  73. data/src/core/ext/filters/client_channel/lb_policy_registry.cc +16 -10
  74. data/src/core/ext/filters/client_channel/lb_policy_registry.h +1 -1
  75. data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +27 -67
  76. data/src/core/ext/filters/client_channel/local_subchannel_pool.h +10 -9
  77. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +71 -78
  78. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +2 -33
  79. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_event_engine.cc +31 -0
  80. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +11 -9
  81. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +14 -12
  82. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +24 -20
  83. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +495 -79
  84. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +6 -1
  85. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_event_engine.cc +28 -0
  86. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc +1 -1
  87. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +1 -1
  88. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +45 -36
  89. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +40 -45
  90. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +8 -6
  91. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +384 -0
  92. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +38 -31
  93. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +883 -71
  94. data/src/core/ext/filters/client_channel/{xds/xds_channel_args.h → resolver/xds/xds_resolver.h} +9 -7
  95. data/src/core/ext/filters/client_channel/resolver.cc +7 -5
  96. data/src/core/ext/filters/client_channel/resolver.h +7 -15
  97. data/src/core/ext/filters/client_channel/resolver_factory.h +6 -6
  98. data/src/core/ext/filters/client_channel/resolver_registry.cc +49 -49
  99. data/src/core/ext/filters/client_channel/resolver_registry.h +2 -2
  100. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +50 -303
  101. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +26 -54
  102. data/src/core/ext/filters/client_channel/retry_filter.cc +2611 -0
  103. data/src/core/ext/filters/client_channel/retry_filter.h +30 -0
  104. data/src/core/ext/filters/client_channel/retry_service_config.cc +316 -0
  105. data/src/core/ext/filters/client_channel/retry_service_config.h +96 -0
  106. data/src/core/ext/filters/client_channel/retry_throttle.cc +5 -3
  107. data/src/core/ext/filters/client_channel/retry_throttle.h +4 -2
  108. data/src/core/ext/filters/client_channel/server_address.cc +129 -7
  109. data/src/core/ext/filters/client_channel/server_address.h +75 -21
  110. data/src/core/ext/filters/client_channel/service_config.cc +27 -21
  111. data/src/core/ext/filters/client_channel/service_config.h +11 -7
  112. data/src/core/ext/filters/client_channel/service_config_call_data.h +60 -2
  113. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +143 -0
  114. data/src/core/ext/filters/client_channel/service_config_parser.cc +14 -12
  115. data/src/core/ext/filters/client_channel/service_config_parser.h +12 -6
  116. data/src/core/ext/filters/client_channel/subchannel.cc +188 -236
  117. data/src/core/ext/filters/client_channel/subchannel.h +88 -113
  118. data/src/core/ext/filters/client_channel/subchannel_interface.h +41 -5
  119. data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +16 -2
  120. data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +16 -10
  121. data/src/core/ext/filters/client_idle/client_idle_filter.cc +18 -17
  122. data/src/core/ext/filters/deadline/deadline_filter.cc +94 -86
  123. data/src/core/ext/filters/deadline/deadline_filter.h +7 -11
  124. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +501 -0
  125. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +39 -0
  126. data/src/core/ext/filters/fault_injection/service_config_parser.cc +189 -0
  127. data/src/core/ext/filters/fault_injection/service_config_parser.h +85 -0
  128. data/src/core/ext/filters/http/client/http_client_filter.cc +39 -29
  129. data/src/core/ext/filters/http/client_authority_filter.cc +9 -9
  130. data/src/core/ext/filters/http/http_filters_plugin.cc +8 -4
  131. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +23 -22
  132. data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +91 -50
  133. data/src/core/ext/filters/http/message_compress/message_decompress_filter.h +3 -1
  134. data/src/core/ext/filters/http/server/http_server_filter.cc +30 -26
  135. data/src/core/ext/filters/max_age/max_age_filter.cc +50 -44
  136. data/src/core/ext/filters/message_size/message_size_filter.cc +72 -92
  137. data/src/core/ext/filters/message_size/message_size_filter.h +8 -1
  138. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +5 -4
  139. data/src/core/ext/filters/workarounds/workaround_utils.cc +1 -1
  140. data/src/core/ext/transport/chttp2/client/authority.cc +3 -3
  141. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +90 -34
  142. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +22 -5
  143. data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +23 -10
  144. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +23 -11
  145. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +38 -50
  146. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +803 -352
  147. data/src/core/ext/transport/chttp2/server/chttp2_server.h +16 -2
  148. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +14 -5
  149. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +22 -20
  150. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +67 -24
  151. data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +8 -8
  152. data/src/core/ext/transport/chttp2/transport/chttp2_slice_allocator.cc +66 -0
  153. data/src/core/ext/transport/chttp2/transport/chttp2_slice_allocator.h +74 -0
  154. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +457 -447
  155. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +12 -1
  156. data/src/core/ext/transport/chttp2/transport/context_list.cc +4 -5
  157. data/src/core/ext/transport/chttp2/transport/context_list.h +4 -4
  158. data/src/core/ext/transport/chttp2/transport/flow_control.cc +36 -33
  159. data/src/core/ext/transport/chttp2/transport/flow_control.h +34 -26
  160. data/src/core/ext/transport/chttp2/transport/frame_data.cc +26 -25
  161. data/src/core/ext/transport/chttp2/transport/frame_data.h +10 -10
  162. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +21 -23
  163. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +6 -6
  164. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +12 -14
  165. data/src/core/ext/transport/chttp2/transport/frame_ping.h +7 -6
  166. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +19 -20
  167. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +6 -6
  168. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +19 -19
  169. data/src/core/ext/transport/chttp2/transport/frame_settings.h +8 -7
  170. data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +19 -24
  171. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +4 -6
  172. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +1 -1
  173. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +681 -765
  174. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +195 -74
  175. data/src/core/ext/transport/chttp2/transport/hpack_table.cc +17 -20
  176. data/src/core/ext/transport/chttp2/transport/hpack_table.h +4 -4
  177. data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +2 -2
  178. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +2 -2
  179. data/src/core/ext/transport/chttp2/transport/internal.h +57 -30
  180. data/src/core/ext/transport/chttp2/transport/parsing.cc +181 -180
  181. data/src/core/ext/transport/chttp2/transport/varint.cc +6 -4
  182. data/src/core/ext/transport/chttp2/transport/writing.cc +24 -25
  183. data/src/core/ext/transport/inproc/inproc_transport.cc +154 -88
  184. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +406 -0
  185. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +1459 -0
  186. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +1 -1
  187. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +1 -1
  188. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +10 -4
  189. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +243 -0
  190. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +865 -0
  191. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +371 -0
  192. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +1452 -0
  193. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +74 -0
  194. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +253 -0
  195. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +461 -0
  196. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +1850 -0
  197. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +35 -0
  198. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +77 -0
  199. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +56 -0
  200. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +364 -0
  201. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +124 -0
  202. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +428 -0
  203. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +35 -0
  204. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +88 -0
  205. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +370 -0
  206. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +1126 -0
  207. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +103 -0
  208. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +388 -0
  209. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +34 -0
  210. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +78 -0
  211. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +53 -0
  212. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +149 -0
  213. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +241 -0
  214. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +839 -0
  215. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +170 -0
  216. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +767 -0
  217. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +36 -0
  218. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +88 -0
  219. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +239 -0
  220. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +982 -0
  221. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +27 -0
  222. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +65 -0
  223. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.c +46 -0
  224. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.h +121 -0
  225. data/src/core/ext/upb-generated/envoy/{api/v2/core → config/core/v3}/socket_option.upb.c +8 -8
  226. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +95 -0
  227. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +43 -0
  228. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +126 -0
  229. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.c +35 -0
  230. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.h +90 -0
  231. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +90 -0
  232. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +243 -0
  233. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +91 -0
  234. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +305 -0
  235. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +112 -0
  236. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +367 -0
  237. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +33 -0
  238. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +73 -0
  239. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +138 -0
  240. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +604 -0
  241. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +161 -0
  242. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +638 -0
  243. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +48 -0
  244. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +171 -0
  245. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +42 -0
  246. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +115 -0
  247. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +144 -0
  248. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +488 -0
  249. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +141 -0
  250. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +452 -0
  251. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +179 -0
  252. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +662 -0
  253. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +82 -0
  254. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +294 -0
  255. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +953 -0
  256. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +3862 -0
  257. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +60 -0
  258. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +159 -0
  259. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +49 -0
  260. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +122 -0
  261. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.c +29 -0
  262. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +67 -0
  263. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +79 -0
  264. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +268 -0
  265. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +79 -0
  266. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +285 -0
  267. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +42 -0
  268. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +117 -0
  269. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +404 -0
  270. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +1671 -0
  271. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +19 -0
  272. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +35 -0
  273. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +116 -0
  274. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +475 -0
  275. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +73 -0
  276. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +219 -0
  277. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +146 -0
  278. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +621 -0
  279. data/src/core/ext/upb-generated/envoy/{api/v2/rds.upb.c → service/cluster/v3/cds.upb.c} +6 -9
  280. data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.h +56 -0
  281. data/src/core/ext/upb-generated/envoy/service/discovery/{v2 → v3}/ads.upb.c +6 -5
  282. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +56 -0
  283. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +146 -0
  284. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +499 -0
  285. data/src/core/ext/upb-generated/envoy/{api/v2 → service/endpoint/v3}/eds.upb.c +6 -10
  286. data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.h +56 -0
  287. data/src/core/ext/upb-generated/envoy/{api/v2 → service/listener/v3}/lds.upb.c +6 -10
  288. data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.h +56 -0
  289. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +54 -0
  290. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +151 -0
  291. data/src/core/ext/upb-generated/envoy/{api/v2/srds.upb.c → service/route/v3/rds.upb.c} +6 -7
  292. data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.h +56 -0
  293. data/src/core/ext/upb-generated/envoy/{api/v2/cds.upb.c → service/route/v3/srds.upb.c} +6 -7
  294. data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.h +56 -0
  295. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +121 -0
  296. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +438 -0
  297. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.c +60 -0
  298. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.h +181 -0
  299. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +47 -0
  300. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +128 -0
  301. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +36 -0
  302. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +90 -0
  303. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +35 -0
  304. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +84 -0
  305. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +34 -0
  306. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +78 -0
  307. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +65 -0
  308. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +166 -0
  309. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +53 -0
  310. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +146 -0
  311. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +46 -0
  312. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +124 -0
  313. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +63 -0
  314. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +207 -0
  315. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +88 -0
  316. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +301 -0
  317. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +90 -0
  318. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +283 -0
  319. data/src/core/ext/upb-generated/envoy/type/{http.upb.c → v3/http.upb.c} +2 -2
  320. data/src/core/ext/upb-generated/envoy/type/{http.upb.h → v3/http.upb.h} +9 -9
  321. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +40 -0
  322. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +99 -0
  323. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +51 -0
  324. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +130 -0
  325. data/src/core/ext/upb-generated/envoy/type/{semantic_version.upb.c → v3/semantic_version.upb.c} +7 -6
  326. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +68 -0
  327. data/src/core/ext/upb-generated/google/api/annotations.upb.h +1 -1
  328. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +242 -0
  329. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +830 -0
  330. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +251 -0
  331. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +871 -0
  332. data/src/core/ext/upb-generated/google/api/http.upb.c +3 -3
  333. data/src/core/ext/upb-generated/google/api/http.upb.h +52 -32
  334. data/src/core/ext/upb-generated/google/protobuf/any.upb.c +1 -1
  335. data/src/core/ext/upb-generated/google/protobuf/any.upb.h +12 -6
  336. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +106 -106
  337. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +688 -499
  338. data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +1 -1
  339. data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +12 -6
  340. data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +1 -1
  341. data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +8 -2
  342. data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +5 -5
  343. data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +55 -57
  344. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +1 -1
  345. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +12 -6
  346. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +9 -9
  347. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +82 -28
  348. data/src/core/ext/upb-generated/google/rpc/status.upb.c +1 -1
  349. data/src/core/ext/upb-generated/google/rpc/status.upb.h +17 -10
  350. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +5 -5
  351. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +40 -45
  352. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +43 -43
  353. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +236 -184
  354. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +5 -5
  355. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +29 -13
  356. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +2 -2
  357. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +19 -7
  358. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +17 -17
  359. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +122 -62
  360. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +3 -3
  361. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +30 -12
  362. data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +31 -0
  363. data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +64 -0
  364. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +1 -1
  365. data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +2 -2
  366. data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +12 -6
  367. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +27 -0
  368. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +60 -0
  369. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +9 -9
  370. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +48 -68
  371. data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.c +33 -0
  372. data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.h +77 -0
  373. data/src/core/ext/upb-generated/validate/validate.upb.c +133 -117
  374. data/src/core/ext/upb-generated/validate/validate.upb.h +881 -645
  375. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.c +28 -0
  376. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.h +60 -0
  377. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +52 -0
  378. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.h +143 -0
  379. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +42 -0
  380. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.h +84 -0
  381. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.c +36 -0
  382. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.h +94 -0
  383. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +54 -0
  384. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.h +166 -0
  385. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +36 -0
  386. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.h +85 -0
  387. data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.c +354 -0
  388. data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.h +140 -0
  389. data/src/core/ext/upbdefs-generated/envoy/annotations/deprecation.upbdefs.c +46 -0
  390. data/src/core/ext/upbdefs-generated/envoy/annotations/deprecation.upbdefs.h +30 -0
  391. data/src/core/ext/upbdefs-generated/envoy/annotations/resource.upbdefs.c +41 -0
  392. data/src/core/ext/upbdefs-generated/envoy/annotations/resource.upbdefs.h +35 -0
  393. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +252 -0
  394. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.h +105 -0
  395. data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +424 -0
  396. data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.h +120 -0
  397. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/circuit_breaker.upbdefs.c +100 -0
  398. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/circuit_breaker.upbdefs.h +45 -0
  399. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +570 -0
  400. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.h +145 -0
  401. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/filter.upbdefs.c +53 -0
  402. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/filter.upbdefs.h +35 -0
  403. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/outlier_detection.upbdefs.c +136 -0
  404. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/outlier_detection.upbdefs.h +35 -0
  405. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.c +127 -0
  406. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.h +65 -0
  407. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/backoff.upbdefs.c +56 -0
  408. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/backoff.upbdefs.h +35 -0
  409. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +300 -0
  410. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.h +145 -0
  411. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +144 -0
  412. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.h +55 -0
  413. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/event_service_config.upbdefs.c +56 -0
  414. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/event_service_config.upbdefs.h +35 -0
  415. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/extension.upbdefs.c +66 -0
  416. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/extension.upbdefs.h +40 -0
  417. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.c +263 -0
  418. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.h +100 -0
  419. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +233 -0
  420. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.h +70 -0
  421. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/http_uri.upbdefs.c +56 -0
  422. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/http_uri.upbdefs.h +35 -0
  423. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +287 -0
  424. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.h +100 -0
  425. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/proxy_protocol.upbdefs.c +43 -0
  426. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/proxy_protocol.upbdefs.h +35 -0
  427. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/resolver.upbdefs.c +59 -0
  428. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/resolver.upbdefs.h +40 -0
  429. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.c +59 -0
  430. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.h +35 -0
  431. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.c +72 -0
  432. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.h +35 -0
  433. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/udp_socket_config.upbdefs.c +52 -0
  434. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/udp_socket_config.upbdefs.h +35 -0
  435. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint.upbdefs.c +107 -0
  436. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint.upbdefs.h +50 -0
  437. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +113 -0
  438. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.h +50 -0
  439. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/load_report.upbdefs.c +146 -0
  440. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/load_report.upbdefs.h +55 -0
  441. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/api_listener.upbdefs.c +50 -0
  442. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/api_listener.upbdefs.h +35 -0
  443. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.c +205 -0
  444. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.h +60 -0
  445. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.c +201 -0
  446. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.h +65 -0
  447. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.c +90 -0
  448. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.h +35 -0
  449. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.c +67 -0
  450. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.h +40 -0
  451. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.c +141 -0
  452. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.h +70 -0
  453. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +141 -0
  454. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +70 -0
  455. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +115 -0
  456. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.h +45 -0
  457. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +964 -0
  458. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +295 -0
  459. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/scoped_route.upbdefs.c +71 -0
  460. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/scoped_route.upbdefs.h +45 -0
  461. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/http_tracer.upbdefs.c +61 -0
  462. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/http_tracer.upbdefs.h +40 -0
  463. data/src/core/ext/upbdefs-generated/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.c +51 -0
  464. data/src/core/ext/upbdefs-generated/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.h +35 -0
  465. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.c +102 -0
  466. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.h +55 -0
  467. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +123 -0
  468. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.h +45 -0
  469. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +79 -0
  470. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.h +35 -0
  471. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +571 -0
  472. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +125 -0
  473. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.c +44 -0
  474. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.h +30 -0
  475. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +178 -0
  476. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.h +55 -0
  477. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.c +97 -0
  478. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.h +45 -0
  479. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +246 -0
  480. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.h +60 -0
  481. data/src/core/ext/upbdefs-generated/envoy/service/cluster/v3/cds.upbdefs.c +72 -0
  482. data/src/core/ext/upbdefs-generated/envoy/service/cluster/v3/cds.upbdefs.h +35 -0
  483. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/ads.upbdefs.c +60 -0
  484. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/ads.upbdefs.h +35 -0
  485. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.c +142 -0
  486. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.h +65 -0
  487. data/src/core/ext/upbdefs-generated/envoy/service/endpoint/v3/eds.upbdefs.c +73 -0
  488. data/src/core/ext/upbdefs-generated/envoy/service/endpoint/v3/eds.upbdefs.h +35 -0
  489. data/src/core/ext/upbdefs-generated/envoy/service/listener/v3/lds.upbdefs.c +72 -0
  490. data/src/core/ext/upbdefs-generated/envoy/service/listener/v3/lds.upbdefs.h +35 -0
  491. data/src/core/ext/upbdefs-generated/envoy/service/load_stats/v3/lrs.upbdefs.c +80 -0
  492. data/src/core/ext/upbdefs-generated/envoy/service/load_stats/v3/lrs.upbdefs.h +40 -0
  493. data/src/core/ext/upbdefs-generated/envoy/service/route/v3/rds.upbdefs.c +80 -0
  494. data/src/core/ext/upbdefs-generated/envoy/service/route/v3/rds.upbdefs.h +35 -0
  495. data/src/core/ext/upbdefs-generated/envoy/service/route/v3/srds.upbdefs.c +74 -0
  496. data/src/core/ext/upbdefs-generated/envoy/service/route/v3/srds.upbdefs.h +35 -0
  497. data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.c +163 -0
  498. data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.h +55 -0
  499. data/src/core/ext/upbdefs-generated/envoy/type/http/v3/path_transformation.upbdefs.c +64 -0
  500. data/src/core/ext/upbdefs-generated/envoy/type/http/v3/path_transformation.upbdefs.h +50 -0
  501. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/metadata.upbdefs.c +64 -0
  502. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/metadata.upbdefs.h +40 -0
  503. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.c +56 -0
  504. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.h +35 -0
  505. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/number.upbdefs.c +54 -0
  506. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/number.upbdefs.h +35 -0
  507. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/path.upbdefs.c +53 -0
  508. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/path.upbdefs.h +35 -0
  509. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +76 -0
  510. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.h +45 -0
  511. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/string.upbdefs.c +69 -0
  512. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/string.upbdefs.h +40 -0
  513. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.c +63 -0
  514. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.h +40 -0
  515. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/value.upbdefs.c +81 -0
  516. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/value.upbdefs.h +45 -0
  517. data/src/core/ext/upbdefs-generated/envoy/type/metadata/v3/metadata.upbdefs.c +92 -0
  518. data/src/core/ext/upbdefs-generated/envoy/type/metadata/v3/metadata.upbdefs.h +65 -0
  519. data/src/core/ext/upbdefs-generated/envoy/type/tracing/v3/custom_tag.upbdefs.c +95 -0
  520. data/src/core/ext/upbdefs-generated/envoy/type/tracing/v3/custom_tag.upbdefs.h +55 -0
  521. data/src/core/ext/upbdefs-generated/envoy/type/v3/http.upbdefs.c +34 -0
  522. data/src/core/ext/{upb-generated/gogoproto/gogo.upb.h → upbdefs-generated/envoy/type/v3/http.upbdefs.h} +10 -10
  523. data/src/core/ext/upbdefs-generated/envoy/type/v3/percent.upbdefs.c +59 -0
  524. data/src/core/ext/upbdefs-generated/envoy/type/v3/percent.upbdefs.h +40 -0
  525. data/src/core/ext/upbdefs-generated/envoy/type/v3/range.upbdefs.c +54 -0
  526. data/src/core/ext/upbdefs-generated/envoy/type/v3/range.upbdefs.h +45 -0
  527. data/src/core/ext/upbdefs-generated/envoy/type/v3/semantic_version.upbdefs.c +47 -0
  528. data/src/core/ext/upbdefs-generated/envoy/type/v3/semantic_version.upbdefs.h +35 -0
  529. data/src/core/ext/upbdefs-generated/google/api/annotations.upbdefs.c +40 -0
  530. data/src/core/ext/upbdefs-generated/google/api/annotations.upbdefs.h +30 -0
  531. data/src/core/ext/upbdefs-generated/google/api/http.upbdefs.c +61 -0
  532. data/src/core/ext/upbdefs-generated/google/api/http.upbdefs.h +45 -0
  533. data/src/core/ext/upbdefs-generated/google/protobuf/any.upbdefs.c +39 -0
  534. data/src/core/ext/upbdefs-generated/google/protobuf/any.upbdefs.h +35 -0
  535. data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c +386 -0
  536. data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.h +165 -0
  537. data/src/core/ext/upbdefs-generated/google/protobuf/duration.upbdefs.c +40 -0
  538. data/src/core/ext/upbdefs-generated/google/protobuf/duration.upbdefs.h +35 -0
  539. data/src/core/ext/upbdefs-generated/google/protobuf/empty.upbdefs.c +37 -0
  540. data/src/core/ext/upbdefs-generated/google/protobuf/empty.upbdefs.h +35 -0
  541. data/src/core/ext/upbdefs-generated/google/protobuf/struct.upbdefs.c +65 -0
  542. data/src/core/ext/upbdefs-generated/google/protobuf/struct.upbdefs.h +50 -0
  543. data/src/core/ext/upbdefs-generated/google/protobuf/timestamp.upbdefs.c +40 -0
  544. data/src/core/ext/upbdefs-generated/google/protobuf/timestamp.upbdefs.h +35 -0
  545. data/src/core/ext/upbdefs-generated/google/protobuf/wrappers.upbdefs.c +66 -0
  546. data/src/core/ext/upbdefs-generated/google/protobuf/wrappers.upbdefs.h +75 -0
  547. data/src/core/ext/upbdefs-generated/google/rpc/status.upbdefs.c +42 -0
  548. data/src/core/ext/upbdefs-generated/google/rpc/status.upbdefs.h +35 -0
  549. data/src/core/ext/upbdefs-generated/udpa/annotations/migrate.upbdefs.c +70 -0
  550. data/src/core/ext/upbdefs-generated/udpa/annotations/migrate.upbdefs.h +45 -0
  551. data/src/core/ext/upbdefs-generated/udpa/annotations/security.upbdefs.c +56 -0
  552. data/src/core/ext/upbdefs-generated/udpa/annotations/security.upbdefs.h +35 -0
  553. data/src/core/ext/upbdefs-generated/udpa/annotations/sensitive.upbdefs.c +33 -0
  554. data/src/core/ext/upbdefs-generated/udpa/annotations/sensitive.upbdefs.h +30 -0
  555. data/src/core/ext/upbdefs-generated/udpa/annotations/status.upbdefs.c +49 -0
  556. data/src/core/ext/upbdefs-generated/udpa/annotations/status.upbdefs.h +35 -0
  557. data/src/core/ext/upbdefs-generated/udpa/annotations/versioning.upbdefs.c +43 -0
  558. data/src/core/ext/upbdefs-generated/udpa/annotations/versioning.upbdefs.h +35 -0
  559. data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.c +44 -0
  560. data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.h +35 -0
  561. data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.c +332 -0
  562. data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.h +145 -0
  563. data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.c +42 -0
  564. data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.h +35 -0
  565. data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.c +62 -0
  566. data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.h +40 -0
  567. data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.c +45 -0
  568. data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.h +40 -0
  569. data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.c +49 -0
  570. data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.h +35 -0
  571. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.c +67 -0
  572. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.h +40 -0
  573. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.c +50 -0
  574. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.h +35 -0
  575. data/src/core/ext/xds/certificate_provider_factory.h +61 -0
  576. data/src/core/ext/xds/certificate_provider_registry.cc +103 -0
  577. data/src/core/ext/xds/certificate_provider_registry.h +57 -0
  578. data/src/core/ext/xds/certificate_provider_store.cc +87 -0
  579. data/src/core/ext/xds/certificate_provider_store.h +112 -0
  580. data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +144 -0
  581. data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +69 -0
  582. data/src/core/ext/xds/xds_api.cc +4124 -0
  583. data/src/core/ext/xds/xds_api.h +709 -0
  584. data/src/core/ext/xds/xds_bootstrap.cc +496 -0
  585. data/src/core/ext/xds/xds_bootstrap.h +115 -0
  586. data/src/core/ext/xds/xds_certificate_provider.cc +405 -0
  587. data/src/core/ext/xds/xds_certificate_provider.h +151 -0
  588. data/src/core/ext/xds/xds_channel_args.h +32 -0
  589. data/src/core/ext/{filters/client_channel/xds → xds}/xds_client.cc +1056 -884
  590. data/src/core/ext/xds/xds_client.h +375 -0
  591. data/src/core/ext/{filters/client_channel/xds → xds}/xds_client_stats.cc +63 -19
  592. data/src/core/ext/{filters/client_channel/xds → xds}/xds_client_stats.h +52 -23
  593. data/src/core/ext/xds/xds_http_fault_filter.cc +226 -0
  594. data/src/core/ext/xds/xds_http_fault_filter.h +63 -0
  595. data/src/core/ext/xds/xds_http_filters.cc +115 -0
  596. data/src/core/ext/xds/xds_http_filters.h +133 -0
  597. data/src/core/ext/xds/xds_server_config_fetcher.cc +546 -0
  598. data/src/core/{ext/filters/client_channel → lib/address_utils}/parse_address.cc +129 -45
  599. data/src/core/lib/address_utils/parse_address.h +77 -0
  600. data/src/core/lib/{iomgr → address_utils}/sockaddr_utils.cc +138 -19
  601. data/src/core/lib/{iomgr → address_utils}/sockaddr_utils.h +38 -7
  602. data/src/core/lib/channel/call_tracer.h +85 -0
  603. data/src/core/lib/channel/channel_args.cc +9 -8
  604. data/src/core/lib/channel/channel_args.h +0 -1
  605. data/src/core/lib/channel/channel_stack.cc +22 -9
  606. data/src/core/lib/channel/channel_stack.h +18 -10
  607. data/src/core/lib/channel/channel_stack_builder.cc +2 -2
  608. data/src/core/lib/channel/channel_stack_builder.h +1 -1
  609. data/src/core/lib/channel/channel_trace.cc +6 -8
  610. data/src/core/lib/channel/channel_trace.h +1 -1
  611. data/src/core/lib/channel/channelz.cc +148 -99
  612. data/src/core/lib/channel/channelz.h +47 -24
  613. data/src/core/lib/channel/channelz_registry.cc +29 -12
  614. data/src/core/lib/channel/channelz_registry.h +3 -1
  615. data/src/core/lib/channel/connected_channel.cc +4 -4
  616. data/src/core/lib/channel/context.h +3 -0
  617. data/src/core/lib/channel/handshaker.cc +11 -52
  618. data/src/core/lib/channel/handshaker.h +8 -25
  619. data/src/core/lib/channel/status_util.cc +12 -2
  620. data/src/core/lib/channel/status_util.h +9 -0
  621. data/src/core/lib/compression/compression.cc +8 -4
  622. data/src/core/lib/compression/compression_args.cc +3 -2
  623. data/src/core/lib/compression/compression_internal.cc +10 -5
  624. data/src/core/lib/compression/compression_internal.h +2 -1
  625. data/src/core/lib/compression/stream_compression.h +1 -1
  626. data/src/core/lib/compression/stream_compression_gzip.h +1 -1
  627. data/src/core/lib/compression/stream_compression_identity.cc +1 -3
  628. data/src/core/lib/compression/stream_compression_identity.h +1 -1
  629. data/src/core/lib/debug/stats.h +3 -3
  630. data/src/core/lib/debug/stats_data.cc +1 -0
  631. data/src/core/lib/debug/stats_data.h +13 -13
  632. data/src/core/lib/event_engine/endpoint_config.cc +46 -0
  633. data/src/core/lib/event_engine/endpoint_config_internal.h +42 -0
  634. data/src/core/lib/event_engine/event_engine.cc +50 -0
  635. data/src/core/lib/event_engine/sockaddr.cc +40 -0
  636. data/src/core/lib/event_engine/sockaddr.h +44 -0
  637. data/src/core/lib/gpr/alloc.cc +3 -2
  638. data/src/core/lib/gpr/cpu_iphone.cc +10 -2
  639. data/src/core/lib/gpr/log.cc +59 -17
  640. data/src/core/lib/gpr/log_linux.cc +23 -9
  641. data/src/core/lib/gpr/log_posix.cc +19 -7
  642. data/src/core/lib/gpr/log_windows.cc +18 -4
  643. data/src/core/lib/gpr/murmur_hash.cc +5 -3
  644. data/src/core/lib/gpr/spinlock.h +10 -2
  645. data/src/core/lib/gpr/string.cc +33 -31
  646. data/src/core/lib/gpr/string.h +9 -8
  647. data/src/core/lib/gpr/sync.cc +4 -4
  648. data/src/core/lib/gpr/sync_abseil.cc +3 -6
  649. data/src/core/lib/gpr/sync_posix.cc +2 -8
  650. data/src/core/lib/gpr/sync_windows.cc +2 -2
  651. data/src/core/lib/gpr/time.cc +12 -12
  652. data/src/core/lib/gpr/time_precise.cc +5 -2
  653. data/src/core/lib/gpr/time_precise.h +6 -2
  654. data/src/core/lib/gpr/tls.h +4 -0
  655. data/src/core/lib/gpr/tls_msvc.h +2 -0
  656. data/src/core/lib/gpr/tls_stdcpp.h +48 -0
  657. data/src/core/lib/gpr/useful.h +5 -4
  658. data/src/core/lib/gpr/wrap_memcpy.cc +2 -1
  659. data/src/core/lib/gprpp/arena.h +3 -2
  660. data/src/core/lib/gprpp/atomic.h +3 -3
  661. data/src/core/lib/gprpp/dual_ref_counted.h +331 -0
  662. data/src/core/lib/gprpp/examine_stack.cc +43 -0
  663. data/src/core/lib/gprpp/examine_stack.h +46 -0
  664. data/src/core/lib/gprpp/fork.cc +2 -2
  665. data/src/core/lib/gprpp/global_config_env.cc +8 -6
  666. data/src/core/lib/gprpp/manual_constructor.h +2 -2
  667. data/src/core/lib/gprpp/mpscq.cc +2 -2
  668. data/src/core/lib/gprpp/orphanable.h +7 -11
  669. data/src/core/lib/gprpp/ref_counted.h +105 -68
  670. data/src/core/lib/gprpp/ref_counted_ptr.h +168 -7
  671. data/src/core/lib/gprpp/stat.h +38 -0
  672. data/src/core/lib/gprpp/stat_posix.cc +49 -0
  673. data/src/core/lib/gprpp/stat_windows.cc +48 -0
  674. data/src/core/lib/gprpp/status_helper.cc +407 -0
  675. data/src/core/lib/gprpp/status_helper.h +183 -0
  676. data/src/core/lib/gprpp/sync.h +104 -43
  677. data/src/core/lib/gprpp/thd.h +3 -3
  678. data/src/core/lib/gprpp/thd_posix.cc +42 -37
  679. data/src/core/lib/gprpp/thd_windows.cc +3 -1
  680. data/src/core/lib/gprpp/time_util.cc +77 -0
  681. data/src/core/lib/gprpp/time_util.h +42 -0
  682. data/src/core/lib/http/httpcli.cc +25 -22
  683. data/src/core/lib/http/httpcli.h +2 -3
  684. data/src/core/lib/http/httpcli_security_connector.cc +19 -15
  685. data/src/core/lib/http/parser.cc +63 -43
  686. data/src/core/lib/http/parser.h +4 -4
  687. data/src/core/lib/iomgr/buffer_list.cc +8 -10
  688. data/src/core/lib/iomgr/buffer_list.h +5 -6
  689. data/src/core/lib/iomgr/call_combiner.cc +21 -15
  690. data/src/core/lib/iomgr/call_combiner.h +12 -14
  691. data/src/core/lib/iomgr/cfstream_handle.cc +6 -5
  692. data/src/core/lib/iomgr/cfstream_handle.h +1 -1
  693. data/src/core/lib/iomgr/closure.h +7 -6
  694. data/src/core/lib/iomgr/combiner.cc +16 -13
  695. data/src/core/lib/iomgr/combiner.h +2 -2
  696. data/src/core/lib/iomgr/endpoint.cc +6 -2
  697. data/src/core/lib/iomgr/endpoint.h +10 -6
  698. data/src/core/lib/iomgr/endpoint_cfstream.cc +46 -23
  699. data/src/core/lib/iomgr/endpoint_pair_event_engine.cc +33 -0
  700. data/src/core/lib/iomgr/endpoint_pair_posix.cc +10 -10
  701. data/src/core/lib/iomgr/endpoint_pair_windows.cc +1 -1
  702. data/src/core/lib/iomgr/error.cc +185 -73
  703. data/src/core/lib/iomgr/error.h +218 -107
  704. data/src/core/lib/iomgr/error_cfstream.cc +12 -10
  705. data/src/core/lib/iomgr/error_cfstream.h +2 -2
  706. data/src/core/lib/iomgr/error_internal.h +6 -2
  707. data/src/core/lib/iomgr/ev_apple.cc +16 -13
  708. data/src/core/lib/iomgr/ev_apple.h +1 -1
  709. data/src/core/lib/iomgr/ev_epoll1_linux.cc +47 -41
  710. data/src/core/lib/iomgr/ev_epollex_linux.cc +92 -87
  711. data/src/core/lib/iomgr/ev_poll_posix.cc +41 -35
  712. data/src/core/lib/iomgr/ev_posix.cc +12 -11
  713. data/src/core/lib/iomgr/ev_posix.h +9 -9
  714. data/src/core/lib/iomgr/event_engine/closure.cc +54 -0
  715. data/src/core/lib/iomgr/event_engine/closure.h +33 -0
  716. data/src/core/lib/iomgr/event_engine/endpoint.cc +192 -0
  717. data/src/core/lib/iomgr/event_engine/endpoint.h +53 -0
  718. data/src/core/lib/iomgr/event_engine/iomgr.cc +105 -0
  719. data/src/core/lib/iomgr/event_engine/iomgr.h +24 -0
  720. data/src/core/lib/iomgr/event_engine/pollset.cc +87 -0
  721. data/src/core/lib/iomgr/event_engine/pollset.h +25 -0
  722. data/src/core/lib/iomgr/event_engine/promise.h +51 -0
  723. data/src/core/lib/iomgr/event_engine/resolved_address_internal.cc +41 -0
  724. data/src/core/lib/iomgr/event_engine/resolved_address_internal.h +35 -0
  725. data/src/core/lib/iomgr/event_engine/resolver.cc +110 -0
  726. data/src/core/lib/iomgr/event_engine/tcp.cc +263 -0
  727. data/src/core/lib/iomgr/event_engine/timer.cc +57 -0
  728. data/src/core/lib/iomgr/exec_ctx.cc +19 -7
  729. data/src/core/lib/iomgr/exec_ctx.h +20 -17
  730. data/src/core/lib/iomgr/executor/mpmcqueue.h +5 -5
  731. data/src/core/lib/iomgr/executor/threadpool.cc +2 -3
  732. data/src/core/lib/iomgr/executor/threadpool.h +6 -6
  733. data/src/core/lib/iomgr/executor.cc +10 -9
  734. data/src/core/lib/iomgr/executor.h +3 -3
  735. data/src/core/lib/iomgr/iomgr.cc +3 -3
  736. data/src/core/lib/iomgr/iomgr.h +1 -1
  737. data/src/core/lib/iomgr/iomgr_custom.cc +1 -1
  738. data/src/core/lib/iomgr/iomgr_internal.cc +2 -2
  739. data/src/core/lib/iomgr/iomgr_internal.h +3 -3
  740. data/src/core/lib/iomgr/iomgr_posix.cc +3 -2
  741. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +42 -13
  742. data/src/core/lib/iomgr/iomgr_windows.cc +1 -1
  743. data/src/core/lib/iomgr/is_epollexclusive_available.cc +14 -0
  744. data/src/core/lib/iomgr/load_file.cc +4 -4
  745. data/src/core/lib/iomgr/load_file.h +2 -2
  746. data/src/core/lib/iomgr/lockfree_event.cc +20 -15
  747. data/src/core/lib/iomgr/lockfree_event.h +2 -2
  748. data/src/core/lib/iomgr/pollset.cc +5 -5
  749. data/src/core/lib/iomgr/pollset.h +9 -9
  750. data/src/core/lib/iomgr/pollset_custom.cc +7 -7
  751. data/src/core/lib/iomgr/pollset_custom.h +3 -1
  752. data/src/core/lib/iomgr/pollset_set_custom.cc +1 -1
  753. data/src/core/lib/iomgr/pollset_uv.cc +3 -1
  754. data/src/core/lib/iomgr/pollset_uv.h +5 -1
  755. data/src/core/lib/iomgr/pollset_windows.cc +5 -5
  756. data/src/core/lib/iomgr/port.h +8 -26
  757. data/src/core/lib/iomgr/python_util.h +5 -5
  758. data/src/core/lib/iomgr/resolve_address.cc +12 -8
  759. data/src/core/lib/iomgr/resolve_address.h +12 -6
  760. data/src/core/lib/iomgr/resolve_address_custom.cc +23 -27
  761. data/src/core/lib/iomgr/resolve_address_custom.h +3 -3
  762. data/src/core/lib/iomgr/resolve_address_posix.cc +4 -8
  763. data/src/core/lib/iomgr/resolve_address_windows.cc +12 -12
  764. data/src/core/lib/iomgr/resource_quota.cc +48 -42
  765. data/src/core/lib/iomgr/sockaddr.h +1 -0
  766. data/src/core/lib/iomgr/socket_factory_posix.cc +3 -2
  767. data/src/core/lib/iomgr/socket_mutator.cc +18 -4
  768. data/src/core/lib/iomgr/socket_mutator.h +26 -2
  769. data/src/core/lib/iomgr/socket_utils_common_posix.cc +120 -77
  770. data/src/core/lib/iomgr/socket_utils_posix.h +20 -20
  771. data/src/core/lib/iomgr/socket_windows.cc +4 -5
  772. data/src/core/lib/iomgr/tcp_client.cc +3 -3
  773. data/src/core/lib/iomgr/tcp_client_cfstream.cc +13 -15
  774. data/src/core/lib/iomgr/tcp_client_custom.cc +17 -20
  775. data/src/core/lib/iomgr/tcp_client_posix.cc +48 -54
  776. data/src/core/lib/iomgr/tcp_client_posix.h +3 -4
  777. data/src/core/lib/iomgr/tcp_client_windows.cc +16 -14
  778. data/src/core/lib/iomgr/tcp_custom.cc +67 -48
  779. data/src/core/lib/iomgr/tcp_custom.h +14 -13
  780. data/src/core/lib/iomgr/tcp_posix.cc +118 -94
  781. data/src/core/lib/iomgr/tcp_posix.h +8 -0
  782. data/src/core/lib/iomgr/tcp_server.cc +9 -10
  783. data/src/core/lib/iomgr/tcp_server.h +19 -16
  784. data/src/core/lib/iomgr/tcp_server_custom.cc +57 -58
  785. data/src/core/lib/iomgr/tcp_server_posix.cc +62 -61
  786. data/src/core/lib/iomgr/tcp_server_utils_posix.h +16 -16
  787. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +26 -25
  788. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +12 -17
  789. data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc +4 -4
  790. data/src/core/lib/iomgr/tcp_server_windows.cc +42 -41
  791. data/src/core/lib/iomgr/tcp_uv.cc +27 -25
  792. data/src/core/lib/iomgr/tcp_windows.cc +39 -23
  793. data/src/core/lib/iomgr/tcp_windows.h +2 -2
  794. data/src/core/lib/iomgr/timer.h +6 -1
  795. data/src/core/lib/iomgr/timer_custom.cc +7 -6
  796. data/src/core/lib/iomgr/timer_custom.h +1 -1
  797. data/src/core/lib/iomgr/timer_generic.cc +24 -23
  798. data/src/core/lib/iomgr/timer_manager.cc +4 -4
  799. data/src/core/lib/iomgr/udp_server.cc +46 -45
  800. data/src/core/lib/iomgr/udp_server.h +6 -4
  801. data/src/core/lib/iomgr/unix_sockets_posix.cc +36 -30
  802. data/src/core/lib/iomgr/unix_sockets_posix.h +9 -2
  803. data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +20 -7
  804. data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +3 -3
  805. data/src/core/lib/iomgr/wakeup_fd_nospecial.cc +1 -1
  806. data/src/core/lib/iomgr/wakeup_fd_pipe.cc +6 -6
  807. data/src/core/lib/iomgr/wakeup_fd_posix.cc +3 -3
  808. data/src/core/lib/iomgr/wakeup_fd_posix.h +8 -6
  809. data/src/core/lib/iomgr/work_serializer.h +17 -1
  810. data/src/core/lib/json/json.h +13 -3
  811. data/src/core/lib/json/json_reader.cc +33 -31
  812. data/src/core/lib/json/json_util.cc +58 -0
  813. data/src/core/lib/json/json_util.h +204 -0
  814. data/src/core/lib/json/json_writer.cc +2 -1
  815. data/src/core/lib/matchers/matchers.cc +327 -0
  816. data/src/core/lib/matchers/matchers.h +161 -0
  817. data/src/core/lib/security/authorization/authorization_engine.h +44 -0
  818. data/src/core/lib/security/authorization/authorization_policy_provider.h +32 -0
  819. data/src/core/lib/security/authorization/authorization_policy_provider_vtable.cc +46 -0
  820. data/src/core/lib/security/authorization/evaluate_args.cc +209 -0
  821. data/src/core/lib/security/authorization/evaluate_args.h +91 -0
  822. data/src/core/lib/security/context/security_context.cc +4 -3
  823. data/src/core/lib/security/context/security_context.h +3 -1
  824. data/src/core/lib/security/credentials/alts/alts_credentials.cc +2 -1
  825. data/src/core/lib/security/credentials/alts/alts_credentials.h +1 -1
  826. data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +1 -1
  827. data/src/core/lib/security/credentials/composite/composite_credentials.cc +4 -4
  828. data/src/core/lib/security/credentials/composite/composite_credentials.h +2 -2
  829. data/src/core/lib/security/credentials/credentials.cc +7 -7
  830. data/src/core/lib/security/credentials/credentials.h +12 -9
  831. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +417 -0
  832. data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +82 -0
  833. data/src/core/lib/security/credentials/external/aws_request_signer.cc +214 -0
  834. data/src/core/lib/security/credentials/external/aws_request_signer.h +72 -0
  835. data/src/core/lib/security/credentials/external/external_account_credentials.cc +500 -0
  836. data/src/core/lib/security/credentials/external/external_account_credentials.h +121 -0
  837. data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +136 -0
  838. data/src/core/lib/security/credentials/external/file_external_account_credentials.h +49 -0
  839. data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +213 -0
  840. data/src/core/lib/security/credentials/external/url_external_account_credentials.h +60 -0
  841. data/src/core/lib/security/credentials/fake/fake_credentials.cc +5 -4
  842. data/src/core/lib/security/credentials/fake/fake_credentials.h +2 -2
  843. data/src/core/lib/security/credentials/google_default/credentials_generic.cc +8 -6
  844. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +95 -65
  845. data/src/core/lib/security/credentials/iam/iam_credentials.cc +2 -2
  846. data/src/core/lib/security/credentials/iam/iam_credentials.h +2 -2
  847. data/src/core/lib/security/credentials/insecure/insecure_credentials.cc +64 -0
  848. data/src/core/lib/security/credentials/jwt/json_token.cc +5 -5
  849. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +10 -7
  850. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +6 -5
  851. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +12 -9
  852. data/src/core/lib/security/credentials/local/local_credentials.cc +2 -1
  853. data/src/core/lib/security/credentials/local/local_credentials.h +1 -1
  854. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +78 -92
  855. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +10 -9
  856. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +12 -12
  857. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -2
  858. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +27 -6
  859. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +12 -2
  860. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +347 -0
  861. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +213 -0
  862. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +454 -0
  863. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +145 -0
  864. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +82 -150
  865. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +65 -185
  866. data/src/core/lib/security/credentials/tls/tls_credentials.cc +18 -13
  867. data/src/core/lib/security/credentials/tls/tls_credentials.h +3 -3
  868. data/src/core/lib/security/credentials/tls/tls_utils.cc +123 -0
  869. data/src/core/lib/security/credentials/tls/tls_utils.h +51 -0
  870. data/src/core/lib/security/credentials/xds/xds_credentials.cc +244 -0
  871. data/src/core/lib/security/credentials/xds/xds_credentials.h +69 -0
  872. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +14 -4
  873. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +33 -28
  874. data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +121 -0
  875. data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +97 -0
  876. data/src/core/lib/security/security_connector/load_system_roots.h +4 -0
  877. data/src/core/lib/security/security_connector/load_system_roots_linux.cc +1 -1
  878. data/src/core/lib/security/security_connector/load_system_roots_linux.h +2 -0
  879. data/src/core/lib/security/security_connector/local/local_security_connector.cc +25 -12
  880. data/src/core/lib/security/security_connector/security_connector.cc +6 -3
  881. data/src/core/lib/security/security_connector/security_connector.h +14 -7
  882. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +38 -21
  883. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +5 -0
  884. data/src/core/lib/security/security_connector/ssl_utils.cc +82 -33
  885. data/src/core/lib/security/security_connector/ssl_utils.h +29 -25
  886. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +380 -312
  887. data/src/core/lib/security/security_connector/tls/tls_security_connector.h +141 -79
  888. data/src/core/lib/security/transport/client_auth_filter.cc +28 -19
  889. data/src/core/lib/security/transport/secure_endpoint.cc +13 -7
  890. data/src/core/lib/security/transport/security_handshaker.cc +81 -44
  891. data/src/core/lib/security/transport/server_auth_filter.cc +19 -12
  892. data/src/core/lib/security/transport/tsi_error.cc +2 -1
  893. data/src/core/lib/security/transport/tsi_error.h +2 -1
  894. data/src/core/lib/security/util/json_util.cc +14 -15
  895. data/src/core/lib/security/util/json_util.h +2 -1
  896. data/src/core/lib/slice/slice.cc +57 -7
  897. data/src/core/lib/slice/slice_buffer.cc +2 -1
  898. data/src/core/lib/slice/slice_intern.cc +11 -13
  899. data/src/core/lib/slice/slice_internal.h +4 -2
  900. data/src/core/lib/surface/call.cc +164 -136
  901. data/src/core/lib/surface/call.h +15 -3
  902. data/src/core/lib/surface/call_details.cc +8 -8
  903. data/src/core/lib/surface/channel.cc +55 -63
  904. data/src/core/lib/surface/channel.h +24 -7
  905. data/src/core/lib/surface/channel_init.cc +1 -1
  906. data/src/core/lib/surface/channel_ping.cc +1 -1
  907. data/src/core/lib/surface/completion_queue.cc +96 -96
  908. data/src/core/lib/surface/completion_queue.h +18 -17
  909. data/src/core/lib/surface/completion_queue_factory.cc +1 -2
  910. data/src/core/lib/surface/init.cc +46 -32
  911. data/src/core/lib/surface/init.h +10 -1
  912. data/src/core/lib/surface/lame_client.cc +51 -58
  913. data/src/core/lib/surface/lame_client.h +5 -0
  914. data/src/core/lib/surface/server.cc +1181 -1365
  915. data/src/core/lib/surface/server.h +463 -70
  916. data/src/core/lib/surface/validate_metadata.cc +7 -7
  917. data/src/core/lib/surface/validate_metadata.h +6 -2
  918. data/src/core/lib/surface/version.cc +2 -2
  919. data/src/core/lib/transport/authority_override.cc +40 -0
  920. data/src/core/lib/transport/authority_override.h +37 -0
  921. data/src/core/lib/transport/bdp_estimator.cc +1 -1
  922. data/src/core/lib/transport/bdp_estimator.h +2 -1
  923. data/src/core/lib/transport/byte_stream.cc +5 -5
  924. data/src/core/lib/transport/byte_stream.h +11 -11
  925. data/src/core/lib/transport/connectivity_state.cc +19 -14
  926. data/src/core/lib/transport/connectivity_state.h +26 -12
  927. data/src/core/lib/transport/error_utils.cc +33 -9
  928. data/src/core/lib/transport/error_utils.h +15 -3
  929. data/src/core/lib/transport/metadata.cc +16 -2
  930. data/src/core/lib/transport/metadata.h +2 -2
  931. data/src/core/lib/transport/metadata_batch.cc +76 -38
  932. data/src/core/lib/transport/metadata_batch.h +43 -21
  933. data/src/core/lib/transport/static_metadata.cc +296 -277
  934. data/src/core/lib/transport/static_metadata.h +80 -73
  935. data/src/core/lib/transport/status_metadata.cc +4 -3
  936. data/src/core/lib/transport/timeout_encoding.cc +4 -4
  937. data/src/core/lib/transport/transport.cc +9 -6
  938. data/src/core/lib/transport/transport.h +26 -11
  939. data/src/core/lib/transport/transport_op_string.cc +6 -6
  940. data/src/core/lib/uri/uri_parser.cc +135 -258
  941. data/src/core/lib/uri/uri_parser.h +58 -20
  942. data/src/core/plugin_registry/grpc_plugin_registry.cc +61 -20
  943. data/src/core/tsi/alts/crypt/gsec.cc +5 -4
  944. data/src/core/tsi/alts/crypt/gsec.h +6 -0
  945. data/src/core/tsi/alts/frame_protector/frame_handler.cc +8 -6
  946. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +47 -42
  947. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +74 -53
  948. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +1 -1
  949. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +2 -1
  950. data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +3 -3
  951. data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc +8 -6
  952. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +4 -4
  953. data/src/core/tsi/fake_transport_security.cc +17 -5
  954. data/src/core/tsi/local_transport_security.cc +5 -1
  955. data/src/core/tsi/local_transport_security.h +6 -7
  956. data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -1
  957. data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +0 -2
  958. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +3 -2
  959. data/src/core/tsi/ssl_transport_security.cc +199 -73
  960. data/src/core/tsi/ssl_transport_security.h +23 -12
  961. data/src/core/tsi/transport_security.cc +10 -8
  962. data/src/core/tsi/transport_security_interface.h +6 -1
  963. data/src/ruby/bin/math_services_pb.rb +5 -5
  964. data/src/ruby/ext/grpc/extconf.rb +17 -4
  965. data/src/ruby/ext/grpc/rb_call.c +3 -2
  966. data/src/ruby/ext/grpc/rb_call.h +4 -0
  967. data/src/ruby/ext/grpc/rb_call_credentials.c +54 -10
  968. data/src/ruby/ext/grpc/rb_channel.c +10 -1
  969. data/src/ruby/ext/grpc/rb_channel_credentials.c +20 -1
  970. data/src/ruby/ext/grpc/rb_channel_credentials.h +4 -0
  971. data/src/ruby/ext/grpc/rb_compression_options.c +1 -1
  972. data/src/ruby/ext/grpc/rb_enable_cpp.cc +1 -1
  973. data/src/ruby/ext/grpc/rb_event_thread.c +2 -0
  974. data/src/ruby/ext/grpc/rb_grpc.c +4 -0
  975. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +46 -18
  976. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +87 -45
  977. data/src/ruby/ext/grpc/rb_server.c +13 -1
  978. data/src/ruby/ext/grpc/rb_server_credentials.c +19 -3
  979. data/src/ruby/ext/grpc/rb_server_credentials.h +4 -0
  980. data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +215 -0
  981. data/src/ruby/ext/grpc/rb_xds_channel_credentials.h +35 -0
  982. data/src/ruby/ext/grpc/rb_xds_server_credentials.c +169 -0
  983. data/src/ruby/ext/grpc/rb_xds_server_credentials.h +35 -0
  984. data/src/ruby/lib/grpc/generic/client_stub.rb +5 -3
  985. data/src/ruby/lib/grpc/generic/interceptors.rb +1 -1
  986. data/src/ruby/lib/grpc/version.rb +1 -1
  987. data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +3 -3
  988. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +40 -0
  989. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +50 -16
  990. data/src/ruby/spec/call_spec.rb +1 -1
  991. data/src/ruby/spec/channel_credentials_spec.rb +42 -0
  992. data/src/ruby/spec/channel_spec.rb +17 -6
  993. data/src/ruby/spec/client_auth_spec.rb +27 -1
  994. data/src/ruby/spec/errors_spec.rb +1 -1
  995. data/src/ruby/spec/generic/active_call_spec.rb +21 -10
  996. data/src/ruby/spec/generic/client_stub_spec.rb +4 -4
  997. data/src/ruby/spec/generic/rpc_server_spec.rb +1 -1
  998. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import2.proto +23 -0
  999. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +2 -0
  1000. data/src/ruby/spec/pb/codegen/grpc/testing/same_package_service_name.proto +27 -0
  1001. data/src/ruby/spec/pb/codegen/grpc/testing/same_ruby_package_service_name.proto +29 -0
  1002. data/src/ruby/spec/pb/codegen/package_option_spec.rb +27 -7
  1003. data/src/ruby/spec/server_credentials_spec.rb +25 -0
  1004. data/src/ruby/spec/server_spec.rb +22 -0
  1005. data/src/ruby/spec/user_agent_spec.rb +74 -0
  1006. data/third_party/abseil-cpp/absl/algorithm/container.h +1764 -0
  1007. data/third_party/abseil-cpp/absl/base/attributes.h +122 -41
  1008. data/third_party/abseil-cpp/absl/base/call_once.h +3 -10
  1009. data/third_party/abseil-cpp/absl/base/casts.h +9 -6
  1010. data/third_party/abseil-cpp/absl/base/config.h +97 -26
  1011. data/third_party/abseil-cpp/absl/base/dynamic_annotations.h +442 -335
  1012. data/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +169 -0
  1013. data/third_party/abseil-cpp/absl/base/internal/dynamic_annotations.h +398 -0
  1014. data/third_party/abseil-cpp/absl/base/internal/endian.h +61 -0
  1015. data/third_party/abseil-cpp/absl/base/internal/exponential_biased.cc +93 -0
  1016. data/third_party/abseil-cpp/absl/base/internal/exponential_biased.h +130 -0
  1017. data/third_party/abseil-cpp/absl/base/internal/invoke.h +4 -4
  1018. data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +620 -0
  1019. data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.h +126 -0
  1020. data/third_party/abseil-cpp/absl/base/internal/low_level_scheduling.h +31 -4
  1021. data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +35 -33
  1022. data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +17 -5
  1023. data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +36 -40
  1024. data/third_party/abseil-cpp/absl/base/internal/spinlock.h +33 -30
  1025. data/third_party/abseil-cpp/absl/base/internal/spinlock_akaros.inc +2 -2
  1026. data/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc +11 -3
  1027. data/third_party/abseil-cpp/absl/base/internal/spinlock_posix.inc +2 -2
  1028. data/third_party/abseil-cpp/absl/base/internal/spinlock_wait.h +11 -11
  1029. data/third_party/abseil-cpp/absl/base/internal/spinlock_win32.inc +5 -5
  1030. data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +28 -5
  1031. data/third_party/abseil-cpp/absl/base/internal/sysinfo.h +8 -0
  1032. data/third_party/abseil-cpp/absl/base/internal/thread_identity.cc +5 -2
  1033. data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +43 -42
  1034. data/third_party/abseil-cpp/absl/base/internal/throw_delegate.cc +111 -7
  1035. data/third_party/abseil-cpp/absl/base/internal/tsan_mutex_interface.h +3 -1
  1036. data/third_party/abseil-cpp/absl/base/internal/unaligned_access.h +0 -76
  1037. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +1 -3
  1038. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +3 -3
  1039. data/third_party/abseil-cpp/absl/base/log_severity.h +4 -4
  1040. data/third_party/abseil-cpp/absl/base/macros.h +47 -109
  1041. data/third_party/abseil-cpp/absl/base/optimization.h +69 -6
  1042. data/third_party/abseil-cpp/absl/base/options.h +31 -4
  1043. data/third_party/abseil-cpp/absl/base/policy_checks.h +1 -1
  1044. data/third_party/abseil-cpp/absl/base/port.h +0 -1
  1045. data/third_party/abseil-cpp/absl/base/thread_annotations.h +95 -40
  1046. data/third_party/abseil-cpp/absl/container/fixed_array.h +532 -0
  1047. data/third_party/abseil-cpp/absl/container/flat_hash_map.h +606 -0
  1048. data/third_party/abseil-cpp/absl/container/inlined_vector.h +38 -39
  1049. data/third_party/abseil-cpp/absl/container/internal/common.h +206 -0
  1050. data/third_party/abseil-cpp/absl/container/internal/compressed_tuple.h +34 -9
  1051. data/third_party/abseil-cpp/absl/container/internal/container_memory.h +460 -0
  1052. data/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h +161 -0
  1053. data/third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h +208 -0
  1054. data/third_party/abseil-cpp/absl/container/internal/hashtable_debug_hooks.h +85 -0
  1055. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +274 -0
  1056. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +322 -0
  1057. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc +31 -0
  1058. data/third_party/abseil-cpp/absl/container/internal/have_sse.h +50 -0
  1059. data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +141 -66
  1060. data/third_party/abseil-cpp/absl/container/internal/layout.h +743 -0
  1061. data/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h +197 -0
  1062. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +61 -0
  1063. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +1903 -0
  1064. data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc +139 -0
  1065. data/third_party/abseil-cpp/absl/debugging/internal/address_is_readable.h +32 -0
  1066. data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +1949 -0
  1067. data/third_party/abseil-cpp/absl/debugging/internal/demangle.h +71 -0
  1068. data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc +382 -0
  1069. data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h +134 -0
  1070. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +199 -0
  1071. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_arm-inl.inc +134 -0
  1072. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h +80 -0
  1073. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_generic-inl.inc +108 -0
  1074. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +253 -0
  1075. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_unimplemented-inl.inc +24 -0
  1076. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_win32-inl.inc +93 -0
  1077. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +346 -0
  1078. data/third_party/abseil-cpp/absl/debugging/internal/symbolize.h +147 -0
  1079. data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc +173 -0
  1080. data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.h +158 -0
  1081. data/third_party/abseil-cpp/absl/debugging/stacktrace.cc +140 -0
  1082. data/third_party/abseil-cpp/absl/debugging/stacktrace.h +231 -0
  1083. data/third_party/abseil-cpp/absl/debugging/symbolize.cc +36 -0
  1084. data/third_party/abseil-cpp/absl/debugging/symbolize.h +99 -0
  1085. data/third_party/abseil-cpp/absl/debugging/symbolize_darwin.inc +101 -0
  1086. data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +1560 -0
  1087. data/third_party/abseil-cpp/absl/debugging/symbolize_unimplemented.inc +40 -0
  1088. data/third_party/abseil-cpp/absl/debugging/symbolize_win32.inc +81 -0
  1089. data/third_party/abseil-cpp/absl/functional/bind_front.h +184 -0
  1090. data/third_party/abseil-cpp/absl/functional/function_ref.h +139 -0
  1091. data/third_party/abseil-cpp/absl/functional/internal/front_binder.h +95 -0
  1092. data/third_party/abseil-cpp/absl/functional/internal/function_ref.h +106 -0
  1093. data/third_party/abseil-cpp/absl/hash/hash.h +325 -0
  1094. data/third_party/abseil-cpp/absl/hash/internal/city.cc +349 -0
  1095. data/third_party/abseil-cpp/absl/hash/internal/city.h +78 -0
  1096. data/third_party/abseil-cpp/absl/hash/internal/hash.cc +70 -0
  1097. data/third_party/abseil-cpp/absl/hash/internal/hash.h +1045 -0
  1098. data/third_party/abseil-cpp/absl/hash/internal/wyhash.cc +111 -0
  1099. data/third_party/abseil-cpp/absl/hash/internal/wyhash.h +48 -0
  1100. data/third_party/abseil-cpp/absl/memory/memory.h +4 -0
  1101. data/third_party/abseil-cpp/absl/meta/type_traits.h +18 -10
  1102. data/third_party/abseil-cpp/absl/numeric/bits.h +177 -0
  1103. data/third_party/abseil-cpp/absl/numeric/int128.cc +13 -27
  1104. data/third_party/abseil-cpp/absl/numeric/int128.h +16 -15
  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 +69 -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 +452 -0
  1110. data/third_party/abseil-cpp/absl/status/status.h +878 -0
  1111. data/third_party/abseil-cpp/absl/status/status_payload_printer.cc +38 -0
  1112. data/third_party/abseil-cpp/absl/status/status_payload_printer.h +51 -0
  1113. data/third_party/abseil-cpp/absl/status/statusor.cc +71 -0
  1114. data/third_party/abseil-cpp/absl/status/statusor.h +760 -0
  1115. data/third_party/abseil-cpp/absl/strings/charconv.cc +7 -7
  1116. data/third_party/abseil-cpp/absl/strings/cord.cc +1953 -0
  1117. data/third_party/abseil-cpp/absl/strings/cord.h +1394 -0
  1118. data/third_party/abseil-cpp/absl/strings/escaping.cc +13 -13
  1119. data/third_party/abseil-cpp/absl/strings/internal/char_map.h +1 -1
  1120. data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +1 -1
  1121. data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.h +2 -2
  1122. data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc +8 -8
  1123. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.cc +83 -0
  1124. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +543 -0
  1125. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_flat.h +146 -0
  1126. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.cc +897 -0
  1127. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.h +589 -0
  1128. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring_reader.h +114 -0
  1129. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +236 -136
  1130. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +150 -64
  1131. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +16 -2
  1132. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +29 -21
  1133. data/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h +21 -14
  1134. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +31 -7
  1135. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +147 -135
  1136. data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +1017 -87
  1137. data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.h +17 -3
  1138. data/third_party/abseil-cpp/absl/strings/internal/str_format/output.h +4 -12
  1139. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc +22 -6
  1140. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +27 -11
  1141. data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +15 -40
  1142. data/third_party/abseil-cpp/absl/strings/internal/string_constant.h +64 -0
  1143. data/third_party/abseil-cpp/absl/strings/match.cc +6 -3
  1144. data/third_party/abseil-cpp/absl/strings/match.h +16 -6
  1145. data/third_party/abseil-cpp/absl/strings/numbers.cc +132 -4
  1146. data/third_party/abseil-cpp/absl/strings/numbers.h +10 -10
  1147. data/third_party/abseil-cpp/absl/strings/str_cat.cc +4 -4
  1148. data/third_party/abseil-cpp/absl/strings/str_cat.h +1 -1
  1149. data/third_party/abseil-cpp/absl/strings/str_format.h +289 -13
  1150. data/third_party/abseil-cpp/absl/strings/str_join.h +1 -1
  1151. data/third_party/abseil-cpp/absl/strings/str_split.cc +2 -2
  1152. data/third_party/abseil-cpp/absl/strings/str_split.h +39 -4
  1153. data/third_party/abseil-cpp/absl/strings/string_view.h +26 -19
  1154. data/third_party/abseil-cpp/absl/strings/substitute.cc +5 -5
  1155. data/third_party/abseil-cpp/absl/strings/substitute.h +32 -29
  1156. data/third_party/abseil-cpp/absl/synchronization/barrier.cc +52 -0
  1157. data/third_party/abseil-cpp/absl/synchronization/barrier.h +79 -0
  1158. data/third_party/abseil-cpp/absl/synchronization/blocking_counter.cc +57 -0
  1159. data/third_party/abseil-cpp/absl/synchronization/blocking_counter.h +99 -0
  1160. data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc +140 -0
  1161. data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.h +60 -0
  1162. data/third_party/abseil-cpp/absl/synchronization/internal/futex.h +154 -0
  1163. data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +698 -0
  1164. data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.h +141 -0
  1165. data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +156 -0
  1166. data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc +106 -0
  1167. data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.h +115 -0
  1168. data/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc +428 -0
  1169. data/third_party/abseil-cpp/absl/synchronization/internal/waiter.h +155 -0
  1170. data/third_party/abseil-cpp/absl/synchronization/mutex.cc +2751 -0
  1171. data/third_party/abseil-cpp/absl/synchronization/mutex.h +1082 -0
  1172. data/third_party/abseil-cpp/absl/synchronization/notification.cc +78 -0
  1173. data/third_party/abseil-cpp/absl/synchronization/notification.h +123 -0
  1174. data/third_party/abseil-cpp/absl/time/civil_time.cc +9 -9
  1175. data/third_party/abseil-cpp/absl/time/clock.cc +146 -130
  1176. data/third_party/abseil-cpp/absl/time/clock.h +2 -2
  1177. data/third_party/abseil-cpp/absl/time/duration.cc +93 -61
  1178. data/third_party/abseil-cpp/absl/time/format.cc +43 -36
  1179. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +33 -27
  1180. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +4 -2
  1181. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/zone_info_source.h +1 -1
  1182. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +136 -29
  1183. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc +13 -21
  1184. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h +1 -1
  1185. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +136 -129
  1186. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h +4 -5
  1187. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +15 -8
  1188. data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +2 -2
  1189. data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +2 -1
  1190. data/third_party/abseil-cpp/absl/time/time.cc +4 -3
  1191. data/third_party/abseil-cpp/absl/time/time.h +41 -40
  1192. data/third_party/abseil-cpp/absl/types/bad_variant_access.cc +64 -0
  1193. data/third_party/abseil-cpp/absl/types/bad_variant_access.h +82 -0
  1194. data/third_party/abseil-cpp/absl/types/internal/variant.h +1646 -0
  1195. data/third_party/abseil-cpp/absl/types/optional.h +9 -9
  1196. data/third_party/abseil-cpp/absl/types/span.h +49 -36
  1197. data/third_party/abseil-cpp/absl/types/variant.h +866 -0
  1198. data/third_party/abseil-cpp/absl/utility/utility.h +2 -2
  1199. data/third_party/address_sorting/include/address_sorting/address_sorting.h +2 -0
  1200. data/third_party/boringssl-with-bazel/err_data.c +763 -721
  1201. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bitstr.c +6 -6
  1202. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bool.c +1 -1
  1203. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_enum.c +5 -5
  1204. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_int.c +6 -6
  1205. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +15 -20
  1206. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_octet.c +3 -3
  1207. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +2 -2
  1208. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_type.c +23 -11
  1209. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +2 -2
  1210. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +16 -22
  1211. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_locl.h +35 -0
  1212. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn_pack.c +1 -1
  1213. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_enum.c +1 -1
  1214. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_int.c +1 -1
  1215. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_string.c +1 -1
  1216. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +28 -79
  1217. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +40 -86
  1218. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_fre.c +6 -17
  1219. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_new.c +10 -61
  1220. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_typ.c +0 -2
  1221. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_utl.c +2 -2
  1222. data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +2 -0
  1223. data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +4 -0
  1224. data/third_party/boringssl-with-bazel/src/crypto/blake2/blake2.c +158 -0
  1225. data/third_party/boringssl-with-bazel/src/crypto/bn_extra/bn_asn1.c +3 -10
  1226. data/third_party/boringssl-with-bazel/src/crypto/bytestring/ber.c +8 -9
  1227. data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.c +60 -45
  1228. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/cipher_extra.c +4 -0
  1229. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_chacha20poly1305.c +6 -81
  1230. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_tls.c +1 -88
  1231. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/internal.h +101 -3
  1232. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/tls_cbc.c +120 -273
  1233. data/third_party/boringssl-with-bazel/src/crypto/cpu-aarch64-win.c +41 -0
  1234. data/third_party/boringssl-with-bazel/src/crypto/cpu-arm-linux.c +11 -2
  1235. data/third_party/boringssl-with-bazel/src/crypto/cpu-arm.c +3 -3
  1236. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +1 -1
  1237. data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +1 -1
  1238. data/third_party/boringssl-with-bazel/src/crypto/{dh → dh_extra}/dh_asn1.c +0 -0
  1239. data/third_party/boringssl-with-bazel/src/crypto/{dh → dh_extra}/params.c +179 -0
  1240. data/third_party/boringssl-with-bazel/src/crypto/digest_extra/digest_extra.c +25 -0
  1241. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +9 -43
  1242. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa_asn1.c +55 -4
  1243. data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/is_fips.c → dsa/internal.h} +16 -11
  1244. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_asn1.c +2 -17
  1245. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +12 -52
  1246. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +0 -22
  1247. data/third_party/boringssl-with-bazel/src/crypto/err/err.c +87 -80
  1248. data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +13 -0
  1249. data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +159 -0
  1250. data/third_party/boringssl-with-bazel/src/crypto/evp/p_dsa_asn1.c +6 -2
  1251. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/mode_wrappers.c +17 -1
  1252. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +4 -1
  1253. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/bn.c +13 -20
  1254. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +2 -3
  1255. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +21 -3
  1256. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/prime.c +0 -4
  1257. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/cipher.c +32 -16
  1258. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/e_aes.c +198 -37
  1259. data/third_party/boringssl-with-bazel/src/crypto/{dh → fipsmodule/dh}/check.c +0 -0
  1260. data/third_party/boringssl-with-bazel/src/crypto/{dh → fipsmodule/dh}/dh.c +136 -213
  1261. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digest.c +9 -0
  1262. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digests.c +10 -2
  1263. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/md32_common.h +87 -160
  1264. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +16 -0
  1265. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +9 -2
  1266. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +2 -5
  1267. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +13 -11
  1268. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64.c +24 -23
  1269. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +20 -16
  1270. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +2 -2
  1271. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/util.c +3 -3
  1272. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +104 -93
  1273. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/internal.h +39 -0
  1274. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md4/md4.c +52 -65
  1275. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/md5.c +52 -66
  1276. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/cbc.c +33 -22
  1277. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/cfb.c +9 -8
  1278. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ctr.c +9 -8
  1279. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm.c +17 -13
  1280. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/internal.h +1 -22
  1281. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ofb.c +2 -1
  1282. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +25 -0
  1283. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +122 -43
  1284. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +26 -14
  1285. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +4 -0
  1286. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +56 -34
  1287. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +116 -60
  1288. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/fips.c +79 -0
  1289. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +231 -11
  1290. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha1.c +61 -75
  1291. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha256.c +80 -103
  1292. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +40 -49
  1293. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +584 -0
  1294. data/third_party/boringssl-with-bazel/src/crypto/internal.h +65 -0
  1295. data/third_party/boringssl-with-bazel/src/crypto/mem.c +43 -15
  1296. data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +3 -3
  1297. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7_x509.c +5 -3
  1298. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +7 -0
  1299. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +131 -53
  1300. data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305.c +10 -7
  1301. data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305_arm.c +13 -11
  1302. data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305_vec.c +4 -0
  1303. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/passive.c +34 -0
  1304. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/rand_extra.c +5 -1
  1305. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/rsa_asn1.c +1 -2
  1306. data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +7 -13
  1307. data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +0 -28
  1308. data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +110 -70
  1309. data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +348 -423
  1310. data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +217 -79
  1311. data/third_party/boringssl-with-bazel/src/crypto/trust_token/voprf.c +766 -0
  1312. data/third_party/boringssl-with-bazel/src/crypto/x509/a_strex.c +7 -7
  1313. data/third_party/boringssl-with-bazel/src/crypto/x509/algorithm.c +10 -0
  1314. data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.c +4 -4
  1315. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +120 -11
  1316. data/third_party/boringssl-with-bazel/src/crypto/x509/rsa_pss.c +5 -1
  1317. data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.c +3 -3
  1318. data/third_party/boringssl-with-bazel/src/crypto/x509/t_req.c +2 -0
  1319. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +1 -1
  1320. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509a.c +3 -0
  1321. data/third_party/boringssl-with-bazel/src/crypto/x509/x509.c +0 -67
  1322. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +19 -25
  1323. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +24 -39
  1324. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_ext.c +27 -21
  1325. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_obj.c +1 -1
  1326. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +52 -89
  1327. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +67 -12
  1328. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +9 -4
  1329. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_txt.c +67 -67
  1330. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +4 -4
  1331. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +71 -59
  1332. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vpm.c +53 -73
  1333. data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +98 -25
  1334. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +9 -8
  1335. data/third_party/boringssl-with-bazel/src/crypto/x509/x509rset.c +3 -0
  1336. data/third_party/boringssl-with-bazel/src/crypto/x509/x_algor.c +21 -17
  1337. data/third_party/boringssl-with-bazel/src/crypto/x509/x_all.c +13 -10
  1338. data/third_party/boringssl-with-bazel/src/crypto/x509/x_attrib.c +21 -34
  1339. data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +43 -17
  1340. data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +28 -40
  1341. data/third_party/boringssl-with-bazel/src/crypto/x509/x_pkey.c +2 -2
  1342. data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +21 -172
  1343. data/third_party/boringssl-with-bazel/src/crypto/x509/x_req.c +5 -8
  1344. data/third_party/boringssl-with-bazel/src/crypto/x509/x_sig.c +25 -0
  1345. data/third_party/boringssl-with-bazel/src/crypto/x509/x_val.c +2 -0
  1346. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +68 -9
  1347. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509a.c +5 -2
  1348. data/third_party/boringssl-with-bazel/src/crypto/x509v3/ext_dat.h +1 -4
  1349. data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +12 -0
  1350. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_data.c +5 -3
  1351. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_akey.c +3 -3
  1352. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +25 -24
  1353. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_bitst.c +3 -3
  1354. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +32 -28
  1355. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +4 -6
  1356. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_enum.c +2 -1
  1357. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_genn.c +42 -22
  1358. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_ia5.c +3 -4
  1359. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_info.c +1 -1
  1360. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +25 -36
  1361. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +2 -2
  1362. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +127 -41
  1363. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +8 -7
  1364. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +11 -14
  1365. data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +25 -4
  1366. data/third_party/boringssl-with-bazel/src/include/openssl/aes.h +16 -4
  1367. data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +119 -0
  1368. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +746 -561
  1369. data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +0 -167
  1370. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +58 -10
  1371. data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +4 -0
  1372. data/third_party/boringssl-with-bazel/src/include/openssl/blake2.h +62 -0
  1373. data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +23 -7
  1374. data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +1 -1
  1375. data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +21 -4
  1376. data/third_party/boringssl-with-bazel/src/include/openssl/cpu.h +22 -32
  1377. data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +25 -5
  1378. data/third_party/boringssl-with-bazel/src/include/openssl/des.h +6 -0
  1379. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +62 -20
  1380. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +16 -2
  1381. data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +20 -2
  1382. data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +33 -0
  1383. data/third_party/boringssl-with-bazel/src/include/openssl/err.h +3 -2
  1384. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +104 -51
  1385. data/third_party/boringssl-with-bazel/src/{crypto/x509/x509_r2x.c → include/openssl/evp_errors.h} +41 -58
  1386. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +325 -0
  1387. data/third_party/boringssl-with-bazel/src/include/openssl/obj.h +24 -5
  1388. data/third_party/boringssl-with-bazel/src/include/openssl/opensslconf.h +3 -0
  1389. data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +202 -134
  1390. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +25 -7
  1391. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs8.h +9 -1
  1392. data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +5 -2
  1393. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +99 -63
  1394. data/third_party/boringssl-with-bazel/src/include/openssl/span.h +2 -1
  1395. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +467 -125
  1396. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +28 -12
  1397. data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +43 -24
  1398. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +1456 -780
  1399. data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +451 -435
  1400. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +595 -441
  1401. data/third_party/boringssl-with-bazel/src/ssl/bio_ssl.cc +18 -5
  1402. data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +7 -2
  1403. data/third_party/boringssl-with-bazel/src/ssl/d1_srtp.cc +1 -1
  1404. data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +1133 -0
  1405. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +336 -25
  1406. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +97 -53
  1407. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +202 -109
  1408. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +174 -30
  1409. data/third_party/boringssl-with-bazel/src/ssl/internal.h +504 -162
  1410. data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +9 -3
  1411. data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +2 -3
  1412. data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +14 -19
  1413. data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +55 -15
  1414. data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +7 -12
  1415. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +8 -9
  1416. data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +23 -26
  1417. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +162 -60
  1418. data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +2 -0
  1419. data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +26 -73
  1420. data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +3 -0
  1421. data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +6 -5
  1422. data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +12 -8
  1423. data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +47 -28
  1424. data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +1070 -566
  1425. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +66 -9
  1426. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +183 -76
  1427. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +169 -89
  1428. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +379 -140
  1429. data/third_party/boringssl-with-bazel/src/ssl/tls_method.cc +4 -2
  1430. data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +5 -3
  1431. data/third_party/re2/re2/bitmap256.h +117 -0
  1432. data/third_party/re2/re2/bitstate.cc +385 -0
  1433. data/third_party/re2/re2/compile.cc +1279 -0
  1434. data/third_party/re2/re2/dfa.cc +2130 -0
  1435. data/third_party/re2/re2/filtered_re2.cc +121 -0
  1436. data/third_party/re2/re2/filtered_re2.h +109 -0
  1437. data/third_party/re2/re2/mimics_pcre.cc +197 -0
  1438. data/third_party/re2/re2/nfa.cc +713 -0
  1439. data/third_party/re2/re2/onepass.cc +623 -0
  1440. data/third_party/re2/re2/parse.cc +2464 -0
  1441. data/third_party/re2/re2/perl_groups.cc +119 -0
  1442. data/third_party/re2/re2/pod_array.h +55 -0
  1443. data/third_party/re2/re2/prefilter.cc +710 -0
  1444. data/third_party/re2/re2/prefilter.h +108 -0
  1445. data/third_party/re2/re2/prefilter_tree.cc +407 -0
  1446. data/third_party/re2/re2/prefilter_tree.h +139 -0
  1447. data/third_party/re2/re2/prog.cc +988 -0
  1448. data/third_party/re2/re2/prog.h +436 -0
  1449. data/third_party/re2/re2/re2.cc +1362 -0
  1450. data/third_party/re2/re2/re2.h +1002 -0
  1451. data/third_party/re2/re2/regexp.cc +980 -0
  1452. data/third_party/re2/re2/regexp.h +659 -0
  1453. data/third_party/re2/re2/set.cc +154 -0
  1454. data/third_party/re2/re2/set.h +80 -0
  1455. data/third_party/re2/re2/simplify.cc +657 -0
  1456. data/third_party/re2/re2/sparse_array.h +392 -0
  1457. data/third_party/re2/re2/sparse_set.h +264 -0
  1458. data/third_party/re2/re2/stringpiece.cc +65 -0
  1459. data/third_party/re2/re2/stringpiece.h +210 -0
  1460. data/third_party/re2/re2/tostring.cc +351 -0
  1461. data/third_party/re2/re2/unicode_casefold.cc +582 -0
  1462. data/third_party/re2/re2/unicode_casefold.h +78 -0
  1463. data/third_party/re2/re2/unicode_groups.cc +6269 -0
  1464. data/third_party/re2/re2/unicode_groups.h +67 -0
  1465. data/third_party/re2/re2/walker-inl.h +246 -0
  1466. data/third_party/re2/util/benchmark.h +156 -0
  1467. data/third_party/re2/util/flags.h +26 -0
  1468. data/third_party/re2/util/logging.h +109 -0
  1469. data/third_party/re2/util/malloc_counter.h +19 -0
  1470. data/third_party/re2/util/mix.h +41 -0
  1471. data/third_party/re2/util/mutex.h +148 -0
  1472. data/third_party/re2/util/pcre.cc +1025 -0
  1473. data/third_party/re2/util/pcre.h +681 -0
  1474. data/third_party/re2/util/rune.cc +260 -0
  1475. data/third_party/re2/util/strutil.cc +149 -0
  1476. data/third_party/re2/util/strutil.h +21 -0
  1477. data/third_party/re2/util/test.h +50 -0
  1478. data/third_party/re2/util/utf.h +44 -0
  1479. data/third_party/re2/util/util.h +42 -0
  1480. data/third_party/upb/third_party/wyhash/wyhash.h +145 -0
  1481. data/third_party/upb/upb/decode.c +604 -511
  1482. data/third_party/upb/upb/decode.h +20 -1
  1483. data/third_party/upb/upb/decode.int.h +163 -0
  1484. data/third_party/upb/upb/decode_fast.c +1040 -0
  1485. data/third_party/upb/upb/decode_fast.h +126 -0
  1486. data/third_party/upb/upb/def.c +2178 -0
  1487. data/third_party/upb/upb/def.h +315 -0
  1488. data/third_party/upb/upb/def.hpp +439 -0
  1489. data/third_party/upb/upb/encode.c +311 -211
  1490. data/third_party/upb/upb/encode.h +27 -2
  1491. data/third_party/upb/upb/msg.c +215 -70
  1492. data/third_party/upb/upb/msg.h +558 -14
  1493. data/third_party/upb/upb/port_def.inc +105 -63
  1494. data/third_party/upb/upb/port_undef.inc +10 -7
  1495. data/third_party/upb/upb/reflection.c +408 -0
  1496. data/third_party/upb/upb/reflection.h +168 -0
  1497. data/third_party/upb/upb/table.c +73 -269
  1498. data/third_party/upb/upb/table.int.h +25 -57
  1499. data/third_party/upb/upb/text_encode.c +421 -0
  1500. data/third_party/upb/upb/text_encode.h +38 -0
  1501. data/third_party/upb/upb/upb.c +138 -135
  1502. data/third_party/upb/upb/upb.h +119 -146
  1503. data/third_party/upb/upb/upb.hpp +88 -0
  1504. data/third_party/upb/upb/upb.int.h +29 -0
  1505. data/third_party/xxhash/xxhash.h +5325 -0
  1506. metadata +698 -181
  1507. data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +0 -938
  1508. data/src/core/ext/filters/client_channel/lb_policy/xds/lrs.cc +0 -528
  1509. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +0 -834
  1510. data/src/core/ext/filters/client_channel/parse_address.h +0 -53
  1511. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +0 -484
  1512. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +0 -68
  1513. data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +0 -348
  1514. data/src/core/ext/filters/client_channel/resolving_lb_policy.h +0 -123
  1515. data/src/core/ext/filters/client_channel/xds/xds_api.cc +0 -1906
  1516. data/src/core/ext/filters/client_channel/xds/xds_api.h +0 -280
  1517. data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +0 -342
  1518. data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +0 -88
  1519. data/src/core/ext/filters/client_channel/xds/xds_channel.h +0 -46
  1520. data/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +0 -106
  1521. data/src/core/ext/filters/client_channel/xds/xds_client.h +0 -309
  1522. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +0 -21
  1523. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +0 -35
  1524. data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.c +0 -114
  1525. data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +0 -418
  1526. data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.c +0 -72
  1527. data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +0 -197
  1528. data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.c +0 -105
  1529. data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +0 -378
  1530. data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +0 -53
  1531. data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +0 -74
  1532. data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +0 -218
  1533. data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +0 -35
  1534. data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +0 -69
  1535. data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +0 -55
  1536. data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +0 -305
  1537. data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +0 -403
  1538. data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +0 -1447
  1539. data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +0 -112
  1540. data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +0 -328
  1541. data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.c +0 -35
  1542. data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +0 -78
  1543. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +0 -313
  1544. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +0 -897
  1545. data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +0 -96
  1546. data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +0 -322
  1547. data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.c +0 -34
  1548. data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +0 -72
  1549. data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +0 -197
  1550. data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +0 -642
  1551. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +0 -172
  1552. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +0 -673
  1553. data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +0 -36
  1554. data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +0 -80
  1555. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +0 -152
  1556. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +0 -518
  1557. data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +0 -89
  1558. data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +0 -129
  1559. data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +0 -392
  1560. data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +0 -53
  1561. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +0 -18
  1562. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +0 -33
  1563. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +0 -91
  1564. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +0 -266
  1565. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +0 -112
  1566. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +0 -324
  1567. data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +0 -92
  1568. data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +0 -240
  1569. data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +0 -53
  1570. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +0 -18
  1571. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +0 -33
  1572. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +0 -145
  1573. data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +0 -527
  1574. data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +0 -43
  1575. data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +0 -112
  1576. data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +0 -109
  1577. data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +0 -399
  1578. data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +0 -53
  1579. data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +0 -18
  1580. data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +0 -33
  1581. data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +0 -815
  1582. data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +0 -3032
  1583. data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +0 -63
  1584. data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +0 -199
  1585. data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +0 -59
  1586. data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +0 -134
  1587. data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +0 -53
  1588. data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +0 -228
  1589. data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +0 -725
  1590. data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +0 -316
  1591. data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +0 -1132
  1592. data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.c +0 -33
  1593. data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +0 -65
  1594. data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.c +0 -51
  1595. data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +0 -125
  1596. data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +0 -50
  1597. data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +0 -54
  1598. data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +0 -134
  1599. data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +0 -63
  1600. data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +0 -144
  1601. data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +0 -53
  1602. data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +0 -133
  1603. data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +0 -88
  1604. data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +0 -258
  1605. data/src/core/ext/upb-generated/envoy/type/percent.upb.c +0 -39
  1606. data/src/core/ext/upb-generated/envoy/type/percent.upb.h +0 -87
  1607. data/src/core/ext/upb-generated/envoy/type/range.upb.c +0 -50
  1608. data/src/core/ext/upb-generated/envoy/type/range.upb.h +0 -112
  1609. data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +0 -62
  1610. data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +0 -89
  1611. data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +0 -249
  1612. data/src/core/ext/upb-generated/gogoproto/gogo.upb.c +0 -17
  1613. data/src/core/lib/gpr/arena.h +0 -47
  1614. data/src/core/lib/gprpp/map.h +0 -53
  1615. data/src/core/lib/iomgr/iomgr_posix.h +0 -26
  1616. data/src/core/lib/iomgr/poller/eventmanager_libuv.cc +0 -87
  1617. data/src/core/lib/iomgr/poller/eventmanager_libuv.h +0 -88
  1618. data/src/core/lib/security/transport/target_authority_table.cc +0 -75
  1619. data/src/core/lib/security/transport/target_authority_table.h +0 -40
  1620. data/src/core/lib/slice/slice_hash_table.h +0 -199
  1621. data/src/core/lib/slice/slice_weak_hash_table.h +0 -102
  1622. data/third_party/abseil-cpp/absl/base/dynamic_annotations.cc +0 -129
  1623. data/third_party/abseil-cpp/absl/base/internal/bits.h +0 -218
  1624. data/third_party/boringssl-with-bazel/src/crypto/x509/vpm_int.h +0 -71
  1625. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_pku.c +0 -110
  1626. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_sxnet.c +0 -274
  1627. data/third_party/upb/upb/generated_util.h +0 -105
  1628. data/third_party/upb/upb/port.c +0 -26
@@ -1,20 +1,18 @@
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
 
@@ -30,32 +28,28 @@
30
28
  #include <grpc/byte_buffer_reader.h>
31
29
  #include <grpc/grpc.h>
32
30
  #include <grpc/support/alloc.h>
33
- #include <grpc/support/string_util.h>
34
31
  #include <grpc/support/time.h>
35
32
 
36
33
  #include "src/core/ext/filters/client_channel/client_channel.h"
37
- #include "src/core/ext/filters/client_channel/parse_address.h"
38
- #include "src/core/ext/filters/client_channel/server_address.h"
39
34
  #include "src/core/ext/filters/client_channel/service_config.h"
40
- #include "src/core/ext/filters/client_channel/xds/xds_api.h"
41
- #include "src/core/ext/filters/client_channel/xds/xds_channel.h"
42
- #include "src/core/ext/filters/client_channel/xds/xds_channel_args.h"
43
- #include "src/core/ext/filters/client_channel/xds/xds_client.h"
44
- #include "src/core/ext/filters/client_channel/xds/xds_client_stats.h"
35
+ #include "src/core/ext/xds/xds_api.h"
36
+ #include "src/core/ext/xds/xds_bootstrap.h"
37
+ #include "src/core/ext/xds/xds_channel_args.h"
38
+ #include "src/core/ext/xds/xds_client.h"
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"
45
42
  #include "src/core/lib/backoff/backoff.h"
46
43
  #include "src/core/lib/channel/channel_args.h"
47
44
  #include "src/core/lib/channel/channel_stack.h"
45
+ #include "src/core/lib/gpr/env.h"
48
46
  #include "src/core/lib/gpr/string.h"
49
- #include "src/core/lib/gprpp/map.h"
50
47
  #include "src/core/lib/gprpp/memory.h"
51
48
  #include "src/core/lib/gprpp/orphanable.h"
52
49
  #include "src/core/lib/gprpp/ref_counted_ptr.h"
53
50
  #include "src/core/lib/gprpp/sync.h"
54
51
  #include "src/core/lib/iomgr/sockaddr.h"
55
- #include "src/core/lib/iomgr/sockaddr_utils.h"
56
52
  #include "src/core/lib/iomgr/timer.h"
57
- #include "src/core/lib/iomgr/work_serializer.h"
58
- #include "src/core/lib/slice/slice_hash_table.h"
59
53
  #include "src/core/lib/slice/slice_internal.h"
60
54
  #include "src/core/lib/slice/slice_string_helpers.h"
61
55
  #include "src/core/lib/surface/call.h"
@@ -72,6 +66,16 @@
72
66
  namespace grpc_core {
73
67
 
74
68
  TraceFlag grpc_xds_client_trace(false, "xds_client");
69
+ TraceFlag grpc_xds_client_refcount_trace(false, "xds_client_refcount");
70
+
71
+ namespace {
72
+
73
+ Mutex* g_mu = nullptr;
74
+ const grpc_channel_args* g_channel_args ABSL_GUARDED_BY(*g_mu) = nullptr;
75
+ XdsClient* g_xds_client ABSL_GUARDED_BY(*g_mu) = nullptr;
76
+ char* g_fallback_bootstrap_config ABSL_GUARDED_BY(*g_mu) = nullptr;
77
+
78
+ } // namespace
75
79
 
76
80
  //
77
81
  // Internal class declarations
@@ -97,8 +101,8 @@ class XdsClient::ChannelState::RetryableCall
97
101
  private:
98
102
  void StartNewCallLocked();
99
103
  void StartRetryTimerLocked();
100
- static void OnRetryTimer(void* arg, grpc_error* error);
101
- void OnRetryTimerLocked(grpc_error* error);
104
+ static void OnRetryTimer(void* arg, grpc_error_handle error);
105
+ void OnRetryTimerLocked(grpc_error_handle error);
102
106
 
103
107
  // The wrapped xds call that talks to the xds server. It's instantiated
104
108
  // every time we start a new call. It's null during call retry backoff.
@@ -130,31 +134,36 @@ class XdsClient::ChannelState::AdsCallState
130
134
  XdsClient* xds_client() const { return chand()->xds_client(); }
131
135
  bool seen_response() const { return seen_response_; }
132
136
 
133
- void Subscribe(const std::string& type_url, const std::string& name);
134
- void Unsubscribe(const std::string& type_url, const std::string& name,
135
- bool delay_unsubscription);
137
+ void SubscribeLocked(const std::string& type_url, const std::string& name)
138
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
139
+ void UnsubscribeLocked(const std::string& type_url, const std::string& name,
140
+ bool delay_unsubscription)
141
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
136
142
 
137
143
  bool HasSubscribedResources() const;
138
144
 
139
145
  private:
140
146
  class ResourceState : public InternallyRefCounted<ResourceState> {
141
147
  public:
142
- ResourceState(const std::string& type_url, const std::string& name)
143
- : type_url_(type_url), name_(name) {
148
+ ResourceState(const std::string& type_url, const std::string& name,
149
+ bool sent_initial_request)
150
+ : type_url_(type_url),
151
+ name_(name),
152
+ sent_initial_request_(sent_initial_request) {
144
153
  GRPC_CLOSURE_INIT(&timer_callback_, OnTimer, this,
145
154
  grpc_schedule_on_exec_ctx);
146
155
  }
147
156
 
148
157
  void Orphan() override {
149
158
  Finish();
150
- Unref();
159
+ Unref(DEBUG_LOCATION, "Orphan");
151
160
  }
152
161
 
153
162
  void Start(RefCountedPtr<AdsCallState> ads_calld) {
154
- if (sent_) return;
155
- sent_ = true;
163
+ if (sent_initial_request_) return;
164
+ sent_initial_request_ = true;
156
165
  ads_calld_ = std::move(ads_calld);
157
- Ref().release();
166
+ Ref(DEBUG_LOCATION, "timer").release();
158
167
  timer_pending_ = true;
159
168
  grpc_timer_init(
160
169
  &timer_,
@@ -170,49 +179,61 @@ class XdsClient::ChannelState::AdsCallState
170
179
  }
171
180
 
172
181
  private:
173
- static void OnTimer(void* arg, grpc_error* error) {
182
+ static void OnTimer(void* arg, grpc_error_handle error) {
174
183
  ResourceState* self = static_cast<ResourceState*>(arg);
175
- GRPC_ERROR_REF(error); // ref owned by lambda
176
- self->ads_calld_->xds_client()->work_serializer_->Run(
177
- [self, error]() { self->OnTimerLocked(error); }, DEBUG_LOCATION);
184
+ {
185
+ MutexLock lock(&self->ads_calld_->xds_client()->mu_);
186
+ self->OnTimerLocked(GRPC_ERROR_REF(error));
187
+ }
188
+ self->ads_calld_.reset();
189
+ self->Unref(DEBUG_LOCATION, "timer");
178
190
  }
179
191
 
180
- void OnTimerLocked(grpc_error* error) {
192
+ void OnTimerLocked(grpc_error_handle error)
193
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_) {
181
194
  if (error == GRPC_ERROR_NONE && timer_pending_) {
182
195
  timer_pending_ = false;
183
- char* msg;
184
- gpr_asprintf(
185
- &msg,
186
- "timeout obtaining resource {type=%s name=%s} from xds server",
187
- type_url_.c_str(), name_.c_str());
188
- grpc_error* watcher_error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
189
- gpr_free(msg);
196
+ grpc_error_handle watcher_error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(
197
+ absl::StrFormat(
198
+ "timeout obtaining resource {type=%s name=%s} from xds server",
199
+ type_url_, name_)
200
+ .c_str());
201
+ watcher_error = grpc_error_set_int(
202
+ watcher_error, GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
190
203
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
191
204
  gpr_log(GPR_INFO, "[xds_client %p] %s", ads_calld_->xds_client(),
192
- grpc_error_string(watcher_error));
205
+ grpc_error_std_string(watcher_error).c_str());
193
206
  }
194
- if (type_url_ == XdsApi::kLdsTypeUrl ||
195
- type_url_ == XdsApi::kRdsTypeUrl) {
196
- ads_calld_->xds_client()->service_config_watcher_->OnError(
197
- watcher_error);
207
+ if (type_url_ == XdsApi::kLdsTypeUrl) {
208
+ ListenerState& state = ads_calld_->xds_client()->listener_map_[name_];
209
+ state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
210
+ for (const auto& p : state.watchers) {
211
+ p.first->OnError(GRPC_ERROR_REF(watcher_error));
212
+ }
213
+ } else if (type_url_ == XdsApi::kRdsTypeUrl) {
214
+ RouteConfigState& state =
215
+ ads_calld_->xds_client()->route_config_map_[name_];
216
+ state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
217
+ for (const auto& p : state.watchers) {
218
+ p.first->OnError(GRPC_ERROR_REF(watcher_error));
219
+ }
198
220
  } else if (type_url_ == XdsApi::kCdsTypeUrl) {
199
221
  ClusterState& state = ads_calld_->xds_client()->cluster_map_[name_];
222
+ state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
200
223
  for (const auto& p : state.watchers) {
201
224
  p.first->OnError(GRPC_ERROR_REF(watcher_error));
202
225
  }
203
- GRPC_ERROR_UNREF(watcher_error);
204
226
  } else if (type_url_ == XdsApi::kEdsTypeUrl) {
205
227
  EndpointState& state = ads_calld_->xds_client()->endpoint_map_[name_];
228
+ state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
206
229
  for (const auto& p : state.watchers) {
207
230
  p.first->OnError(GRPC_ERROR_REF(watcher_error));
208
231
  }
209
- GRPC_ERROR_UNREF(watcher_error);
210
232
  } else {
211
233
  GPR_UNREACHABLE_CODE(return );
212
234
  }
235
+ GRPC_ERROR_UNREF(watcher_error);
213
236
  }
214
- ads_calld_.reset();
215
- Unref();
216
237
  GRPC_ERROR_UNREF(error);
217
238
  }
218
239
 
@@ -220,7 +241,7 @@ class XdsClient::ChannelState::AdsCallState
220
241
  const std::string name_;
221
242
 
222
243
  RefCountedPtr<AdsCallState> ads_calld_;
223
- bool sent_ = false;
244
+ bool sent_initial_request_;
224
245
  bool timer_pending_ = false;
225
246
  grpc_timer timer_;
226
247
  grpc_closure timer_callback_;
@@ -229,29 +250,46 @@ class XdsClient::ChannelState::AdsCallState
229
250
  struct ResourceTypeState {
230
251
  ~ResourceTypeState() { GRPC_ERROR_UNREF(error); }
231
252
 
232
- // Version, nonce, and error for this resource type.
233
- std::string version;
253
+ // Nonce and error for this resource type.
234
254
  std::string nonce;
235
- grpc_error* error = GRPC_ERROR_NONE;
255
+ grpc_error_handle error = GRPC_ERROR_NONE;
236
256
 
237
257
  // Subscribed resources of this type.
238
258
  std::map<std::string /* name */, OrphanablePtr<ResourceState>>
239
259
  subscribed_resources;
240
260
  };
241
261
 
242
- void SendMessageLocked(const std::string& type_url);
243
-
244
- void AcceptLdsUpdate(absl::optional<XdsApi::LdsUpdate> lds_update);
245
- void AcceptRdsUpdate(absl::optional<XdsApi::RdsUpdate> rds_update);
246
- void AcceptCdsUpdate(XdsApi::CdsUpdateMap cds_update_map);
247
- void AcceptEdsUpdate(XdsApi::EdsUpdateMap eds_update_map);
248
-
249
- static void OnRequestSent(void* arg, grpc_error* error);
250
- void OnRequestSentLocked(grpc_error* error);
251
- static void OnResponseReceived(void* arg, grpc_error* error);
252
- void OnResponseReceivedLocked();
253
- static void OnStatusReceived(void* arg, grpc_error* error);
254
- void OnStatusReceivedLocked(grpc_error* error);
262
+ void SendMessageLocked(const std::string& type_url)
263
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
264
+
265
+ void AcceptLdsUpdateLocked(std::string version, grpc_millis update_time,
266
+ XdsApi::LdsUpdateMap lds_update_map)
267
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
268
+ void AcceptRdsUpdateLocked(std::string version, grpc_millis update_time,
269
+ XdsApi::RdsUpdateMap rds_update_map)
270
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
271
+ void AcceptCdsUpdateLocked(std::string version, grpc_millis update_time,
272
+ XdsApi::CdsUpdateMap cds_update_map)
273
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
274
+ void AcceptEdsUpdateLocked(std::string version, grpc_millis update_time,
275
+ XdsApi::EdsUpdateMap eds_update_map)
276
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
277
+
278
+ template <typename StateMap>
279
+ void RejectAdsUpdateLocked(grpc_millis update_time,
280
+ const XdsApi::AdsParseResult& result,
281
+ StateMap* state_map)
282
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
283
+
284
+ static void OnRequestSent(void* arg, grpc_error_handle error);
285
+ void OnRequestSentLocked(grpc_error_handle error)
286
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
287
+ static void OnResponseReceived(void* arg, grpc_error_handle error);
288
+ bool OnResponseReceivedLocked()
289
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
290
+ static void OnStatusReceived(void* arg, grpc_error_handle error);
291
+ void OnStatusReceivedLocked(grpc_error_handle error)
292
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
255
293
 
256
294
  bool IsCurrentCallOnChannel() const;
257
295
 
@@ -324,12 +362,15 @@ class XdsClient::ChannelState::LrsCallState
324
362
  void Orphan() override;
325
363
 
326
364
  private:
327
- void ScheduleNextReportLocked();
328
- static void OnNextReportTimer(void* arg, grpc_error* error);
329
- void OnNextReportTimerLocked(grpc_error* error);
330
- void SendReportLocked();
331
- static void OnReportDone(void* arg, grpc_error* error);
332
- void OnReportDoneLocked(grpc_error* error);
365
+ void ScheduleNextReportLocked()
366
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
367
+ static void OnNextReportTimer(void* arg, grpc_error_handle error);
368
+ bool OnNextReportTimerLocked(grpc_error_handle error)
369
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
370
+ bool SendReportLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
371
+ static void OnReportDone(void* arg, grpc_error_handle error);
372
+ bool OnReportDoneLocked(grpc_error_handle error)
373
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
333
374
 
334
375
  bool IsCurrentReporterOnCall() const {
335
376
  return this == parent_->reporter_.get();
@@ -348,12 +389,15 @@ class XdsClient::ChannelState::LrsCallState
348
389
  grpc_closure on_report_done_;
349
390
  };
350
391
 
351
- static void OnInitialRequestSent(void* arg, grpc_error* error);
352
- void OnInitialRequestSentLocked();
353
- static void OnResponseReceived(void* arg, grpc_error* error);
354
- void OnResponseReceivedLocked();
355
- static void OnStatusReceived(void* arg, grpc_error* error);
356
- void OnStatusReceivedLocked(grpc_error* error);
392
+ static void OnInitialRequestSent(void* arg, grpc_error_handle error);
393
+ void OnInitialRequestSentLocked()
394
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
395
+ static void OnResponseReceived(void* arg, grpc_error_handle error);
396
+ bool OnResponseReceivedLocked()
397
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
398
+ static void OnStatusReceived(void* arg, grpc_error_handle error);
399
+ void OnStatusReceivedLocked(grpc_error_handle error)
400
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
357
401
 
358
402
  bool IsCurrentCallOnChannel() const;
359
403
 
@@ -396,20 +440,22 @@ class XdsClient::ChannelState::StateWatcher
396
440
  : public AsyncConnectivityStateWatcherInterface {
397
441
  public:
398
442
  explicit StateWatcher(RefCountedPtr<ChannelState> parent)
399
- : AsyncConnectivityStateWatcherInterface(
400
- parent->xds_client()->work_serializer_),
401
- parent_(std::move(parent)) {}
443
+ : parent_(std::move(parent)) {}
402
444
 
403
445
  private:
404
- void OnConnectivityStateChange(grpc_connectivity_state new_state) override {
446
+ void OnConnectivityStateChange(grpc_connectivity_state new_state,
447
+ const absl::Status& status) override {
448
+ MutexLock lock(&parent_->xds_client_->mu_);
405
449
  if (!parent_->shutting_down_ &&
406
450
  new_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
407
451
  // In TRANSIENT_FAILURE. Notify all watchers of error.
408
452
  gpr_log(GPR_INFO,
409
- "[xds_client %p] xds channel in state TRANSIENT_FAILURE",
410
- parent_->xds_client());
411
- parent_->xds_client()->NotifyOnError(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
412
- "xds channel in TRANSIENT_FAILURE"));
453
+ "[xds_client %p] xds channel in state:TRANSIENT_FAILURE "
454
+ "status_message:(%s)",
455
+ parent_->xds_client(), status.ToString().c_str());
456
+ parent_->xds_client_->NotifyOnErrorLocked(
457
+ GRPC_ERROR_CREATE_FROM_STATIC_STRING(
458
+ "xds channel in TRANSIENT_FAILURE"));
413
459
  }
414
460
  }
415
461
 
@@ -422,69 +468,30 @@ class XdsClient::ChannelState::StateWatcher
422
468
 
423
469
  namespace {
424
470
 
425
- // Returns the channel args for the xds channel.
426
- grpc_channel_args* BuildXdsChannelArgs(const grpc_channel_args& args) {
427
- static const char* args_to_remove[] = {
428
- // LB policy name, since we want to use the default (pick_first) in
429
- // the LB channel.
430
- GRPC_ARG_LB_POLICY_NAME,
431
- // The service config that contains the LB config. We don't want to
432
- // recursively use xds in the LB channel.
433
- GRPC_ARG_SERVICE_CONFIG,
434
- // The channel arg for the server URI, since that will be different for
435
- // the xds channel than for the parent channel. The client channel
436
- // factory will re-add this arg with the right value.
437
- GRPC_ARG_SERVER_URI,
438
- // The xds channel should use the authority indicated by the target
439
- // authority table (see \a ModifyXdsChannelArgs),
440
- // as opposed to the authority from the parent channel.
441
- GRPC_ARG_DEFAULT_AUTHORITY,
442
- // Just as for \a GRPC_ARG_DEFAULT_AUTHORITY, the xds channel should be
443
- // treated as a stand-alone channel and not inherit this argument from the
444
- // args of the parent channel.
445
- GRPC_SSL_TARGET_NAME_OVERRIDE_ARG,
446
- // Don't want to pass down channelz node from parent; the balancer
447
- // channel will get its own.
448
- GRPC_ARG_CHANNELZ_CHANNEL_NODE,
449
- // Keepalive interval. We are explicitly setting our own value below.
450
- GRPC_ARG_KEEPALIVE_TIME_MS,
451
- };
452
- // Channel args to add.
453
- absl::InlinedVector<grpc_arg, 3> args_to_add;
454
- // Keepalive interval.
455
- args_to_add.emplace_back(grpc_channel_arg_integer_create(
456
- const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS), 5000));
457
- // A channel arg indicating that the target is an xds server.
458
- // TODO(roth): Once we figure out our fallback and credentials story, decide
459
- // whether this is actually needed. Note that it's currently used by the
460
- // fake security connector as well.
461
- args_to_add.emplace_back(grpc_channel_arg_integer_create(
462
- const_cast<char*>(GRPC_ARG_ADDRESS_IS_XDS_SERVER), 1));
463
- // The parent channel's channelz uuid.
464
- channelz::ChannelNode* channelz_node = nullptr;
465
- const grpc_arg* arg =
466
- grpc_channel_args_find(&args, GRPC_ARG_CHANNELZ_CHANNEL_NODE);
467
- if (arg != nullptr && arg->type == GRPC_ARG_POINTER &&
468
- arg->value.pointer.p != nullptr) {
469
- channelz_node = static_cast<channelz::ChannelNode*>(arg->value.pointer.p);
470
- args_to_add.emplace_back(
471
- channelz::MakeParentUuidArg(channelz_node->uuid()));
472
- }
473
- // Construct channel args.
474
- grpc_channel_args* new_args = grpc_channel_args_copy_and_add_and_remove(
475
- &args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), args_to_add.data(),
476
- args_to_add.size());
477
- // Make any necessary modifications for security.
478
- return ModifyXdsChannelArgs(new_args);
471
+ grpc_channel* CreateXdsChannel(grpc_channel_args* args,
472
+ const XdsBootstrap::XdsServer& server) {
473
+ RefCountedPtr<grpc_channel_credentials> channel_creds =
474
+ XdsChannelCredsRegistry::MakeChannelCreds(server.channel_creds_type,
475
+ server.channel_creds_config);
476
+ return grpc_secure_channel_create(channel_creds.get(),
477
+ server.server_uri.c_str(), args, nullptr);
479
478
  }
480
479
 
481
480
  } // namespace
482
481
 
483
- XdsClient::ChannelState::ChannelState(RefCountedPtr<XdsClient> xds_client,
484
- grpc_channel* channel)
485
- : InternallyRefCounted<ChannelState>(&grpc_xds_client_trace),
482
+ XdsClient::ChannelState::ChannelState(WeakRefCountedPtr<XdsClient> xds_client,
483
+ const XdsBootstrap::XdsServer& server)
484
+ : InternallyRefCounted<ChannelState>(
485
+ GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_refcount_trace)
486
+ ? "ChannelState"
487
+ : nullptr),
486
488
  xds_client_(std::move(xds_client)),
487
- channel_(channel) {
489
+ server_(server) {
490
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
491
+ gpr_log(GPR_INFO, "[xds_client %p] creating channel to %s",
492
+ xds_client_.get(), server.server_uri.c_str());
493
+ }
494
+ channel_ = CreateXdsChannel(xds_client_->args_, server);
488
495
  GPR_ASSERT(channel_ != nullptr);
489
496
  StartConnectivityWatchLocked();
490
497
  }
@@ -495,6 +502,7 @@ XdsClient::ChannelState::~ChannelState() {
495
502
  this);
496
503
  }
497
504
  grpc_channel_destroy(channel_);
505
+ xds_client_.reset(DEBUG_LOCATION, "ChannelState");
498
506
  }
499
507
 
500
508
  void XdsClient::ChannelState::Orphan() {
@@ -516,7 +524,7 @@ XdsClient::ChannelState::LrsCallState* XdsClient::ChannelState::lrs_calld()
516
524
  }
517
525
 
518
526
  bool XdsClient::ChannelState::HasActiveAdsCall() const {
519
- return ads_calld_->calld() != nullptr;
527
+ return ads_calld_ != nullptr && ads_calld_->calld() != nullptr;
520
528
  }
521
529
 
522
530
  void XdsClient::ChannelState::MaybeStartLrsCall() {
@@ -528,24 +536,22 @@ void XdsClient::ChannelState::MaybeStartLrsCall() {
528
536
  void XdsClient::ChannelState::StopLrsCall() { lrs_calld_.reset(); }
529
537
 
530
538
  void XdsClient::ChannelState::StartConnectivityWatchLocked() {
531
- grpc_channel_element* client_channel_elem =
532
- grpc_channel_stack_last_element(grpc_channel_get_channel_stack(channel_));
533
- GPR_ASSERT(client_channel_elem->filter == &grpc_client_channel_filter);
534
- watcher_ = new StateWatcher(Ref());
535
- grpc_client_channel_start_connectivity_watch(
536
- client_channel_elem, GRPC_CHANNEL_IDLE,
539
+ ClientChannel* client_channel = ClientChannel::GetFromChannel(channel_);
540
+ GPR_ASSERT(client_channel != nullptr);
541
+ watcher_ = new StateWatcher(Ref(DEBUG_LOCATION, "ChannelState+watch"));
542
+ client_channel->AddConnectivityWatcher(
543
+ GRPC_CHANNEL_IDLE,
537
544
  OrphanablePtr<AsyncConnectivityStateWatcherInterface>(watcher_));
538
545
  }
539
546
 
540
547
  void XdsClient::ChannelState::CancelConnectivityWatchLocked() {
541
- grpc_channel_element* client_channel_elem =
542
- grpc_channel_stack_last_element(grpc_channel_get_channel_stack(channel_));
543
- GPR_ASSERT(client_channel_elem->filter == &grpc_client_channel_filter);
544
- grpc_client_channel_stop_connectivity_watch(client_channel_elem, watcher_);
548
+ ClientChannel* client_channel = ClientChannel::GetFromChannel(channel_);
549
+ GPR_ASSERT(client_channel != nullptr);
550
+ client_channel->RemoveConnectivityWatcher(watcher_);
545
551
  }
546
552
 
547
- void XdsClient::ChannelState::Subscribe(const std::string& type_url,
548
- const std::string& name) {
553
+ void XdsClient::ChannelState::SubscribeLocked(const std::string& type_url,
554
+ const std::string& name) {
549
555
  if (ads_calld_ == nullptr) {
550
556
  // Start the ADS call if this is the first request.
551
557
  ads_calld_.reset(new RetryableCall<AdsCallState>(
@@ -559,15 +565,18 @@ void XdsClient::ChannelState::Subscribe(const std::string& type_url,
559
565
  // because when the call is restarted it will resend all necessary requests.
560
566
  if (ads_calld() == nullptr) return;
561
567
  // Subscribe to this resource if the ADS call is active.
562
- ads_calld()->Subscribe(type_url, name);
568
+ ads_calld()->SubscribeLocked(type_url, name);
563
569
  }
564
570
 
565
- void XdsClient::ChannelState::Unsubscribe(const std::string& type_url,
566
- const std::string& name,
567
- bool delay_unsubscription) {
571
+ void XdsClient::ChannelState::UnsubscribeLocked(const std::string& type_url,
572
+ const std::string& name,
573
+ bool delay_unsubscription) {
568
574
  if (ads_calld_ != nullptr) {
569
- ads_calld_->calld()->Unsubscribe(type_url, name, delay_unsubscription);
570
- if (!ads_calld_->calld()->HasSubscribedResources()) ads_calld_.reset();
575
+ auto* calld = ads_calld_->calld();
576
+ if (calld != nullptr) {
577
+ calld->UnsubscribeLocked(type_url, name, delay_unsubscription);
578
+ if (!calld->HasSubscribedResources()) ads_calld_.reset();
579
+ }
571
580
  }
572
581
  }
573
582
 
@@ -648,16 +657,18 @@ void XdsClient::ChannelState::RetryableCall<T>::StartRetryTimerLocked() {
648
657
 
649
658
  template <typename T>
650
659
  void XdsClient::ChannelState::RetryableCall<T>::OnRetryTimer(
651
- void* arg, grpc_error* error) {
660
+ void* arg, grpc_error_handle error) {
652
661
  RetryableCall* calld = static_cast<RetryableCall*>(arg);
653
- GRPC_ERROR_REF(error); // ref owned by lambda
654
- calld->chand_->xds_client()->work_serializer_->Run(
655
- [calld, error]() { calld->OnRetryTimerLocked(error); }, DEBUG_LOCATION);
662
+ {
663
+ MutexLock lock(&calld->chand_->xds_client()->mu_);
664
+ calld->OnRetryTimerLocked(GRPC_ERROR_REF(error));
665
+ }
666
+ calld->Unref(DEBUG_LOCATION, "RetryableCall+retry_timer_done");
656
667
  }
657
668
 
658
669
  template <typename T>
659
670
  void XdsClient::ChannelState::RetryableCall<T>::OnRetryTimerLocked(
660
- grpc_error* error) {
671
+ grpc_error_handle error) {
661
672
  retry_timer_callback_pending_ = false;
662
673
  if (!shutting_down_ && error == GRPC_ERROR_NONE) {
663
674
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
@@ -668,7 +679,6 @@ void XdsClient::ChannelState::RetryableCall<T>::OnRetryTimerLocked(
668
679
  }
669
680
  StartNewCallLocked();
670
681
  }
671
- this->Unref(DEBUG_LOCATION, "RetryableCall+retry_timer_done");
672
682
  GRPC_ERROR_UNREF(error);
673
683
  }
674
684
 
@@ -678,19 +688,24 @@ void XdsClient::ChannelState::RetryableCall<T>::OnRetryTimerLocked(
678
688
 
679
689
  XdsClient::ChannelState::AdsCallState::AdsCallState(
680
690
  RefCountedPtr<RetryableCall<AdsCallState>> parent)
681
- : InternallyRefCounted<AdsCallState>(&grpc_xds_client_trace),
691
+ : InternallyRefCounted<AdsCallState>(
692
+ GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_refcount_trace)
693
+ ? "AdsCallState"
694
+ : nullptr),
682
695
  parent_(std::move(parent)) {
683
696
  // Init the ADS call. Note that the call will progress every time there's
684
697
  // activity in xds_client()->interested_parties_, which is comprised of
685
698
  // the polling entities from client_channel.
686
699
  GPR_ASSERT(xds_client() != nullptr);
687
- GPR_ASSERT(!xds_client()->server_name_.empty());
688
700
  // Create a call with the specified method name.
701
+ const auto& method =
702
+ chand()->server_.ShouldUseV3()
703
+ ? GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V3_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES
704
+ : GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V2_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES;
689
705
  call_ = grpc_channel_create_pollset_set_call(
690
706
  chand()->channel_, nullptr, GRPC_PROPAGATE_DEFAULTS,
691
- xds_client()->interested_parties_,
692
- GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V2_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES,
693
- nullptr, GRPC_MILLIS_INF_FUTURE, nullptr);
707
+ xds_client()->interested_parties_, method, nullptr,
708
+ GRPC_MILLIS_INF_FUTURE, nullptr);
694
709
  GPR_ASSERT(call_ != nullptr);
695
710
  // Init data associated with the call.
696
711
  grpc_metadata_array_init(&initial_metadata_recv_);
@@ -714,25 +729,23 @@ XdsClient::ChannelState::AdsCallState::AdsCallState(
714
729
  GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET;
715
730
  op->reserved = nullptr;
716
731
  op++;
717
- call_error = grpc_call_start_batch_and_execute(call_, ops, (size_t)(op - ops),
718
- nullptr);
732
+ call_error = grpc_call_start_batch_and_execute(
733
+ call_, ops, static_cast<size_t>(op - ops), nullptr);
719
734
  GPR_ASSERT(GRPC_CALL_OK == call_error);
720
735
  // Op: send request message.
721
736
  GRPC_CLOSURE_INIT(&on_request_sent_, OnRequestSent, this,
722
737
  grpc_schedule_on_exec_ctx);
723
- if (xds_client()->service_config_watcher_ != nullptr) {
724
- Subscribe(XdsApi::kLdsTypeUrl, xds_client()->server_name_);
725
- if (xds_client()->lds_result_.has_value() &&
726
- !xds_client()->lds_result_->route_config_name.empty()) {
727
- Subscribe(XdsApi::kRdsTypeUrl,
728
- xds_client()->lds_result_->route_config_name);
729
- }
738
+ for (const auto& p : xds_client()->listener_map_) {
739
+ SubscribeLocked(XdsApi::kLdsTypeUrl, std::string(p.first));
740
+ }
741
+ for (const auto& p : xds_client()->route_config_map_) {
742
+ SubscribeLocked(XdsApi::kRdsTypeUrl, std::string(p.first));
730
743
  }
731
744
  for (const auto& p : xds_client()->cluster_map_) {
732
- Subscribe(XdsApi::kCdsTypeUrl, std::string(p.first));
745
+ SubscribeLocked(XdsApi::kCdsTypeUrl, std::string(p.first));
733
746
  }
734
747
  for (const auto& p : xds_client()->endpoint_map_) {
735
- Subscribe(XdsApi::kEdsTypeUrl, std::string(p.first));
748
+ SubscribeLocked(XdsApi::kEdsTypeUrl, std::string(p.first));
736
749
  }
737
750
  // Op: recv initial metadata.
738
751
  op = ops;
@@ -751,8 +764,8 @@ XdsClient::ChannelState::AdsCallState::AdsCallState(
751
764
  Ref(DEBUG_LOCATION, "ADS+OnResponseReceivedLocked").release();
752
765
  GRPC_CLOSURE_INIT(&on_response_received_, OnResponseReceived, this,
753
766
  grpc_schedule_on_exec_ctx);
754
- call_error = grpc_call_start_batch_and_execute(call_, ops, (size_t)(op - ops),
755
- &on_response_received_);
767
+ call_error = grpc_call_start_batch_and_execute(
768
+ call_, ops, static_cast<size_t>(op - ops), &on_response_received_);
756
769
  GPR_ASSERT(GRPC_CALL_OK == call_error);
757
770
  // Op: recv server status.
758
771
  op = ops;
@@ -768,8 +781,8 @@ XdsClient::ChannelState::AdsCallState::AdsCallState(
768
781
  // unreffed.
769
782
  GRPC_CLOSURE_INIT(&on_status_received_, OnStatusReceived, this,
770
783
  grpc_schedule_on_exec_ctx);
771
- call_error = grpc_call_start_batch_and_execute(call_, ops, (size_t)(op - ops),
772
- &on_status_received_);
784
+ call_error = grpc_call_start_batch_and_execute(
785
+ call_, ops, static_cast<size_t>(op - ops), &on_status_received_);
773
786
  GPR_ASSERT(GRPC_CALL_OK == call_error);
774
787
  }
775
788
 
@@ -789,14 +802,15 @@ void XdsClient::ChannelState::AdsCallState::Orphan() {
789
802
  // on_status_received_ will complete the cancellation and clean up. Otherwise,
790
803
  // we are here because xds_client has to orphan a failed call, then the
791
804
  // following cancellation will be a no-op.
792
- grpc_call_cancel(call_, nullptr);
805
+ grpc_call_cancel_internal(call_);
793
806
  state_map_.clear();
794
807
  // Note that the initial ref is hold by on_status_received_. So the
795
808
  // corresponding unref happens in on_status_received_ instead of here.
796
809
  }
797
810
 
798
811
  void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
799
- const std::string& type_url) {
812
+ const std::string& type_url)
813
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_) {
800
814
  // Buffer message sending if an existing message is in flight.
801
815
  if (send_message_payload_ != nullptr) {
802
816
  buffered_requests_.insert(type_url);
@@ -807,7 +821,8 @@ void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
807
821
  std::set<absl::string_view> resource_names =
808
822
  ResourceNamesForRequest(type_url);
809
823
  request_payload_slice = xds_client()->api_.CreateAdsRequest(
810
- type_url, resource_names, state.version, state.nonce,
824
+ chand()->server_, type_url, resource_names,
825
+ xds_client()->resource_version_map_[type_url], state.nonce,
811
826
  GRPC_ERROR_REF(state.error), !sent_initial_message_);
812
827
  if (type_url != XdsApi::kLdsTypeUrl && type_url != XdsApi::kRdsTypeUrl &&
813
828
  type_url != XdsApi::kCdsTypeUrl && type_url != XdsApi::kEdsTypeUrl) {
@@ -818,8 +833,9 @@ void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
818
833
  gpr_log(GPR_INFO,
819
834
  "[xds_client %p] sending ADS request: type=%s version=%s nonce=%s "
820
835
  "error=%s resources=%s",
821
- xds_client(), type_url.c_str(), state.version.c_str(),
822
- state.nonce.c_str(), grpc_error_string(state.error),
836
+ xds_client(), type_url.c_str(),
837
+ xds_client()->resource_version_map_[type_url].c_str(),
838
+ state.nonce.c_str(), grpc_error_std_string(state.error).c_str(),
823
839
  absl::StrJoin(resource_names, " ").c_str());
824
840
  }
825
841
  GRPC_ERROR_UNREF(state.error);
@@ -846,16 +862,17 @@ void XdsClient::ChannelState::AdsCallState::SendMessageLocked(
846
862
  }
847
863
  }
848
864
 
849
- void XdsClient::ChannelState::AdsCallState::Subscribe(
865
+ void XdsClient::ChannelState::AdsCallState::SubscribeLocked(
850
866
  const std::string& type_url, const std::string& name) {
851
867
  auto& state = state_map_[type_url].subscribed_resources[name];
852
868
  if (state == nullptr) {
853
- state = MakeOrphanable<ResourceState>(type_url, name);
869
+ state = MakeOrphanable<ResourceState>(
870
+ type_url, name, !xds_client()->resource_version_map_[type_url].empty());
854
871
  SendMessageLocked(type_url);
855
872
  }
856
873
  }
857
874
 
858
- void XdsClient::ChannelState::AdsCallState::Unsubscribe(
875
+ void XdsClient::ChannelState::AdsCallState::UnsubscribeLocked(
859
876
  const std::string& type_url, const std::string& name,
860
877
  bool delay_unsubscription) {
861
878
  state_map_[type_url].subscribed_resources.erase(name);
@@ -869,148 +886,167 @@ bool XdsClient::ChannelState::AdsCallState::HasSubscribedResources() const {
869
886
  return false;
870
887
  }
871
888
 
872
- void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate(
873
- absl::optional<XdsApi::LdsUpdate> lds_update) {
874
- if (!lds_update.has_value()) {
875
- gpr_log(GPR_INFO,
876
- "[xds_client %p] LDS update does not include requested resource",
877
- xds_client());
878
- if (xds_client()->lds_result_.has_value() &&
879
- !xds_client()->lds_result_->route_config_name.empty()) {
880
- Unsubscribe(XdsApi::kRdsTypeUrl,
881
- xds_client()->lds_result_->route_config_name,
882
- /*delay_unsubscription=*/false);
883
- xds_client()->rds_result_.reset();
884
- }
885
- xds_client()->lds_result_.reset();
886
- xds_client()->service_config_watcher_->OnResourceDoesNotExist();
887
- return;
888
- }
889
+ namespace {
890
+
891
+ // Build a resource metadata struct for ADS result accepting methods and CSDS.
892
+ XdsApi::ResourceMetadata CreateResourceMetadataAcked(
893
+ std::string serialized_proto, std::string version,
894
+ grpc_millis update_time) {
895
+ XdsApi::ResourceMetadata resource_metadata;
896
+ resource_metadata.serialized_proto = std::move(serialized_proto);
897
+ resource_metadata.update_time = update_time;
898
+ resource_metadata.version = std::move(version);
899
+ resource_metadata.client_status = XdsApi::ResourceMetadata::ACKED;
900
+ return resource_metadata;
901
+ }
902
+
903
+ } // namespace
904
+
905
+ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdateLocked(
906
+ std::string version, grpc_millis update_time,
907
+ XdsApi::LdsUpdateMap lds_update_map) {
889
908
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
890
909
  gpr_log(GPR_INFO,
891
- "[xds_client %p] LDS update received: route_config_name=%s",
892
- xds_client(),
893
- (!lds_update->route_config_name.empty()
894
- ? lds_update->route_config_name.c_str()
895
- : "<inlined>"));
896
- if (lds_update->rds_update.has_value()) {
897
- gpr_log(GPR_INFO, " RouteConfiguration contains %" PRIuPTR " routes",
898
- lds_update->rds_update.value().routes.size());
899
- for (const auto& route : lds_update->rds_update.value().routes) {
910
+ "[xds_client %p] LDS update received containing %" PRIuPTR
911
+ " resources",
912
+ xds_client(), lds_update_map.size());
913
+ }
914
+ auto& lds_state = state_map_[XdsApi::kLdsTypeUrl];
915
+ std::set<std::string> rds_resource_names_seen;
916
+ for (auto& p : lds_update_map) {
917
+ const std::string& listener_name = p.first;
918
+ XdsApi::LdsUpdate& lds_update = p.second.resource;
919
+ auto& state = lds_state.subscribed_resources[listener_name];
920
+ if (state != nullptr) state->Finish();
921
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
922
+ gpr_log(GPR_INFO, "[xds_client %p] LDS resource %s: %s", xds_client(),
923
+ listener_name.c_str(), lds_update.ToString().c_str());
924
+ }
925
+ // Record the RDS resource names seen.
926
+ if (!lds_update.http_connection_manager.route_config_name.empty()) {
927
+ rds_resource_names_seen.insert(
928
+ lds_update.http_connection_manager.route_config_name);
929
+ }
930
+ // Ignore identical update.
931
+ ListenerState& listener_state = xds_client()->listener_map_[listener_name];
932
+ if (listener_state.update.has_value() &&
933
+ *listener_state.update == lds_update) {
934
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
900
935
  gpr_log(GPR_INFO,
901
- " route: { service=\"%s\", "
902
- "method=\"%s\" }, cluster=\"%s\" }",
903
- route.service.c_str(), route.method.c_str(),
904
- route.cluster_name.c_str());
936
+ "[xds_client %p] LDS update for %s identical to current, "
937
+ "ignoring.",
938
+ xds_client(), listener_name.c_str());
905
939
  }
940
+ continue;
941
+ }
942
+ // Update the listener state.
943
+ listener_state.update = std::move(lds_update);
944
+ listener_state.meta = CreateResourceMetadataAcked(
945
+ std::move(p.second.serialized_proto), version, update_time);
946
+ // Notify watchers.
947
+ for (const auto& p : listener_state.watchers) {
948
+ p.first->OnListenerChanged(*listener_state.update);
906
949
  }
907
950
  }
908
- auto& lds_state = state_map_[XdsApi::kLdsTypeUrl];
909
- auto& state = lds_state.subscribed_resources[xds_client()->server_name_];
910
- if (state != nullptr) state->Finish();
911
- // Ignore identical update.
912
- if (xds_client()->lds_result_ == lds_update) {
913
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
914
- gpr_log(GPR_INFO,
915
- "[xds_client %p] LDS update identical to current, ignoring.",
916
- xds_client());
951
+ // For any subscribed resource that is not present in the update,
952
+ // remove it from the cache and notify watchers that it does not exist.
953
+ for (const auto& p : lds_state.subscribed_resources) {
954
+ const std::string& listener_name = p.first;
955
+ if (lds_update_map.find(listener_name) == lds_update_map.end()) {
956
+ ListenerState& listener_state =
957
+ xds_client()->listener_map_[listener_name];
958
+ // If the resource was newly requested but has not yet been received,
959
+ // we don't want to generate an error for the watchers, because this LDS
960
+ // response may be in reaction to an earlier request that did not yet
961
+ // request the new resource, so its absence from the response does not
962
+ // necessarily indicate that the resource does not exist.
963
+ // For that case, we rely on the request timeout instead.
964
+ if (!listener_state.update.has_value()) continue;
965
+ listener_state.update.reset();
966
+ for (const auto& p : listener_state.watchers) {
967
+ p.first->OnResourceDoesNotExist();
968
+ }
917
969
  }
918
- return;
919
970
  }
920
- if (xds_client()->lds_result_.has_value() &&
921
- !xds_client()->lds_result_->route_config_name.empty()) {
922
- Unsubscribe(
923
- XdsApi::kRdsTypeUrl, xds_client()->lds_result_->route_config_name,
924
- /*delay_unsubscription=*/!lds_update->route_config_name.empty());
925
- xds_client()->rds_result_.reset();
926
- }
927
- xds_client()->lds_result_ = std::move(lds_update);
928
- if (xds_client()->lds_result_->rds_update.has_value()) {
929
- // If the RouteConfiguration was found inlined in LDS response, notify
930
- // the watcher immediately.
931
- RefCountedPtr<ServiceConfig> service_config;
932
- grpc_error* error = xds_client()->CreateServiceConfig(
933
- xds_client()->lds_result_->rds_update.value(), &service_config);
934
- if (error == GRPC_ERROR_NONE) {
935
- xds_client()->service_config_watcher_->OnServiceConfigChanged(
936
- std::move(service_config));
937
- } else {
938
- xds_client()->service_config_watcher_->OnError(error);
971
+ // For any RDS resource that is no longer referred to by any LDS
972
+ // resources, remove it from the cache and notify watchers that it
973
+ // does not exist.
974
+ auto& rds_state = state_map_[XdsApi::kRdsTypeUrl];
975
+ for (const auto& p : rds_state.subscribed_resources) {
976
+ const std::string& rds_resource_name = p.first;
977
+ if (rds_resource_names_seen.find(rds_resource_name) ==
978
+ rds_resource_names_seen.end()) {
979
+ RouteConfigState& route_config_state =
980
+ xds_client()->route_config_map_[rds_resource_name];
981
+ route_config_state.update.reset();
982
+ for (const auto& p : route_config_state.watchers) {
983
+ p.first->OnResourceDoesNotExist();
984
+ }
939
985
  }
940
- } else {
941
- // Send RDS request for dynamic resolution.
942
- Subscribe(XdsApi::kRdsTypeUrl,
943
- xds_client()->lds_result_->route_config_name);
944
986
  }
945
987
  }
946
988
 
947
- void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdate(
948
- absl::optional<XdsApi::RdsUpdate> rds_update) {
949
- if (!rds_update.has_value()) {
950
- gpr_log(GPR_INFO,
951
- "[xds_client %p] RDS update does not include requested resource",
952
- xds_client());
953
- xds_client()->rds_result_.reset();
954
- xds_client()->service_config_watcher_->OnResourceDoesNotExist();
955
- return;
956
- }
989
+ void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdateLocked(
990
+ std::string version, grpc_millis update_time,
991
+ XdsApi::RdsUpdateMap rds_update_map) {
957
992
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
958
993
  gpr_log(GPR_INFO,
959
- "[xds_client %p] RDS update received; RouteConfiguration contains "
960
- "%" PRIuPTR " routes",
961
- this, rds_update.value().routes.size());
962
- for (const auto& route : rds_update.value().routes) {
963
- gpr_log(GPR_INFO,
964
- " route: { service=\"%s\", "
965
- "method=\"%s\" }, cluster=\"%s\" }",
966
- route.service.c_str(), route.method.c_str(),
967
- route.cluster_name.c_str());
968
- }
994
+ "[xds_client %p] RDS update received containing %" PRIuPTR
995
+ " resources",
996
+ xds_client(), rds_update_map.size());
969
997
  }
970
998
  auto& rds_state = state_map_[XdsApi::kRdsTypeUrl];
971
- auto& state =
972
- rds_state
973
- .subscribed_resources[xds_client()->lds_result_->route_config_name];
974
- if (state != nullptr) state->Finish();
975
- // Ignore identical update.
976
- if (xds_client()->rds_result_ == rds_update) {
999
+ for (auto& p : rds_update_map) {
1000
+ const std::string& route_config_name = p.first;
1001
+ XdsApi::RdsUpdate& rds_update = p.second.resource;
1002
+ auto& state = rds_state.subscribed_resources[route_config_name];
1003
+ if (state != nullptr) state->Finish();
977
1004
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
978
- gpr_log(GPR_INFO,
979
- "[xds_client %p] RDS update identical to current, ignoring.",
980
- xds_client());
1005
+ gpr_log(GPR_INFO, "[xds_client %p] RDS resource:\n%s", xds_client(),
1006
+ rds_update.ToString().c_str());
1007
+ }
1008
+ RouteConfigState& route_config_state =
1009
+ xds_client()->route_config_map_[route_config_name];
1010
+ // Ignore identical update.
1011
+ if (route_config_state.update.has_value() &&
1012
+ *route_config_state.update == rds_update) {
1013
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1014
+ gpr_log(GPR_INFO,
1015
+ "[xds_client %p] RDS resource identical to current, ignoring",
1016
+ xds_client());
1017
+ }
1018
+ continue;
1019
+ }
1020
+ // Update the cache.
1021
+ route_config_state.update = std::move(rds_update);
1022
+ route_config_state.meta = CreateResourceMetadataAcked(
1023
+ std::move(p.second.serialized_proto), version, update_time);
1024
+ // Notify all watchers.
1025
+ for (const auto& p : route_config_state.watchers) {
1026
+ p.first->OnRouteConfigChanged(*route_config_state.update);
981
1027
  }
982
- return;
983
- }
984
- xds_client()->rds_result_ = std::move(rds_update);
985
- // Notify the watcher.
986
- RefCountedPtr<ServiceConfig> service_config;
987
- grpc_error* error = xds_client()->CreateServiceConfig(
988
- xds_client()->rds_result_.value(), &service_config);
989
- if (error == GRPC_ERROR_NONE) {
990
- xds_client()->service_config_watcher_->OnServiceConfigChanged(
991
- std::move(service_config));
992
- } else {
993
- xds_client()->service_config_watcher_->OnError(error);
994
1028
  }
995
1029
  }
996
1030
 
997
- void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
1031
+ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdateLocked(
1032
+ std::string version, grpc_millis update_time,
998
1033
  XdsApi::CdsUpdateMap cds_update_map) {
1034
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1035
+ gpr_log(GPR_INFO,
1036
+ "[xds_client %p] CDS update received containing %" PRIuPTR
1037
+ " resources",
1038
+ xds_client(), cds_update_map.size());
1039
+ }
999
1040
  auto& cds_state = state_map_[XdsApi::kCdsTypeUrl];
1000
1041
  std::set<std::string> eds_resource_names_seen;
1001
1042
  for (auto& p : cds_update_map) {
1002
1043
  const char* cluster_name = p.first.c_str();
1003
- XdsApi::CdsUpdate& cds_update = p.second;
1044
+ XdsApi::CdsUpdate& cds_update = p.second.resource;
1004
1045
  auto& state = cds_state.subscribed_resources[cluster_name];
1005
1046
  if (state != nullptr) state->Finish();
1006
1047
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1007
- gpr_log(GPR_INFO,
1008
- "[xds_client %p] CDS update (cluster=%s) received: "
1009
- "eds_service_name=%s, lrs_load_reporting_server_name=%s",
1010
- xds_client(), cluster_name, cds_update.eds_service_name.c_str(),
1011
- cds_update.lrs_load_reporting_server_name.has_value()
1012
- ? cds_update.lrs_load_reporting_server_name.value().c_str()
1013
- : "(N/A)");
1048
+ gpr_log(GPR_INFO, "[xds_client %p] cluster=%s: %s", xds_client(),
1049
+ cluster_name, cds_update.ToString().c_str());
1014
1050
  }
1015
1051
  // Record the EDS resource names seen.
1016
1052
  eds_resource_names_seen.insert(cds_update.eds_service_name.empty()
@@ -1019,9 +1055,7 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
1019
1055
  // Ignore identical update.
1020
1056
  ClusterState& cluster_state = xds_client()->cluster_map_[cluster_name];
1021
1057
  if (cluster_state.update.has_value() &&
1022
- cds_update.eds_service_name == cluster_state.update->eds_service_name &&
1023
- cds_update.lrs_load_reporting_server_name ==
1024
- cluster_state.update->lrs_load_reporting_server_name) {
1058
+ *cluster_state.update == cds_update) {
1025
1059
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1026
1060
  gpr_log(GPR_INFO,
1027
1061
  "[xds_client %p] CDS update identical to current, ignoring.",
@@ -1031,6 +1065,8 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
1031
1065
  }
1032
1066
  // Update the cluster state.
1033
1067
  cluster_state.update = std::move(cds_update);
1068
+ cluster_state.meta = CreateResourceMetadataAcked(
1069
+ std::move(p.second.serialized_proto), version, update_time);
1034
1070
  // Notify all watchers.
1035
1071
  for (const auto& p : cluster_state.watchers) {
1036
1072
  p.first->OnClusterChanged(cluster_state.update.value());
@@ -1042,6 +1078,13 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
1042
1078
  const std::string& cluster_name = p.first;
1043
1079
  if (cds_update_map.find(cluster_name) == cds_update_map.end()) {
1044
1080
  ClusterState& cluster_state = xds_client()->cluster_map_[cluster_name];
1081
+ // If the resource was newly requested but has not yet been received,
1082
+ // we don't want to generate an error for the watchers, because this CDS
1083
+ // response may be in reaction to an earlier request that did not yet
1084
+ // request the new resource, so its absence from the response does not
1085
+ // necessarily indicate that the resource does not exist.
1086
+ // For that case, we rely on the request timeout instead.
1087
+ if (!cluster_state.update.has_value()) continue;
1045
1088
  cluster_state.update.reset();
1046
1089
  for (const auto& p : cluster_state.watchers) {
1047
1090
  p.first->OnResourceDoesNotExist();
@@ -1066,82 +1109,41 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
1066
1109
  }
1067
1110
  }
1068
1111
 
1069
- void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
1112
+ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdateLocked(
1113
+ std::string version, grpc_millis update_time,
1070
1114
  XdsApi::EdsUpdateMap eds_update_map) {
1115
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1116
+ gpr_log(GPR_INFO,
1117
+ "[xds_client %p] EDS update received containing %" PRIuPTR
1118
+ " resources",
1119
+ xds_client(), eds_update_map.size());
1120
+ }
1071
1121
  auto& eds_state = state_map_[XdsApi::kEdsTypeUrl];
1072
1122
  for (auto& p : eds_update_map) {
1073
1123
  const char* eds_service_name = p.first.c_str();
1074
- XdsApi::EdsUpdate& eds_update = p.second;
1124
+ XdsApi::EdsUpdate& eds_update = p.second.resource;
1075
1125
  auto& state = eds_state.subscribed_resources[eds_service_name];
1076
1126
  if (state != nullptr) state->Finish();
1077
1127
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1078
- gpr_log(GPR_INFO,
1079
- "[xds_client %p] EDS response with %" PRIuPTR
1080
- " priorities and %" PRIuPTR
1081
- " drop categories received (drop_all=%d)",
1082
- xds_client(), eds_update.priority_list_update.size(),
1083
- eds_update.drop_config->drop_category_list().size(),
1084
- eds_update.drop_config->drop_all());
1085
- for (size_t priority = 0;
1086
- priority < eds_update.priority_list_update.size(); ++priority) {
1087
- const auto* locality_map_update = eds_update.priority_list_update.Find(
1088
- static_cast<uint32_t>(priority));
1089
- gpr_log(GPR_INFO,
1090
- "[xds_client %p] Priority %" PRIuPTR " contains %" PRIuPTR
1091
- " localities",
1092
- xds_client(), priority, locality_map_update->size());
1093
- size_t locality_count = 0;
1094
- for (const auto& p : locality_map_update->localities) {
1095
- const auto& locality = p.second;
1096
- gpr_log(GPR_INFO,
1097
- "[xds_client %p] Priority %" PRIuPTR ", locality %" PRIuPTR
1098
- " %s has weight %d, contains %" PRIuPTR " server addresses",
1099
- xds_client(), priority, locality_count,
1100
- locality.name->AsHumanReadableString(), locality.lb_weight,
1101
- locality.serverlist.size());
1102
- for (size_t i = 0; i < locality.serverlist.size(); ++i) {
1103
- std::string ipport = grpc_sockaddr_to_string(
1104
- &locality.serverlist[i].address(), false);
1105
- gpr_log(GPR_INFO,
1106
- "[xds_client %p] Priority %" PRIuPTR ", locality %" PRIuPTR
1107
- " %s, server address %" PRIuPTR ": %s",
1108
- xds_client(), priority, locality_count,
1109
- locality.name->AsHumanReadableString(), i, ipport.c_str());
1110
- }
1111
- ++locality_count;
1112
- }
1113
- }
1114
- for (size_t i = 0;
1115
- i < eds_update.drop_config->drop_category_list().size(); ++i) {
1116
- const XdsApi::DropConfig::DropCategory& drop_category =
1117
- eds_update.drop_config->drop_category_list()[i];
1118
- gpr_log(GPR_INFO,
1119
- "[xds_client %p] Drop category %s has drop rate %d per million",
1120
- xds_client(), drop_category.name.c_str(),
1121
- drop_category.parts_per_million);
1122
- }
1128
+ gpr_log(GPR_INFO, "[xds_client %p] EDS resource %s: %s", xds_client(),
1129
+ eds_service_name, eds_update.ToString().c_str());
1123
1130
  }
1124
1131
  EndpointState& endpoint_state =
1125
1132
  xds_client()->endpoint_map_[eds_service_name];
1126
1133
  // Ignore identical update.
1127
- if (endpoint_state.update.has_value()) {
1128
- const XdsApi::EdsUpdate& prev_update = endpoint_state.update.value();
1129
- const bool priority_list_changed =
1130
- prev_update.priority_list_update != eds_update.priority_list_update;
1131
- const bool drop_config_changed =
1132
- prev_update.drop_config == nullptr ||
1133
- *prev_update.drop_config != *eds_update.drop_config;
1134
- if (!priority_list_changed && !drop_config_changed) {
1135
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1136
- gpr_log(GPR_INFO,
1137
- "[xds_client %p] EDS update identical to current, ignoring.",
1138
- xds_client());
1139
- }
1140
- continue;
1134
+ if (endpoint_state.update.has_value() &&
1135
+ *endpoint_state.update == eds_update) {
1136
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1137
+ gpr_log(GPR_INFO,
1138
+ "[xds_client %p] EDS update identical to current, ignoring.",
1139
+ xds_client());
1141
1140
  }
1141
+ continue;
1142
1142
  }
1143
1143
  // Update the cluster state.
1144
1144
  endpoint_state.update = std::move(eds_update);
1145
+ endpoint_state.meta = CreateResourceMetadataAcked(
1146
+ std::move(p.second.serialized_proto), version, update_time);
1145
1147
  // Notify all watchers.
1146
1148
  for (const auto& p : endpoint_state.watchers) {
1147
1149
  p.first->OnEndpointChanged(endpoint_state.update.value());
@@ -1149,17 +1151,59 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdate(
1149
1151
  }
1150
1152
  }
1151
1153
 
1152
- void XdsClient::ChannelState::AdsCallState::OnRequestSent(void* arg,
1153
- grpc_error* error) {
1154
+ namespace {
1155
+
1156
+ // Update resource_metadata for NACK.
1157
+ void UpdateResourceMetadataNacked(const std::string& version,
1158
+ const std::string& details,
1159
+ grpc_millis update_time,
1160
+ XdsApi::ResourceMetadata* resource_metadata) {
1161
+ resource_metadata->client_status = XdsApi::ResourceMetadata::NACKED;
1162
+ resource_metadata->failed_version = version;
1163
+ resource_metadata->failed_details = details;
1164
+ resource_metadata->failed_update_time = update_time;
1165
+ }
1166
+
1167
+ } // namespace
1168
+
1169
+ template <typename StateMap>
1170
+ void XdsClient::ChannelState::AdsCallState::RejectAdsUpdateLocked(
1171
+ grpc_millis update_time, const XdsApi::AdsParseResult& result,
1172
+ StateMap* state_map) {
1173
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1174
+ gpr_log(GPR_INFO,
1175
+ "[xds_client %p] %s update NACKed containing %" PRIuPTR
1176
+ " resources",
1177
+ xds_client(), result.type_url.c_str(),
1178
+ result.resource_names_failed.size());
1179
+ }
1180
+ std::string details = grpc_error_std_string(result.parse_error);
1181
+ for (auto& name : result.resource_names_failed) {
1182
+ auto it = state_map->find(name);
1183
+ if (it == state_map->end()) continue;
1184
+ auto& state = it->second;
1185
+ // Notify watchers of error.
1186
+ for (const auto& p : state.watchers) {
1187
+ p.first->OnError(GRPC_ERROR_REF(result.parse_error));
1188
+ }
1189
+ // Update resource metadata for CSDS.
1190
+ UpdateResourceMetadataNacked(result.version, details, update_time,
1191
+ &state.meta);
1192
+ }
1193
+ }
1194
+
1195
+ void XdsClient::ChannelState::AdsCallState::OnRequestSent(
1196
+ void* arg, grpc_error_handle error) {
1154
1197
  AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
1155
- GRPC_ERROR_REF(error); // ref owned by lambda
1156
- ads_calld->xds_client()->work_serializer_->Run(
1157
- [ads_calld, error]() { ads_calld->OnRequestSentLocked(error); },
1158
- DEBUG_LOCATION);
1198
+ {
1199
+ MutexLock lock(&ads_calld->xds_client()->mu_);
1200
+ ads_calld->OnRequestSentLocked(GRPC_ERROR_REF(error));
1201
+ }
1202
+ ads_calld->Unref(DEBUG_LOCATION, "ADS+OnRequestSentLocked");
1159
1203
  }
1160
1204
 
1161
1205
  void XdsClient::ChannelState::AdsCallState::OnRequestSentLocked(
1162
- grpc_error* error) {
1206
+ grpc_error_handle error) {
1163
1207
  if (IsCurrentCallOnChannel() && error == GRPC_ERROR_NONE) {
1164
1208
  // Clean up the sent message.
1165
1209
  grpc_byte_buffer_destroy(send_message_payload_);
@@ -1179,22 +1223,24 @@ void XdsClient::ChannelState::AdsCallState::OnRequestSentLocked(
1179
1223
  buffered_requests_.erase(it);
1180
1224
  }
1181
1225
  }
1182
- Unref(DEBUG_LOCATION, "ADS+OnRequestSentLocked");
1183
1226
  GRPC_ERROR_UNREF(error);
1184
1227
  }
1185
1228
 
1186
1229
  void XdsClient::ChannelState::AdsCallState::OnResponseReceived(
1187
- void* arg, grpc_error* /* error */) {
1230
+ void* arg, grpc_error_handle /* error */) {
1188
1231
  AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
1189
- ads_calld->xds_client()->work_serializer_->Run(
1190
- [ads_calld]() { ads_calld->OnResponseReceivedLocked(); }, DEBUG_LOCATION);
1232
+ bool done;
1233
+ {
1234
+ MutexLock lock(&ads_calld->xds_client()->mu_);
1235
+ done = ads_calld->OnResponseReceivedLocked();
1236
+ }
1237
+ if (done) ads_calld->Unref(DEBUG_LOCATION, "ADS+OnResponseReceivedLocked");
1191
1238
  }
1192
1239
 
1193
- void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
1240
+ bool XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
1194
1241
  // Empty payload means the call was cancelled.
1195
1242
  if (!IsCurrentCallOnChannel() || recv_message_payload_ == nullptr) {
1196
- Unref(DEBUG_LOCATION, "ADS+OnResponseReceivedLocked");
1197
- return;
1243
+ return true;
1198
1244
  }
1199
1245
  // Read the response.
1200
1246
  grpc_byte_buffer_reader bbr;
@@ -1203,66 +1249,72 @@ void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
1203
1249
  grpc_byte_buffer_reader_destroy(&bbr);
1204
1250
  grpc_byte_buffer_destroy(recv_message_payload_);
1205
1251
  recv_message_payload_ = nullptr;
1206
- // TODO(juanlishen): When we convert this to use the xds protocol, the
1207
- // balancer will send us a fallback timeout such that we should go into
1208
- // fallback mode if we have lost contact with the balancer after a certain
1209
- // period of time. We will need to save the timeout value here, and then
1210
- // when the balancer call ends, we will need to start a timer for the
1211
- // specified period of time, and if the timer fires, we go into fallback
1212
- // mode. We will also need to cancel the timer when we receive a serverlist
1213
- // from the balancer.
1214
- // Parse the response.
1215
- absl::optional<XdsApi::LdsUpdate> lds_update;
1216
- absl::optional<XdsApi::RdsUpdate> rds_update;
1217
- XdsApi::CdsUpdateMap cds_update_map;
1218
- XdsApi::EdsUpdateMap eds_update_map;
1219
- std::string version;
1220
- std::string nonce;
1221
- std::string type_url;
1222
- // Note that ParseAdsResponse() also validates the response.
1223
- grpc_error* parse_error = xds_client()->api_.ParseAdsResponse(
1224
- response_slice, xds_client()->server_name_,
1252
+ // Parse and validate the response.
1253
+ XdsApi::AdsParseResult result = xds_client()->api_.ParseAdsResponse(
1254
+ chand()->server_, response_slice,
1255
+ ResourceNamesForRequest(XdsApi::kLdsTypeUrl),
1225
1256
  ResourceNamesForRequest(XdsApi::kRdsTypeUrl),
1226
1257
  ResourceNamesForRequest(XdsApi::kCdsTypeUrl),
1227
- ResourceNamesForRequest(XdsApi::kEdsTypeUrl), &lds_update, &rds_update,
1228
- &cds_update_map, &eds_update_map, &version, &nonce, &type_url);
1258
+ ResourceNamesForRequest(XdsApi::kEdsTypeUrl));
1229
1259
  grpc_slice_unref_internal(response_slice);
1230
- if (type_url.empty()) {
1260
+ if (result.type_url.empty()) {
1231
1261
  // Ignore unparsable response.
1232
1262
  gpr_log(GPR_ERROR,
1233
1263
  "[xds_client %p] Error parsing ADS response (%s) -- ignoring",
1234
- xds_client(), grpc_error_string(parse_error));
1235
- GRPC_ERROR_UNREF(parse_error);
1264
+ xds_client(), grpc_error_std_string(result.parse_error).c_str());
1265
+ GRPC_ERROR_UNREF(result.parse_error);
1236
1266
  } else {
1267
+ grpc_millis update_time = grpc_core::ExecCtx::Get()->Now();
1237
1268
  // Update nonce.
1238
- auto& state = state_map_[type_url];
1239
- state.nonce = std::move(nonce);
1269
+ auto& state = state_map_[result.type_url];
1270
+ state.nonce = std::move(result.nonce);
1240
1271
  // NACK or ACK the response.
1241
- if (parse_error != GRPC_ERROR_NONE) {
1242
- GRPC_ERROR_UNREF(state.error);
1243
- state.error = parse_error;
1272
+ if (result.parse_error != GRPC_ERROR_NONE) {
1244
1273
  // NACK unacceptable update.
1245
1274
  gpr_log(GPR_ERROR,
1246
1275
  "[xds_client %p] ADS response invalid for resource type %s "
1247
1276
  "version %s, will NACK: nonce=%s error=%s",
1248
- xds_client(), type_url.c_str(), version.c_str(),
1249
- state.nonce.c_str(), grpc_error_string(parse_error));
1250
- SendMessageLocked(type_url);
1277
+ xds_client(), result.type_url.c_str(), result.version.c_str(),
1278
+ state.nonce.c_str(),
1279
+ grpc_error_std_string(result.parse_error).c_str());
1280
+ result.parse_error =
1281
+ grpc_error_set_int(result.parse_error, GRPC_ERROR_INT_GRPC_STATUS,
1282
+ GRPC_STATUS_UNAVAILABLE);
1283
+ GRPC_ERROR_UNREF(state.error);
1284
+ state.error = result.parse_error;
1285
+ if (result.type_url == XdsApi::kLdsTypeUrl) {
1286
+ RejectAdsUpdateLocked(update_time, result,
1287
+ &xds_client()->listener_map_);
1288
+ } else if (result.type_url == XdsApi::kRdsTypeUrl) {
1289
+ RejectAdsUpdateLocked(update_time, result,
1290
+ &xds_client()->route_config_map_);
1291
+ } else if (result.type_url == XdsApi::kCdsTypeUrl) {
1292
+ RejectAdsUpdateLocked(update_time, result, &xds_client()->cluster_map_);
1293
+ } else if (result.type_url == XdsApi::kEdsTypeUrl) {
1294
+ RejectAdsUpdateLocked(update_time, result,
1295
+ &xds_client()->endpoint_map_);
1296
+ }
1297
+ SendMessageLocked(result.type_url);
1251
1298
  } else {
1252
1299
  seen_response_ = true;
1253
1300
  // Accept the ADS response according to the type_url.
1254
- if (type_url == XdsApi::kLdsTypeUrl) {
1255
- AcceptLdsUpdate(std::move(lds_update));
1256
- } else if (type_url == XdsApi::kRdsTypeUrl) {
1257
- AcceptRdsUpdate(std::move(rds_update));
1258
- } else if (type_url == XdsApi::kCdsTypeUrl) {
1259
- AcceptCdsUpdate(std::move(cds_update_map));
1260
- } else if (type_url == XdsApi::kEdsTypeUrl) {
1261
- AcceptEdsUpdate(std::move(eds_update_map));
1301
+ if (result.type_url == XdsApi::kLdsTypeUrl) {
1302
+ AcceptLdsUpdateLocked(result.version, update_time,
1303
+ std::move(result.lds_update_map));
1304
+ } else if (result.type_url == XdsApi::kRdsTypeUrl) {
1305
+ AcceptRdsUpdateLocked(result.version, update_time,
1306
+ std::move(result.rds_update_map));
1307
+ } else if (result.type_url == XdsApi::kCdsTypeUrl) {
1308
+ AcceptCdsUpdateLocked(result.version, update_time,
1309
+ std::move(result.cds_update_map));
1310
+ } else if (result.type_url == XdsApi::kEdsTypeUrl) {
1311
+ AcceptEdsUpdateLocked(result.version, update_time,
1312
+ std::move(result.eds_update_map));
1262
1313
  }
1263
- state.version = std::move(version);
1314
+ xds_client()->resource_version_map_[result.type_url] =
1315
+ std::move(result.version);
1264
1316
  // ACK the update.
1265
- SendMessageLocked(type_url);
1317
+ SendMessageLocked(result.type_url);
1266
1318
  // Start load reporting if needed.
1267
1319
  auto& lrs_call = chand()->lrs_calld_;
1268
1320
  if (lrs_call != nullptr) {
@@ -1271,10 +1323,7 @@ void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
1271
1323
  }
1272
1324
  }
1273
1325
  }
1274
- if (xds_client()->shutting_down_) {
1275
- Unref(DEBUG_LOCATION, "ADS+OnResponseReceivedLocked+xds_shutdown");
1276
- return;
1277
- }
1326
+ if (xds_client()->shutting_down_) return true;
1278
1327
  // Keep listening for updates.
1279
1328
  grpc_op op;
1280
1329
  memset(&op, 0, sizeof(op));
@@ -1287,26 +1336,28 @@ void XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
1287
1336
  const grpc_call_error call_error =
1288
1337
  grpc_call_start_batch_and_execute(call_, &op, 1, &on_response_received_);
1289
1338
  GPR_ASSERT(GRPC_CALL_OK == call_error);
1339
+ return false;
1290
1340
  }
1291
1341
 
1292
1342
  void XdsClient::ChannelState::AdsCallState::OnStatusReceived(
1293
- void* arg, grpc_error* error) {
1343
+ void* arg, grpc_error_handle error) {
1294
1344
  AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
1295
- GRPC_ERROR_REF(error); // ref owned by lambda
1296
- ads_calld->xds_client()->work_serializer_->Run(
1297
- [ads_calld, error]() { ads_calld->OnStatusReceivedLocked(error); },
1298
- DEBUG_LOCATION);
1345
+ {
1346
+ MutexLock lock(&ads_calld->xds_client()->mu_);
1347
+ ads_calld->OnStatusReceivedLocked(GRPC_ERROR_REF(error));
1348
+ }
1349
+ ads_calld->Unref(DEBUG_LOCATION, "ADS+OnStatusReceivedLocked");
1299
1350
  }
1300
1351
 
1301
1352
  void XdsClient::ChannelState::AdsCallState::OnStatusReceivedLocked(
1302
- grpc_error* error) {
1353
+ grpc_error_handle error) {
1303
1354
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1304
1355
  char* status_details = grpc_slice_to_c_string(status_details_);
1305
1356
  gpr_log(GPR_INFO,
1306
1357
  "[xds_client %p] ADS call status received. Status = %d, details "
1307
1358
  "= '%s', (chand: %p, ads_calld: %p, call: %p), error '%s'",
1308
1359
  xds_client(), status_code_, status_details, chand(), this, call_,
1309
- grpc_error_string(error));
1360
+ grpc_error_std_string(error).c_str());
1310
1361
  gpr_free(status_details);
1311
1362
  }
1312
1363
  // Ignore status from a stale call.
@@ -1314,10 +1365,9 @@ void XdsClient::ChannelState::AdsCallState::OnStatusReceivedLocked(
1314
1365
  // Try to restart the call.
1315
1366
  parent_->OnCallFinishedLocked();
1316
1367
  // Send error to all watchers.
1317
- xds_client()->NotifyOnError(
1368
+ xds_client()->NotifyOnErrorLocked(
1318
1369
  GRPC_ERROR_CREATE_FROM_STATIC_STRING("xds call failed"));
1319
1370
  }
1320
- Unref(DEBUG_LOCATION, "ADS+OnStatusReceivedLocked");
1321
1371
  GRPC_ERROR_UNREF(error);
1322
1372
  }
1323
1373
 
@@ -1337,7 +1387,7 @@ XdsClient::ChannelState::AdsCallState::ResourceNamesForRequest(
1337
1387
  for (auto& p : it->second.subscribed_resources) {
1338
1388
  resource_names.insert(p.first);
1339
1389
  OrphanablePtr<ResourceState>& state = p.second;
1340
- state->Start(Ref());
1390
+ state->Start(Ref(DEBUG_LOCATION, "ResourceState"));
1341
1391
  }
1342
1392
  }
1343
1393
  return resource_names;
@@ -1362,23 +1412,24 @@ void XdsClient::ChannelState::LrsCallState::Reporter::
1362
1412
  }
1363
1413
 
1364
1414
  void XdsClient::ChannelState::LrsCallState::Reporter::OnNextReportTimer(
1365
- void* arg, grpc_error* error) {
1415
+ void* arg, grpc_error_handle error) {
1366
1416
  Reporter* self = static_cast<Reporter*>(arg);
1367
- GRPC_ERROR_REF(error); // ref owned by lambda
1368
- self->xds_client()->work_serializer_->Run(
1369
- [self, error]() { self->OnNextReportTimerLocked(error); },
1370
- DEBUG_LOCATION);
1417
+ bool done;
1418
+ {
1419
+ MutexLock lock(&self->xds_client()->mu_);
1420
+ done = self->OnNextReportTimerLocked(GRPC_ERROR_REF(error));
1421
+ }
1422
+ if (done) self->Unref(DEBUG_LOCATION, "Reporter+timer");
1371
1423
  }
1372
1424
 
1373
- void XdsClient::ChannelState::LrsCallState::Reporter::OnNextReportTimerLocked(
1374
- grpc_error* error) {
1425
+ bool XdsClient::ChannelState::LrsCallState::Reporter::OnNextReportTimerLocked(
1426
+ grpc_error_handle error) {
1375
1427
  next_report_timer_callback_pending_ = false;
1376
1428
  if (error != GRPC_ERROR_NONE || !IsCurrentReporterOnCall()) {
1377
- Unref(DEBUG_LOCATION, "Reporter+timer");
1378
- } else {
1379
- SendReportLocked();
1429
+ GRPC_ERROR_UNREF(error);
1430
+ return true;
1380
1431
  }
1381
- GRPC_ERROR_UNREF(error);
1432
+ return SendReportLocked();
1382
1433
  }
1383
1434
 
1384
1435
  namespace {
@@ -1386,9 +1437,7 @@ namespace {
1386
1437
  bool LoadReportCountersAreZero(const XdsApi::ClusterLoadReportMap& snapshot) {
1387
1438
  for (const auto& p : snapshot) {
1388
1439
  const XdsApi::ClusterLoadReport& cluster_snapshot = p.second;
1389
- for (const auto& q : cluster_snapshot.dropped_requests) {
1390
- if (q.second > 0) return false;
1391
- }
1440
+ if (!cluster_snapshot.dropped_requests.IsZero()) return false;
1392
1441
  for (const auto& q : cluster_snapshot.locality_stats) {
1393
1442
  const XdsClusterLocalityStats::Snapshot& locality_snapshot = q.second;
1394
1443
  if (!locality_snapshot.IsZero()) return false;
@@ -1399,17 +1448,22 @@ bool LoadReportCountersAreZero(const XdsApi::ClusterLoadReportMap& snapshot) {
1399
1448
 
1400
1449
  } // namespace
1401
1450
 
1402
- void XdsClient::ChannelState::LrsCallState::Reporter::SendReportLocked() {
1451
+ bool XdsClient::ChannelState::LrsCallState::Reporter::SendReportLocked() {
1403
1452
  // Construct snapshot from all reported stats.
1404
- XdsApi::ClusterLoadReportMap snapshot = xds_client()->BuildLoadReportSnapshot(
1405
- parent_->send_all_clusters_, parent_->cluster_names_);
1453
+ XdsApi::ClusterLoadReportMap snapshot =
1454
+ xds_client()->BuildLoadReportSnapshotLocked(parent_->send_all_clusters_,
1455
+ parent_->cluster_names_);
1406
1456
  // Skip client load report if the counters were all zero in the last
1407
1457
  // report and they are still zero in this one.
1408
1458
  const bool old_val = last_report_counters_were_zero_;
1409
1459
  last_report_counters_were_zero_ = LoadReportCountersAreZero(snapshot);
1410
1460
  if (old_val && last_report_counters_were_zero_) {
1461
+ if (xds_client()->load_report_map_.empty()) {
1462
+ parent_->chand()->StopLrsCall();
1463
+ return true;
1464
+ }
1411
1465
  ScheduleNextReportLocked();
1412
- return;
1466
+ return false;
1413
1467
  }
1414
1468
  // Create a request that contains the snapshot.
1415
1469
  grpc_slice request_payload_slice =
@@ -1430,37 +1484,41 @@ void XdsClient::ChannelState::LrsCallState::Reporter::SendReportLocked() {
1430
1484
  xds_client(), this, call_error);
1431
1485
  GPR_ASSERT(GRPC_CALL_OK == call_error);
1432
1486
  }
1487
+ return false;
1433
1488
  }
1434
1489
 
1435
1490
  void XdsClient::ChannelState::LrsCallState::Reporter::OnReportDone(
1436
- void* arg, grpc_error* error) {
1491
+ void* arg, grpc_error_handle error) {
1437
1492
  Reporter* self = static_cast<Reporter*>(arg);
1438
- GRPC_ERROR_REF(error); // ref owned by lambda
1439
- self->xds_client()->work_serializer_->Run(
1440
- [self, error]() { self->OnReportDoneLocked(error); }, DEBUG_LOCATION);
1493
+ bool done;
1494
+ {
1495
+ MutexLock lock(&self->xds_client()->mu_);
1496
+ done = self->OnReportDoneLocked(GRPC_ERROR_REF(error));
1497
+ }
1498
+ if (done) self->Unref(DEBUG_LOCATION, "Reporter+report_done");
1441
1499
  }
1442
1500
 
1443
- void XdsClient::ChannelState::LrsCallState::Reporter::OnReportDoneLocked(
1444
- grpc_error* error) {
1501
+ bool XdsClient::ChannelState::LrsCallState::Reporter::OnReportDoneLocked(
1502
+ grpc_error_handle error) {
1445
1503
  grpc_byte_buffer_destroy(parent_->send_message_payload_);
1446
1504
  parent_->send_message_payload_ = nullptr;
1447
1505
  // If there are no more registered stats to report, cancel the call.
1448
1506
  if (xds_client()->load_report_map_.empty()) {
1449
1507
  parent_->chand()->StopLrsCall();
1450
- Unref(DEBUG_LOCATION, "Reporter+report_done+no_more_reporters");
1451
- return;
1508
+ GRPC_ERROR_UNREF(error);
1509
+ return true;
1452
1510
  }
1453
1511
  if (error != GRPC_ERROR_NONE || !IsCurrentReporterOnCall()) {
1512
+ GRPC_ERROR_UNREF(error);
1454
1513
  // If this reporter is no longer the current one on the call, the reason
1455
1514
  // might be that it was orphaned for a new one due to config update.
1456
1515
  if (!IsCurrentReporterOnCall()) {
1457
1516
  parent_->MaybeStartReportingLocked();
1458
1517
  }
1459
- Unref(DEBUG_LOCATION, "Reporter+report_done");
1460
- } else {
1461
- ScheduleNextReportLocked();
1518
+ return true;
1462
1519
  }
1463
- GRPC_ERROR_UNREF(error);
1520
+ ScheduleNextReportLocked();
1521
+ return false;
1464
1522
  }
1465
1523
 
1466
1524
  //
@@ -1469,22 +1527,27 @@ void XdsClient::ChannelState::LrsCallState::Reporter::OnReportDoneLocked(
1469
1527
 
1470
1528
  XdsClient::ChannelState::LrsCallState::LrsCallState(
1471
1529
  RefCountedPtr<RetryableCall<LrsCallState>> parent)
1472
- : InternallyRefCounted<LrsCallState>(&grpc_xds_client_trace),
1530
+ : InternallyRefCounted<LrsCallState>(
1531
+ GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_refcount_trace)
1532
+ ? "LrsCallState"
1533
+ : nullptr),
1473
1534
  parent_(std::move(parent)) {
1474
1535
  // Init the LRS call. Note that the call will progress every time there's
1475
1536
  // activity in xds_client()->interested_parties_, which is comprised of
1476
1537
  // the polling entities from client_channel.
1477
1538
  GPR_ASSERT(xds_client() != nullptr);
1478
- GPR_ASSERT(!xds_client()->server_name_.empty());
1539
+ const auto& method =
1540
+ chand()->server_.ShouldUseV3()
1541
+ ? GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V3_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS
1542
+ : GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V2_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS;
1479
1543
  call_ = grpc_channel_create_pollset_set_call(
1480
1544
  chand()->channel_, nullptr, GRPC_PROPAGATE_DEFAULTS,
1481
- xds_client()->interested_parties_,
1482
- GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V2_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS,
1483
- nullptr, GRPC_MILLIS_INF_FUTURE, nullptr);
1545
+ xds_client()->interested_parties_, method, nullptr,
1546
+ GRPC_MILLIS_INF_FUTURE, nullptr);
1484
1547
  GPR_ASSERT(call_ != nullptr);
1485
1548
  // Init the request payload.
1486
1549
  grpc_slice request_payload_slice =
1487
- xds_client()->api_.CreateLrsInitialRequest(xds_client()->server_name_);
1550
+ xds_client()->api_.CreateLrsInitialRequest(chand()->server_);
1488
1551
  send_message_payload_ =
1489
1552
  grpc_raw_byte_buffer_create(&request_payload_slice, 1);
1490
1553
  grpc_slice_unref_internal(request_payload_slice);
@@ -1520,8 +1583,8 @@ XdsClient::ChannelState::LrsCallState::LrsCallState(
1520
1583
  Ref(DEBUG_LOCATION, "LRS+OnInitialRequestSentLocked").release();
1521
1584
  GRPC_CLOSURE_INIT(&on_initial_request_sent_, OnInitialRequestSent, this,
1522
1585
  grpc_schedule_on_exec_ctx);
1523
- call_error = grpc_call_start_batch_and_execute(call_, ops, (size_t)(op - ops),
1524
- &on_initial_request_sent_);
1586
+ call_error = grpc_call_start_batch_and_execute(
1587
+ call_, ops, static_cast<size_t>(op - ops), &on_initial_request_sent_);
1525
1588
  GPR_ASSERT(GRPC_CALL_OK == call_error);
1526
1589
  // Op: recv initial metadata.
1527
1590
  op = ops;
@@ -1540,8 +1603,8 @@ XdsClient::ChannelState::LrsCallState::LrsCallState(
1540
1603
  Ref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked").release();
1541
1604
  GRPC_CLOSURE_INIT(&on_response_received_, OnResponseReceived, this,
1542
1605
  grpc_schedule_on_exec_ctx);
1543
- call_error = grpc_call_start_batch_and_execute(call_, ops, (size_t)(op - ops),
1544
- &on_response_received_);
1606
+ call_error = grpc_call_start_batch_and_execute(
1607
+ call_, ops, static_cast<size_t>(op - ops), &on_response_received_);
1545
1608
  GPR_ASSERT(GRPC_CALL_OK == call_error);
1546
1609
  // Op: recv server status.
1547
1610
  op = ops;
@@ -1557,8 +1620,8 @@ XdsClient::ChannelState::LrsCallState::LrsCallState(
1557
1620
  // unreffed.
1558
1621
  GRPC_CLOSURE_INIT(&on_status_received_, OnStatusReceived, this,
1559
1622
  grpc_schedule_on_exec_ctx);
1560
- call_error = grpc_call_start_batch_and_execute(call_, ops, (size_t)(op - ops),
1561
- &on_status_received_);
1623
+ call_error = grpc_call_start_batch_and_execute(
1624
+ call_, ops, static_cast<size_t>(op - ops), &on_status_received_);
1562
1625
  GPR_ASSERT(GRPC_CALL_OK == call_error);
1563
1626
  }
1564
1627
 
@@ -1579,7 +1642,7 @@ void XdsClient::ChannelState::LrsCallState::Orphan() {
1579
1642
  // on_status_received_ will complete the cancellation and clean up. Otherwise,
1580
1643
  // we are here because xds_client has to orphan a failed call, then the
1581
1644
  // following cancellation will be a no-op.
1582
- grpc_call_cancel(call_, nullptr);
1645
+ grpc_call_cancel_internal(call_);
1583
1646
  // Note that the initial ref is hold by on_status_received_. So the
1584
1647
  // corresponding unref happens in on_status_received_ instead of here.
1585
1648
  }
@@ -1606,11 +1669,13 @@ void XdsClient::ChannelState::LrsCallState::MaybeStartReportingLocked() {
1606
1669
  }
1607
1670
 
1608
1671
  void XdsClient::ChannelState::LrsCallState::OnInitialRequestSent(
1609
- void* arg, grpc_error* /*error*/) {
1672
+ void* arg, grpc_error_handle /*error*/) {
1610
1673
  LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
1611
- lrs_calld->xds_client()->work_serializer_->Run(
1612
- [lrs_calld]() { lrs_calld->OnInitialRequestSentLocked(); },
1613
- DEBUG_LOCATION);
1674
+ {
1675
+ MutexLock lock(&lrs_calld->xds_client()->mu_);
1676
+ lrs_calld->OnInitialRequestSentLocked();
1677
+ }
1678
+ lrs_calld->Unref(DEBUG_LOCATION, "LRS+OnInitialRequestSentLocked");
1614
1679
  }
1615
1680
 
1616
1681
  void XdsClient::ChannelState::LrsCallState::OnInitialRequestSentLocked() {
@@ -1618,21 +1683,23 @@ void XdsClient::ChannelState::LrsCallState::OnInitialRequestSentLocked() {
1618
1683
  grpc_byte_buffer_destroy(send_message_payload_);
1619
1684
  send_message_payload_ = nullptr;
1620
1685
  MaybeStartReportingLocked();
1621
- Unref(DEBUG_LOCATION, "LRS+OnInitialRequestSentLocked");
1622
1686
  }
1623
1687
 
1624
1688
  void XdsClient::ChannelState::LrsCallState::OnResponseReceived(
1625
- void* arg, grpc_error* /*error*/) {
1689
+ void* arg, grpc_error_handle /*error*/) {
1626
1690
  LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
1627
- lrs_calld->xds_client()->work_serializer_->Run(
1628
- [lrs_calld]() { lrs_calld->OnResponseReceivedLocked(); }, DEBUG_LOCATION);
1691
+ bool done;
1692
+ {
1693
+ MutexLock lock(&lrs_calld->xds_client()->mu_);
1694
+ done = lrs_calld->OnResponseReceivedLocked();
1695
+ }
1696
+ if (done) lrs_calld->Unref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked");
1629
1697
  }
1630
1698
 
1631
- void XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked() {
1699
+ bool XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked() {
1632
1700
  // Empty payload means the call was cancelled.
1633
1701
  if (!IsCurrentCallOnChannel() || recv_message_payload_ == nullptr) {
1634
- Unref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked");
1635
- return;
1702
+ return true;
1636
1703
  }
1637
1704
  // Read the response.
1638
1705
  grpc_byte_buffer_reader bbr;
@@ -1647,13 +1714,13 @@ void XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked() {
1647
1714
  bool send_all_clusters = false;
1648
1715
  std::set<std::string> new_cluster_names;
1649
1716
  grpc_millis new_load_reporting_interval;
1650
- grpc_error* parse_error = xds_client()->api_.ParseLrsResponse(
1717
+ grpc_error_handle parse_error = xds_client()->api_.ParseLrsResponse(
1651
1718
  response_slice, &send_all_clusters, &new_cluster_names,
1652
1719
  &new_load_reporting_interval);
1653
1720
  if (parse_error != GRPC_ERROR_NONE) {
1654
1721
  gpr_log(GPR_ERROR,
1655
1722
  "[xds_client %p] LRS response parsing failed. error=%s",
1656
- xds_client(), grpc_error_string(parse_error));
1723
+ xds_client(), grpc_error_std_string(parse_error).c_str());
1657
1724
  GRPC_ERROR_UNREF(parse_error);
1658
1725
  return;
1659
1726
  }
@@ -1705,10 +1772,7 @@ void XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked() {
1705
1772
  MaybeStartReportingLocked();
1706
1773
  }();
1707
1774
  grpc_slice_unref_internal(response_slice);
1708
- if (xds_client()->shutting_down_) {
1709
- Unref(DEBUG_LOCATION, "LRS+OnResponseReceivedLocked+xds_shutdown");
1710
- return;
1711
- }
1775
+ if (xds_client()->shutting_down_) return true;
1712
1776
  // Keep listening for LRS config updates.
1713
1777
  grpc_op op;
1714
1778
  memset(&op, 0, sizeof(op));
@@ -1721,19 +1785,21 @@ void XdsClient::ChannelState::LrsCallState::OnResponseReceivedLocked() {
1721
1785
  const grpc_call_error call_error =
1722
1786
  grpc_call_start_batch_and_execute(call_, &op, 1, &on_response_received_);
1723
1787
  GPR_ASSERT(GRPC_CALL_OK == call_error);
1788
+ return false;
1724
1789
  }
1725
1790
 
1726
1791
  void XdsClient::ChannelState::LrsCallState::OnStatusReceived(
1727
- void* arg, grpc_error* error) {
1792
+ void* arg, grpc_error_handle error) {
1728
1793
  LrsCallState* lrs_calld = static_cast<LrsCallState*>(arg);
1729
- GRPC_ERROR_REF(error); // ref owned by lambda
1730
- lrs_calld->xds_client()->work_serializer_->Run(
1731
- [lrs_calld, error]() { lrs_calld->OnStatusReceivedLocked(error); },
1732
- DEBUG_LOCATION);
1794
+ {
1795
+ MutexLock lock(&lrs_calld->xds_client()->mu_);
1796
+ lrs_calld->OnStatusReceivedLocked(GRPC_ERROR_REF(error));
1797
+ }
1798
+ lrs_calld->Unref(DEBUG_LOCATION, "LRS+OnStatusReceivedLocked");
1733
1799
  }
1734
1800
 
1735
1801
  void XdsClient::ChannelState::LrsCallState::OnStatusReceivedLocked(
1736
- grpc_error* error) {
1802
+ grpc_error_handle error) {
1737
1803
  GPR_ASSERT(call_ != nullptr);
1738
1804
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1739
1805
  char* status_details = grpc_slice_to_c_string(status_details_);
@@ -1741,7 +1807,7 @@ void XdsClient::ChannelState::LrsCallState::OnStatusReceivedLocked(
1741
1807
  "[xds_client %p] LRS call status received. Status = %d, details "
1742
1808
  "= '%s', (chand: %p, calld: %p, call: %p), error '%s'",
1743
1809
  xds_client(), status_code_, status_details, chand(), this, call_,
1744
- grpc_error_string(error));
1810
+ grpc_error_std_string(error).c_str());
1745
1811
  gpr_free(status_details);
1746
1812
  }
1747
1813
  // Ignore status from a stale call.
@@ -1750,7 +1816,6 @@ void XdsClient::ChannelState::LrsCallState::OnStatusReceivedLocked(
1750
1816
  // Try to restart the call.
1751
1817
  parent_->OnCallFinishedLocked();
1752
1818
  }
1753
- Unref(DEBUG_LOCATION, "LRS+OnStatusReceivedLocked");
1754
1819
  GRPC_ERROR_UNREF(error);
1755
1820
  }
1756
1821
 
@@ -1767,89 +1832,189 @@ bool XdsClient::ChannelState::LrsCallState::IsCurrentCallOnChannel() const {
1767
1832
 
1768
1833
  namespace {
1769
1834
 
1770
- grpc_millis GetRequestTimeout(const grpc_channel_args& args) {
1835
+ grpc_millis GetRequestTimeout(const grpc_channel_args* args) {
1771
1836
  return grpc_channel_args_find_integer(
1772
- &args, GRPC_ARG_XDS_RESOURCE_DOES_NOT_EXIST_TIMEOUT_MS,
1837
+ args, GRPC_ARG_XDS_RESOURCE_DOES_NOT_EXIST_TIMEOUT_MS,
1773
1838
  {15000, 0, INT_MAX});
1774
1839
  }
1775
1840
 
1841
+ grpc_channel_args* ModifyChannelArgs(const grpc_channel_args* args) {
1842
+ absl::InlinedVector<grpc_arg, 2> args_to_add = {
1843
+ grpc_channel_arg_integer_create(
1844
+ const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS),
1845
+ 5 * 60 * GPR_MS_PER_SEC),
1846
+ grpc_channel_arg_integer_create(
1847
+ const_cast<char*>(GRPC_ARG_CHANNELZ_IS_INTERNAL_CHANNEL), 1),
1848
+ };
1849
+ return grpc_channel_args_copy_and_add(args, args_to_add.data(),
1850
+ args_to_add.size());
1851
+ }
1852
+
1776
1853
  } // namespace
1777
1854
 
1778
- XdsClient::XdsClient(std::shared_ptr<WorkSerializer> work_serializer,
1779
- grpc_pollset_set* interested_parties,
1780
- absl::string_view server_name,
1781
- std::unique_ptr<ServiceConfigWatcherInterface> watcher,
1782
- const grpc_channel_args& channel_args, grpc_error** error)
1783
- : InternallyRefCounted<XdsClient>(&grpc_xds_client_trace),
1784
- request_timeout_(GetRequestTimeout(channel_args)),
1785
- work_serializer_(std::move(work_serializer)),
1786
- interested_parties_(interested_parties),
1787
- bootstrap_(
1788
- XdsBootstrap::ReadFromFile(this, &grpc_xds_client_trace, error)),
1789
- api_(this, &grpc_xds_client_trace,
1790
- bootstrap_ == nullptr ? nullptr : bootstrap_->node()),
1791
- server_name_(server_name),
1792
- service_config_watcher_(std::move(watcher)) {
1855
+ XdsClient::XdsClient(std::unique_ptr<XdsBootstrap> bootstrap,
1856
+ const grpc_channel_args* args)
1857
+ : DualRefCounted<XdsClient>(
1858
+ GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_refcount_trace) ? "XdsClient"
1859
+ : nullptr),
1860
+ bootstrap_(std::move(bootstrap)),
1861
+ args_(ModifyChannelArgs(args)),
1862
+ request_timeout_(GetRequestTimeout(args)),
1863
+ interested_parties_(grpc_pollset_set_create()),
1864
+ certificate_provider_store_(MakeOrphanable<CertificateProviderStore>(
1865
+ bootstrap_->certificate_providers())),
1866
+ api_(this, &grpc_xds_client_trace, bootstrap_->node(),
1867
+ &bootstrap_->certificate_providers()) {
1793
1868
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1794
1869
  gpr_log(GPR_INFO, "[xds_client %p] creating xds client", this);
1795
1870
  }
1796
- if (*error != GRPC_ERROR_NONE) {
1797
- gpr_log(GPR_ERROR, "[xds_client %p] failed to read bootstrap file: %s",
1798
- this, grpc_error_string(*error));
1799
- return;
1800
- }
1801
- if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1802
- gpr_log(GPR_INFO, "[xds_client %p] creating channel to %s", this,
1803
- bootstrap_->server().server_uri.c_str());
1804
- }
1805
- grpc_channel_args* new_args = BuildXdsChannelArgs(channel_args);
1806
- grpc_channel* channel = CreateXdsChannel(*bootstrap_, *new_args, error);
1807
- grpc_channel_args_destroy(new_args);
1808
- if (*error != GRPC_ERROR_NONE) {
1809
- gpr_log(GPR_ERROR, "[xds_client %p] failed to create xds channel: %s", this,
1810
- grpc_error_string(*error));
1811
- return;
1812
- }
1871
+ // Create ChannelState object.
1813
1872
  chand_ = MakeOrphanable<ChannelState>(
1814
- Ref(DEBUG_LOCATION, "XdsClient+ChannelState"), channel);
1815
- if (service_config_watcher_ != nullptr) {
1816
- chand_->Subscribe(XdsApi::kLdsTypeUrl, std::string(server_name));
1817
- }
1873
+ WeakRef(DEBUG_LOCATION, "XdsClient+ChannelState"), bootstrap_->server());
1818
1874
  }
1819
1875
 
1820
1876
  XdsClient::~XdsClient() {
1821
1877
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1822
1878
  gpr_log(GPR_INFO, "[xds_client %p] destroying xds client", this);
1823
1879
  }
1880
+ grpc_channel_args_destroy(args_);
1881
+ grpc_pollset_set_destroy(interested_parties_);
1882
+ }
1883
+
1884
+ void XdsClient::AddChannelzLinkage(
1885
+ channelz::ChannelNode* parent_channelz_node) {
1886
+ MutexLock lock(&mu_);
1887
+ channelz::ChannelNode* xds_channelz_node =
1888
+ grpc_channel_get_channelz_node(chand_->channel());
1889
+ if (xds_channelz_node != nullptr) {
1890
+ parent_channelz_node->AddChildChannel(xds_channelz_node->uuid());
1891
+ }
1892
+ }
1893
+
1894
+ void XdsClient::RemoveChannelzLinkage(
1895
+ channelz::ChannelNode* parent_channelz_node) {
1896
+ MutexLock lock(&mu_);
1897
+ channelz::ChannelNode* xds_channelz_node =
1898
+ grpc_channel_get_channelz_node(chand_->channel());
1899
+ if (xds_channelz_node != nullptr) {
1900
+ parent_channelz_node->RemoveChildChannel(xds_channelz_node->uuid());
1901
+ }
1824
1902
  }
1825
1903
 
1826
1904
  void XdsClient::Orphan() {
1827
1905
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1828
1906
  gpr_log(GPR_INFO, "[xds_client %p] shutting down xds client", this);
1829
1907
  }
1830
- shutting_down_ = true;
1831
- chand_.reset();
1832
- // We do not clear cluster_map_ and endpoint_map_ if the xds client was
1833
- // created by the XdsResolver because the maps contain refs for watchers which
1834
- // in turn hold refs to the loadbalancing policies. At this point, it is
1835
- // possible for ADS calls to be in progress. Unreffing the loadbalancing
1836
- // policies before those calls are done would lead to issues such as
1837
- // https://github.com/grpc/grpc/issues/20928.
1838
- if (service_config_watcher_ != nullptr) {
1839
- cluster_map_.clear();
1840
- endpoint_map_.clear();
1908
+ {
1909
+ MutexLock lock(g_mu);
1910
+ if (g_xds_client == this) g_xds_client = nullptr;
1911
+ }
1912
+ {
1913
+ MutexLock lock(&mu_);
1914
+ shutting_down_ = true;
1915
+ // Orphan ChannelState object.
1916
+ chand_.reset();
1917
+ // We do not clear cluster_map_ and endpoint_map_ if the xds client was
1918
+ // created by the XdsResolver because the maps contain refs for watchers
1919
+ // which in turn hold refs to the loadbalancing policies. At this point, it
1920
+ // is possible for ADS calls to be in progress. Unreffing the loadbalancing
1921
+ // policies before those calls are done would lead to issues such as
1922
+ // https://github.com/grpc/grpc/issues/20928.
1923
+ if (!listener_map_.empty()) {
1924
+ cluster_map_.clear();
1925
+ endpoint_map_.clear();
1926
+ }
1927
+ }
1928
+ }
1929
+
1930
+ void XdsClient::WatchListenerData(
1931
+ absl::string_view listener_name,
1932
+ std::unique_ptr<ListenerWatcherInterface> watcher) {
1933
+ std::string listener_name_str = std::string(listener_name);
1934
+ MutexLock lock(&mu_);
1935
+ ListenerState& listener_state = listener_map_[listener_name_str];
1936
+ ListenerWatcherInterface* w = watcher.get();
1937
+ listener_state.watchers[w] = std::move(watcher);
1938
+ // If we've already received an LDS update, notify the new watcher
1939
+ // immediately.
1940
+ if (listener_state.update.has_value()) {
1941
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1942
+ gpr_log(GPR_INFO, "[xds_client %p] returning cached listener data for %s",
1943
+ this, listener_name_str.c_str());
1944
+ }
1945
+ w->OnListenerChanged(*listener_state.update);
1946
+ }
1947
+ chand_->SubscribeLocked(XdsApi::kLdsTypeUrl, listener_name_str);
1948
+ }
1949
+
1950
+ void XdsClient::CancelListenerDataWatch(absl::string_view listener_name,
1951
+ ListenerWatcherInterface* watcher,
1952
+ bool delay_unsubscription) {
1953
+ MutexLock lock(&mu_);
1954
+ if (shutting_down_) return;
1955
+ std::string listener_name_str = std::string(listener_name);
1956
+ ListenerState& listener_state = listener_map_[listener_name_str];
1957
+ auto it = listener_state.watchers.find(watcher);
1958
+ if (it != listener_state.watchers.end()) {
1959
+ listener_state.watchers.erase(it);
1960
+ if (listener_state.watchers.empty()) {
1961
+ listener_map_.erase(listener_name_str);
1962
+ chand_->UnsubscribeLocked(XdsApi::kLdsTypeUrl, listener_name_str,
1963
+ delay_unsubscription);
1964
+ }
1965
+ }
1966
+ }
1967
+
1968
+ void XdsClient::WatchRouteConfigData(
1969
+ absl::string_view route_config_name,
1970
+ std::unique_ptr<RouteConfigWatcherInterface> watcher) {
1971
+ std::string route_config_name_str = std::string(route_config_name);
1972
+ MutexLock lock(&mu_);
1973
+ RouteConfigState& route_config_state =
1974
+ route_config_map_[route_config_name_str];
1975
+ RouteConfigWatcherInterface* w = watcher.get();
1976
+ route_config_state.watchers[w] = std::move(watcher);
1977
+ // If we've already received an RDS update, notify the new watcher
1978
+ // immediately.
1979
+ if (route_config_state.update.has_value()) {
1980
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1981
+ gpr_log(GPR_INFO,
1982
+ "[xds_client %p] returning cached route config data for %s", this,
1983
+ route_config_name_str.c_str());
1984
+ }
1985
+ w->OnRouteConfigChanged(*route_config_state.update);
1986
+ }
1987
+ chand_->SubscribeLocked(XdsApi::kRdsTypeUrl, route_config_name_str);
1988
+ }
1989
+
1990
+ void XdsClient::CancelRouteConfigDataWatch(absl::string_view route_config_name,
1991
+ RouteConfigWatcherInterface* watcher,
1992
+ bool delay_unsubscription) {
1993
+ MutexLock lock(&mu_);
1994
+ if (shutting_down_) return;
1995
+ std::string route_config_name_str = std::string(route_config_name);
1996
+ RouteConfigState& route_config_state =
1997
+ route_config_map_[route_config_name_str];
1998
+ auto it = route_config_state.watchers.find(watcher);
1999
+ if (it != route_config_state.watchers.end()) {
2000
+ route_config_state.watchers.erase(it);
2001
+ if (route_config_state.watchers.empty()) {
2002
+ route_config_map_.erase(route_config_name_str);
2003
+ chand_->UnsubscribeLocked(XdsApi::kRdsTypeUrl, route_config_name_str,
2004
+ delay_unsubscription);
2005
+ }
1841
2006
  }
1842
- Unref(DEBUG_LOCATION, "XdsClient::Orphan()");
1843
2007
  }
1844
2008
 
1845
2009
  void XdsClient::WatchClusterData(
1846
2010
  absl::string_view cluster_name,
1847
2011
  std::unique_ptr<ClusterWatcherInterface> watcher) {
1848
2012
  std::string cluster_name_str = std::string(cluster_name);
2013
+ MutexLock lock(&mu_);
1849
2014
  ClusterState& cluster_state = cluster_map_[cluster_name_str];
1850
2015
  ClusterWatcherInterface* w = watcher.get();
1851
2016
  cluster_state.watchers[w] = std::move(watcher);
1852
- // If we've already received an CDS update, notify the new watcher
2017
+ // If we've already received a CDS update, notify the new watcher
1853
2018
  // immediately.
1854
2019
  if (cluster_state.update.has_value()) {
1855
2020
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
@@ -1858,12 +2023,13 @@ void XdsClient::WatchClusterData(
1858
2023
  }
1859
2024
  w->OnClusterChanged(cluster_state.update.value());
1860
2025
  }
1861
- chand_->Subscribe(XdsApi::kCdsTypeUrl, cluster_name_str);
2026
+ chand_->SubscribeLocked(XdsApi::kCdsTypeUrl, cluster_name_str);
1862
2027
  }
1863
2028
 
1864
2029
  void XdsClient::CancelClusterDataWatch(absl::string_view cluster_name,
1865
2030
  ClusterWatcherInterface* watcher,
1866
2031
  bool delay_unsubscription) {
2032
+ MutexLock lock(&mu_);
1867
2033
  if (shutting_down_) return;
1868
2034
  std::string cluster_name_str = std::string(cluster_name);
1869
2035
  ClusterState& cluster_state = cluster_map_[cluster_name_str];
@@ -1872,8 +2038,8 @@ void XdsClient::CancelClusterDataWatch(absl::string_view cluster_name,
1872
2038
  cluster_state.watchers.erase(it);
1873
2039
  if (cluster_state.watchers.empty()) {
1874
2040
  cluster_map_.erase(cluster_name_str);
1875
- chand_->Unsubscribe(XdsApi::kCdsTypeUrl, cluster_name_str,
1876
- delay_unsubscription);
2041
+ chand_->UnsubscribeLocked(XdsApi::kCdsTypeUrl, cluster_name_str,
2042
+ delay_unsubscription);
1877
2043
  }
1878
2044
  }
1879
2045
  }
@@ -1882,6 +2048,7 @@ void XdsClient::WatchEndpointData(
1882
2048
  absl::string_view eds_service_name,
1883
2049
  std::unique_ptr<EndpointWatcherInterface> watcher) {
1884
2050
  std::string eds_service_name_str = std::string(eds_service_name);
2051
+ MutexLock lock(&mu_);
1885
2052
  EndpointState& endpoint_state = endpoint_map_[eds_service_name_str];
1886
2053
  EndpointWatcherInterface* w = watcher.get();
1887
2054
  endpoint_state.watchers[w] = std::move(watcher);
@@ -1894,12 +2061,13 @@ void XdsClient::WatchEndpointData(
1894
2061
  }
1895
2062
  w->OnEndpointChanged(endpoint_state.update.value());
1896
2063
  }
1897
- chand_->Subscribe(XdsApi::kEdsTypeUrl, eds_service_name_str);
2064
+ chand_->SubscribeLocked(XdsApi::kEdsTypeUrl, eds_service_name_str);
1898
2065
  }
1899
2066
 
1900
2067
  void XdsClient::CancelEndpointDataWatch(absl::string_view eds_service_name,
1901
2068
  EndpointWatcherInterface* watcher,
1902
2069
  bool delay_unsubscription) {
2070
+ MutexLock lock(&mu_);
1903
2071
  if (shutting_down_) return;
1904
2072
  std::string eds_service_name_str = std::string(eds_service_name);
1905
2073
  EndpointState& endpoint_state = endpoint_map_[eds_service_name_str];
@@ -1908,8 +2076,8 @@ void XdsClient::CancelEndpointDataWatch(absl::string_view eds_service_name,
1908
2076
  endpoint_state.watchers.erase(it);
1909
2077
  if (endpoint_state.watchers.empty()) {
1910
2078
  endpoint_map_.erase(eds_service_name_str);
1911
- chand_->Unsubscribe(XdsApi::kEdsTypeUrl, eds_service_name_str,
1912
- delay_unsubscription);
2079
+ chand_->UnsubscribeLocked(XdsApi::kEdsTypeUrl, eds_service_name_str,
2080
+ delay_unsubscription);
1913
2081
  }
1914
2082
  }
1915
2083
  }
@@ -1921,16 +2089,29 @@ RefCountedPtr<XdsClusterDropStats> XdsClient::AddClusterDropStats(
1921
2089
  // server name specified in lrs_server.
1922
2090
  auto key =
1923
2091
  std::make_pair(std::string(cluster_name), std::string(eds_service_name));
2092
+ MutexLock lock(&mu_);
1924
2093
  // We jump through some hoops here to make sure that the absl::string_views
1925
2094
  // stored in the XdsClusterDropStats object point to the strings
1926
2095
  // in the load_report_map_ key, so that they have the same lifetime.
1927
2096
  auto it = load_report_map_
1928
2097
  .emplace(std::make_pair(std::move(key), LoadReportState()))
1929
2098
  .first;
1930
- auto cluster_drop_stats = MakeRefCounted<XdsClusterDropStats>(
1931
- Ref(DEBUG_LOCATION, "DropStats"), lrs_server,
1932
- it->first.first /*cluster_name*/, it->first.second /*eds_service_name*/);
1933
- it->second.drop_stats.insert(cluster_drop_stats.get());
2099
+ LoadReportState& load_report_state = it->second;
2100
+ RefCountedPtr<XdsClusterDropStats> cluster_drop_stats;
2101
+ if (load_report_state.drop_stats != nullptr) {
2102
+ cluster_drop_stats = load_report_state.drop_stats->RefIfNonZero();
2103
+ }
2104
+ if (cluster_drop_stats == nullptr) {
2105
+ if (load_report_state.drop_stats != nullptr) {
2106
+ load_report_state.deleted_drop_stats +=
2107
+ load_report_state.drop_stats->GetSnapshotAndReset();
2108
+ }
2109
+ cluster_drop_stats = MakeRefCounted<XdsClusterDropStats>(
2110
+ Ref(DEBUG_LOCATION, "DropStats"), lrs_server,
2111
+ it->first.first /*cluster_name*/,
2112
+ it->first.second /*eds_service_name*/);
2113
+ load_report_state.drop_stats = cluster_drop_stats.get();
2114
+ }
1934
2115
  chand_->MaybeStartLrsCall();
1935
2116
  return cluster_drop_stats;
1936
2117
  }
@@ -1939,20 +2120,19 @@ void XdsClient::RemoveClusterDropStats(
1939
2120
  absl::string_view /*lrs_server*/, absl::string_view cluster_name,
1940
2121
  absl::string_view eds_service_name,
1941
2122
  XdsClusterDropStats* cluster_drop_stats) {
1942
- auto load_report_it = load_report_map_.find(
1943
- std::make_pair(std::string(cluster_name), std::string(eds_service_name)));
1944
- if (load_report_it == load_report_map_.end()) return;
1945
- LoadReportState& load_report_state = load_report_it->second;
2123
+ MutexLock lock(&mu_);
1946
2124
  // TODO(roth): When we add support for direct federation, use the
1947
2125
  // server name specified in lrs_server.
1948
- auto it = load_report_state.drop_stats.find(cluster_drop_stats);
1949
- if (it != load_report_state.drop_stats.end()) {
1950
- // Record final drop stats in deleted_drop_stats, which will be
2126
+ auto it = load_report_map_.find(
2127
+ std::make_pair(std::string(cluster_name), std::string(eds_service_name)));
2128
+ if (it == load_report_map_.end()) return;
2129
+ LoadReportState& load_report_state = it->second;
2130
+ if (load_report_state.drop_stats == cluster_drop_stats) {
2131
+ // Record final snapshot in deleted_drop_stats, which will be
1951
2132
  // added to the next load report.
1952
- for (const auto& p : cluster_drop_stats->GetSnapshotAndReset()) {
1953
- load_report_state.deleted_drop_stats[p.first] += p.second;
1954
- }
1955
- load_report_state.drop_stats.erase(it);
2133
+ load_report_state.deleted_drop_stats +=
2134
+ load_report_state.drop_stats->GetSnapshotAndReset();
2135
+ load_report_state.drop_stats = nullptr;
1956
2136
  }
1957
2137
  }
1958
2138
 
@@ -1964,18 +2144,31 @@ RefCountedPtr<XdsClusterLocalityStats> XdsClient::AddClusterLocalityStats(
1964
2144
  // server name specified in lrs_server.
1965
2145
  auto key =
1966
2146
  std::make_pair(std::string(cluster_name), std::string(eds_service_name));
2147
+ MutexLock lock(&mu_);
1967
2148
  // We jump through some hoops here to make sure that the absl::string_views
1968
2149
  // stored in the XdsClusterLocalityStats object point to the strings
1969
2150
  // in the load_report_map_ key, so that they have the same lifetime.
1970
2151
  auto it = load_report_map_
1971
2152
  .emplace(std::make_pair(std::move(key), LoadReportState()))
1972
2153
  .first;
1973
- auto cluster_locality_stats = MakeRefCounted<XdsClusterLocalityStats>(
1974
- Ref(DEBUG_LOCATION, "LocalityStats"), lrs_server,
1975
- it->first.first /*cluster_name*/, it->first.second /*eds_service_name*/,
1976
- locality);
1977
- it->second.locality_stats[std::move(locality)].locality_stats.insert(
1978
- cluster_locality_stats.get());
2154
+ LoadReportState& load_report_state = it->second;
2155
+ LoadReportState::LocalityState& locality_state =
2156
+ load_report_state.locality_stats[locality];
2157
+ RefCountedPtr<XdsClusterLocalityStats> cluster_locality_stats;
2158
+ if (locality_state.locality_stats != nullptr) {
2159
+ cluster_locality_stats = locality_state.locality_stats->RefIfNonZero();
2160
+ }
2161
+ if (cluster_locality_stats == nullptr) {
2162
+ if (locality_state.locality_stats != nullptr) {
2163
+ locality_state.deleted_locality_stats +=
2164
+ locality_state.locality_stats->GetSnapshotAndReset();
2165
+ }
2166
+ cluster_locality_stats = MakeRefCounted<XdsClusterLocalityStats>(
2167
+ Ref(DEBUG_LOCATION, "LocalityStats"), lrs_server,
2168
+ it->first.first /*cluster_name*/, it->first.second /*eds_service_name*/,
2169
+ std::move(locality));
2170
+ locality_state.locality_stats = cluster_locality_stats.get();
2171
+ }
1979
2172
  chand_->MaybeStartLrsCall();
1980
2173
  return cluster_locality_stats;
1981
2174
  }
@@ -1985,263 +2178,65 @@ void XdsClient::RemoveClusterLocalityStats(
1985
2178
  absl::string_view eds_service_name,
1986
2179
  const RefCountedPtr<XdsLocalityName>& locality,
1987
2180
  XdsClusterLocalityStats* cluster_locality_stats) {
1988
- auto load_report_it = load_report_map_.find(
1989
- std::make_pair(std::string(cluster_name), std::string(eds_service_name)));
1990
- if (load_report_it == load_report_map_.end()) return;
1991
- LoadReportState& load_report_state = load_report_it->second;
2181
+ MutexLock lock(&mu_);
1992
2182
  // TODO(roth): When we add support for direct federation, use the
1993
2183
  // server name specified in lrs_server.
2184
+ auto it = load_report_map_.find(
2185
+ std::make_pair(std::string(cluster_name), std::string(eds_service_name)));
2186
+ if (it == load_report_map_.end()) return;
2187
+ LoadReportState& load_report_state = it->second;
1994
2188
  auto locality_it = load_report_state.locality_stats.find(locality);
1995
2189
  if (locality_it == load_report_state.locality_stats.end()) return;
1996
- auto& locality_set = locality_it->second.locality_stats;
1997
- auto it = locality_set.find(cluster_locality_stats);
1998
- if (it != locality_set.end()) {
2190
+ LoadReportState::LocalityState& locality_state = locality_it->second;
2191
+ if (locality_state.locality_stats == cluster_locality_stats) {
1999
2192
  // Record final snapshot in deleted_locality_stats, which will be
2000
2193
  // added to the next load report.
2001
- locality_it->second.deleted_locality_stats.emplace_back(
2002
- cluster_locality_stats->GetSnapshotAndReset());
2003
- locality_set.erase(it);
2194
+ locality_state.deleted_locality_stats +=
2195
+ locality_state.locality_stats->GetSnapshotAndReset();
2196
+ locality_state.locality_stats = nullptr;
2004
2197
  }
2005
2198
  }
2006
2199
 
2007
2200
  void XdsClient::ResetBackoff() {
2201
+ MutexLock lock(&mu_);
2008
2202
  if (chand_ != nullptr) {
2009
2203
  grpc_channel_reset_connect_backoff(chand_->channel());
2010
2204
  }
2011
2205
  }
2012
2206
 
2013
- namespace {
2014
- std::string CreateServiceConfigActionCluster(const std::string& cluster_name) {
2015
- return absl::StrFormat(
2016
- " \"cds:%s\":{\n"
2017
- " \"childPolicy\":[ {\n"
2018
- " \"cds_experimental\":{\n"
2019
- " \"cluster\": \"%s\"\n"
2020
- " }\n"
2021
- " } ]\n"
2022
- " }",
2023
- cluster_name, cluster_name);
2024
- }
2025
-
2026
- std::string CreateServiceConfigRoute(const std::string& action_name,
2027
- const std::string& service,
2028
- const std::string& method) {
2029
- return absl::StrFormat(
2030
- " { \n"
2031
- " \"methodName\": {\n"
2032
- " \"service\": \"%s\",\n"
2033
- " \"method\": \"%s\"\n"
2034
- " },\n"
2035
- " \"action\": \"%s\"\n"
2036
- " }",
2037
- service, method, action_name);
2038
- }
2039
-
2040
- // Create the service config for one weighted cluster.
2041
- std::string CreateServiceConfigActionWeightedCluster(
2042
- const std::string& name,
2043
- const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>& clusters) {
2044
- std::vector<std::string> config_parts;
2045
- config_parts.push_back(
2046
- absl::StrFormat(" \"weighted:%s\":{\n"
2047
- " \"childPolicy\":[ {\n"
2048
- " \"weighted_target_experimental\":{\n"
2049
- " \"targets\":{\n",
2050
- name));
2051
- std::vector<std::string> weighted_targets;
2052
- weighted_targets.reserve(clusters.size());
2053
- for (const auto& cluster_weight : clusters) {
2054
- weighted_targets.push_back(absl::StrFormat(
2055
- " \"%s\":{\n"
2056
- " \"weight\":%d,\n"
2057
- " \"childPolicy\":[ {\n"
2058
- " \"cds_experimental\":{\n"
2059
- " \"cluster\": \"%s\"\n"
2060
- " }\n"
2061
- " } ]\n"
2062
- " }",
2063
- cluster_weight.name, cluster_weight.weight, cluster_weight.name));
2064
- }
2065
- config_parts.push_back(absl::StrJoin(weighted_targets, ",\n"));
2066
- config_parts.push_back(
2067
- " }\n"
2068
- " }\n"
2069
- " } ]\n"
2070
- " }");
2071
- return absl::StrJoin(config_parts, "");
2072
- }
2073
-
2074
- struct WeightedClustersKeys {
2075
- std::string cluster_names_key;
2076
- std::string cluster_weights_key;
2077
- };
2078
-
2079
- // Returns the cluster names and weights key or the cluster names only key.
2080
- WeightedClustersKeys GetWeightedClustersKey(
2081
- const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>&
2082
- weighted_clusters) {
2083
- std::set<std::string> cluster_names;
2084
- std::set<std::string> cluster_weights;
2085
- for (const auto& cluster_weight : weighted_clusters) {
2086
- cluster_names.emplace(absl::StrFormat("%s", cluster_weight.name));
2087
- cluster_weights.emplace(
2088
- absl::StrFormat("%s_%d", cluster_weight.name, cluster_weight.weight));
2207
+ void XdsClient::NotifyOnErrorLocked(grpc_error_handle error) {
2208
+ for (const auto& p : listener_map_) {
2209
+ const ListenerState& listener_state = p.second;
2210
+ for (const auto& p : listener_state.watchers) {
2211
+ p.first->OnError(GRPC_ERROR_REF(error));
2212
+ }
2089
2213
  }
2090
- return {absl::StrJoin(cluster_names, "_"),
2091
- absl::StrJoin(cluster_weights, "_")};
2092
- }
2093
-
2094
- } // namespace
2095
-
2096
- std::string XdsClient::WeightedClustersActionName(
2097
- const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>&
2098
- weighted_clusters) {
2099
- WeightedClustersKeys keys = GetWeightedClustersKey(weighted_clusters);
2100
- auto cluster_names_map_it =
2101
- weighted_cluster_index_map_.find(keys.cluster_names_key);
2102
- GPR_ASSERT(cluster_names_map_it != weighted_cluster_index_map_.end());
2103
- const auto& cluster_weights_map =
2104
- cluster_names_map_it->second.cluster_weights_map;
2105
- auto cluster_weights_map_it =
2106
- cluster_weights_map.find(keys.cluster_weights_key);
2107
- GPR_ASSERT(cluster_weights_map_it != cluster_weights_map.end());
2108
- return absl::StrFormat("%s_%d", keys.cluster_names_key,
2109
- cluster_weights_map_it->second);
2110
- }
2111
-
2112
- void XdsClient::UpdateWeightedClusterIndexMap(
2113
- const XdsApi::RdsUpdate& rds_update) {
2114
- // Construct a list of unique WeightedCluster
2115
- // actions which we need to process: to find action names
2116
- std::map<std::string /* cluster_weights_key */,
2117
- std::string /* cluster_names_key */>
2118
- actions_to_process;
2119
- for (const auto& route : rds_update.routes) {
2120
- if (!route.weighted_clusters.empty()) {
2121
- WeightedClustersKeys keys =
2122
- GetWeightedClustersKey(route.weighted_clusters);
2123
- auto action_it = actions_to_process.find(keys.cluster_weights_key);
2124
- if (action_it == actions_to_process.end()) {
2125
- actions_to_process[std::move(keys.cluster_weights_key)] =
2126
- std::move(keys.cluster_names_key);
2127
- }
2214
+ for (const auto& p : route_config_map_) {
2215
+ const RouteConfigState& route_config_state = p.second;
2216
+ for (const auto& p : route_config_state.watchers) {
2217
+ p.first->OnError(GRPC_ERROR_REF(error));
2128
2218
  }
2129
2219
  }
2130
- // First pass of all unique WeightedCluster actions: if the exact same
2131
- // weighted target policy (same clusters and weights) appears in the old map,
2132
- // then that old action name is taken again and should be moved to the new
2133
- // map; any other action names from the old set of actions are candidates for
2134
- // reuse.
2135
- XdsClient::WeightedClusterIndexMap new_weighted_cluster_index_map;
2136
- for (auto action_it = actions_to_process.begin();
2137
- action_it != actions_to_process.end();) {
2138
- const std::string& cluster_names_key = action_it->second;
2139
- const std::string& cluster_weights_key = action_it->first;
2140
- auto old_cluster_names_map_it =
2141
- weighted_cluster_index_map_.find(cluster_names_key);
2142
- if (old_cluster_names_map_it != weighted_cluster_index_map_.end()) {
2143
- // Add cluster_names_key to the new map and copy next_index.
2144
- auto& new_cluster_names_info =
2145
- new_weighted_cluster_index_map[cluster_names_key];
2146
- new_cluster_names_info.next_index =
2147
- old_cluster_names_map_it->second.next_index;
2148
- // Lookup cluster_weights_key in old map.
2149
- auto& old_cluster_weights_map =
2150
- old_cluster_names_map_it->second.cluster_weights_map;
2151
- auto old_cluster_weights_map_it =
2152
- old_cluster_weights_map.find(cluster_weights_key);
2153
- if (old_cluster_weights_map_it != old_cluster_weights_map.end()) {
2154
- // same policy found, move from old map to new map.
2155
- new_cluster_names_info.cluster_weights_map[cluster_weights_key] =
2156
- old_cluster_weights_map_it->second;
2157
- old_cluster_weights_map.erase(old_cluster_weights_map_it);
2158
- // This action has been added to new map, so no need to process it
2159
- // again.
2160
- action_it = actions_to_process.erase(action_it);
2161
- continue;
2162
- }
2220
+ for (const auto& p : cluster_map_) {
2221
+ const ClusterState& cluster_state = p.second;
2222
+ for (const auto& p : cluster_state.watchers) {
2223
+ p.first->OnError(GRPC_ERROR_REF(error));
2163
2224
  }
2164
- ++action_it;
2165
- }
2166
- // Second pass of all remaining unique WeightedCluster actions: if clusters
2167
- // for a new action are the same as an old unused action, reuse the name. If
2168
- // clusters differ, use a brand new name.
2169
- for (const auto& action : actions_to_process) {
2170
- const std::string& cluster_names_key = action.second;
2171
- const std::string& cluster_weights_key = action.first;
2172
- auto& new_cluster_names_info =
2173
- new_weighted_cluster_index_map[cluster_names_key];
2174
- auto& old_cluster_weights_map =
2175
- weighted_cluster_index_map_[cluster_names_key].cluster_weights_map;
2176
- auto old_cluster_weights_it = old_cluster_weights_map.begin();
2177
- if (old_cluster_weights_it != old_cluster_weights_map.end()) {
2178
- // There is something to reuse: this action uses the same set
2179
- // of clusters as a previous action and that action name is not
2180
- // already taken.
2181
- new_cluster_names_info.cluster_weights_map[cluster_weights_key] =
2182
- old_cluster_weights_it->second;
2183
- // Remove the name from being able to reuse again.
2184
- old_cluster_weights_map.erase(old_cluster_weights_it);
2185
- } else {
2186
- // There is nothing to reuse, take the next index to use and
2187
- // increment.
2188
- new_cluster_names_info.cluster_weights_map[cluster_weights_key] =
2189
- new_cluster_names_info.next_index++;
2190
- }
2191
- }
2192
- weighted_cluster_index_map_ = std::move(new_weighted_cluster_index_map);
2193
- }
2194
-
2195
- grpc_error* XdsClient::CreateServiceConfig(
2196
- const XdsApi::RdsUpdate& rds_update,
2197
- RefCountedPtr<ServiceConfig>* service_config) {
2198
- UpdateWeightedClusterIndexMap(rds_update);
2199
- std::vector<std::string> actions_vector;
2200
- std::vector<std::string> route_table;
2201
- std::set<std::string> actions_set;
2202
- for (const auto& route : rds_update.routes) {
2203
- const std::string action_name =
2204
- route.weighted_clusters.empty()
2205
- ? route.cluster_name
2206
- : WeightedClustersActionName(route.weighted_clusters);
2207
- if (actions_set.find(action_name) == actions_set.end()) {
2208
- actions_set.emplace(action_name);
2209
- actions_vector.push_back(
2210
- route.weighted_clusters.empty()
2211
- ? CreateServiceConfigActionCluster(action_name)
2212
- : CreateServiceConfigActionWeightedCluster(
2213
- action_name, route.weighted_clusters));
2214
- }
2215
- route_table.push_back(CreateServiceConfigRoute(
2216
- absl::StrFormat("%s:%s",
2217
- route.weighted_clusters.empty() ? "cds" : "weighted",
2218
- action_name),
2219
- route.service, route.method));
2220
- }
2221
- std::vector<std::string> config_parts;
2222
- config_parts.push_back(
2223
- "{\n"
2224
- " \"loadBalancingConfig\":[\n"
2225
- " { \"xds_routing_experimental\":{\n"
2226
- " \"actions\":{\n");
2227
- config_parts.push_back(absl::StrJoin(actions_vector, ",\n"));
2228
- config_parts.push_back(
2229
- " },\n"
2230
- " \"routes\":[\n");
2231
- config_parts.push_back(absl::StrJoin(route_table, ",\n"));
2232
- config_parts.push_back(
2233
- " ]\n"
2234
- " } }\n"
2235
- " ]\n"
2236
- "}");
2237
- std::string json = absl::StrJoin(config_parts, "");
2238
- grpc_error* error = GRPC_ERROR_NONE;
2239
- *service_config = ServiceConfig::Create(json.c_str(), &error);
2240
- return error;
2241
- }
2242
-
2243
- XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshot(
2225
+ }
2226
+ for (const auto& p : endpoint_map_) {
2227
+ const EndpointState& endpoint_state = p.second;
2228
+ for (const auto& p : endpoint_state.watchers) {
2229
+ p.first->OnError(GRPC_ERROR_REF(error));
2230
+ }
2231
+ }
2232
+ GRPC_ERROR_UNREF(error);
2233
+ }
2234
+
2235
+ XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshotLocked(
2244
2236
  bool send_all_clusters, const std::set<std::string>& clusters) {
2237
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
2238
+ gpr_log(GPR_INFO, "[xds_client %p] start building load report", this);
2239
+ }
2245
2240
  XdsApi::ClusterLoadReportMap snapshot_map;
2246
2241
  for (auto load_report_it = load_report_map_.begin();
2247
2242
  load_report_it != load_report_map_.end();) {
@@ -2260,9 +2255,14 @@ XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshot(
2260
2255
  XdsApi::ClusterLoadReport snapshot;
2261
2256
  // Aggregate drop stats.
2262
2257
  snapshot.dropped_requests = std::move(load_report.deleted_drop_stats);
2263
- for (auto& drop_stats : load_report.drop_stats) {
2264
- for (const auto& p : drop_stats->GetSnapshotAndReset()) {
2265
- snapshot.dropped_requests[p.first] += p.second;
2258
+ if (load_report.drop_stats != nullptr) {
2259
+ snapshot.dropped_requests +=
2260
+ load_report.drop_stats->GetSnapshotAndReset();
2261
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
2262
+ gpr_log(GPR_INFO,
2263
+ "[xds_client %p] cluster=%s eds_service_name=%s drop_stats=%p",
2264
+ this, cluster_key.first.c_str(), cluster_key.second.c_str(),
2265
+ load_report.drop_stats);
2266
2266
  }
2267
2267
  }
2268
2268
  // Aggregate locality stats.
@@ -2272,34 +2272,39 @@ XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshot(
2272
2272
  auto& locality_state = it->second;
2273
2273
  XdsClusterLocalityStats::Snapshot& locality_snapshot =
2274
2274
  snapshot.locality_stats[locality_name];
2275
- for (auto& locality_stats : locality_state.locality_stats) {
2276
- locality_snapshot += locality_stats->GetSnapshotAndReset();
2277
- }
2278
- // Add final snapshots from recently deleted locality stats objects.
2279
- for (auto& deleted_locality_stats :
2280
- locality_state.deleted_locality_stats) {
2281
- locality_snapshot += deleted_locality_stats;
2275
+ locality_snapshot = std::move(locality_state.deleted_locality_stats);
2276
+ if (locality_state.locality_stats != nullptr) {
2277
+ locality_snapshot +=
2278
+ locality_state.locality_stats->GetSnapshotAndReset();
2279
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
2280
+ gpr_log(GPR_INFO,
2281
+ "[xds_client %p] cluster=%s eds_service_name=%s "
2282
+ "locality=%s locality_stats=%p",
2283
+ this, cluster_key.first.c_str(), cluster_key.second.c_str(),
2284
+ locality_name->AsHumanReadableString().c_str(),
2285
+ locality_state.locality_stats);
2286
+ }
2282
2287
  }
2283
- locality_state.deleted_locality_stats.clear();
2284
2288
  // If the only thing left in this entry was final snapshots from
2285
2289
  // deleted locality stats objects, remove the entry.
2286
- if (locality_state.locality_stats.empty()) {
2290
+ if (locality_state.locality_stats == nullptr) {
2287
2291
  it = load_report.locality_stats.erase(it);
2288
2292
  } else {
2289
2293
  ++it;
2290
2294
  }
2291
2295
  }
2296
+ // Compute load report interval.
2297
+ const grpc_millis now = ExecCtx::Get()->Now();
2298
+ snapshot.load_report_interval = now - load_report.last_report_time;
2299
+ load_report.last_report_time = now;
2300
+ // Record snapshot.
2292
2301
  if (record_stats) {
2293
- // Compute load report interval.
2294
- const grpc_millis now = ExecCtx::Get()->Now();
2295
- snapshot.load_report_interval = now - load_report.last_report_time;
2296
- load_report.last_report_time = now;
2297
- // Record snapshot.
2298
2302
  snapshot_map[cluster_key] = std::move(snapshot);
2299
2303
  }
2300
2304
  // If the only thing left in this entry was final snapshots from
2301
2305
  // deleted stats objects, remove the entry.
2302
- if (load_report.locality_stats.empty() && load_report.drop_stats.empty()) {
2306
+ if (load_report.locality_stats.empty() &&
2307
+ load_report.drop_stats == nullptr) {
2303
2308
  load_report_it = load_report_map_.erase(load_report_it);
2304
2309
  } else {
2305
2310
  ++load_report_it;
@@ -2308,60 +2313,227 @@ XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshot(
2308
2313
  return snapshot_map;
2309
2314
  }
2310
2315
 
2311
- void XdsClient::NotifyOnError(grpc_error* error) {
2312
- if (service_config_watcher_ != nullptr) {
2313
- service_config_watcher_->OnError(GRPC_ERROR_REF(error));
2316
+ std::string XdsClient::DumpClientConfigBinary() {
2317
+ MutexLock lock(&mu_);
2318
+ XdsApi::ResourceTypeMetadataMap resource_type_metadata_map;
2319
+ // Update per-xds-type version if available, this version corresponding to the
2320
+ // last successful ADS update version.
2321
+ for (auto& p : resource_version_map_) {
2322
+ resource_type_metadata_map[p.first].version = p.second;
2314
2323
  }
2315
- for (const auto& p : cluster_map_) {
2316
- const ClusterState& cluster_state = p.second;
2317
- for (const auto& p : cluster_state.watchers) {
2318
- p.first->OnError(GRPC_ERROR_REF(error));
2324
+ // Collect resource metadata from listeners
2325
+ auto& lds_map =
2326
+ resource_type_metadata_map[XdsApi::kLdsTypeUrl].resource_metadata_map;
2327
+ for (auto& p : listener_map_) {
2328
+ lds_map[p.first] = &p.second.meta;
2329
+ }
2330
+ // Collect resource metadata from route configs
2331
+ auto& rds_map =
2332
+ resource_type_metadata_map[XdsApi::kRdsTypeUrl].resource_metadata_map;
2333
+ for (auto& p : route_config_map_) {
2334
+ rds_map[p.first] = &p.second.meta;
2335
+ }
2336
+ // Collect resource metadata from clusters
2337
+ auto& cds_map =
2338
+ resource_type_metadata_map[XdsApi::kCdsTypeUrl].resource_metadata_map;
2339
+ for (auto& p : cluster_map_) {
2340
+ cds_map[p.first] = &p.second.meta;
2341
+ }
2342
+ // Collect resource metadata from endpoints
2343
+ auto& eds_map =
2344
+ resource_type_metadata_map[XdsApi::kEdsTypeUrl].resource_metadata_map;
2345
+ for (auto& p : endpoint_map_) {
2346
+ eds_map[p.first] = &p.second.meta;
2347
+ }
2348
+ // Assemble config dump messages
2349
+ return api_.AssembleClientConfig(resource_type_metadata_map);
2350
+ }
2351
+
2352
+ //
2353
+ // accessors for global state
2354
+ //
2355
+
2356
+ void XdsClientGlobalInit() {
2357
+ g_mu = new Mutex;
2358
+ XdsHttpFilterRegistry::Init();
2359
+ }
2360
+
2361
+ // TODO(roth): Find a better way to clear the fallback config that does
2362
+ // not require using ABSL_NO_THREAD_SAFETY_ANALYSIS.
2363
+ void XdsClientGlobalShutdown() ABSL_NO_THREAD_SAFETY_ANALYSIS {
2364
+ gpr_free(g_fallback_bootstrap_config);
2365
+ g_fallback_bootstrap_config = nullptr;
2366
+ delete g_mu;
2367
+ g_mu = nullptr;
2368
+ XdsHttpFilterRegistry::Shutdown();
2369
+ }
2370
+
2371
+ namespace {
2372
+
2373
+ std::string GetBootstrapContents(const char* fallback_config,
2374
+ grpc_error_handle* error) {
2375
+ // First, try GRPC_XDS_BOOTSTRAP env var.
2376
+ grpc_core::UniquePtr<char> path(gpr_getenv("GRPC_XDS_BOOTSTRAP"));
2377
+ if (path != nullptr) {
2378
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
2379
+ gpr_log(GPR_INFO,
2380
+ "Got bootstrap file location from GRPC_XDS_BOOTSTRAP "
2381
+ "environment variable: %s",
2382
+ path.get());
2319
2383
  }
2384
+ grpc_slice contents;
2385
+ *error =
2386
+ grpc_load_file(path.get(), /*add_null_terminator=*/true, &contents);
2387
+ if (*error != GRPC_ERROR_NONE) return "";
2388
+ std::string contents_str(StringViewFromSlice(contents));
2389
+ grpc_slice_unref_internal(contents);
2390
+ return contents_str;
2391
+ }
2392
+ // Next, try GRPC_XDS_BOOTSTRAP_CONFIG env var.
2393
+ grpc_core::UniquePtr<char> env_config(
2394
+ gpr_getenv("GRPC_XDS_BOOTSTRAP_CONFIG"));
2395
+ if (env_config != nullptr) {
2396
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
2397
+ gpr_log(GPR_INFO,
2398
+ "Got bootstrap contents from GRPC_XDS_BOOTSTRAP_CONFIG "
2399
+ "environment variable");
2400
+ }
2401
+ return env_config.get();
2320
2402
  }
2321
- for (const auto& p : endpoint_map_) {
2322
- const EndpointState& endpoint_state = p.second;
2323
- for (const auto& p : endpoint_state.watchers) {
2324
- p.first->OnError(GRPC_ERROR_REF(error));
2403
+ // Finally, try fallback config.
2404
+ if (fallback_config != nullptr) {
2405
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
2406
+ gpr_log(GPR_INFO, "Got bootstrap contents from fallback config");
2325
2407
  }
2408
+ return fallback_config;
2326
2409
  }
2327
- GRPC_ERROR_UNREF(error);
2410
+ // No bootstrap config found.
2411
+ *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2412
+ "Environment variables GRPC_XDS_BOOTSTRAP or GRPC_XDS_BOOTSTRAP_CONFIG "
2413
+ "not defined");
2414
+ return "";
2415
+ }
2416
+
2417
+ } // namespace
2418
+
2419
+ RefCountedPtr<XdsClient> XdsClient::GetOrCreate(const grpc_channel_args* args,
2420
+ grpc_error_handle* error) {
2421
+ RefCountedPtr<XdsClient> xds_client;
2422
+ // If getting bootstrap from channel args, create a local XdsClient
2423
+ // instance for the channel or server instead of using the global instance.
2424
+ const char* bootstrap_config = grpc_channel_args_find_string(
2425
+ args, GRPC_ARG_TEST_ONLY_DO_NOT_USE_IN_PROD_XDS_BOOTSTRAP_CONFIG);
2426
+ if (bootstrap_config != nullptr) {
2427
+ std::unique_ptr<XdsBootstrap> bootstrap =
2428
+ XdsBootstrap::Create(bootstrap_config, error);
2429
+ if (*error == GRPC_ERROR_NONE) {
2430
+ grpc_channel_args* xds_channel_args =
2431
+ grpc_channel_args_find_pointer<grpc_channel_args>(
2432
+ args,
2433
+ GRPC_ARG_TEST_ONLY_DO_NOT_USE_IN_PROD_XDS_CLIENT_CHANNEL_ARGS);
2434
+ return MakeRefCounted<XdsClient>(std::move(bootstrap), xds_channel_args);
2435
+ }
2436
+ return nullptr;
2437
+ }
2438
+ // Otherwise, use the global instance.
2439
+ {
2440
+ MutexLock lock(g_mu);
2441
+ if (g_xds_client != nullptr) {
2442
+ auto xds_client = g_xds_client->RefIfNonZero();
2443
+ if (xds_client != nullptr) return xds_client;
2444
+ }
2445
+ // Find bootstrap contents.
2446
+ std::string bootstrap_contents =
2447
+ GetBootstrapContents(g_fallback_bootstrap_config, error);
2448
+ if (*error != GRPC_ERROR_NONE) return nullptr;
2449
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
2450
+ gpr_log(GPR_INFO, "xDS bootstrap contents: %s",
2451
+ bootstrap_contents.c_str());
2452
+ }
2453
+ // Parse bootstrap.
2454
+ std::unique_ptr<XdsBootstrap> bootstrap =
2455
+ XdsBootstrap::Create(bootstrap_contents, error);
2456
+ if (*error != GRPC_ERROR_NONE) return nullptr;
2457
+ // Instantiate XdsClient.
2458
+ xds_client =
2459
+ MakeRefCounted<XdsClient>(std::move(bootstrap), g_channel_args);
2460
+ g_xds_client = xds_client.get();
2461
+ }
2462
+ return xds_client;
2463
+ }
2464
+
2465
+ namespace internal {
2466
+
2467
+ void SetXdsChannelArgsForTest(grpc_channel_args* args) {
2468
+ MutexLock lock(g_mu);
2469
+ g_channel_args = args;
2470
+ }
2471
+
2472
+ void UnsetGlobalXdsClientForTest() {
2473
+ MutexLock lock(g_mu);
2474
+ g_xds_client = nullptr;
2475
+ }
2476
+
2477
+ void SetXdsFallbackBootstrapConfig(const char* config) {
2478
+ MutexLock lock(g_mu);
2479
+ gpr_free(g_fallback_bootstrap_config);
2480
+ g_fallback_bootstrap_config = gpr_strdup(config);
2328
2481
  }
2329
2482
 
2330
- void* XdsClient::ChannelArgCopy(void* p) {
2483
+ } // namespace internal
2484
+
2485
+ //
2486
+ // embedding XdsClient in channel args
2487
+ //
2488
+
2489
+ #define GRPC_ARG_XDS_CLIENT "grpc.internal.xds_client"
2490
+
2491
+ namespace {
2492
+
2493
+ void* XdsClientArgCopy(void* p) {
2331
2494
  XdsClient* xds_client = static_cast<XdsClient*>(p);
2332
2495
  xds_client->Ref(DEBUG_LOCATION, "channel arg").release();
2333
2496
  return p;
2334
2497
  }
2335
2498
 
2336
- void XdsClient::ChannelArgDestroy(void* p) {
2499
+ void XdsClientArgDestroy(void* p) {
2337
2500
  XdsClient* xds_client = static_cast<XdsClient*>(p);
2338
2501
  xds_client->Unref(DEBUG_LOCATION, "channel arg");
2339
2502
  }
2340
2503
 
2341
- int XdsClient::ChannelArgCmp(void* p, void* q) { return GPR_ICMP(p, q); }
2504
+ int XdsClientArgCmp(void* p, void* q) { return GPR_ICMP(p, q); }
2505
+
2506
+ const grpc_arg_pointer_vtable kXdsClientArgVtable = {
2507
+ XdsClientArgCopy, XdsClientArgDestroy, XdsClientArgCmp};
2342
2508
 
2343
- const grpc_arg_pointer_vtable XdsClient::kXdsClientVtable = {
2344
- XdsClient::ChannelArgCopy, XdsClient::ChannelArgDestroy,
2345
- XdsClient::ChannelArgCmp};
2509
+ } // namespace
2346
2510
 
2347
2511
  grpc_arg XdsClient::MakeChannelArg() const {
2348
2512
  return grpc_channel_arg_pointer_create(const_cast<char*>(GRPC_ARG_XDS_CLIENT),
2349
2513
  const_cast<XdsClient*>(this),
2350
- &XdsClient::kXdsClientVtable);
2514
+ &kXdsClientArgVtable);
2351
2515
  }
2352
2516
 
2353
2517
  RefCountedPtr<XdsClient> XdsClient::GetFromChannelArgs(
2354
2518
  const grpc_channel_args& args) {
2355
2519
  XdsClient* xds_client =
2356
2520
  grpc_channel_args_find_pointer<XdsClient>(&args, GRPC_ARG_XDS_CLIENT);
2357
- if (xds_client != nullptr) return xds_client->Ref();
2358
- return nullptr;
2359
- }
2360
-
2361
- grpc_channel_args* XdsClient::RemoveFromChannelArgs(
2362
- const grpc_channel_args& args) {
2363
- const char* arg_name = GRPC_ARG_XDS_CLIENT;
2364
- return grpc_channel_args_copy_and_remove(&args, &arg_name, 1);
2521
+ if (xds_client == nullptr) return nullptr;
2522
+ return xds_client->Ref(DEBUG_LOCATION, "GetFromChannelArgs");
2365
2523
  }
2366
2524
 
2367
2525
  } // namespace grpc_core
2526
+
2527
+ // The returned bytes may contain NULL(0), so we can't use c-string.
2528
+ grpc_slice grpc_dump_xds_configs() {
2529
+ grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
2530
+ grpc_core::ExecCtx exec_ctx;
2531
+ grpc_error_handle error = GRPC_ERROR_NONE;
2532
+ auto xds_client = grpc_core::XdsClient::GetOrCreate(nullptr, &error);
2533
+ if (error != GRPC_ERROR_NONE) {
2534
+ // If we isn't using xDS, just return an empty string.
2535
+ GRPC_ERROR_UNREF(error);
2536
+ return grpc_empty_slice();
2537
+ }
2538
+ return grpc_slice_from_cpp_string(xds_client->DumpClientConfigBinary());
2539
+ }