grpc 1.69.0 → 1.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1235) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +249 -283
  3. data/include/grpc/event_engine/endpoint_config.h +5 -5
  4. data/include/grpc/event_engine/event_engine.h +44 -5
  5. data/include/grpc/status.h +1 -1
  6. data/include/grpc/support/atm.h +0 -13
  7. data/include/grpc/support/json.h +16 -16
  8. data/src/core/call/request_buffer.cc +224 -0
  9. data/src/core/call/request_buffer.h +192 -0
  10. data/src/core/channelz/channelz.cc +2 -2
  11. data/src/core/channelz/channelz.h +3 -22
  12. data/src/core/channelz/channelz_registry.cc +0 -7
  13. data/src/core/client_channel/client_channel.cc +18 -29
  14. data/src/core/client_channel/client_channel.h +2 -2
  15. data/src/core/client_channel/client_channel_args.h +21 -0
  16. data/src/core/client_channel/client_channel_filter.cc +54 -131
  17. data/src/core/client_channel/client_channel_filter.h +11 -9
  18. data/src/core/client_channel/client_channel_plugin.cc +2 -1
  19. data/src/core/client_channel/client_channel_service_config.cc +1 -1
  20. data/src/core/client_channel/client_channel_service_config.h +5 -5
  21. data/src/core/client_channel/direct_channel.cc +1 -1
  22. data/src/core/client_channel/direct_channel.h +1 -1
  23. data/src/core/client_channel/lb_metadata.cc +7 -8
  24. data/src/core/client_channel/lb_metadata.h +3 -3
  25. data/src/core/client_channel/load_balanced_call_destination.cc +4 -4
  26. data/src/core/client_channel/retry_filter.cc +1 -1
  27. data/src/core/client_channel/retry_filter.h +1 -1
  28. data/src/core/client_channel/retry_filter_legacy_call_data.cc +10 -12
  29. data/src/core/client_channel/retry_filter_legacy_call_data.h +7 -7
  30. data/src/core/client_channel/retry_interceptor.cc +408 -0
  31. data/src/core/client_channel/retry_interceptor.h +157 -0
  32. data/src/core/client_channel/retry_service_config.cc +1 -1
  33. data/src/core/client_channel/retry_service_config.h +16 -3
  34. data/src/core/client_channel/retry_throttle.cc +33 -18
  35. data/src/core/client_channel/retry_throttle.h +3 -3
  36. data/src/core/client_channel/subchannel.cc +43 -76
  37. data/src/core/client_channel/subchannel.h +4 -4
  38. data/src/core/client_channel/subchannel_stream_client.cc +0 -1
  39. data/src/core/client_channel/subchannel_stream_client.h +3 -3
  40. data/src/core/config/config_vars.cc +1 -0
  41. data/src/core/config/config_vars.h +1 -0
  42. data/src/core/config/load_config.cc +3 -2
  43. data/src/core/config/load_config.h +1 -1
  44. data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +4 -11
  45. data/src/core/ext/filters/backend_metrics/backend_metric_filter.h +7 -7
  46. data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +1 -1
  47. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +8 -15
  48. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +6 -6
  49. data/src/core/ext/filters/fault_injection/fault_injection_service_config_parser.cc +1 -1
  50. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +0 -7
  51. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h +6 -6
  52. data/src/core/ext/filters/gcp_authentication/gcp_authentication_service_config_parser.cc +1 -1
  53. data/src/core/ext/filters/gcp_authentication/gcp_authentication_service_config_parser.h +1 -1
  54. data/src/core/ext/filters/http/client/http_client_filter.cc +1 -6
  55. data/src/core/ext/filters/http/client/http_client_filter.h +4 -4
  56. data/src/core/ext/filters/http/client_authority_filter.cc +6 -11
  57. data/src/core/ext/filters/http/client_authority_filter.h +6 -6
  58. data/src/core/ext/filters/http/message_compress/compression_filter.cc +18 -22
  59. data/src/core/ext/filters/http/message_compress/compression_filter.h +18 -13
  60. data/src/core/ext/filters/http/server/http_server_filter.cc +3 -8
  61. data/src/core/ext/filters/http/server/http_server_filter.h +4 -4
  62. data/src/core/ext/filters/message_size/message_size_filter.cc +13 -25
  63. data/src/core/ext/filters/message_size/message_size_filter.h +20 -21
  64. data/src/core/ext/filters/rbac/rbac_filter.cc +0 -7
  65. data/src/core/ext/filters/rbac/rbac_filter.h +6 -6
  66. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +3 -3
  67. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +1 -6
  68. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +4 -4
  69. data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc +1 -1
  70. data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h +2 -2
  71. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -2
  72. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +4 -3
  73. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +612 -100
  74. data/src/core/ext/transport/chttp2/server/chttp2_server.h +189 -13
  75. data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +1 -1
  76. data/src/core/ext/transport/chttp2/transport/call_tracer_wrapper.cc +2 -2
  77. data/src/core/ext/transport/chttp2/transport/call_tracer_wrapper.h +4 -4
  78. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +85 -59
  79. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +7 -7
  80. data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -1
  81. data/src/core/ext/transport/chttp2/transport/flow_control.h +3 -3
  82. data/src/core/ext/transport/chttp2/transport/frame.cc +2 -2
  83. data/src/core/ext/transport/chttp2/transport/frame.h +5 -5
  84. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +8 -8
  85. data/src/core/ext/transport/chttp2/transport/frame_security.cc +1 -3
  86. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +5 -5
  87. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +2 -2
  88. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +32 -31
  89. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +6 -7
  90. data/src/core/ext/transport/chttp2/transport/http2_settings.cc +3 -3
  91. data/src/core/ext/transport/chttp2/transport/http2_settings.h +2 -2
  92. data/src/core/ext/transport/chttp2/transport/internal.h +19 -8
  93. data/src/core/ext/transport/chttp2/transport/parsing.cc +14 -14
  94. data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.cc +1 -1
  95. data/src/core/ext/transport/chttp2/transport/ping_callbacks.cc +2 -2
  96. data/src/core/ext/transport/chttp2/transport/ping_callbacks.h +2 -2
  97. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +2 -2
  98. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.h +2 -2
  99. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +1 -0
  100. data/src/core/ext/transport/chttp2/transport/varint.cc +4 -4
  101. data/src/core/ext/transport/chttp2/transport/writing.cc +16 -22
  102. data/src/core/ext/transport/inproc/inproc_transport.cc +1 -3
  103. data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +15 -10
  104. data/src/core/ext/upb-gen/envoy/admin/v3/config_dump_shared.upb.h +3 -1
  105. data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb.h +16 -0
  106. data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb_minitable.c +3 -2
  107. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb.h +66 -36
  108. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.c +19 -17
  109. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb.h +116 -0
  110. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.c +31 -5
  111. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.h +2 -0
  112. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb.h +97 -6
  113. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.c +17 -11
  114. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb.h +151 -0
  115. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb_minitable.c +60 -0
  116. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb_minitable.h +32 -0
  117. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb.h +228 -21
  118. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.c +65 -17
  119. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.h +6 -0
  120. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb.h +7 -106
  121. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb_minitable.c +7 -28
  122. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb_minitable.h +0 -2
  123. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb.h +85 -0
  124. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb_minitable.c +25 -3
  125. data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb.h +2 -1
  126. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb.h +152 -0
  127. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.c +40 -10
  128. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.h +2 -0
  129. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb.h +253 -4
  130. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.c +70 -13
  131. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.h +4 -0
  132. data/src/core/ext/upb-gen/envoy/config/trace/v3/trace.upb.h +0 -2
  133. data/src/core/ext/upb-gen/envoy/config/trace/v3/trace.upb_minitable.c +0 -1
  134. data/src/core/ext/upb-gen/envoy/config/trace/v3/trace.upb_minitable.h +0 -1
  135. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +16 -0
  136. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c +3 -2
  137. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +60 -0
  138. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb_minitable.c +13 -2
  139. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb.h +0 -1
  140. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.c +0 -1
  141. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +102 -24
  142. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls.upb_minitable.c +28 -19
  143. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.h +37 -7
  144. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb_minitable.c +7 -5
  145. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb.h +251 -18
  146. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb_minitable.c +41 -16
  147. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb_minitable.h +2 -0
  148. data/src/core/ext/upb-gen/envoy/service/status/v3/csds.upb.h +2 -1
  149. data/src/core/ext/upb-gen/envoy/type/matcher/v3/address.upb.h +142 -0
  150. data/src/core/ext/upb-gen/envoy/type/matcher/v3/address.upb_minitable.c +55 -0
  151. data/src/core/ext/upb-gen/envoy/type/matcher/v3/address.upb_minitable.h +32 -0
  152. data/src/core/ext/upb-gen/envoy/type/matcher/v3/filter_state.upb.h +33 -0
  153. data/src/core/ext/upb-gen/envoy/type/matcher/v3/filter_state.upb_minitable.c +7 -4
  154. data/src/core/ext/upbdefs-gen/envoy/admin/v3/config_dump_shared.upbdefs.c +11 -10
  155. data/src/core/ext/upbdefs-gen/envoy/admin/v3/server_info.upbdefs.c +6 -4
  156. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.c +418 -413
  157. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.c +161 -153
  158. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.h +5 -0
  159. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.c +270 -261
  160. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_cmsg_headers.upbdefs.c +46 -0
  161. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_cmsg_headers.upbdefs.h +33 -0
  162. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_option.upbdefs.c +29 -19
  163. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_option.upbdefs.h +15 -0
  164. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener_components.upbdefs.c +58 -65
  165. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener_components.upbdefs.h +0 -5
  166. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/quic_config.upbdefs.c +73 -63
  167. data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.c +49 -48
  168. data/src/core/ext/upbdefs-gen/envoy/config/rbac/v3/rbac.upbdefs.c +117 -100
  169. data/src/core/ext/upbdefs-gen/envoy/config/rbac/v3/rbac.upbdefs.h +5 -0
  170. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.c +917 -898
  171. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.h +10 -0
  172. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/trace.upbdefs.c +15 -18
  173. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.c +33 -33
  174. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +460 -457
  175. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.c +16 -19
  176. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +95 -95
  177. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +202 -191
  178. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upbdefs.c +19 -17
  179. data/src/core/ext/upbdefs-gen/envoy/service/discovery/v3/discovery.upbdefs.c +148 -135
  180. data/src/core/ext/upbdefs-gen/envoy/service/discovery/v3/discovery.upbdefs.h +5 -0
  181. data/src/core/ext/upbdefs-gen/envoy/service/status/v3/csds.upbdefs.c +23 -22
  182. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/address.upbdefs.c +41 -0
  183. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/address.upbdefs.h +33 -0
  184. data/src/core/ext/upbdefs-gen/envoy/type/matcher/v3/filter_state.upbdefs.c +26 -19
  185. data/src/core/filter/blackboard.cc +2 -2
  186. data/src/core/filter/filter_args.h +112 -0
  187. data/src/core/handshaker/handshaker.cc +0 -3
  188. data/src/core/handshaker/http_connect/http_connect_handshaker.cc +4 -6
  189. data/src/core/handshaker/http_connect/http_proxy_mapper.cc +31 -32
  190. data/src/core/handshaker/http_connect/http_proxy_mapper.h +4 -4
  191. data/src/core/handshaker/http_connect/xds_http_proxy_mapper.cc +5 -5
  192. data/src/core/handshaker/http_connect/xds_http_proxy_mapper.h +5 -5
  193. data/src/core/handshaker/proxy_mapper.h +4 -4
  194. data/src/core/handshaker/proxy_mapper_registry.cc +5 -6
  195. data/src/core/handshaker/proxy_mapper_registry.h +4 -4
  196. data/src/core/handshaker/security/secure_endpoint.cc +2 -2
  197. data/src/core/handshaker/security/security_handshaker.cc +3 -5
  198. data/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc +6 -4
  199. data/src/core/lib/channel/channel_args.cc +13 -13
  200. data/src/core/lib/channel/channel_args.h +8 -8
  201. data/src/core/lib/channel/connected_channel.cc +1 -1
  202. data/src/core/lib/channel/promise_based_filter.cc +9 -9
  203. data/src/core/lib/channel/promise_based_filter.h +84 -159
  204. data/src/core/lib/compression/compression.cc +3 -2
  205. data/src/core/lib/compression/compression_internal.cc +9 -9
  206. data/src/core/lib/compression/compression_internal.h +3 -3
  207. data/src/core/lib/debug/trace_flags.cc +5 -2
  208. data/src/core/lib/debug/trace_flags.h +2 -1
  209. data/src/core/lib/event_engine/ares_resolver.cc +9 -11
  210. data/src/core/lib/event_engine/ares_resolver.h +6 -10
  211. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +2 -4
  212. data/src/core/lib/event_engine/cf_engine/cf_engine.h +2 -4
  213. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +6 -7
  214. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +2 -4
  215. data/src/core/lib/event_engine/cf_engine/cftype_unique_ref.h +2 -4
  216. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +3 -7
  217. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +2 -4
  218. data/src/core/lib/event_engine/channel_args_endpoint_config.cc +5 -7
  219. data/src/core/lib/event_engine/channel_args_endpoint_config.h +6 -7
  220. data/src/core/lib/event_engine/common_closures.h +2 -4
  221. data/src/core/lib/event_engine/default_event_engine.cc +62 -33
  222. data/src/core/lib/event_engine/default_event_engine.h +24 -33
  223. data/src/core/lib/event_engine/default_event_engine_factory.cc +6 -12
  224. data/src/core/lib/event_engine/default_event_engine_factory.h +2 -4
  225. data/src/core/lib/event_engine/event_engine.cc +2 -4
  226. data/src/core/lib/event_engine/extensions/can_track_errors.h +2 -4
  227. data/src/core/lib/event_engine/extensions/chaotic_good_extension.h +2 -4
  228. data/src/core/lib/event_engine/extensions/supports_fd.h +2 -4
  229. data/src/core/lib/event_engine/extensions/tcp_trace.h +2 -4
  230. data/src/core/lib/event_engine/forkable.cc +2 -4
  231. data/src/core/lib/event_engine/forkable.h +2 -4
  232. data/src/core/lib/event_engine/grpc_polled_fd.h +2 -4
  233. data/src/core/lib/event_engine/handle_containers.h +2 -4
  234. data/src/core/lib/event_engine/memory_allocator_factory.h +2 -4
  235. data/src/core/lib/event_engine/poller.h +2 -4
  236. data/src/core/lib/event_engine/posix.h +2 -4
  237. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +4 -50
  238. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h +2 -4
  239. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -51
  240. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +2 -4
  241. data/src/core/lib/event_engine/posix_engine/event_poller.h +2 -4
  242. data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.cc +2 -4
  243. data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.h +2 -4
  244. data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +2 -4
  245. data/src/core/lib/event_engine/posix_engine/internal_errqueue.cc +2 -4
  246. data/src/core/lib/event_engine/posix_engine/internal_errqueue.h +2 -4
  247. data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +2 -4
  248. data/src/core/lib/event_engine/posix_engine/lockfree_event.h +2 -4
  249. data/src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.cc +2 -4
  250. data/src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.h +2 -4
  251. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +20 -10
  252. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +2 -4
  253. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +9 -6
  254. data/src/core/lib/event_engine/posix_engine/posix_engine.h +2 -6
  255. data/src/core/lib/event_engine/posix_engine/posix_engine_closure.h +2 -4
  256. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +3 -5
  257. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +2 -4
  258. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +2 -4
  259. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h +2 -4
  260. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +5 -6
  261. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +2 -4
  262. data/src/core/lib/event_engine/posix_engine/timer.cc +4 -6
  263. data/src/core/lib/event_engine/posix_engine/timer.h +4 -6
  264. data/src/core/lib/event_engine/posix_engine/timer_heap.cc +2 -4
  265. data/src/core/lib/event_engine/posix_engine/timer_heap.h +2 -4
  266. data/src/core/lib/event_engine/posix_engine/timer_manager.cc +5 -7
  267. data/src/core/lib/event_engine/posix_engine/timer_manager.h +4 -6
  268. data/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc +4 -8
  269. data/src/core/lib/event_engine/posix_engine/traced_buffer_list.h +24 -25
  270. data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.cc +2 -4
  271. data/src/core/lib/event_engine/posix_engine/wakeup_fd_eventfd.h +2 -4
  272. data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.cc +2 -4
  273. data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.h +2 -4
  274. data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix.h +2 -4
  275. data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.cc +2 -4
  276. data/src/core/lib/event_engine/posix_engine/wakeup_fd_posix_default.h +2 -4
  277. data/src/core/lib/event_engine/query_extensions.h +2 -4
  278. data/src/core/lib/event_engine/ref_counted_dns_resolver_interface.h +2 -4
  279. data/src/core/lib/event_engine/resolved_address.cc +2 -4
  280. data/src/core/lib/event_engine/resolved_address_internal.h +2 -4
  281. data/src/core/lib/event_engine/shim.cc +2 -4
  282. data/src/core/lib/event_engine/shim.h +2 -4
  283. data/src/core/lib/event_engine/slice.cc +2 -4
  284. data/src/core/lib/event_engine/slice_buffer.cc +2 -4
  285. data/src/core/lib/event_engine/tcp_socket_utils.cc +6 -8
  286. data/src/core/lib/event_engine/tcp_socket_utils.h +5 -7
  287. data/src/core/lib/event_engine/thread_local.cc +2 -4
  288. data/src/core/lib/event_engine/thread_local.h +2 -4
  289. data/src/core/lib/event_engine/thread_pool/thread_count.cc +2 -4
  290. data/src/core/lib/event_engine/thread_pool/thread_count.h +4 -18
  291. data/src/core/lib/event_engine/thread_pool/thread_pool.h +2 -4
  292. data/src/core/lib/event_engine/thread_pool/thread_pool_factory.cc +2 -4
  293. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +3 -5
  294. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +2 -4
  295. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc +2 -4
  296. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.h +2 -4
  297. data/src/core/lib/event_engine/time_util.cc +2 -4
  298. data/src/core/lib/event_engine/time_util.h +2 -4
  299. data/src/core/lib/event_engine/utils.cc +2 -4
  300. data/src/core/lib/event_engine/utils.h +2 -4
  301. data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +2 -4
  302. data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.h +2 -4
  303. data/src/core/lib/event_engine/windows/iocp.cc +2 -4
  304. data/src/core/lib/event_engine/windows/iocp.h +2 -4
  305. data/src/core/lib/event_engine/windows/native_windows_dns_resolver.cc +2 -4
  306. data/src/core/lib/event_engine/windows/native_windows_dns_resolver.h +2 -4
  307. data/src/core/lib/event_engine/windows/win_socket.cc +2 -4
  308. data/src/core/lib/event_engine/windows/win_socket.h +2 -4
  309. data/src/core/lib/event_engine/windows/windows_endpoint.cc +2 -4
  310. data/src/core/lib/event_engine/windows/windows_endpoint.h +4 -6
  311. data/src/core/lib/event_engine/windows/windows_engine.cc +3 -4
  312. data/src/core/lib/event_engine/windows/windows_engine.h +2 -4
  313. data/src/core/lib/event_engine/windows/windows_listener.cc +2 -4
  314. data/src/core/lib/event_engine/windows/windows_listener.h +2 -4
  315. data/src/core/lib/event_engine/work_queue/basic_work_queue.cc +2 -4
  316. data/src/core/lib/event_engine/work_queue/basic_work_queue.h +2 -4
  317. data/src/core/lib/event_engine/work_queue/work_queue.h +2 -4
  318. data/src/core/lib/experiments/experiments.cc +147 -207
  319. data/src/core/lib/experiments/experiments.h +79 -96
  320. data/src/core/lib/iomgr/buffer_list.h +22 -21
  321. data/src/core/lib/iomgr/cfstream_handle.cc +0 -2
  322. data/src/core/lib/iomgr/closure.h +1 -4
  323. data/src/core/lib/iomgr/combiner.cc +0 -1
  324. data/src/core/lib/iomgr/error.cc +2 -2
  325. data/src/core/lib/iomgr/event_engine_shims/closure.cc +0 -1
  326. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +1 -3
  327. data/src/core/lib/iomgr/event_engine_shims/tcp_client.cc +0 -1
  328. data/src/core/lib/iomgr/exec_ctx.cc +1 -7
  329. data/src/core/lib/iomgr/exec_ctx.h +1 -132
  330. data/src/core/lib/iomgr/executor.cc +0 -11
  331. data/src/core/lib/iomgr/resolve_address_posix.cc +0 -2
  332. data/src/core/lib/iomgr/resolve_address_windows.cc +0 -2
  333. data/src/core/lib/iomgr/socket_utils_posix.cc +3 -2
  334. data/src/core/lib/iomgr/tcp_posix.cc +3 -2
  335. data/src/core/lib/iomgr/tcp_server_posix.cc +1 -3
  336. data/src/core/lib/iomgr/tcp_server_windows.cc +0 -1
  337. data/src/core/lib/iomgr/timer_manager.cc +1 -9
  338. data/src/core/lib/promise/activity.cc +2 -0
  339. data/src/core/lib/promise/activity.h +33 -12
  340. data/src/core/lib/promise/detail/join_state.h +16 -68
  341. data/src/core/lib/promise/detail/promise_factory.h +85 -25
  342. data/src/core/lib/promise/detail/promise_like.h +16 -19
  343. data/src/core/lib/promise/detail/seq_state.h +102 -315
  344. data/src/core/lib/promise/for_each.h +14 -5
  345. data/src/core/lib/promise/if.h +48 -20
  346. data/src/core/lib/promise/interceptor_list.h +9 -9
  347. data/src/core/lib/promise/latch.h +14 -6
  348. data/src/core/lib/promise/loop.h +58 -18
  349. data/src/core/lib/promise/map.h +145 -49
  350. data/src/core/lib/promise/party.cc +84 -15
  351. data/src/core/lib/promise/party.h +229 -32
  352. data/src/core/lib/promise/pipe.h +12 -12
  353. data/src/core/lib/promise/poll.h +8 -5
  354. data/src/core/lib/promise/prioritized_race.h +16 -22
  355. data/src/core/lib/promise/promise.h +2 -3
  356. data/src/core/lib/promise/race.h +4 -12
  357. data/src/core/lib/promise/seq.h +41 -6
  358. data/src/core/lib/promise/sleep.cc +3 -3
  359. data/src/core/lib/promise/sleep.h +15 -1
  360. data/src/core/lib/promise/status_flag.h +19 -3
  361. data/src/core/lib/promise/try_join.h +119 -5
  362. data/src/core/lib/promise/try_seq.h +39 -12
  363. data/src/core/lib/resource_quota/arena.h +87 -0
  364. data/src/core/lib/resource_quota/connection_quota.h +4 -0
  365. data/src/core/lib/resource_quota/memory_quota.cc +53 -49
  366. data/src/core/lib/resource_quota/memory_quota.h +4 -4
  367. data/src/core/lib/security/authorization/evaluate_args.cc +3 -3
  368. data/src/core/lib/security/authorization/evaluate_args.h +3 -3
  369. data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +0 -7
  370. data/src/core/lib/security/authorization/grpc_server_authz_filter.h +6 -6
  371. data/src/core/lib/security/authorization/matchers.h +3 -3
  372. data/src/core/lib/security/authorization/rbac_policy.cc +1 -1
  373. data/src/core/lib/security/authorization/rbac_policy.h +3 -3
  374. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +1 -2
  375. data/src/core/lib/security/credentials/external/external_account_credentials.cc +1 -3
  376. data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +0 -1
  377. data/src/core/lib/security/credentials/google_default/credentials_generic.cc +1 -1
  378. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +2 -2
  379. data/src/core/lib/security/credentials/iam/iam_credentials.cc +1 -1
  380. data/src/core/lib/security/credentials/iam/iam_credentials.h +2 -2
  381. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +1 -2
  382. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +2 -2
  383. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +0 -1
  384. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +4 -4
  385. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +3 -3
  386. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +0 -1
  387. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +2 -2
  388. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +12 -13
  389. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +14 -14
  390. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +23 -15
  391. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +3 -3
  392. data/src/core/lib/security/credentials/tls/grpc_tls_crl_provider.cc +0 -1
  393. data/src/core/lib/security/credentials/tls/grpc_tls_crl_provider.h +1 -2
  394. data/src/core/lib/security/credentials/tls/tls_credentials.cc +2 -2
  395. data/src/core/lib/security/credentials/token_fetcher/token_fetcher_credentials.cc +4 -5
  396. data/src/core/lib/security/credentials/token_fetcher/token_fetcher_credentials.h +4 -4
  397. data/src/core/lib/security/credentials/xds/xds_credentials.cc +2 -1
  398. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +1 -1
  399. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +3 -3
  400. data/src/core/lib/security/security_connector/local/local_security_connector.cc +1 -1
  401. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +9 -9
  402. data/src/core/lib/security/security_connector/tls/tls_security_connector.h +13 -13
  403. data/src/core/lib/security/transport/auth_filters.h +95 -7
  404. data/src/core/lib/security/transport/client_auth_filter.cc +96 -6
  405. data/src/core/lib/security/transport/server_auth_filter.cc +0 -8
  406. data/src/core/lib/slice/slice_buffer.cc +2 -2
  407. data/src/core/lib/slice/slice_buffer.h +2 -2
  408. data/src/core/lib/surface/call.cc +0 -4
  409. data/src/core/lib/surface/call.h +4 -3
  410. data/src/core/lib/surface/call_utils.cc +2 -2
  411. data/src/core/lib/surface/call_utils.h +10 -4
  412. data/src/core/lib/surface/channel.cc +6 -14
  413. data/src/core/lib/surface/channel.h +3 -3
  414. data/src/core/lib/surface/channel_init.cc +1 -1
  415. data/src/core/lib/surface/client_call.cc +56 -41
  416. data/src/core/lib/surface/client_call.h +7 -2
  417. data/src/core/lib/surface/completion_queue.cc +10 -49
  418. data/src/core/lib/surface/event_string.cc +7 -1
  419. data/src/core/lib/surface/filter_stack_call.cc +2 -4
  420. data/src/core/lib/surface/filter_stack_call.h +1 -1
  421. data/src/core/lib/surface/init.cc +17 -12
  422. data/src/core/lib/surface/init_internally.h +13 -2
  423. data/src/core/lib/surface/legacy_channel.cc +10 -8
  424. data/src/core/lib/surface/legacy_channel.h +2 -2
  425. data/src/core/lib/surface/server_call.cc +116 -84
  426. data/src/core/lib/surface/server_call.h +2 -0
  427. data/src/core/lib/surface/version.cc +2 -2
  428. data/src/core/lib/transport/call_filters.cc +10 -4
  429. data/src/core/lib/transport/call_filters.h +108 -59
  430. data/src/core/lib/transport/call_spine.cc +12 -49
  431. data/src/core/lib/transport/call_spine.h +174 -7
  432. data/src/core/lib/transport/call_state.h +140 -47
  433. data/src/core/lib/transport/connectivity_state.cc +8 -9
  434. data/src/core/lib/transport/connectivity_state.h +2 -4
  435. data/src/core/lib/transport/http2_errors.h +5 -3
  436. data/src/core/lib/transport/interception_chain.cc +8 -0
  437. data/src/core/lib/transport/interception_chain.h +36 -7
  438. data/src/core/lib/transport/metadata.h +88 -0
  439. data/src/core/lib/transport/metadata_batch.cc +2 -2
  440. data/src/core/lib/transport/metadata_batch.h +79 -18
  441. data/src/core/lib/transport/timeout_encoding.cc +15 -15
  442. data/src/core/lib/transport/timeout_encoding.h +3 -2
  443. data/src/core/lib/transport/transport.cc +0 -1
  444. data/src/core/lib/transport/transport.h +12 -7
  445. data/src/core/load_balancing/backend_metric_parser.cc +21 -28
  446. data/src/core/load_balancing/endpoint_list.cc +11 -1
  447. data/src/core/load_balancing/endpoint_list.h +20 -13
  448. data/src/core/load_balancing/grpclb/client_load_reporting_filter.cc +1 -6
  449. data/src/core/load_balancing/grpclb/client_load_reporting_filter.h +4 -4
  450. data/src/core/load_balancing/grpclb/grpclb.cc +21 -38
  451. data/src/core/load_balancing/health_check_client.cc +16 -48
  452. data/src/core/load_balancing/health_check_client_internal.h +7 -7
  453. data/src/core/load_balancing/lb_policy.cc +4 -6
  454. data/src/core/load_balancing/lb_policy.h +4 -12
  455. data/src/core/load_balancing/lb_policy_registry.cc +10 -8
  456. data/src/core/load_balancing/outlier_detection/outlier_detection.cc +57 -68
  457. data/src/core/load_balancing/outlier_detection/outlier_detection.h +4 -3
  458. data/src/core/load_balancing/pick_first/pick_first.cc +110 -77
  459. data/src/core/load_balancing/priority/priority.cc +8 -13
  460. data/src/core/load_balancing/ring_hash/ring_hash.cc +210 -158
  461. data/src/core/load_balancing/ring_hash/ring_hash.h +4 -11
  462. data/src/core/load_balancing/rls/rls.cc +105 -194
  463. data/src/core/load_balancing/rls/rls.h +97 -1
  464. data/src/core/load_balancing/round_robin/round_robin.cc +14 -19
  465. data/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc +4 -4
  466. data/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.h +2 -2
  467. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +20 -29
  468. data/src/core/load_balancing/weighted_target/weighted_target.cc +7 -15
  469. data/src/core/load_balancing/xds/cds.cc +11 -15
  470. data/src/core/load_balancing/xds/xds_cluster_impl.cc +15 -18
  471. data/src/core/load_balancing/xds/xds_cluster_manager.cc +10 -18
  472. data/src/core/load_balancing/xds/xds_override_host.cc +45 -92
  473. data/src/core/load_balancing/xds/xds_wrr_locality.cc +10 -12
  474. data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +11 -11
  475. data/src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +10 -15
  476. data/src/core/resolver/dns/native/dns_resolver.cc +1 -1
  477. data/src/core/resolver/fake/fake_resolver.cc +10 -11
  478. data/src/core/resolver/fake/fake_resolver.h +2 -2
  479. data/src/core/resolver/google_c2p/google_c2p_resolver.cc +9 -12
  480. data/src/core/resolver/polling_resolver.cc +2 -5
  481. data/src/core/resolver/polling_resolver.h +3 -3
  482. data/src/core/resolver/resolver_registry.cc +4 -3
  483. data/src/core/resolver/xds/xds_config.cc +6 -6
  484. data/src/core/resolver/xds/xds_config.h +2 -2
  485. data/src/core/resolver/xds/xds_dependency_manager.cc +190 -183
  486. data/src/core/resolver/xds/xds_dependency_manager.h +28 -18
  487. data/src/core/resolver/xds/xds_resolver.cc +81 -122
  488. data/src/core/server/server.cc +353 -95
  489. data/src/core/server/server.h +214 -65
  490. data/src/core/server/server_call_tracer_filter.cc +3 -7
  491. data/src/core/server/server_config_selector_filter.cc +8 -15
  492. data/src/core/server/xds_server_config_fetcher.cc +93 -159
  493. data/src/core/service_config/service_config_channel_arg_filter.cc +7 -19
  494. data/src/core/service_config/service_config_impl.cc +3 -3
  495. data/src/core/telemetry/call_tracer.cc +8 -8
  496. data/src/core/telemetry/call_tracer.h +6 -5
  497. data/src/core/telemetry/metrics.cc +3 -3
  498. data/src/core/telemetry/metrics.h +2 -8
  499. data/src/core/telemetry/tcp_tracer.h +32 -32
  500. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +3 -3
  501. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +14 -14
  502. data/src/core/tsi/fake_transport_security.cc +5 -0
  503. data/src/core/util/backoff.cc +15 -4
  504. data/src/core/util/dump_args.h +1 -9
  505. data/src/core/util/env.h +3 -4
  506. data/src/core/util/examine_stack.cc +2 -2
  507. data/src/core/util/examine_stack.h +3 -4
  508. data/src/core/util/gpr_time.cc +0 -2
  509. data/src/core/util/http_client/httpcli.cc +69 -22
  510. data/src/core/util/http_client/httpcli.h +18 -8
  511. data/src/core/util/http_client/httpcli_security_connector.cc +2 -2
  512. data/src/core/util/json/json_channel_args.h +2 -1
  513. data/src/core/util/json/json_object_loader.cc +4 -4
  514. data/src/core/util/json/json_object_loader.h +12 -12
  515. data/src/core/util/json/json_reader.cc +4 -4
  516. data/src/core/util/json/json_writer.cc +3 -3
  517. data/src/core/util/latent_see.cc +3 -3
  518. data/src/core/util/latent_see.h +2 -2
  519. data/src/core/util/linux/env.cc +3 -4
  520. data/src/core/util/lru_cache.h +4 -4
  521. data/src/core/util/match.h +7 -7
  522. data/src/core/util/matchers.cc +1 -2
  523. data/src/core/util/matchers.h +7 -12
  524. data/src/core/util/posix/env.cc +2 -2
  525. data/src/core/util/posix/sync.cc +0 -1
  526. data/src/core/util/posix/time.cc +0 -1
  527. data/src/core/util/ref_counted.h +1 -0
  528. data/src/core/util/ref_counted_ptr.h +1 -1
  529. data/src/core/util/ring_buffer.h +4 -5
  530. data/src/core/util/status_helper.cc +16 -20
  531. data/src/core/util/status_helper.h +5 -5
  532. data/src/core/util/sync_abseil.cc +0 -1
  533. data/src/core/util/table.h +6 -21
  534. data/src/core/util/time.cc +1 -1
  535. data/src/core/util/time.h +3 -3
  536. data/src/core/util/time_precise.cc +0 -1
  537. data/src/core/util/type_list.h +56 -0
  538. data/src/core/util/uri.cc +6 -4
  539. data/src/core/util/uri.h +7 -0
  540. data/src/core/util/useful.h +13 -15
  541. data/src/core/util/validation_errors.cc +5 -5
  542. data/src/core/util/wait_for_single_owner.h +62 -0
  543. data/src/core/util/windows/env.cc +3 -3
  544. data/src/core/util/windows/sync.cc +0 -1
  545. data/src/core/util/windows/time.cc +0 -1
  546. data/src/core/util/work_serializer.cc +27 -267
  547. data/src/core/util/work_serializer.h +3 -27
  548. data/src/core/xds/grpc/certificate_provider_store.cc +12 -17
  549. data/src/core/xds/grpc/file_watcher_certificate_provider_factory.cc +2 -2
  550. data/src/core/xds/grpc/xds_audit_logger_registry.cc +1 -1
  551. data/src/core/xds/grpc/xds_bootstrap_grpc.cc +11 -14
  552. data/src/core/xds/grpc/xds_bootstrap_grpc.h +2 -2
  553. data/src/core/xds/grpc/xds_certificate_provider.cc +15 -15
  554. data/src/core/xds/grpc/xds_client_grpc.cc +7 -8
  555. data/src/core/xds/grpc/xds_cluster.h +4 -4
  556. data/src/core/xds/grpc/xds_cluster_parser.cc +26 -26
  557. data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +4 -4
  558. data/src/core/xds/grpc/xds_common_types.cc +2 -2
  559. data/src/core/xds/grpc/xds_common_types.h +4 -4
  560. data/src/core/xds/grpc/xds_common_types_parser.cc +29 -31
  561. data/src/core/xds/grpc/xds_common_types_parser.h +8 -7
  562. data/src/core/xds/grpc/xds_endpoint.cc +3 -4
  563. data/src/core/xds/grpc/xds_endpoint_parser.cc +68 -37
  564. data/src/core/xds/grpc/xds_health_status.cc +4 -4
  565. data/src/core/xds/grpc/xds_health_status.h +4 -3
  566. data/src/core/xds/grpc/xds_http_fault_filter.cc +18 -20
  567. data/src/core/xds/grpc/xds_http_fault_filter.h +4 -3
  568. data/src/core/xds/grpc/xds_http_filter.h +3 -3
  569. data/src/core/xds/grpc/xds_http_filter_registry.cc +7 -7
  570. data/src/core/xds/grpc/xds_http_filter_registry.h +3 -3
  571. data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +7 -7
  572. data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +4 -3
  573. data/src/core/xds/grpc/xds_http_rbac_filter.cc +30 -23
  574. data/src/core/xds/grpc/xds_http_rbac_filter.h +4 -3
  575. data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +10 -10
  576. data/src/core/xds/grpc/xds_http_stateful_session_filter.h +4 -3
  577. data/src/core/xds/grpc/xds_lb_policy_registry.cc +4 -4
  578. data/src/core/xds/grpc/xds_listener.cc +4 -6
  579. data/src/core/xds/grpc/xds_listener.h +10 -10
  580. data/src/core/xds/grpc/xds_listener_parser.cc +58 -51
  581. data/src/core/xds/grpc/xds_listener_parser.h +2 -1
  582. data/src/core/xds/grpc/xds_metadata.cc +5 -5
  583. data/src/core/xds/grpc/xds_metadata.h +8 -0
  584. data/src/core/xds/grpc/xds_metadata_parser.cc +65 -52
  585. data/src/core/xds/grpc/xds_route_config.cc +9 -15
  586. data/src/core/xds/grpc/xds_route_config.h +9 -9
  587. data/src/core/xds/grpc/xds_route_config_parser.cc +114 -116
  588. data/src/core/xds/grpc/xds_route_config_parser.h +4 -4
  589. data/src/core/xds/grpc/xds_routing.cc +6 -6
  590. data/src/core/xds/grpc/xds_routing.h +5 -5
  591. data/src/core/xds/grpc/xds_server_grpc.cc +22 -1
  592. data/src/core/xds/grpc/xds_server_grpc.h +5 -2
  593. data/src/core/xds/grpc/xds_server_grpc_interface.h +33 -0
  594. data/src/core/xds/grpc/xds_transport_grpc.cc +5 -6
  595. data/src/core/xds/xds_client/lrs_client.cc +71 -83
  596. data/src/core/xds/xds_client/lrs_client.h +8 -8
  597. data/src/core/xds/xds_client/xds_api.cc +5 -228
  598. data/src/core/xds/xds_client/xds_api.h +1 -133
  599. data/src/core/xds/xds_client/xds_bootstrap.cc +11 -1
  600. data/src/core/xds/xds_client/xds_bootstrap.h +7 -0
  601. data/src/core/xds/xds_client/xds_client.cc +1030 -704
  602. data/src/core/xds/xds_client/xds_client.h +135 -29
  603. data/src/core/xds/xds_client/xds_resource_type.h +2 -3
  604. data/src/core/xds/xds_client/xds_resource_type_impl.h +13 -8
  605. data/src/ruby/ext/grpc/extconf.rb +1 -0
  606. data/src/ruby/lib/grpc/version.rb +1 -1
  607. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_bitstr.c → a_bitstr.cc} +16 -57
  608. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bool.cc +53 -0
  609. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_d2i_fp.cc +47 -0
  610. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_dup.cc +42 -0
  611. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_gentm.cc +109 -0
  612. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_i2d_fp.cc +43 -0
  613. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_int.c → a_int.cc} +15 -56
  614. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_mbstr.c → a_mbstr.cc} +22 -62
  615. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_object.c → a_object.cc} +14 -56
  616. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_octet.cc +32 -0
  617. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_strex.c → a_strex.cc} +13 -55
  618. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_strnid.c → a_strnid.cc} +20 -59
  619. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_time.c → a_time.cc} +41 -76
  620. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_type.c → a_type.cc} +17 -59
  621. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.cc +109 -0
  622. data/third_party/boringssl-with-bazel/src/crypto/asn1/{asn1_lib.c → asn1_lib.cc} +17 -59
  623. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_par.cc +61 -0
  624. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn_pack.cc +56 -0
  625. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_int.cc +63 -0
  626. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_string.cc +52 -0
  627. data/third_party/boringssl-with-bazel/src/crypto/asn1/internal.h +13 -57
  628. data/third_party/boringssl-with-bazel/src/crypto/asn1/{posix_time.c → posix_time.cc} +14 -14
  629. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_dec.c → tasn_dec.cc} +17 -58
  630. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_enc.c → tasn_enc.cc} +22 -61
  631. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_fre.cc +164 -0
  632. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_new.c → tasn_new.cc} +20 -61
  633. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_typ.cc +84 -0
  634. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_utl.c → tasn_utl.cc} +26 -65
  635. data/third_party/boringssl-with-bazel/src/crypto/base64/{base64.c → base64.cc} +22 -67
  636. data/third_party/boringssl-with-bazel/src/crypto/bcm_support.h +19 -13
  637. data/third_party/boringssl-with-bazel/src/crypto/bio/{bio.c → bio.cc} +45 -113
  638. data/third_party/boringssl-with-bazel/src/crypto/bio/{bio_mem.c → bio_mem.cc} +21 -62
  639. data/third_party/boringssl-with-bazel/src/crypto/bio/{connect.c → connect.cc} +40 -73
  640. data/third_party/boringssl-with-bazel/src/crypto/bio/errno.cc +50 -0
  641. data/third_party/boringssl-with-bazel/src/crypto/bio/{fd.c → fd.cc} +14 -56
  642. data/third_party/boringssl-with-bazel/src/crypto/bio/{file.c → file.cc} +17 -59
  643. data/third_party/boringssl-with-bazel/src/crypto/bio/hexdump.cc +152 -0
  644. data/third_party/boringssl-with-bazel/src/crypto/bio/internal.h +13 -55
  645. data/third_party/boringssl-with-bazel/src/crypto/bio/{pair.c → pair.cc} +37 -71
  646. data/third_party/boringssl-with-bazel/src/crypto/bio/printf.cc +59 -0
  647. data/third_party/boringssl-with-bazel/src/crypto/bio/socket.cc +147 -0
  648. data/third_party/boringssl-with-bazel/src/crypto/bio/{socket_helper.c → socket_helper.cc} +13 -13
  649. data/third_party/boringssl-with-bazel/src/crypto/blake2/{blake2.c → blake2.cc} +14 -14
  650. data/third_party/boringssl-with-bazel/src/crypto/{bn_extra/bn_asn1.c → bn/bn_asn1.cc} +13 -13
  651. data/third_party/boringssl-with-bazel/src/crypto/{bn_extra/convert.c → bn/convert.cc} +34 -76
  652. data/third_party/boringssl-with-bazel/src/crypto/buf/buf.cc +118 -0
  653. data/third_party/boringssl-with-bazel/src/crypto/bytestring/asn1_compat.cc +53 -0
  654. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{ber.c → ber.cc} +13 -13
  655. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{cbb.c → cbb.cc} +45 -61
  656. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{cbs.c → cbs.cc} +42 -41
  657. data/third_party/boringssl-with-bazel/src/crypto/bytestring/internal.h +13 -13
  658. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{unicode.c → unicode.cc} +13 -13
  659. data/third_party/boringssl-with-bazel/src/crypto/chacha/{chacha.c → chacha.cc} +13 -13
  660. data/third_party/boringssl-with-bazel/src/crypto/chacha/internal.h +18 -18
  661. data/third_party/boringssl-with-bazel/src/crypto/cipher/derive_key.cc +110 -0
  662. data/third_party/boringssl-with-bazel/src/crypto/{cipher_extra/e_aesctrhmac.c → cipher/e_aesctrhmac.cc} +18 -23
  663. data/third_party/boringssl-with-bazel/src/crypto/{cipher_extra/e_aesgcmsiv.c → cipher/e_aesgcmsiv.cc} +42 -38
  664. data/third_party/boringssl-with-bazel/src/crypto/{cipher_extra/e_chacha20poly1305.c → cipher/e_chacha20poly1305.cc} +13 -20
  665. data/third_party/boringssl-with-bazel/src/crypto/cipher/e_des.cc +198 -0
  666. data/third_party/boringssl-with-bazel/src/crypto/cipher/e_null.cc +51 -0
  667. data/third_party/boringssl-with-bazel/src/crypto/{cipher_extra/e_rc2.c → cipher/e_rc2.cc} +50 -88
  668. data/third_party/boringssl-with-bazel/src/crypto/cipher/e_rc4.cc +54 -0
  669. data/third_party/boringssl-with-bazel/src/crypto/{cipher_extra/e_tls.c → cipher/e_tls.cc} +14 -13
  670. data/third_party/boringssl-with-bazel/src/crypto/cipher/get_cipher.cc +85 -0
  671. data/third_party/boringssl-with-bazel/src/crypto/{cipher_extra → cipher}/internal.h +29 -69
  672. data/third_party/boringssl-with-bazel/src/crypto/{cipher_extra/tls_cbc.c → cipher/tls_cbc.cc} +13 -51
  673. data/third_party/boringssl-with-bazel/src/crypto/conf/{conf.c → conf.cc} +31 -72
  674. data/third_party/boringssl-with-bazel/src/crypto/conf/internal.h +13 -13
  675. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_apple.c → cpu_aarch64_apple.cc} +14 -14
  676. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_fuchsia.c → cpu_aarch64_fuchsia.cc} +14 -14
  677. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_linux.c → cpu_aarch64_linux.cc} +14 -14
  678. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_openbsd.c → cpu_aarch64_openbsd.cc} +17 -17
  679. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_sysreg.c → cpu_aarch64_sysreg.cc} +15 -14
  680. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_win.cc +41 -0
  681. data/third_party/boringssl-with-bazel/src/crypto/{cpu_arm_freebsd.c → cpu_arm_freebsd.cc} +15 -15
  682. data/third_party/boringssl-with-bazel/src/crypto/{cpu_arm_linux.c → cpu_arm_linux.cc} +17 -17
  683. data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_linux.h +13 -13
  684. data/third_party/boringssl-with-bazel/src/crypto/{cpu_intel.c → cpu_intel.cc} +60 -99
  685. data/third_party/boringssl-with-bazel/src/crypto/{crypto.c → crypto.cc} +18 -23
  686. data/third_party/boringssl-with-bazel/src/crypto/curve25519/{curve25519.c → curve25519.cc} +40 -43
  687. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_64_adx.cc +18 -0
  688. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +13 -13
  689. data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +13 -13
  690. data/third_party/boringssl-with-bazel/src/crypto/curve25519/{spake25519.c → spake25519.cc} +34 -28
  691. data/third_party/boringssl-with-bazel/src/crypto/des/{des.c → des.cc} +13 -55
  692. data/third_party/boringssl-with-bazel/src/crypto/des/internal.h +27 -69
  693. data/third_party/boringssl-with-bazel/src/crypto/dh/dh_asn1.cc +124 -0
  694. data/third_party/boringssl-with-bazel/src/crypto/{dh_extra/params.c → dh/params.cc} +13 -51
  695. data/third_party/boringssl-with-bazel/src/crypto/{digest_extra/digest_extra.c → digest/digest_extra.cc} +126 -86
  696. data/third_party/boringssl-with-bazel/src/crypto/dsa/{dsa.c → dsa.cc} +166 -212
  697. data/third_party/boringssl-with-bazel/src/crypto/dsa/{dsa_asn1.c → dsa_asn1.cc} +13 -53
  698. data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +13 -15
  699. data/third_party/boringssl-with-bazel/src/crypto/{ec_extra/ec_asn1.c → ec/ec_asn1.cc} +59 -61
  700. data/third_party/boringssl-with-bazel/src/crypto/{ec_extra/ec_derive.c → ec/ec_derive.cc} +13 -13
  701. data/third_party/boringssl-with-bazel/src/crypto/{ec_extra/hash_to_curve.c → ec/hash_to_curve.cc} +79 -77
  702. data/third_party/boringssl-with-bazel/src/crypto/{ec_extra → ec}/internal.h +13 -13
  703. data/third_party/boringssl-with-bazel/src/crypto/ecdh/ecdh.cc +73 -0
  704. data/third_party/boringssl-with-bazel/src/crypto/{ecdsa_extra/ecdsa_asn1.c → ecdsa/ecdsa_asn1.cc} +32 -86
  705. data/third_party/boringssl-with-bazel/src/crypto/engine/{engine.c → engine.cc} +24 -20
  706. data/third_party/boringssl-with-bazel/src/crypto/err/{err.c → err.cc} +41 -134
  707. data/third_party/boringssl-with-bazel/src/crypto/err/internal.h +13 -13
  708. data/third_party/boringssl-with-bazel/src/crypto/evp/{evp.c → evp.cc} +37 -88
  709. data/third_party/boringssl-with-bazel/src/crypto/evp/{evp_asn1.c → evp_asn1.cc} +122 -198
  710. data/third_party/boringssl-with-bazel/src/crypto/evp/{evp_ctx.c → evp_ctx.cc} +20 -63
  711. data/third_party/boringssl-with-bazel/src/crypto/evp/internal.h +13 -55
  712. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_dh.c → p_dh.cc} +38 -22
  713. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_dh_asn1.c → p_dh_asn1.cc} +51 -29
  714. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_dsa_asn1.c → p_dsa_asn1.cc} +75 -134
  715. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ec.c → p_ec.cc} +31 -75
  716. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ec_asn1.c → p_ec_asn1.cc} +36 -82
  717. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ed25519.c → p_ed25519.cc} +34 -31
  718. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ed25519_asn1.c → p_ed25519_asn1.cc} +26 -25
  719. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_hkdf.c → p_hkdf.cc} +30 -26
  720. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_rsa.c → p_rsa.cc} +54 -91
  721. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_rsa_asn1.c → p_rsa_asn1.cc} +26 -69
  722. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_x25519.c → p_x25519.cc} +34 -31
  723. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_x25519_asn1.c → p_x25519_asn1.cc} +30 -29
  724. data/third_party/boringssl-with-bazel/src/crypto/evp/pbkdf.cc +98 -0
  725. data/third_party/boringssl-with-bazel/src/crypto/evp/{print.c → print.cc} +17 -56
  726. data/third_party/boringssl-with-bazel/src/crypto/evp/{scrypt.c → scrypt.cc} +20 -13
  727. data/third_party/boringssl-with-bazel/src/crypto/evp/sign.cc +114 -0
  728. data/third_party/boringssl-with-bazel/src/crypto/ex_data.cc +141 -0
  729. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes.cc.inc +191 -0
  730. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{aes_nohw.c.inc → aes_nohw.cc.inc} +13 -13
  731. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{modes/cbc.c.inc → aes/cbc.cc.inc} +13 -47
  732. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{modes/cfb.c.inc → aes/cfb.cc.inc} +13 -47
  733. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/ctr.cc.inc +100 -0
  734. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{modes/gcm.c.inc → aes/gcm.cc.inc} +175 -314
  735. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{modes/gcm_nohw.c.inc → aes/gcm_nohw.cc.inc} +13 -13
  736. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/internal.h +419 -70
  737. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{key_wrap.c.inc → key_wrap.cc.inc} +14 -48
  738. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/mode_wrappers.cc.inc +84 -0
  739. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/ofb.cc.inc +53 -0
  740. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{modes/polyval.c.inc → aes/polyval.cc.inc} +14 -15
  741. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{bcm.c → bcm.cc} +116 -113
  742. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm_interface.h +665 -25
  743. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{add.c.inc → add.cc.inc} +14 -55
  744. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/asm/{x86_64-gcc.c.inc → x86_64-gcc.cc.inc} +19 -6
  745. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{bn.c.inc → bn.cc.inc} +25 -79
  746. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{bytes.c.inc → bytes.cc.inc} +13 -55
  747. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{cmp.c.inc → cmp.cc.inc} +13 -55
  748. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{ctx.c.inc → ctx.cc.inc} +20 -63
  749. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{div.c.inc → div.cc.inc} +42 -93
  750. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{div_extra.c.inc → div_extra.cc.inc} +13 -13
  751. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{exponentiation.c.inc → exponentiation.cc.inc} +38 -131
  752. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{gcd.c.inc → gcd.cc.inc} +16 -113
  753. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{gcd_extra.c.inc → gcd_extra.cc.inc} +45 -37
  754. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{generic.c.inc → generic.cc.inc} +13 -55
  755. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +25 -134
  756. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/jacobi.cc.inc +108 -0
  757. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{montgomery.c.inc → montgomery.cc.inc} +24 -126
  758. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{montgomery_inv.c.inc → montgomery_inv.cc.inc} +13 -13
  759. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{mul.c.inc → mul.cc.inc} +24 -70
  760. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{prime.c.inc → prime.cc.inc} +44 -141
  761. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{random.c.inc → random.cc.inc} +13 -107
  762. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{rsaz_exp.c.inc → rsaz_exp.cc.inc} +18 -13
  763. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/rsaz_exp.h +20 -17
  764. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{shift.c.inc → shift.cc.inc} +16 -59
  765. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{sqrt.c.inc → sqrt.cc.inc} +13 -53
  766. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{aead.c.inc → aead.cc.inc} +30 -22
  767. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{cipher.c.inc → cipher.cc.inc} +20 -65
  768. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{e_aes.c.inc → e_aes.cc.inc} +113 -335
  769. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{e_aesccm.c.inc → e_aesccm.cc.inc} +21 -58
  770. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/internal.h +14 -65
  771. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cmac/{cmac.c.inc → cmac.cc.inc} +19 -53
  772. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/delocate.h +26 -22
  773. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/{check.c.inc → check.cc.inc} +13 -55
  774. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/{dh.c.inc → dh.cc.inc} +28 -74
  775. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/internal.h +13 -15
  776. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/{digest.c.inc → digest.cc.inc} +30 -68
  777. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digests.cc.inc +178 -0
  778. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/internal.h +13 -55
  779. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/md32_common.h +13 -47
  780. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digestsign/{digestsign.c.inc → digestsign.cc.inc} +14 -55
  781. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/builtin_curves.h +91 -91
  782. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec.c.inc → ec.cc.inc} +24 -81
  783. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec_key.c.inc → ec_key.cc.inc} +26 -86
  784. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec_montgomery.c.inc → ec_montgomery.cc.inc} +14 -66
  785. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{felem.c.inc → felem.cc.inc} +13 -13
  786. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +19 -66
  787. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{oct.c.inc → oct.cc.inc} +19 -72
  788. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p224-64.c.inc → p224-64.cc.inc} +13 -13
  789. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz-table.h +15 -10
  790. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p256-nistz.c.inc → p256-nistz.cc.inc} +37 -30
  791. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.h +22 -17
  792. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p256.c.inc → p256.cc.inc} +13 -13
  793. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +13 -13
  794. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{scalar.c.inc → scalar.cc.inc} +21 -15
  795. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{simple.c.inc → simple.cc.inc} +14 -66
  796. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{simple_mul.c.inc → simple_mul.cc.inc} +13 -13
  797. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{util.c.inc → util.cc.inc} +13 -13
  798. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{wnaf.c.inc → wnaf.cc.inc} +38 -81
  799. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.cc.inc +88 -0
  800. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/{ecdsa.c.inc → ecdsa.cc.inc} +19 -58
  801. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/internal.h +13 -13
  802. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/fips_shared_support.cc +28 -0
  803. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hkdf/{hkdf.c.inc → hkdf.cc.inc} +13 -13
  804. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hmac/{hmac.c.inc → hmac.cc.inc} +16 -57
  805. data/third_party/boringssl-with-bazel/src/crypto/{keccak → fipsmodule/keccak}/internal.h +13 -13
  806. data/third_party/boringssl-with-bazel/src/crypto/{keccak/keccak.c → fipsmodule/keccak/keccak.cc.inc} +14 -14
  807. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/mldsa/mldsa.cc.inc +1993 -0
  808. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/mlkem/mlkem.cc.inc +1165 -0
  809. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/{ctrdrbg.c.inc → ctrdrbg.cc.inc} +22 -28
  810. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +18 -24
  811. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/{rand.c.inc → rand.cc.inc} +34 -30
  812. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/blinding.cc.inc +147 -0
  813. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +13 -56
  814. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{padding.c.inc → padding.cc.inc} +32 -73
  815. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{rsa.c.inc → rsa.cc.inc} +93 -148
  816. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{rsa_impl.c.inc → rsa_impl.cc.inc} +82 -137
  817. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/{fips.c.inc → fips.cc.inc} +26 -18
  818. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/{self_check.c.inc → self_check.cc.inc} +68 -64
  819. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/service_indicator/internal.h +34 -34
  820. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/service_indicator/{service_indicator.c.inc → service_indicator.cc.inc} +23 -24
  821. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/internal.h +43 -57
  822. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha1.c.inc → sha1.cc.inc} +39 -88
  823. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha256.c.inc → sha256.cc.inc} +50 -110
  824. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha512.c.inc → sha512.cc.inc} +61 -131
  825. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/address.h +119 -0
  826. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/fors.cc.inc +169 -0
  827. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/fors.h +58 -0
  828. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/merkle.cc.inc +161 -0
  829. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/merkle.h +70 -0
  830. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/params.h +78 -0
  831. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/slhdsa.cc.inc +329 -0
  832. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/thash.cc.inc +173 -0
  833. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/thash.h +85 -0
  834. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/wots.cc.inc +171 -0
  835. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/slhdsa/wots.h +50 -0
  836. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/internal.h +13 -13
  837. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/{kdf.c.inc → kdf.cc.inc} +13 -51
  838. data/third_party/boringssl-with-bazel/src/crypto/hpke/{hpke.c → hpke.cc} +19 -16
  839. data/third_party/boringssl-with-bazel/src/crypto/hrss/{hrss.c → hrss.cc} +73 -122
  840. data/third_party/boringssl-with-bazel/src/crypto/hrss/internal.h +13 -13
  841. data/third_party/boringssl-with-bazel/src/crypto/internal.h +242 -442
  842. data/third_party/boringssl-with-bazel/src/crypto/kyber/internal.h +13 -13
  843. data/third_party/boringssl-with-bazel/src/crypto/kyber/{kyber.c → kyber.cc} +52 -28
  844. data/third_party/boringssl-with-bazel/src/crypto/lhash/internal.h +31 -75
  845. data/third_party/boringssl-with-bazel/src/crypto/lhash/{lhash.c → lhash.cc} +21 -62
  846. data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/md4/md4.c.inc → md4/md4.cc} +21 -67
  847. data/third_party/boringssl-with-bazel/src/crypto/md5/internal.h +37 -0
  848. data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/md5/md5.c.inc → md5/md5.cc} +17 -58
  849. data/third_party/boringssl-with-bazel/src/crypto/{mem.c → mem.cc} +47 -77
  850. data/third_party/boringssl-with-bazel/src/crypto/mldsa/mldsa.cc +90 -0
  851. data/third_party/boringssl-with-bazel/src/crypto/mlkem/mlkem.cc +97 -1042
  852. data/third_party/boringssl-with-bazel/src/crypto/obj/{obj.c → obj.cc} +40 -85
  853. data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +14 -56
  854. data/third_party/boringssl-with-bazel/src/crypto/obj/obj_xref.cc +80 -0
  855. data/third_party/boringssl-with-bazel/src/crypto/pem/internal.h +44 -0
  856. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_all.cc +149 -0
  857. data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_info.c → pem_info.cc} +20 -60
  858. data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_lib.c → pem_lib.cc} +59 -107
  859. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_oth.cc +45 -0
  860. data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_pk8.c → pem_pk8.cc} +13 -55
  861. data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_pkey.c → pem_pkey.cc} +13 -55
  862. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_x509.cc +22 -0
  863. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_xaux.cc +22 -0
  864. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/internal.h +13 -13
  865. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/{pkcs7.c → pkcs7.cc} +17 -17
  866. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/{pkcs7_x509.c → pkcs7_x509.cc} +40 -37
  867. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +13 -54
  868. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/{p5_pbev2.c → p5_pbev2.cc} +13 -54
  869. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/{pkcs8.c → pkcs8.cc} +170 -210
  870. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/{pkcs8_x509.c → pkcs8_x509.cc} +101 -149
  871. data/third_party/boringssl-with-bazel/src/crypto/poly1305/internal.h +13 -13
  872. data/third_party/boringssl-with-bazel/src/crypto/poly1305/{poly1305.c → poly1305.cc} +15 -15
  873. data/third_party/boringssl-with-bazel/src/crypto/poly1305/{poly1305_arm.c → poly1305_arm.cc} +16 -14
  874. data/third_party/boringssl-with-bazel/src/crypto/poly1305/{poly1305_vec.c → poly1305_vec.cc} +26 -23
  875. data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +13 -13
  876. data/third_party/boringssl-with-bazel/src/crypto/pool/{pool.c → pool.cc} +24 -23
  877. data/third_party/boringssl-with-bazel/src/crypto/{rand_extra/deterministic.c → rand/deterministic.cc} +14 -14
  878. data/third_party/boringssl-with-bazel/src/crypto/{rand_extra/fork_detect.c → rand/fork_detect.cc} +23 -24
  879. data/third_party/boringssl-with-bazel/src/crypto/rand/forkunsafe.cc +44 -0
  880. data/third_party/boringssl-with-bazel/src/crypto/{rand_extra/getentropy.c → rand/getentropy.cc} +13 -13
  881. data/third_party/boringssl-with-bazel/src/crypto/{rand_extra → rand}/getrandom_fillin.h +13 -13
  882. data/third_party/boringssl-with-bazel/src/crypto/rand/ios.cc +42 -0
  883. data/third_party/boringssl-with-bazel/src/crypto/{rand_extra/passive.c → rand/passive.cc} +34 -30
  884. data/third_party/boringssl-with-bazel/src/crypto/{rand_extra/rand_extra.c → rand/rand.cc} +13 -13
  885. data/third_party/boringssl-with-bazel/src/crypto/rand/sysrand_internal.h +37 -0
  886. data/third_party/boringssl-with-bazel/src/crypto/rand/trusty.cc +46 -0
  887. data/third_party/boringssl-with-bazel/src/crypto/{rand_extra/urandom.c → rand/urandom.cc} +19 -19
  888. data/third_party/boringssl-with-bazel/src/crypto/{rand_extra/windows.c → rand/windows.cc} +13 -13
  889. data/third_party/boringssl-with-bazel/src/crypto/rc4/rc4.cc +56 -0
  890. data/third_party/boringssl-with-bazel/src/crypto/{refcount.c → refcount.cc} +13 -13
  891. data/third_party/boringssl-with-bazel/src/crypto/rsa/internal.h +36 -0
  892. data/third_party/boringssl-with-bazel/src/crypto/{rsa_extra/rsa_asn1.c → rsa/rsa_asn1.cc} +13 -54
  893. data/third_party/boringssl-with-bazel/src/crypto/{rsa_extra/rsa_crypt.c → rsa/rsa_crypt.cc} +94 -133
  894. data/third_party/boringssl-with-bazel/src/crypto/rsa/rsa_extra.cc +19 -0
  895. data/third_party/boringssl-with-bazel/src/crypto/rsa/rsa_print.cc +27 -0
  896. data/third_party/boringssl-with-bazel/src/crypto/sha/sha1.cc +52 -0
  897. data/third_party/boringssl-with-bazel/src/crypto/sha/sha256.cc +87 -0
  898. data/third_party/boringssl-with-bazel/src/crypto/sha/sha512.cc +104 -0
  899. data/third_party/boringssl-with-bazel/src/crypto/siphash/{siphash.c → siphash.cc} +13 -13
  900. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/slhdsa.cc +113 -0
  901. data/third_party/boringssl-with-bazel/src/crypto/spake2plus/internal.h +204 -0
  902. data/third_party/boringssl-with-bazel/src/crypto/spake2plus/spake2plus.cc +501 -0
  903. data/third_party/boringssl-with-bazel/src/crypto/stack/{stack.c → stack.cc} +23 -61
  904. data/third_party/boringssl-with-bazel/src/crypto/thread.cc +68 -0
  905. data/third_party/boringssl-with-bazel/src/crypto/{thread_none.c → thread_none.cc} +13 -13
  906. data/third_party/boringssl-with-bazel/src/crypto/{thread_pthread.c → thread_pthread.cc} +21 -20
  907. data/third_party/boringssl-with-bazel/src/crypto/{thread_win.c → thread_win.cc} +33 -29
  908. data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +13 -13
  909. data/third_party/boringssl-with-bazel/src/crypto/trust_token/{pmbtoken.c → pmbtoken.cc} +159 -171
  910. data/third_party/boringssl-with-bazel/src/crypto/trust_token/{trust_token.c → trust_token.cc} +32 -34
  911. data/third_party/boringssl-with-bazel/src/crypto/trust_token/{voprf.c → voprf.cc} +178 -182
  912. data/third_party/boringssl-with-bazel/src/crypto/x509/a_digest.cc +52 -0
  913. data/third_party/boringssl-with-bazel/src/crypto/x509/a_sign.cc +97 -0
  914. data/third_party/boringssl-with-bazel/src/crypto/x509/a_verify.cc +74 -0
  915. data/third_party/boringssl-with-bazel/src/crypto/x509/{algorithm.c → algorithm.cc} +14 -56
  916. data/third_party/boringssl-with-bazel/src/crypto/x509/{asn1_gen.c → asn1_gen.cc} +19 -62
  917. data/third_party/boringssl-with-bazel/src/crypto/x509/{by_dir.c → by_dir.cc} +32 -77
  918. data/third_party/boringssl-with-bazel/src/crypto/x509/{by_file.c → by_file.cc} +13 -55
  919. data/third_party/boringssl-with-bazel/src/crypto/x509/ext_dat.h +13 -55
  920. data/third_party/boringssl-with-bazel/src/crypto/x509/i2d_pr.cc +37 -0
  921. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +13 -57
  922. data/third_party/boringssl-with-bazel/src/crypto/x509/{name_print.c → name_print.cc} +13 -55
  923. data/third_party/boringssl-with-bazel/src/crypto/x509/{policy.c → policy.cc} +200 -190
  924. data/third_party/boringssl-with-bazel/src/crypto/x509/{rsa_pss.c → rsa_pss.cc} +59 -96
  925. data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.cc +103 -0
  926. data/third_party/boringssl-with-bazel/src/crypto/x509/{t_req.c → t_req.cc} +13 -55
  927. data/third_party/boringssl-with-bazel/src/crypto/x509/{t_x509.c → t_x509.cc} +13 -55
  928. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509a.cc +79 -0
  929. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_akey.c → v3_akey.cc} +17 -57
  930. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_akeya.cc +31 -0
  931. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_alt.c → v3_alt.cc} +17 -58
  932. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_bcons.cc +95 -0
  933. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_bitst.cc +102 -0
  934. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_conf.c → v3_conf.cc} +18 -60
  935. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_cpols.c → v3_cpols.cc} +60 -98
  936. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_crld.c → v3_crld.cc} +16 -57
  937. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_enum.cc +73 -0
  938. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_extku.cc +114 -0
  939. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_genn.c → v3_genn.cc} +20 -62
  940. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_ia5.cc +79 -0
  941. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_info.c → v3_info.cc} +20 -67
  942. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_int.cc +81 -0
  943. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_lib.c → v3_lib.cc} +23 -63
  944. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_ncons.c → v3_ncons.cc} +15 -56
  945. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_ocsp.c → v3_ocsp.cc} +17 -9
  946. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_pcons.cc +101 -0
  947. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_pmaps.c → v3_pmaps.cc} +15 -56
  948. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_prn.c → v3_prn.cc} +15 -56
  949. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_purp.c → v3_purp.cc} +29 -63
  950. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_skey.cc +131 -0
  951. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_utl.c → v3_utl.cc} +30 -78
  952. data/third_party/boringssl-with-bazel/src/crypto/x509/x509.cc +47 -0
  953. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_att.c → x509_att.cc} +16 -57
  954. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_cmp.c → x509_cmp.cc} +13 -55
  955. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_d2.cc +66 -0
  956. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_def.cc +44 -0
  957. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_ext.c → x509_ext.cc} +13 -55
  958. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_lu.c → x509_lu.cc} +20 -65
  959. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_obj.c → x509_obj.cc} +13 -55
  960. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_req.c → x509_req.cc} +13 -55
  961. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_set.c → x509_set.cc} +13 -55
  962. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_trs.c → x509_trs.cc} +13 -55
  963. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_txt.c → x509_txt.cc} +13 -55
  964. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_v3.c → x509_v3.cc} +15 -57
  965. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_vfy.c → x509_vfy.cc} +229 -267
  966. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_vpm.c → x509_vpm.cc} +68 -68
  967. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509cset.c → x509cset.cc} +13 -55
  968. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509name.c → x509name.cc} +13 -55
  969. data/third_party/boringssl-with-bazel/src/crypto/x509/x509rset.cc +67 -0
  970. data/third_party/boringssl-with-bazel/src/crypto/x509/x509spki.cc +91 -0
  971. data/third_party/boringssl-with-bazel/src/crypto/x509/x_algor.cc +107 -0
  972. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_all.c → x_all.cc} +23 -61
  973. data/third_party/boringssl-with-bazel/src/crypto/x509/x_attrib.cc +55 -0
  974. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_crl.c → x_crl.cc} +19 -61
  975. data/third_party/boringssl-with-bazel/src/crypto/x509/x_exten.cc +36 -0
  976. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_name.c → x_name.cc} +52 -87
  977. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_pubkey.c → x_pubkey.cc} +17 -57
  978. data/third_party/boringssl-with-bazel/src/crypto/x509/x_req.cc +74 -0
  979. data/third_party/boringssl-with-bazel/src/crypto/x509/x_sig.cc +51 -0
  980. data/third_party/boringssl-with-bazel/src/crypto/x509/x_spki.cc +34 -0
  981. data/third_party/boringssl-with-bazel/src/crypto/x509/x_val.cc +28 -0
  982. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_x509.c → x_x509.cc} +61 -99
  983. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_x509a.c → x_x509a.cc} +17 -57
  984. data/third_party/boringssl-with-bazel/src/gen/crypto/{err_data.c → err_data.cc} +468 -453
  985. data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +13 -13
  986. data/third_party/boringssl-with-bazel/src/include/openssl/aes.h +13 -47
  987. data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +13 -51
  988. data/third_party/boringssl-with-bazel/src/include/openssl/asm_base.h +14 -14
  989. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +23 -62
  990. data/third_party/boringssl-with-bazel/src/include/openssl/asn1_mac.h +13 -13
  991. data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +248 -328
  992. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +24 -55
  993. data/third_party/boringssl-with-bazel/src/include/openssl/base64.h +13 -55
  994. data/third_party/boringssl-with-bazel/src/include/openssl/bcm_public.h +82 -0
  995. data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +13 -55
  996. data/third_party/boringssl-with-bazel/src/include/openssl/blake2.h +13 -13
  997. data/third_party/boringssl-with-bazel/src/include/openssl/blowfish.h +13 -55
  998. data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +14 -121
  999. data/third_party/boringssl-with-bazel/src/include/openssl/buf.h +13 -55
  1000. data/third_party/boringssl-with-bazel/src/include/openssl/buffer.h +13 -13
  1001. data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +31 -16
  1002. data/third_party/boringssl-with-bazel/src/include/openssl/cast.h +13 -55
  1003. data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +13 -13
  1004. data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +31 -59
  1005. data/third_party/boringssl-with-bazel/src/include/openssl/cmac.h +13 -13
  1006. data/third_party/boringssl-with-bazel/src/include/openssl/conf.h +13 -55
  1007. data/third_party/boringssl-with-bazel/src/include/openssl/cpu.h +13 -13
  1008. data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +25 -14
  1009. data/third_party/boringssl-with-bazel/src/include/openssl/ctrdrbg.h +13 -13
  1010. data/third_party/boringssl-with-bazel/src/include/openssl/curve25519.h +13 -13
  1011. data/third_party/boringssl-with-bazel/src/include/openssl/des.h +13 -55
  1012. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +17 -55
  1013. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +19 -56
  1014. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +17 -58
  1015. data/third_party/boringssl-with-bazel/src/include/openssl/dtls1.h +13 -13
  1016. data/third_party/boringssl-with-bazel/src/include/openssl/e_os2.h +13 -13
  1017. data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +14 -66
  1018. data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +31 -72
  1019. data/third_party/boringssl-with-bazel/src/include/openssl/ecdh.h +14 -65
  1020. data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +13 -51
  1021. data/third_party/boringssl-with-bazel/src/include/openssl/engine.h +13 -13
  1022. data/third_party/boringssl-with-bazel/src/include/openssl/err.h +13 -107
  1023. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +14 -56
  1024. data/third_party/boringssl-with-bazel/src/include/openssl/evp_errors.h +13 -55
  1025. data/third_party/boringssl-with-bazel/src/include/openssl/ex_data.h +13 -107
  1026. data/third_party/boringssl-with-bazel/src/include/openssl/experimental/kyber.h +13 -13
  1027. data/third_party/boringssl-with-bazel/src/include/openssl/hkdf.h +13 -13
  1028. data/third_party/boringssl-with-bazel/src/include/openssl/hmac.h +13 -55
  1029. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +13 -13
  1030. data/third_party/boringssl-with-bazel/src/include/openssl/hrss.h +13 -13
  1031. data/third_party/boringssl-with-bazel/src/include/openssl/is_boringssl.h +13 -13
  1032. data/third_party/boringssl-with-bazel/src/include/openssl/kdf.h +13 -13
  1033. data/third_party/boringssl-with-bazel/src/include/openssl/lhash.h +13 -55
  1034. data/third_party/boringssl-with-bazel/src/include/openssl/md4.h +13 -55
  1035. data/third_party/boringssl-with-bazel/src/include/openssl/md5.h +13 -55
  1036. data/third_party/boringssl-with-bazel/src/include/openssl/mem.h +13 -55
  1037. data/third_party/boringssl-with-bazel/src/include/openssl/mldsa.h +20 -26
  1038. data/third_party/boringssl-with-bazel/src/include/openssl/mlkem.h +13 -37
  1039. data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +27 -69
  1040. data/third_party/boringssl-with-bazel/src/include/openssl/obj.h +13 -55
  1041. data/third_party/boringssl-with-bazel/src/include/openssl/obj_mac.h +13 -13
  1042. data/third_party/boringssl-with-bazel/src/include/openssl/objects.h +13 -13
  1043. data/third_party/boringssl-with-bazel/src/include/openssl/opensslconf.h +13 -13
  1044. data/third_party/boringssl-with-bazel/src/include/openssl/opensslv.h +13 -13
  1045. data/third_party/boringssl-with-bazel/src/include/openssl/ossl_typ.h +13 -13
  1046. data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +22 -60
  1047. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs12.h +13 -13
  1048. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +13 -13
  1049. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs8.h +13 -55
  1050. data/third_party/boringssl-with-bazel/src/include/openssl/poly1305.h +13 -13
  1051. data/third_party/boringssl-with-bazel/src/include/openssl/pool.h +13 -13
  1052. data/third_party/boringssl-with-bazel/src/include/openssl/posix_time.h +13 -13
  1053. data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +13 -13
  1054. data/third_party/boringssl-with-bazel/src/include/openssl/rc4.h +13 -55
  1055. data/third_party/boringssl-with-bazel/src/include/openssl/ripemd.h +13 -55
  1056. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +23 -63
  1057. data/third_party/boringssl-with-bazel/src/include/openssl/safestack.h +13 -13
  1058. data/third_party/boringssl-with-bazel/src/include/openssl/service_indicator.h +13 -13
  1059. data/third_party/boringssl-with-bazel/src/include/openssl/sha.h +15 -95
  1060. data/third_party/boringssl-with-bazel/src/include/openssl/siphash.h +13 -13
  1061. data/third_party/boringssl-with-bazel/src/include/openssl/slhdsa.h +174 -0
  1062. data/third_party/boringssl-with-bazel/src/include/openssl/span.h +24 -32
  1063. data/third_party/boringssl-with-bazel/src/include/openssl/srtp.h +13 -13
  1064. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +358 -290
  1065. data/third_party/boringssl-with-bazel/src/include/openssl/ssl3.h +15 -114
  1066. data/third_party/boringssl-with-bazel/src/include/openssl/stack.h +13 -55
  1067. data/third_party/boringssl-with-bazel/src/include/openssl/target.h +23 -13
  1068. data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +15 -57
  1069. data/third_party/boringssl-with-bazel/src/include/openssl/time.h +13 -13
  1070. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +27 -156
  1071. data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +15 -15
  1072. data/third_party/boringssl-with-bazel/src/include/openssl/type_check.h +13 -55
  1073. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +14 -61
  1074. data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +13 -13
  1075. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +13 -13
  1076. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3_errors.h +13 -53
  1077. data/third_party/boringssl-with-bazel/src/ssl/bio_ssl.cc +15 -14
  1078. data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +680 -434
  1079. data/third_party/boringssl-with-bazel/src/ssl/d1_lib.cc +129 -174
  1080. data/third_party/boringssl-with-bazel/src/ssl/d1_pkt.cc +176 -131
  1081. data/third_party/boringssl-with-bazel/src/ssl/d1_srtp.cc +21 -127
  1082. data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +107 -104
  1083. data/third_party/boringssl-with-bazel/src/ssl/dtls_record.cc +311 -312
  1084. data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +54 -47
  1085. data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +677 -475
  1086. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +66 -73
  1087. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +61 -153
  1088. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +198 -331
  1089. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +88 -212
  1090. data/third_party/boringssl-with-bazel/src/ssl/internal.h +949 -531
  1091. data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +47 -157
  1092. data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +29 -159
  1093. data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +18 -112
  1094. data/third_party/boringssl-with-bazel/src/ssl/ssl_aead_ctx.cc +103 -196
  1095. data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +52 -145
  1096. data/third_party/boringssl-with-bazel/src/ssl/ssl_buffer.cc +15 -20
  1097. data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +117 -157
  1098. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +229 -365
  1099. data/third_party/boringssl-with-bazel/src/ssl/ssl_credential.cc +216 -31
  1100. data/third_party/boringssl-with-bazel/src/ssl/ssl_file.cc +13 -109
  1101. data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +34 -33
  1102. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +194 -350
  1103. data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +38 -83
  1104. data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +101 -236
  1105. data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +17 -91
  1106. data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +109 -157
  1107. data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +44 -30
  1108. data/third_party/boringssl-with-bazel/src/ssl/ssl_x509.cc +66 -195
  1109. data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +45 -176
  1110. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +58 -42
  1111. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +146 -94
  1112. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +251 -180
  1113. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +236 -107
  1114. data/third_party/boringssl-with-bazel/src/ssl/tls_method.cc +64 -117
  1115. data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +52 -134
  1116. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_32.h +6 -0
  1117. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64.h +6 -0
  1118. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_adx.h +4 -1
  1119. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_32.h +1 -1
  1120. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64.h +3 -0
  1121. metadata +357 -348
  1122. data/src/core/ext/upb-gen/envoy/config/trace/v3/opencensus.upb.h +0 -426
  1123. data/src/core/ext/upb-gen/envoy/config/trace/v3/opencensus.upb_minitable.c +0 -87
  1124. data/src/core/ext/upb-gen/envoy/config/trace/v3/opencensus.upb_minitable.h +0 -32
  1125. data/src/core/ext/upb-gen/opencensus/proto/trace/v1/trace_config.upb.h +0 -408
  1126. data/src/core/ext/upb-gen/opencensus/proto/trace/v1/trace_config.upb_minitable.c +0 -124
  1127. data/src/core/ext/upb-gen/opencensus/proto/trace/v1/trace_config.upb_minitable.h +0 -38
  1128. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opencensus.upbdefs.c +0 -108
  1129. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opencensus.upbdefs.h +0 -33
  1130. data/src/core/ext/upbdefs-gen/opencensus/proto/trace/v1/trace_config.upbdefs.c +0 -67
  1131. data/src/core/ext/upbdefs-gen/opencensus/proto/trace/v1/trace_config.upbdefs.h +0 -48
  1132. data/src/core/util/atm.cc +0 -34
  1133. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bool.c +0 -95
  1134. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_d2i_fp.c +0 -89
  1135. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_dup.c +0 -84
  1136. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_gentm.c +0 -151
  1137. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_i2d_fp.c +0 -85
  1138. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_octet.c +0 -74
  1139. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +0 -183
  1140. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_par.c +0 -103
  1141. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn_pack.c +0 -98
  1142. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_int.c +0 -105
  1143. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_string.c +0 -94
  1144. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_fre.c +0 -212
  1145. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_typ.c +0 -126
  1146. data/third_party/boringssl-with-bazel/src/crypto/bio/errno.c +0 -92
  1147. data/third_party/boringssl-with-bazel/src/crypto/bio/hexdump.c +0 -192
  1148. data/third_party/boringssl-with-bazel/src/crypto/bio/printf.c +0 -102
  1149. data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +0 -189
  1150. data/third_party/boringssl-with-bazel/src/crypto/buf/buf.c +0 -158
  1151. data/third_party/boringssl-with-bazel/src/crypto/bytestring/asn1_compat.c +0 -53
  1152. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/cipher_extra.c +0 -127
  1153. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/derive_key.c +0 -152
  1154. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_des.c +0 -228
  1155. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_null.c +0 -90
  1156. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_rc4.c +0 -94
  1157. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_win.c +0 -41
  1158. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_64_adx.c +0 -18
  1159. data/third_party/boringssl-with-bazel/src/crypto/dh_extra/dh_asn1.c +0 -165
  1160. data/third_party/boringssl-with-bazel/src/crypto/dilithium/dilithium.c +0 -1539
  1161. data/third_party/boringssl-with-bazel/src/crypto/dilithium/internal.h +0 -58
  1162. data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/ecdh_extra.c +0 -124
  1163. data/third_party/boringssl-with-bazel/src/crypto/evp/pbkdf.c +0 -146
  1164. data/third_party/boringssl-with-bazel/src/crypto/evp/sign.c +0 -156
  1165. data/third_party/boringssl-with-bazel/src/crypto/ex_data.c +0 -236
  1166. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes.c.inc +0 -127
  1167. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/mode_wrappers.c.inc +0 -124
  1168. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/jacobi.c.inc +0 -146
  1169. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digests.c.inc +0 -304
  1170. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.c.inc +0 -130
  1171. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/fips_shared_support.c +0 -29
  1172. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/internal.h +0 -37
  1173. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ctr.c.inc +0 -196
  1174. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/internal.h +0 -428
  1175. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ofb.c.inc +0 -87
  1176. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/blinding.c.inc +0 -241
  1177. data/third_party/boringssl-with-bazel/src/crypto/mldsa/internal.h +0 -73
  1178. data/third_party/boringssl-with-bazel/src/crypto/mldsa/mldsa.c +0 -1687
  1179. data/third_party/boringssl-with-bazel/src/crypto/mlkem/internal.h +0 -90
  1180. data/third_party/boringssl-with-bazel/src/crypto/obj/obj_xref.c +0 -122
  1181. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_all.c +0 -243
  1182. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_oth.c +0 -87
  1183. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_x509.c +0 -64
  1184. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_xaux.c +0 -64
  1185. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/forkunsafe.c +0 -44
  1186. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/ios.c +0 -42
  1187. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/sysrand_internal.h +0 -37
  1188. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/trusty.c +0 -46
  1189. data/third_party/boringssl-with-bazel/src/crypto/rc4/rc4.c +0 -98
  1190. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/internal.h +0 -79
  1191. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/rsa_print.c +0 -22
  1192. data/third_party/boringssl-with-bazel/src/crypto/spx/address.c +0 -101
  1193. data/third_party/boringssl-with-bazel/src/crypto/spx/address.h +0 -50
  1194. data/third_party/boringssl-with-bazel/src/crypto/spx/fors.c +0 -133
  1195. data/third_party/boringssl-with-bazel/src/crypto/spx/fors.h +0 -54
  1196. data/third_party/boringssl-with-bazel/src/crypto/spx/merkle.c +0 -150
  1197. data/third_party/boringssl-with-bazel/src/crypto/spx/merkle.h +0 -61
  1198. data/third_party/boringssl-with-bazel/src/crypto/spx/params.h +0 -71
  1199. data/third_party/boringssl-with-bazel/src/crypto/spx/spx.c +0 -140
  1200. data/third_party/boringssl-with-bazel/src/crypto/spx/spx_util.c +0 -53
  1201. data/third_party/boringssl-with-bazel/src/crypto/spx/spx_util.h +0 -44
  1202. data/third_party/boringssl-with-bazel/src/crypto/spx/thash.c +0 -136
  1203. data/third_party/boringssl-with-bazel/src/crypto/spx/thash.h +0 -70
  1204. data/third_party/boringssl-with-bazel/src/crypto/spx/wots.c +0 -135
  1205. data/third_party/boringssl-with-bazel/src/crypto/spx/wots.h +0 -45
  1206. data/third_party/boringssl-with-bazel/src/crypto/thread.c +0 -110
  1207. data/third_party/boringssl-with-bazel/src/crypto/x509/a_digest.c +0 -94
  1208. data/third_party/boringssl-with-bazel/src/crypto/x509/a_sign.c +0 -136
  1209. data/third_party/boringssl-with-bazel/src/crypto/x509/a_verify.c +0 -116
  1210. data/third_party/boringssl-with-bazel/src/crypto/x509/i2d_pr.c +0 -79
  1211. data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.c +0 -145
  1212. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509a.c +0 -121
  1213. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_akeya.c +0 -73
  1214. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_bcons.c +0 -135
  1215. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_bitst.c +0 -141
  1216. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_enum.c +0 -112
  1217. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_extku.c +0 -154
  1218. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_ia5.c +0 -122
  1219. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_int.c +0 -121
  1220. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_pcons.c +0 -142
  1221. data/third_party/boringssl-with-bazel/src/crypto/x509/v3_skey.c +0 -170
  1222. data/third_party/boringssl-with-bazel/src/crypto/x509/x509.c +0 -89
  1223. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_d2.c +0 -108
  1224. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_def.c +0 -86
  1225. data/third_party/boringssl-with-bazel/src/crypto/x509/x509rset.c +0 -109
  1226. data/third_party/boringssl-with-bazel/src/crypto/x509/x509spki.c +0 -133
  1227. data/third_party/boringssl-with-bazel/src/crypto/x509/x_algor.c +0 -149
  1228. data/third_party/boringssl-with-bazel/src/crypto/x509/x_attrib.c +0 -97
  1229. data/third_party/boringssl-with-bazel/src/crypto/x509/x_exten.c +0 -78
  1230. data/third_party/boringssl-with-bazel/src/crypto/x509/x_req.c +0 -116
  1231. data/third_party/boringssl-with-bazel/src/crypto/x509/x_sig.c +0 -93
  1232. data/third_party/boringssl-with-bazel/src/crypto/x509/x_spki.c +0 -79
  1233. data/third_party/boringssl-with-bazel/src/crypto/x509/x_val.c +0 -70
  1234. data/third_party/boringssl-with-bazel/src/include/openssl/experimental/dilithium.h +0 -129
  1235. data/third_party/boringssl-with-bazel/src/include/openssl/experimental/spx.h +0 -90
@@ -24,6 +24,7 @@
24
24
  #include <algorithm>
25
25
  #include <functional>
26
26
  #include <memory>
27
+ #include <optional>
27
28
  #include <string>
28
29
  #include <type_traits>
29
30
  #include <vector>
@@ -37,11 +38,12 @@
37
38
  #include "absl/strings/str_split.h"
38
39
  #include "absl/strings/string_view.h"
39
40
  #include "absl/strings/strip.h"
40
- #include "absl/types/optional.h"
41
41
  #include "envoy/config/core/v3/base.upb.h"
42
- #include "envoy/service/status/v3/csds.upb.h"
42
+ #include "envoy/service/discovery/v3/discovery.upb.h"
43
+ #include "envoy/service/discovery/v3/discovery.upbdefs.h"
43
44
  #include "google/protobuf/any.upb.h"
44
45
  #include "google/protobuf/timestamp.upb.h"
46
+ #include "google/rpc/status.upb.h"
45
47
  #include "src/core/lib/iomgr/exec_ctx.h"
46
48
  #include "src/core/util/backoff.h"
47
49
  #include "src/core/util/debug_location.h"
@@ -55,6 +57,8 @@
55
57
  #include "src/core/xds/xds_client/xds_locality.h"
56
58
  #include "upb/base/string_view.h"
57
59
  #include "upb/mem/arena.h"
60
+ #include "upb/reflection/def.h"
61
+ #include "upb/text/encode.h"
58
62
 
59
63
  #define GRPC_XDS_INITIAL_CONNECT_BACKOFF_SECONDS 1
60
64
  #define GRPC_XDS_RECONNECT_BACKOFF_MULTIPLIER 1.6
@@ -107,7 +111,7 @@ class XdsClient::XdsChannel::RetryableCall final
107
111
 
108
112
  // Retry state.
109
113
  BackOff backoff_;
110
- absl::optional<EventEngine::TaskHandle> timer_handle_
114
+ std::optional<EventEngine::TaskHandle> timer_handle_
111
115
  ABSL_GUARDED_BY(&XdsClient::mu_);
112
116
 
113
117
  bool shutting_down_ = false;
@@ -120,7 +124,10 @@ class XdsClient::XdsChannel::AdsCall final
120
124
  // The ctor and dtor should not be used directly.
121
125
  explicit AdsCall(RefCountedPtr<RetryableCall<AdsCall>> retryable_call);
122
126
 
123
- void Orphan() override;
127
+ // Disable thread-safety analysis because this method is called via
128
+ // OrphanablePtr<>, but there's no way to pass the lock annotation
129
+ // through there.
130
+ void Orphan() override ABSL_NO_THREAD_SAFETY_ANALYSIS;
124
131
 
125
132
  RetryableCall<AdsCall>* retryable_call() const {
126
133
  return retryable_call_.get();
@@ -141,44 +148,6 @@ class XdsClient::XdsChannel::AdsCall final
141
148
  private:
142
149
  class AdsReadDelayHandle;
143
150
 
144
- class AdsResponseParser final : public XdsApi::AdsResponseParserInterface {
145
- public:
146
- struct Result {
147
- const XdsResourceType* type;
148
- std::string type_url;
149
- std::string version;
150
- std::string nonce;
151
- std::vector<std::string> errors;
152
- std::map<std::string /*authority*/, std::set<XdsResourceKey>>
153
- resources_seen;
154
- uint64_t num_valid_resources = 0;
155
- uint64_t num_invalid_resources = 0;
156
- RefCountedPtr<ReadDelayHandle> read_delay_handle;
157
- };
158
-
159
- explicit AdsResponseParser(AdsCall* ads_call) : ads_call_(ads_call) {}
160
-
161
- absl::Status ProcessAdsResponseFields(AdsResponseFields fields) override
162
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
163
-
164
- void ParseResource(upb_Arena* arena, size_t idx, absl::string_view type_url,
165
- absl::string_view resource_name,
166
- absl::string_view serialized_resource) override
167
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
168
-
169
- void ResourceWrapperParsingFailed(size_t idx,
170
- absl::string_view message) override;
171
-
172
- Result TakeResult() { return std::move(result_); }
173
-
174
- private:
175
- XdsClient* xds_client() const { return ads_call_->xds_client(); }
176
-
177
- AdsCall* ads_call_;
178
- const Timestamp update_time_ = Timestamp::Now();
179
- Result result_;
180
- };
181
-
182
151
  class ResourceTimer final : public InternallyRefCounted<ResourceTimer> {
183
152
  public:
184
153
  ResourceTimer(const XdsResourceType* type, const XdsResourceName& name)
@@ -238,14 +207,20 @@ class XdsClient::XdsChannel::AdsCall final
238
207
  // optimize by not resending the resource that we already have.
239
208
  auto& authority_state =
240
209
  ads_call->xds_client()->authority_state_map_[name_.authority];
241
- ResourceState& state = authority_state.resource_map[type_][name_.key];
242
- if (state.resource != nullptr) return;
210
+ ResourceState& state = authority_state.type_map[type_][name_.key];
211
+ if (state.HasResource()) return;
243
212
  // Start timer.
244
213
  ads_call_ = std::move(ads_call);
214
+ Duration timeout = ads_call_->xds_client()->request_timeout_;
215
+ if (timeout == Duration::Zero()) {
216
+ timeout = XdsDataErrorHandlingEnabled() &&
217
+ ads_call_->xds_channel()
218
+ ->server_.ResourceTimerIsTransientFailure()
219
+ ? Duration::Seconds(30)
220
+ : Duration::Seconds(15);
221
+ }
245
222
  timer_handle_ = ads_call_->xds_client()->engine()->RunAfter(
246
- ads_call_->xds_client()->request_timeout_,
247
- [self = Ref(DEBUG_LOCATION, "timer")]() {
248
- ApplicationCallbackExecCtx callback_exec_ctx;
223
+ timeout, [self = Ref(DEBUG_LOCATION, "timer")]() {
249
224
  ExecCtx exec_ctx;
250
225
  self->OnTimer();
251
226
  });
@@ -257,10 +232,10 @@ class XdsClient::XdsChannel::AdsCall final
257
232
  timer_handle_.reset();
258
233
  auto& authority_state =
259
234
  ads_call_->xds_client()->authority_state_map_[name_.authority];
260
- ResourceState& state = authority_state.resource_map[type_][name_.key];
235
+ ResourceState& state = authority_state.type_map[type_][name_.key];
261
236
  // We might have received the resource after the timer fired but before
262
237
  // the callback ran.
263
- if (state.resource == nullptr) {
238
+ if (!state.HasResource()) {
264
239
  GRPC_TRACE_LOG(xds_client, INFO)
265
240
  << "[xds_client " << ads_call_->xds_client() << "] xds server "
266
241
  << ads_call_->xds_channel()->server_.server_uri()
@@ -270,12 +245,20 @@ class XdsClient::XdsChannel::AdsCall final
270
245
  name_.authority, type_->type_url(), name_.key)
271
246
  << "} from xds server";
272
247
  resource_seen_ = true;
273
- state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
274
- ads_call_->xds_client()->NotifyWatchersOnResourceDoesNotExist(
275
- state.watchers, ReadDelayHandle::NoWait());
248
+ if (XdsDataErrorHandlingEnabled() &&
249
+ ads_call_->xds_channel()
250
+ ->server_.ResourceTimerIsTransientFailure()) {
251
+ state.SetTimeout(
252
+ absl::StrCat("timeout obtaining resource from xDS server ",
253
+ ads_call_->xds_channel()->server_uri()));
254
+ } else {
255
+ state.SetDoesNotExistOnTimeout();
256
+ }
257
+ ads_call_->xds_client()->NotifyWatchersOnResourceChanged(
258
+ state.failed_status(), state.watchers(),
259
+ ReadDelayHandle::NoWait());
276
260
  }
277
261
  }
278
- ads_call_->xds_client()->work_serializer_.DrainQueue();
279
262
  ads_call_.reset();
280
263
  }
281
264
 
@@ -290,7 +273,7 @@ class XdsClient::XdsChannel::AdsCall final
290
273
  // stream or (b) declared the resource to not exist due to the timer
291
274
  // firing.
292
275
  bool resource_seen_ ABSL_GUARDED_BY(&XdsClient::mu_) = false;
293
- absl::optional<EventEngine::TaskHandle> timer_handle_
276
+ std::optional<EventEngine::TaskHandle> timer_handle_
294
277
  ABSL_GUARDED_BY(&XdsClient::mu_);
295
278
  };
296
279
 
@@ -323,9 +306,44 @@ class XdsClient::XdsChannel::AdsCall final
323
306
  subscribed_resources;
324
307
  };
325
308
 
309
+ std::string CreateAdsRequest(absl::string_view type_url,
310
+ absl::string_view version,
311
+ absl::string_view nonce,
312
+ const std::vector<std::string>& resource_names,
313
+ absl::Status status) const
314
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
315
+
326
316
  void SendMessageLocked(const XdsResourceType* type)
327
317
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
328
318
 
319
+ struct DecodeContext {
320
+ upb::Arena arena;
321
+ const XdsResourceType* type;
322
+ std::string type_url;
323
+ std::string version;
324
+ std::string nonce;
325
+ std::vector<std::string> errors;
326
+ std::map<std::string /*authority*/, std::set<XdsResourceKey>>
327
+ resources_seen;
328
+ uint64_t num_valid_resources = 0;
329
+ uint64_t num_invalid_resources = 0;
330
+ Timestamp update_time = Timestamp::Now();
331
+ RefCountedPtr<ReadDelayHandle> read_delay_handle;
332
+ };
333
+ void ParseResource(size_t idx, absl::string_view type_url,
334
+ absl::string_view resource_name,
335
+ absl::string_view serialized_resource,
336
+ DecodeContext* context)
337
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
338
+ void HandleServerReportedResourceError(size_t idx,
339
+ absl::string_view resource_name,
340
+ absl::Status status,
341
+ DecodeContext* context)
342
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
343
+ absl::Status DecodeAdsResponse(absl::string_view encoded_response,
344
+ DecodeContext* context)
345
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
346
+
329
347
  void OnRequestSent(bool ok);
330
348
  void OnRecvMessage(absl::string_view payload);
331
349
  void OnStatusReceived(absl::Status status);
@@ -430,16 +448,12 @@ void XdsClient::XdsChannel::Orphaned() ABSL_NO_THREAD_SAFETY_ANALYSIS {
430
448
 
431
449
  void XdsClient::XdsChannel::ResetBackoff() { transport_->ResetBackoff(); }
432
450
 
433
- XdsClient::XdsChannel::AdsCall* XdsClient::XdsChannel::ads_call() const {
434
- return ads_call_->call();
435
- }
436
-
437
451
  void XdsClient::XdsChannel::SubscribeLocked(const XdsResourceType* type,
438
452
  const XdsResourceName& name) {
439
453
  if (ads_call_ == nullptr) {
440
454
  // Start the ADS call if this is the first request.
441
- ads_call_.reset(
442
- new RetryableCall<AdsCall>(WeakRef(DEBUG_LOCATION, "XdsChannel+ads")));
455
+ ads_call_ = MakeOrphanable<RetryableCall<AdsCall>>(
456
+ WeakRef(DEBUG_LOCATION, "XdsChannel+ads"));
443
457
  // Note: AdsCall's ctor will automatically subscribe to all
444
458
  // resources that the XdsClient already has watchers for, so we can
445
459
  // return here.
@@ -447,9 +461,9 @@ void XdsClient::XdsChannel::SubscribeLocked(const XdsResourceType* type,
447
461
  }
448
462
  // If the ADS call is in backoff state, we don't need to do anything now
449
463
  // because when the call is restarted it will resend all necessary requests.
450
- if (ads_call() == nullptr) return;
464
+ if (ads_call_->call() == nullptr) return;
451
465
  // Subscribe to this resource if the ADS call is active.
452
- ads_call()->SubscribeLocked(type, name, /*delay_send=*/false);
466
+ ads_call_->call()->SubscribeLocked(type, name, /*delay_send=*/false);
453
467
  }
454
468
 
455
469
  void XdsClient::XdsChannel::UnsubscribeLocked(const XdsResourceType* type,
@@ -462,6 +476,12 @@ void XdsClient::XdsChannel::UnsubscribeLocked(const XdsResourceType* type,
462
476
  if (!call->HasSubscribedResources()) {
463
477
  ads_call_.reset();
464
478
  }
479
+ } else {
480
+ // If there is currently no ADS call because we're in retry backoff,
481
+ // then we immediately trigger deletion of unsubscribed cache entries.
482
+ // This may orphan the XdsChannel, which would stop the retry
483
+ // timer, since we would no longer need to restart the ADS call.
484
+ xds_client_->MaybeRemoveUnsubscribedCacheEntriesForTypeLocked(this, type);
465
485
  }
466
486
  }
467
487
  }
@@ -481,10 +501,12 @@ bool XdsClient::XdsChannel::MaybeFallbackLocked(
481
501
  ++i) {
482
502
  authority_state.xds_channels.emplace_back(
483
503
  xds_client_->GetOrCreateXdsChannelLocked(*xds_servers[i], "fallback"));
484
- for (const auto& type_resource : authority_state.resource_map) {
485
- for (const auto& key_state : type_resource.second) {
486
- authority_state.xds_channels.back()->SubscribeLocked(
487
- type_resource.first, {authority, key_state.first});
504
+ for (const auto& [type, resource_map] : authority_state.type_map) {
505
+ for (const auto& [key, resource_state] : resource_map) {
506
+ if (resource_state.HasWatchers()) {
507
+ authority_state.xds_channels.back()->SubscribeLocked(
508
+ type, {authority, key});
509
+ }
488
510
  }
489
511
  }
490
512
  GRPC_TRACE_LOG(xds_client, INFO)
@@ -505,28 +527,32 @@ void XdsClient::XdsChannel::SetHealthyLocked() {
505
527
  // 1. Channel is on the list of authority channels
506
528
  // 2. Channel is not the last channel on the list (i.e. not the active
507
529
  // channel)
508
- for (auto& authority : xds_client_->authority_state_map_) {
509
- auto& channels = authority.second.xds_channels;
530
+ for (auto& [authority, authority_state] : xds_client_->authority_state_map_) {
531
+ auto& channels = authority_state.xds_channels;
510
532
  // Skip if channel is active.
511
533
  if (channels.back() == this) continue;
512
534
  auto channel_it = std::find(channels.begin(), channels.end(), this);
513
535
  // Skip if this is not on the list
514
536
  if (channel_it != channels.end()) {
515
537
  GRPC_TRACE_LOG(xds_client, INFO)
516
- << "[xds_client " << xds_client_.get() << "] authority "
517
- << authority.first << ": Falling forward to " << server_.server_uri();
538
+ << "[xds_client " << xds_client_.get() << "] authority " << authority
539
+ << ": Falling forward to " << server_.server_uri();
518
540
  // Lower priority channels are no longer needed, connection is back!
541
+ // Note that we move the lower priority channels out of the vector
542
+ // before we unref them, or else
543
+ // MaybeRemoveUnsubscribedCacheEntriesForTypeLocked() will try to
544
+ // access the vector while we are modifying it.
545
+ std::vector<RefCountedPtr<XdsChannel>> channels_to_unref(
546
+ std::make_move_iterator(channel_it + 1),
547
+ std::make_move_iterator(channels.end()));
519
548
  channels.erase(channel_it + 1, channels.end());
520
549
  }
521
550
  }
522
551
  }
523
552
 
524
553
  void XdsClient::XdsChannel::OnConnectivityFailure(absl::Status status) {
525
- {
526
- MutexLock lock(&xds_client_->mu_);
527
- SetChannelStatusLocked(std::move(status));
528
- }
529
- xds_client_->work_serializer_.DrainQueue();
554
+ MutexLock lock(&xds_client_->mu_);
555
+ SetChannelStatusLocked(std::move(status));
530
556
  }
531
557
 
532
558
  void XdsClient::XdsChannel::SetChannelStatusLocked(absl::Status status) {
@@ -535,15 +561,6 @@ void XdsClient::XdsChannel::SetChannelStatusLocked(absl::Status status) {
535
561
  server_.server_uri(), ": ",
536
562
  status.message()));
537
563
  LOG(INFO) << "[xds_client " << xds_client() << "] " << status;
538
- // If the node ID is set, append that to the status message that we send to
539
- // the watchers, so that it will appear in log messages visible to users.
540
- const auto* node = xds_client_->bootstrap_->node();
541
- if (node != nullptr) {
542
- status = absl::Status(
543
- status.code(),
544
- absl::StrCat(status.message(),
545
- " (node ID:", xds_client_->bootstrap_->node()->id(), ")"));
546
- }
547
564
  // If status was previously OK, report that the channel has gone unhealthy.
548
565
  if (status_.ok() && xds_client_->metrics_reporter_ != nullptr) {
549
566
  xds_client_->metrics_reporter_->ReportServerFailure(server_.server_uri());
@@ -552,30 +569,32 @@ void XdsClient::XdsChannel::SetChannelStatusLocked(absl::Status status) {
552
569
  // error for any new watchers that may be started.
553
570
  status_ = status;
554
571
  // Find all watchers for this channel.
555
- std::set<RefCountedPtr<ResourceWatcherInterface>> watchers;
556
- for (auto& a : xds_client_->authority_state_map_) { // authority
557
- if (a.second.xds_channels.empty() || a.second.xds_channels.back() != this ||
558
- MaybeFallbackLocked(a.first, a.second)) {
572
+ WatcherSet watchers_cached;
573
+ WatcherSet watchers_uncached;
574
+ for (auto& [authority, authority_state] : xds_client_->authority_state_map_) {
575
+ if (authority_state.xds_channels.empty() ||
576
+ authority_state.xds_channels.back() != this ||
577
+ MaybeFallbackLocked(authority, authority_state)) {
559
578
  continue;
560
579
  }
561
- for (const auto& t : a.second.resource_map) { // type
562
- for (const auto& r : t.second) { // resource id
563
- for (const auto& w : r.second.watchers) { // watchers
564
- watchers.insert(w.second);
580
+ for (const auto& [_, resource_map] : authority_state.type_map) {
581
+ for (const auto& [_, resource_state] : resource_map) {
582
+ auto& watchers =
583
+ resource_state.HasResource() ? watchers_cached : watchers_uncached;
584
+ for (const auto& watcher : resource_state.watchers()) {
585
+ watchers.insert(watcher);
565
586
  }
566
587
  }
567
588
  }
568
589
  }
569
- if (!watchers.empty()) {
570
- // Enqueue notification for the watchers.
571
- xds_client_->work_serializer_.Schedule(
572
- [watchers = std::move(watchers), status = std::move(status)]()
573
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(xds_client_->work_serializer_) {
574
- for (const auto& watcher : watchers) {
575
- watcher->OnError(status, ReadDelayHandle::NoWait());
576
- }
577
- },
578
- DEBUG_LOCATION);
590
+ // Enqueue notifications for the watchers.
591
+ if (!watchers_cached.empty()) {
592
+ xds_client_->NotifyWatchersOnAmbientError(
593
+ status, std::move(watchers_cached), ReadDelayHandle::NoWait());
594
+ }
595
+ if (!watchers_uncached.empty()) {
596
+ xds_client_->NotifyWatchersOnResourceChanged(
597
+ status, std::move(watchers_uncached), ReadDelayHandle::NoWait());
579
598
  }
580
599
  }
581
600
 
@@ -642,7 +661,6 @@ void XdsClient::XdsChannel::RetryableCall<T>::StartRetryTimerLocked() {
642
661
  timer_handle_ = xds_channel()->xds_client()->engine()->RunAfter(
643
662
  delay,
644
663
  [self = this->Ref(DEBUG_LOCATION, "RetryableCall+retry_timer_start")]() {
645
- ApplicationCallbackExecCtx callback_exec_ctx;
646
664
  ExecCtx exec_ctx;
647
665
  self->OnRetryTimer();
648
666
  });
@@ -682,203 +700,6 @@ class XdsClient::XdsChannel::AdsCall::AdsReadDelayHandle final
682
700
  RefCountedPtr<AdsCall> ads_call_;
683
701
  };
684
702
 
685
- //
686
- // XdsClient::XdsChannel::AdsCall::AdsResponseParser
687
- //
688
-
689
- absl::Status
690
- XdsClient::XdsChannel::AdsCall::AdsResponseParser::ProcessAdsResponseFields(
691
- AdsResponseFields fields) {
692
- GRPC_TRACE_LOG(xds_client, INFO)
693
- << "[xds_client " << ads_call_->xds_client() << "] xds server "
694
- << ads_call_->xds_channel()->server_.server_uri()
695
- << ": received ADS response: type_url=" << fields.type_url
696
- << ", version=" << fields.version << ", nonce=" << fields.nonce
697
- << ", num_resources=" << fields.num_resources;
698
- result_.type =
699
- ads_call_->xds_client()->GetResourceTypeLocked(fields.type_url);
700
- if (result_.type == nullptr) {
701
- return absl::InvalidArgumentError(
702
- absl::StrCat("unknown resource type ", fields.type_url));
703
- }
704
- result_.type_url = std::move(fields.type_url);
705
- result_.version = std::move(fields.version);
706
- result_.nonce = std::move(fields.nonce);
707
- result_.read_delay_handle =
708
- MakeRefCounted<AdsReadDelayHandle>(ads_call_->Ref());
709
- return absl::OkStatus();
710
- }
711
-
712
- namespace {
713
-
714
- // Build a resource metadata struct for ADS result accepting methods and CSDS.
715
- XdsApi::ResourceMetadata CreateResourceMetadataAcked(
716
- std::string serialized_proto, std::string version, Timestamp update_time) {
717
- XdsApi::ResourceMetadata resource_metadata;
718
- resource_metadata.serialized_proto = std::move(serialized_proto);
719
- resource_metadata.update_time = update_time;
720
- resource_metadata.version = std::move(version);
721
- resource_metadata.client_status = XdsApi::ResourceMetadata::ACKED;
722
- return resource_metadata;
723
- }
724
-
725
- // Update resource_metadata for NACK.
726
- void UpdateResourceMetadataNacked(const std::string& version,
727
- const std::string& details,
728
- Timestamp update_time,
729
- XdsApi::ResourceMetadata* resource_metadata) {
730
- resource_metadata->client_status = XdsApi::ResourceMetadata::NACKED;
731
- resource_metadata->failed_version = version;
732
- resource_metadata->failed_details = details;
733
- resource_metadata->failed_update_time = update_time;
734
- }
735
-
736
- } // namespace
737
-
738
- void XdsClient::XdsChannel::AdsCall::AdsResponseParser::ParseResource(
739
- upb_Arena* arena, size_t idx, absl::string_view type_url,
740
- absl::string_view resource_name, absl::string_view serialized_resource) {
741
- std::string error_prefix = absl::StrCat(
742
- "resource index ", idx, ": ",
743
- resource_name.empty() ? "" : absl::StrCat(resource_name, ": "));
744
- // Check the type_url of the resource.
745
- if (result_.type_url != type_url) {
746
- result_.errors.emplace_back(
747
- absl::StrCat(error_prefix, "incorrect resource type \"", type_url,
748
- "\" (should be \"", result_.type_url, "\")"));
749
- ++result_.num_invalid_resources;
750
- return;
751
- }
752
- // Parse the resource.
753
- XdsResourceType::DecodeContext context = {
754
- xds_client(), ads_call_->xds_channel()->server_, &xds_client_trace,
755
- xds_client()->def_pool_.ptr(), arena};
756
- XdsResourceType::DecodeResult decode_result =
757
- result_.type->Decode(context, serialized_resource);
758
- // If we didn't already have the resource name from the Resource
759
- // wrapper, try to get it from the decoding result.
760
- if (resource_name.empty()) {
761
- if (decode_result.name.has_value()) {
762
- resource_name = *decode_result.name;
763
- error_prefix =
764
- absl::StrCat("resource index ", idx, ": ", resource_name, ": ");
765
- } else {
766
- // We don't have any way of determining the resource name, so
767
- // there's nothing more we can do here.
768
- result_.errors.emplace_back(absl::StrCat(
769
- error_prefix, decode_result.resource.status().ToString()));
770
- ++result_.num_invalid_resources;
771
- return;
772
- }
773
- }
774
- // If decoding failed, make sure we include the error in the NACK.
775
- const absl::Status& decode_status = decode_result.resource.status();
776
- if (!decode_status.ok()) {
777
- result_.errors.emplace_back(
778
- absl::StrCat(error_prefix, decode_status.ToString()));
779
- }
780
- // Check the resource name.
781
- auto parsed_resource_name =
782
- xds_client()->ParseXdsResourceName(resource_name, result_.type);
783
- if (!parsed_resource_name.ok()) {
784
- result_.errors.emplace_back(
785
- absl::StrCat(error_prefix, "Cannot parse xDS resource name"));
786
- ++result_.num_invalid_resources;
787
- return;
788
- }
789
- // Cancel resource-does-not-exist timer, if needed.
790
- auto timer_it = ads_call_->state_map_.find(result_.type);
791
- if (timer_it != ads_call_->state_map_.end()) {
792
- auto it = timer_it->second.subscribed_resources.find(
793
- parsed_resource_name->authority);
794
- if (it != timer_it->second.subscribed_resources.end()) {
795
- auto res_it = it->second.find(parsed_resource_name->key);
796
- if (res_it != it->second.end()) {
797
- res_it->second->MarkSeen();
798
- }
799
- }
800
- }
801
- // Lookup the authority in the cache.
802
- auto authority_it =
803
- xds_client()->authority_state_map_.find(parsed_resource_name->authority);
804
- if (authority_it == xds_client()->authority_state_map_.end()) {
805
- return; // Skip resource -- we don't have a subscription for it.
806
- }
807
- // Found authority, so look up type.
808
- AuthorityState& authority_state = authority_it->second;
809
- auto type_it = authority_state.resource_map.find(result_.type);
810
- if (type_it == authority_state.resource_map.end()) {
811
- return; // Skip resource -- we don't have a subscription for it.
812
- }
813
- auto& type_map = type_it->second;
814
- // Found type, so look up resource key.
815
- auto it = type_map.find(parsed_resource_name->key);
816
- if (it == type_map.end()) {
817
- return; // Skip resource -- we don't have a subscription for it.
818
- }
819
- ResourceState& resource_state = it->second;
820
- // If needed, record that we've seen this resource.
821
- if (result_.type->AllResourcesRequiredInSotW()) {
822
- result_.resources_seen[parsed_resource_name->authority].insert(
823
- parsed_resource_name->key);
824
- }
825
- // If we previously ignored the resource's deletion, log that we're
826
- // now re-adding it.
827
- if (resource_state.ignored_deletion) {
828
- LOG(INFO) << "[xds_client " << xds_client() << "] xds server "
829
- << ads_call_->xds_channel()->server_.server_uri()
830
- << ": server returned new version of resource for which we "
831
- "previously ignored a deletion: type "
832
- << type_url << " name " << resource_name;
833
- resource_state.ignored_deletion = false;
834
- }
835
- // Update resource state based on whether the resource is valid.
836
- if (!decode_status.ok()) {
837
- xds_client()->NotifyWatchersOnErrorLocked(
838
- resource_state.watchers,
839
- absl::UnavailableError(
840
- absl::StrCat("invalid resource: ", decode_status.ToString())),
841
- result_.read_delay_handle);
842
- UpdateResourceMetadataNacked(result_.version, decode_status.ToString(),
843
- update_time_, &resource_state.meta);
844
- ++result_.num_invalid_resources;
845
- return;
846
- }
847
- // Resource is valid.
848
- ++result_.num_valid_resources;
849
- // If it didn't change, ignore it.
850
- if (resource_state.resource != nullptr &&
851
- result_.type->ResourcesEqual(resource_state.resource.get(),
852
- decode_result.resource->get())) {
853
- GRPC_TRACE_LOG(xds_client, INFO)
854
- << "[xds_client " << xds_client() << "] " << result_.type_url
855
- << " resource " << resource_name << " identical to current, ignoring.";
856
- return;
857
- }
858
- // Update the resource state.
859
- resource_state.resource = std::move(*decode_result.resource);
860
- resource_state.meta = CreateResourceMetadataAcked(
861
- std::string(serialized_resource), result_.version, update_time_);
862
- // Notify watchers.
863
- auto& watchers_list = resource_state.watchers;
864
- xds_client()->work_serializer_.Schedule(
865
- [watchers_list, value = resource_state.resource,
866
- read_delay_handle = result_.read_delay_handle]()
867
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&xds_client()->work_serializer_) {
868
- for (const auto& p : watchers_list) {
869
- p.first->OnGenericResourceChanged(value, read_delay_handle);
870
- }
871
- },
872
- DEBUG_LOCATION);
873
- }
874
-
875
- void XdsClient::XdsChannel::AdsCall::AdsResponseParser::
876
- ResourceWrapperParsingFailed(size_t idx, absl::string_view message) {
877
- result_.errors.emplace_back(
878
- absl::StrCat("resource index ", idx, ": ", message));
879
- ++result_.num_invalid_resources;
880
- }
881
-
882
703
  //
883
704
  // XdsClient::XdsChannel::AdsCall
884
705
  //
@@ -907,30 +728,37 @@ XdsClient::XdsChannel::AdsCall::AdsCall(
907
728
  << ", streaming_call: " << streaming_call_.get() << ")";
908
729
  // If this is a reconnect, add any necessary subscriptions from what's
909
730
  // already in the cache.
910
- for (auto& a : xds_client()->authority_state_map_) {
911
- const std::string& authority = a.first;
912
- auto it = std::find(a.second.xds_channels.begin(),
913
- a.second.xds_channels.end(), xds_channel());
731
+ for (auto& [authority, authority_state] :
732
+ xds_client()->authority_state_map_) {
733
+ auto it = std::find(authority_state.xds_channels.begin(),
734
+ authority_state.xds_channels.end(), xds_channel());
914
735
  // Skip authorities that are not using this xDS channel. The channel can be
915
736
  // anywhere in the list.
916
- if (it == a.second.xds_channels.end()) continue;
917
- for (const auto& t : a.second.resource_map) {
918
- const XdsResourceType* type = t.first;
919
- for (const auto& r : t.second) {
920
- const XdsResourceKey& resource_key = r.first;
921
- SubscribeLocked(type, {authority, resource_key}, /*delay_send=*/true);
737
+ if (it == authority_state.xds_channels.end()) continue;
738
+ for (const auto& [type, resource_map] : authority_state.type_map) {
739
+ for (const auto& [resource_key, resource_state] : resource_map) {
740
+ if (resource_state.HasWatchers()) {
741
+ SubscribeLocked(type, {authority, resource_key}, /*delay_send=*/true);
742
+ }
922
743
  }
923
744
  }
924
745
  }
925
746
  // Send initial message if we added any subscriptions above.
926
- for (const auto& p : state_map_) {
927
- SendMessageLocked(p.first);
747
+ for (const auto& [type, _] : state_map_) {
748
+ SendMessageLocked(type);
928
749
  }
929
750
  streaming_call_->StartRecvMessage();
930
751
  }
931
752
 
932
753
  void XdsClient::XdsChannel::AdsCall::Orphan() {
933
754
  state_map_.clear();
755
+ // We may have unsubscriptions for which we have not yet actually sent
756
+ // unsubscribe messages, and now we never will, so do a pass to delete
757
+ // any cache entries for which we've unsubscribed.
758
+ for (const auto& [_, type] : xds_client()->resource_types_) {
759
+ xds_client()->MaybeRemoveUnsubscribedCacheEntriesForTypeLocked(
760
+ xds_channel(), type);
761
+ }
934
762
  // Note that the initial ref is held by the StreamEventHandler, which
935
763
  // will be destroyed when streaming_call_ is destroyed, which may not happen
936
764
  // here, since there may be other refs held to streaming_call_ by internal
@@ -938,31 +766,6 @@ void XdsClient::XdsChannel::AdsCall::Orphan() {
938
766
  streaming_call_.reset();
939
767
  }
940
768
 
941
- void XdsClient::XdsChannel::AdsCall::SendMessageLocked(
942
- const XdsResourceType* type)
943
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_) {
944
- // Buffer message sending if an existing message is in flight.
945
- if (send_message_pending_ != nullptr) {
946
- buffered_requests_.insert(type);
947
- return;
948
- }
949
- auto& state = state_map_[type];
950
- std::string serialized_message = xds_client()->api_.CreateAdsRequest(
951
- type->type_url(), xds_channel()->resource_type_version_map_[type],
952
- state.nonce, ResourceNamesForRequest(type), state.status,
953
- !sent_initial_message_);
954
- sent_initial_message_ = true;
955
- GRPC_TRACE_LOG(xds_client, INFO)
956
- << "[xds_client " << xds_client() << "] xds server "
957
- << xds_channel()->server_.server_uri()
958
- << ": sending ADS request: type=" << type->type_url()
959
- << " version=" << xds_channel()->resource_type_version_map_[type]
960
- << " nonce=" << state.nonce << " error=" << state.status;
961
- state.status = absl::OkStatus();
962
- streaming_call_->SendMessage(std::move(serialized_message));
963
- send_message_pending_ = type;
964
- }
965
-
966
769
  void XdsClient::XdsChannel::AdsCall::SubscribeLocked(
967
770
  const XdsResourceType* type, const XdsResourceName& name, bool delay_send) {
968
771
  auto& state = state_map_[type].subscribed_resources[name.authority][name.key];
@@ -980,6 +783,10 @@ void XdsClient::XdsChannel::AdsCall::UnsubscribeLocked(
980
783
  authority_map.erase(name.key);
981
784
  if (authority_map.empty()) {
982
785
  type_state_map.subscribed_resources.erase(name.authority);
786
+ // Note: We intentionally do not remove the top-level map entry for
787
+ // the resource type even if the authority map for the type is empty,
788
+ // because we need to retain the nonce in case a new watch is
789
+ // started for a resource of this type while this stream is still open.
983
790
  }
984
791
  // Don't need to send unsubscription message if this was the last
985
792
  // resource we were subscribed to, since we'll be closing the stream
@@ -990,21 +797,134 @@ void XdsClient::XdsChannel::AdsCall::UnsubscribeLocked(
990
797
  }
991
798
 
992
799
  bool XdsClient::XdsChannel::AdsCall::HasSubscribedResources() const {
993
- for (const auto& p : state_map_) {
994
- if (!p.second.subscribed_resources.empty()) return true;
800
+ for (const auto& [_, resource_type_state] : state_map_) {
801
+ if (!resource_type_state.subscribed_resources.empty()) return true;
995
802
  }
996
803
  return false;
997
804
  }
998
805
 
806
+ namespace {
807
+
808
+ void MaybeLogDiscoveryRequest(
809
+ const XdsClient* client, upb_DefPool* def_pool,
810
+ const envoy_service_discovery_v3_DiscoveryRequest* request) {
811
+ if (GRPC_TRACE_FLAG_ENABLED(xds_client) && ABSL_VLOG_IS_ON(2)) {
812
+ const upb_MessageDef* msg_type =
813
+ envoy_service_discovery_v3_DiscoveryRequest_getmsgdef(def_pool);
814
+ char buf[10240];
815
+ upb_TextEncode(reinterpret_cast<const upb_Message*>(request), msg_type,
816
+ nullptr, 0, buf, sizeof(buf));
817
+ VLOG(2) << "[xds_client " << client << "] constructed ADS request: " << buf;
818
+ }
819
+ }
820
+
821
+ std::string SerializeDiscoveryRequest(
822
+ upb_Arena* arena, envoy_service_discovery_v3_DiscoveryRequest* request) {
823
+ size_t output_length;
824
+ char* output = envoy_service_discovery_v3_DiscoveryRequest_serialize(
825
+ request, arena, &output_length);
826
+ return std::string(output, output_length);
827
+ }
828
+
829
+ } // namespace
830
+
831
+ std::string XdsClient::XdsChannel::AdsCall::CreateAdsRequest(
832
+ absl::string_view type_url, absl::string_view version,
833
+ absl::string_view nonce, const std::vector<std::string>& resource_names,
834
+ absl::Status status) const {
835
+ upb::Arena arena;
836
+ // Create a request.
837
+ envoy_service_discovery_v3_DiscoveryRequest* request =
838
+ envoy_service_discovery_v3_DiscoveryRequest_new(arena.ptr());
839
+ // Set type_url.
840
+ std::string type_url_str = absl::StrCat("type.googleapis.com/", type_url);
841
+ envoy_service_discovery_v3_DiscoveryRequest_set_type_url(
842
+ request, StdStringToUpbString(type_url_str));
843
+ // Set version_info.
844
+ if (!version.empty()) {
845
+ envoy_service_discovery_v3_DiscoveryRequest_set_version_info(
846
+ request, StdStringToUpbString(version));
847
+ }
848
+ // Set nonce.
849
+ if (!nonce.empty()) {
850
+ envoy_service_discovery_v3_DiscoveryRequest_set_response_nonce(
851
+ request, StdStringToUpbString(nonce));
852
+ }
853
+ // Set error_detail if it's a NACK.
854
+ std::string error_string_storage;
855
+ if (!status.ok()) {
856
+ google_rpc_Status* error_detail =
857
+ envoy_service_discovery_v3_DiscoveryRequest_mutable_error_detail(
858
+ request, arena.ptr());
859
+ // Hard-code INVALID_ARGUMENT as the status code.
860
+ // TODO(roth): If at some point we decide we care about this value,
861
+ // we could attach a status code to the individual errors where we
862
+ // generate them in the parsing code, and then use that here.
863
+ google_rpc_Status_set_code(error_detail, GRPC_STATUS_INVALID_ARGUMENT);
864
+ // Error description comes from the status that was passed in.
865
+ error_string_storage = std::string(status.message());
866
+ upb_StringView error_description =
867
+ StdStringToUpbString(error_string_storage);
868
+ google_rpc_Status_set_message(error_detail, error_description);
869
+ }
870
+ // Populate node.
871
+ if (!sent_initial_message_) {
872
+ envoy_config_core_v3_Node* node_msg =
873
+ envoy_service_discovery_v3_DiscoveryRequest_mutable_node(request,
874
+ arena.ptr());
875
+ PopulateXdsNode(xds_client()->bootstrap_->node(),
876
+ xds_client()->user_agent_name_,
877
+ xds_client()->user_agent_version_, node_msg, arena.ptr());
878
+ envoy_config_core_v3_Node_add_client_features(
879
+ node_msg, upb_StringView_FromString("xds.config.resource-in-sotw"),
880
+ arena.ptr());
881
+ }
882
+ // Add resource_names.
883
+ for (const std::string& resource_name : resource_names) {
884
+ envoy_service_discovery_v3_DiscoveryRequest_add_resource_names(
885
+ request, StdStringToUpbString(resource_name), arena.ptr());
886
+ }
887
+ MaybeLogDiscoveryRequest(xds_client(), xds_client()->def_pool_.ptr(),
888
+ request);
889
+ return SerializeDiscoveryRequest(arena.ptr(), request);
890
+ }
891
+
892
+ void XdsClient::XdsChannel::AdsCall::SendMessageLocked(
893
+ const XdsResourceType* type)
894
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_) {
895
+ // Buffer message sending if an existing message is in flight.
896
+ if (send_message_pending_ != nullptr) {
897
+ buffered_requests_.insert(type);
898
+ return;
899
+ }
900
+ xds_client()->MaybeRemoveUnsubscribedCacheEntriesForTypeLocked(xds_channel(),
901
+ type);
902
+ auto& state = state_map_[type];
903
+ std::string serialized_message = CreateAdsRequest(
904
+ type->type_url(), xds_channel()->resource_type_version_map_[type],
905
+ state.nonce, ResourceNamesForRequest(type), state.status);
906
+ sent_initial_message_ = true;
907
+ GRPC_TRACE_LOG(xds_client, INFO)
908
+ << "[xds_client " << xds_client() << "] xds server "
909
+ << xds_channel()->server_.server_uri()
910
+ << ": sending ADS request: type=" << type->type_url()
911
+ << " version=" << xds_channel()->resource_type_version_map_[type]
912
+ << " nonce=" << state.nonce << " error=" << state.status;
913
+ state.status = absl::OkStatus();
914
+ streaming_call_->SendMessage(std::move(serialized_message));
915
+ send_message_pending_ = type;
916
+ }
917
+
999
918
  void XdsClient::XdsChannel::AdsCall::OnRequestSent(bool ok) {
1000
919
  MutexLock lock(&xds_client()->mu_);
1001
920
  // For each resource that was in the message we just sent, start the
1002
921
  // resource timer if needed.
1003
922
  if (ok) {
1004
923
  auto& resource_type_state = state_map_[send_message_pending_];
1005
- for (const auto& p : resource_type_state.subscribed_resources) {
1006
- for (auto& q : p.second) {
1007
- q.second->MaybeMarkSubscriptionSendComplete(
924
+ for (const auto& [_, resource_map] :
925
+ resource_type_state.subscribed_resources) {
926
+ for (auto& [_, resource_timer] : resource_map) {
927
+ resource_timer->MaybeMarkSubscriptionSendComplete(
1008
928
  Ref(DEBUG_LOCATION, "ResourceTimer"));
1009
929
  }
1010
930
  }
@@ -1028,142 +948,467 @@ void XdsClient::XdsChannel::AdsCall::OnRequestSent(bool ok) {
1028
948
  }
1029
949
  }
1030
950
 
951
+ void XdsClient::XdsChannel::AdsCall::ParseResource(
952
+ size_t idx, absl::string_view type_url, absl::string_view resource_name,
953
+ absl::string_view serialized_resource, DecodeContext* context) {
954
+ std::string error_prefix = absl::StrCat(
955
+ "resource index ", idx, ": ",
956
+ resource_name.empty() ? "" : absl::StrCat(resource_name, ": "));
957
+ // Check the type_url of the resource.
958
+ if (context->type_url != type_url) {
959
+ context->errors.emplace_back(
960
+ absl::StrCat(error_prefix, "incorrect resource type \"", type_url,
961
+ "\" (should be \"", context->type_url, "\")"));
962
+ ++context->num_invalid_resources;
963
+ return;
964
+ }
965
+ // Parse the resource.
966
+ XdsResourceType::DecodeContext resource_type_context = {
967
+ xds_client(), xds_channel()->server_, xds_client()->def_pool_.ptr(),
968
+ context->arena.ptr()};
969
+ XdsResourceType::DecodeResult decode_result =
970
+ context->type->Decode(resource_type_context, serialized_resource);
971
+ // If we didn't already have the resource name from the Resource
972
+ // wrapper, try to get it from the decoding result.
973
+ if (resource_name.empty()) {
974
+ if (decode_result.name.has_value()) {
975
+ resource_name = *decode_result.name;
976
+ error_prefix =
977
+ absl::StrCat("resource index ", idx, ": ", resource_name, ": ");
978
+ } else {
979
+ // We don't have any way of determining the resource name, so
980
+ // there's nothing more we can do here.
981
+ context->errors.emplace_back(absl::StrCat(
982
+ error_prefix, decode_result.resource.status().ToString()));
983
+ ++context->num_invalid_resources;
984
+ return;
985
+ }
986
+ }
987
+ // If decoding failed, make sure we include the error in the NACK.
988
+ const absl::Status& decode_status = decode_result.resource.status();
989
+ if (!decode_status.ok()) {
990
+ context->errors.emplace_back(
991
+ absl::StrCat(error_prefix, decode_status.ToString()));
992
+ }
993
+ // Check the resource name.
994
+ auto parsed_resource_name =
995
+ xds_client()->ParseXdsResourceName(resource_name, context->type);
996
+ if (!parsed_resource_name.ok()) {
997
+ context->errors.emplace_back(
998
+ absl::StrCat(error_prefix, "Cannot parse xDS resource name"));
999
+ ++context->num_invalid_resources;
1000
+ return;
1001
+ }
1002
+ // Cancel resource-does-not-exist timer, if needed.
1003
+ if (auto it = state_map_.find(context->type); it != state_map_.end()) {
1004
+ auto& resource_type_state = it->second;
1005
+ auto authority_it = resource_type_state.subscribed_resources.find(
1006
+ parsed_resource_name->authority);
1007
+ if (authority_it != resource_type_state.subscribed_resources.end()) {
1008
+ auto& resource_map = authority_it->second;
1009
+ auto res_it = resource_map.find(parsed_resource_name->key);
1010
+ if (res_it != resource_map.end()) {
1011
+ res_it->second->MarkSeen();
1012
+ }
1013
+ }
1014
+ }
1015
+ // Lookup the authority in the cache.
1016
+ auto authority_it =
1017
+ xds_client()->authority_state_map_.find(parsed_resource_name->authority);
1018
+ if (authority_it == xds_client()->authority_state_map_.end()) {
1019
+ return; // Skip resource -- we don't have a subscription for it.
1020
+ }
1021
+ AuthorityState& authority_state = authority_it->second;
1022
+ // Found authority, so look up type.
1023
+ auto type_it = authority_state.type_map.find(context->type);
1024
+ if (type_it == authority_state.type_map.end()) {
1025
+ return; // Skip resource -- we don't have a subscription for it.
1026
+ }
1027
+ auto& type_map = type_it->second;
1028
+ // Found type, so look up resource key.
1029
+ auto res_it = type_map.find(parsed_resource_name->key);
1030
+ if (res_it == type_map.end()) {
1031
+ return; // Skip resource -- we don't have a subscription for it.
1032
+ }
1033
+ ResourceState& resource_state = res_it->second;
1034
+ // If needed, record that we've seen this resource.
1035
+ if (context->type->AllResourcesRequiredInSotW()) {
1036
+ context->resources_seen[parsed_resource_name->authority].insert(
1037
+ parsed_resource_name->key);
1038
+ }
1039
+ // Update resource state based on whether the resource is valid.
1040
+ if (!decode_status.ok()) {
1041
+ ++context->num_invalid_resources;
1042
+ // If the fail_on_data_errors server feature is present, drop the
1043
+ // existing cached resource, if any.
1044
+ const bool drop_cached_resource = XdsDataErrorHandlingEnabled() &&
1045
+ xds_channel()->server_.FailOnDataErrors();
1046
+ resource_state.SetNacked(context->version, decode_status.message(),
1047
+ context->update_time, drop_cached_resource);
1048
+ xds_client()->NotifyWatchersOnError(resource_state,
1049
+ context->read_delay_handle);
1050
+ return;
1051
+ }
1052
+ // Resource is valid.
1053
+ ++context->num_valid_resources;
1054
+ // Check if the resource has changed.
1055
+ const bool resource_identical =
1056
+ resource_state.HasResource() &&
1057
+ context->type->ResourcesEqual(resource_state.resource().get(),
1058
+ decode_result.resource->get());
1059
+ // If not changed, keep using the current decoded resource object.
1060
+ // This should avoid wasting memory, since external watchers may be
1061
+ // holding refs to the current object.
1062
+ if (resource_identical) decode_result.resource = resource_state.resource();
1063
+ // Update the resource state.
1064
+ resource_state.SetAcked(std::move(*decode_result.resource),
1065
+ std::string(serialized_resource), context->version,
1066
+ context->update_time);
1067
+ // If the resource didn't change, inhibit watcher notifications.
1068
+ if (resource_identical) {
1069
+ GRPC_TRACE_LOG(xds_client, INFO)
1070
+ << "[xds_client " << xds_client() << "] " << context->type_url
1071
+ << " resource " << resource_name << " identical to current, ignoring.";
1072
+ // If we previously had connectivity problems, notify watchers that
1073
+ // the ambient error has been cleared.
1074
+ if (!xds_channel()->status().ok()) {
1075
+ xds_client()->NotifyWatchersOnAmbientError(absl::OkStatus(),
1076
+ resource_state.watchers(),
1077
+ context->read_delay_handle);
1078
+ }
1079
+ return;
1080
+ }
1081
+ // Notify watchers.
1082
+ xds_client()->NotifyWatchersOnResourceChanged(resource_state.resource(),
1083
+ resource_state.watchers(),
1084
+ context->read_delay_handle);
1085
+ }
1086
+
1087
+ void XdsClient::XdsChannel::AdsCall::HandleServerReportedResourceError(
1088
+ size_t idx, absl::string_view resource_name, absl::Status status,
1089
+ DecodeContext* context) {
1090
+ std::string error_prefix = absl::StrCat(
1091
+ "resource_errors index ", idx, ": ",
1092
+ resource_name.empty() ? "" : absl::StrCat(resource_name, ": "));
1093
+ if (resource_name.empty()) {
1094
+ context->errors.emplace_back(
1095
+ absl::StrCat(error_prefix, "resource_name unset"));
1096
+ ++context->num_invalid_resources;
1097
+ return;
1098
+ }
1099
+ if (status.ok()) {
1100
+ context->errors.emplace_back(
1101
+ absl::StrCat(error_prefix, "error_detail must be non-OK"));
1102
+ ++context->num_invalid_resources;
1103
+ return;
1104
+ }
1105
+ // Check the resource name.
1106
+ auto parsed_resource_name =
1107
+ xds_client()->ParseXdsResourceName(resource_name, context->type);
1108
+ if (!parsed_resource_name.ok()) {
1109
+ context->errors.emplace_back(
1110
+ absl::StrCat(error_prefix, "Cannot parse xDS resource name"));
1111
+ ++context->num_invalid_resources;
1112
+ return;
1113
+ }
1114
+ // Cancel resource-does-not-exist timer, if needed.
1115
+ auto timer_it = state_map_.find(context->type);
1116
+ if (timer_it != state_map_.end()) {
1117
+ auto it = timer_it->second.subscribed_resources.find(
1118
+ parsed_resource_name->authority);
1119
+ if (it != timer_it->second.subscribed_resources.end()) {
1120
+ auto res_it = it->second.find(parsed_resource_name->key);
1121
+ if (res_it != it->second.end()) {
1122
+ res_it->second->MarkSeen();
1123
+ }
1124
+ }
1125
+ }
1126
+ // Lookup the authority in the cache.
1127
+ auto authority_it =
1128
+ xds_client()->authority_state_map_.find(parsed_resource_name->authority);
1129
+ if (authority_it == xds_client()->authority_state_map_.end()) {
1130
+ return; // Skip resource -- we don't have a subscription for it.
1131
+ }
1132
+ AuthorityState& authority_state = authority_it->second;
1133
+ // Found authority, so look up type.
1134
+ auto type_it = authority_state.type_map.find(context->type);
1135
+ if (type_it == authority_state.type_map.end()) {
1136
+ return; // Skip resource -- we don't have a subscription for it.
1137
+ }
1138
+ auto& type_map = type_it->second;
1139
+ // Found type, so look up resource key.
1140
+ auto it = type_map.find(parsed_resource_name->key);
1141
+ if (it == type_map.end()) {
1142
+ return; // Skip resource -- we don't have a subscription for it.
1143
+ }
1144
+ ResourceState& resource_state = it->second;
1145
+ // If needed, record that we've seen this resource.
1146
+ if (context->type->AllResourcesRequiredInSotW()) {
1147
+ context->resources_seen[parsed_resource_name->authority].insert(
1148
+ parsed_resource_name->key);
1149
+ }
1150
+ ++context->num_invalid_resources;
1151
+ // Update cache state.
1152
+ const bool drop_cached_resource =
1153
+ xds_channel()->server_.FailOnDataErrors() &&
1154
+ (status.code() == absl::StatusCode::kNotFound ||
1155
+ status.code() == absl::StatusCode::kPermissionDenied);
1156
+ resource_state.SetReceivedError(context->version, std::move(status),
1157
+ context->update_time, drop_cached_resource);
1158
+ // If there is no cached resource (either because we didn't have one
1159
+ // or because we just dropped it due to fail_on_data_errors), then notify
1160
+ // via OnResourceChanged(); otherwise, notify via OnAmbientError().
1161
+ if (!resource_state.HasResource()) {
1162
+ xds_client()->NotifyWatchersOnResourceChanged(
1163
+ resource_state.failed_status(), resource_state.watchers(),
1164
+ context->read_delay_handle);
1165
+ } else {
1166
+ xds_client()->NotifyWatchersOnAmbientError(resource_state.failed_status(),
1167
+ resource_state.watchers(),
1168
+ context->read_delay_handle);
1169
+ }
1170
+ }
1171
+
1172
+ namespace {
1173
+
1174
+ void MaybeLogDiscoveryResponse(
1175
+ const XdsClient* client, upb_DefPool* def_pool,
1176
+ const envoy_service_discovery_v3_DiscoveryResponse* response) {
1177
+ if (GRPC_TRACE_FLAG_ENABLED(xds_client) && ABSL_VLOG_IS_ON(2)) {
1178
+ const upb_MessageDef* msg_type =
1179
+ envoy_service_discovery_v3_DiscoveryResponse_getmsgdef(def_pool);
1180
+ char buf[10240];
1181
+ upb_TextEncode(reinterpret_cast<const upb_Message*>(response), msg_type,
1182
+ nullptr, 0, buf, sizeof(buf));
1183
+ VLOG(2) << "[xds_client " << client << "] received response: " << buf;
1184
+ }
1185
+ }
1186
+
1187
+ } // namespace
1188
+
1189
+ absl::Status XdsClient::XdsChannel::AdsCall::DecodeAdsResponse(
1190
+ absl::string_view encoded_response, DecodeContext* context) {
1191
+ // Decode the response.
1192
+ const envoy_service_discovery_v3_DiscoveryResponse* response =
1193
+ envoy_service_discovery_v3_DiscoveryResponse_parse(
1194
+ encoded_response.data(), encoded_response.size(),
1195
+ context->arena.ptr());
1196
+ // If decoding fails, report a fatal error and return.
1197
+ if (response == nullptr) {
1198
+ return absl::InvalidArgumentError("Can't decode DiscoveryResponse.");
1199
+ }
1200
+ MaybeLogDiscoveryResponse(xds_client(), xds_client()->def_pool_.ptr(),
1201
+ response);
1202
+ // Get the type_url, version, nonce, number of resources, and number
1203
+ // of errors.
1204
+ context->type_url = std::string(absl::StripPrefix(
1205
+ UpbStringToAbsl(
1206
+ envoy_service_discovery_v3_DiscoveryResponse_type_url(response)),
1207
+ "type.googleapis.com/"));
1208
+ context->version = UpbStringToStdString(
1209
+ envoy_service_discovery_v3_DiscoveryResponse_version_info(response));
1210
+ context->nonce = UpbStringToStdString(
1211
+ envoy_service_discovery_v3_DiscoveryResponse_nonce(response));
1212
+ size_t num_resources;
1213
+ const google_protobuf_Any* const* resources =
1214
+ envoy_service_discovery_v3_DiscoveryResponse_resources(response,
1215
+ &num_resources);
1216
+ size_t num_errors = 0;
1217
+ const envoy_service_discovery_v3_ResourceError* const* errors = nullptr;
1218
+ if (XdsDataErrorHandlingEnabled()) {
1219
+ errors = envoy_service_discovery_v3_DiscoveryResponse_resource_errors(
1220
+ response, &num_errors);
1221
+ }
1222
+ GRPC_TRACE_LOG(xds_client, INFO)
1223
+ << "[xds_client " << xds_client() << "] xds server "
1224
+ << xds_channel()->server_.server_uri()
1225
+ << ": received ADS response: type_url=" << context->type_url
1226
+ << ", version=" << context->version << ", nonce=" << context->nonce
1227
+ << ", num_resources=" << num_resources << ", num_errors=" << num_errors;
1228
+ context->type = xds_client()->GetResourceTypeLocked(context->type_url);
1229
+ if (context->type == nullptr) {
1230
+ return absl::InvalidArgumentError(
1231
+ absl::StrCat("unknown resource type ", context->type_url));
1232
+ }
1233
+ context->read_delay_handle = MakeRefCounted<AdsReadDelayHandle>(Ref());
1234
+ // Process each resource.
1235
+ for (size_t i = 0; i < num_resources; ++i) {
1236
+ absl::string_view type_url = absl::StripPrefix(
1237
+ UpbStringToAbsl(google_protobuf_Any_type_url(resources[i])),
1238
+ "type.googleapis.com/");
1239
+ absl::string_view serialized_resource =
1240
+ UpbStringToAbsl(google_protobuf_Any_value(resources[i]));
1241
+ // Unwrap Resource messages, if so wrapped.
1242
+ absl::string_view resource_name;
1243
+ if (type_url == "envoy.service.discovery.v3.Resource") {
1244
+ const auto* resource_wrapper = envoy_service_discovery_v3_Resource_parse(
1245
+ serialized_resource.data(), serialized_resource.size(),
1246
+ context->arena.ptr());
1247
+ if (resource_wrapper == nullptr) {
1248
+ context->errors.emplace_back(absl::StrCat(
1249
+ "resource index ", i, ": Can't decode Resource proto wrapper"));
1250
+ ++context->num_invalid_resources;
1251
+ continue;
1252
+ }
1253
+ const auto* resource =
1254
+ envoy_service_discovery_v3_Resource_resource(resource_wrapper);
1255
+ if (resource == nullptr) {
1256
+ context->errors.emplace_back(
1257
+ absl::StrCat("resource index ", i,
1258
+ ": No resource present in Resource proto wrappe"));
1259
+ ++context->num_invalid_resources;
1260
+ continue;
1261
+ }
1262
+ type_url = absl::StripPrefix(
1263
+ UpbStringToAbsl(google_protobuf_Any_type_url(resource)),
1264
+ "type.googleapis.com/");
1265
+ serialized_resource =
1266
+ UpbStringToAbsl(google_protobuf_Any_value(resource));
1267
+ resource_name = UpbStringToAbsl(
1268
+ envoy_service_discovery_v3_Resource_name(resource_wrapper));
1269
+ }
1270
+ ParseResource(i, type_url, resource_name, serialized_resource, context);
1271
+ }
1272
+ // Process each error.
1273
+ for (size_t i = 0; i < num_errors; ++i) {
1274
+ absl::string_view name;
1275
+ {
1276
+ const envoy_service_discovery_v3_ResourceName* resource_name =
1277
+ envoy_service_discovery_v3_ResourceError_resource_name(errors[i]);
1278
+ if (resource_name != nullptr) {
1279
+ name = UpbStringToAbsl(
1280
+ envoy_service_discovery_v3_ResourceName_name(resource_name));
1281
+ }
1282
+ }
1283
+ absl::Status status;
1284
+ {
1285
+ const google_rpc_Status* error_detail =
1286
+ envoy_service_discovery_v3_ResourceError_error_detail(errors[i]);
1287
+ if (error_detail != nullptr) {
1288
+ status = absl::Status(
1289
+ static_cast<absl::StatusCode>(google_rpc_Status_code(error_detail)),
1290
+ UpbStringToAbsl(google_rpc_Status_message(error_detail)));
1291
+ }
1292
+ }
1293
+ HandleServerReportedResourceError(i, name, std::move(status), context);
1294
+ }
1295
+ return absl::OkStatus();
1296
+ }
1297
+
1031
1298
  void XdsClient::XdsChannel::AdsCall::OnRecvMessage(absl::string_view payload) {
1032
- // Needs to be destroyed after the mutex is released.
1033
- RefCountedPtr<ReadDelayHandle> read_delay_handle;
1034
- {
1035
- MutexLock lock(&xds_client()->mu_);
1036
- if (!IsCurrentCallOnChannel()) return;
1037
- // Parse and validate the response.
1038
- AdsResponseParser parser(this);
1039
- absl::Status status = xds_client()->api_.ParseAdsResponse(payload, &parser);
1040
- // This includes a handle that will trigger an ADS read.
1041
- AdsResponseParser::Result result = parser.TakeResult();
1042
- read_delay_handle = std::move(result.read_delay_handle);
1043
- if (!status.ok()) {
1044
- // Ignore unparsable response.
1299
+ // context.read_delay_handle needs to be destroyed after the mutex is
1300
+ // released.
1301
+ DecodeContext context;
1302
+ MutexLock lock(&xds_client()->mu_);
1303
+ if (!IsCurrentCallOnChannel()) return;
1304
+ // Parse and validate the response.
1305
+ absl::Status status = DecodeAdsResponse(payload, &context);
1306
+ if (!status.ok()) {
1307
+ // Ignore unparsable response.
1308
+ LOG(ERROR) << "[xds_client " << xds_client() << "] xds server "
1309
+ << xds_channel()->server_.server_uri()
1310
+ << ": error parsing ADS response (" << status << ") -- ignoring";
1311
+ } else {
1312
+ seen_response_ = true;
1313
+ xds_channel()->SetHealthyLocked();
1314
+ // Update nonce.
1315
+ auto& state = state_map_[context.type];
1316
+ state.nonce = context.nonce;
1317
+ // If we got an error, set state.status so that we'll NACK the update.
1318
+ if (!context.errors.empty()) {
1319
+ state.status = absl::UnavailableError(
1320
+ absl::StrCat("xDS response validation errors: [",
1321
+ absl::StrJoin(context.errors, "; "), "]"));
1045
1322
  LOG(ERROR) << "[xds_client " << xds_client() << "] xds server "
1046
1323
  << xds_channel()->server_.server_uri()
1047
- << ": error parsing ADS response (" << status
1048
- << ") -- ignoring";
1049
- } else {
1050
- seen_response_ = true;
1051
- xds_channel()->SetHealthyLocked();
1052
- // Update nonce.
1053
- auto& state = state_map_[result.type];
1054
- state.nonce = result.nonce;
1055
- // If we got an error, set state.status so that we'll NACK the update.
1056
- if (!result.errors.empty()) {
1057
- state.status = absl::UnavailableError(
1058
- absl::StrCat("xDS response validation errors: [",
1059
- absl::StrJoin(result.errors, "; "), "]"));
1060
- LOG(ERROR) << "[xds_client " << xds_client() << "] xds server "
1061
- << xds_channel()->server_.server_uri()
1062
- << ": ADS response invalid for resource type "
1063
- << result.type_url << " version " << result.version
1064
- << ", will NACK: nonce=" << state.nonce
1065
- << " status=" << state.status;
1066
- }
1067
- // Delete resources not seen in update if needed.
1068
- if (result.type->AllResourcesRequiredInSotW()) {
1069
- for (auto& a : xds_client()->authority_state_map_) {
1070
- const std::string& authority = a.first;
1071
- AuthorityState& authority_state = a.second;
1072
- // Skip authorities that are not using this xDS channel.
1073
- if (authority_state.xds_channels.back() != xds_channel()) {
1074
- continue;
1075
- }
1076
- auto seen_authority_it = result.resources_seen.find(authority);
1077
- // Find this resource type.
1078
- auto type_it = authority_state.resource_map.find(result.type);
1079
- if (type_it == authority_state.resource_map.end()) continue;
1080
- // Iterate over resource ids.
1081
- for (auto& r : type_it->second) {
1082
- const XdsResourceKey& resource_key = r.first;
1083
- ResourceState& resource_state = r.second;
1084
- if (seen_authority_it == result.resources_seen.end() ||
1085
- seen_authority_it->second.find(resource_key) ==
1086
- seen_authority_it->second.end()) {
1087
- // If the resource was newly requested but has not yet been
1088
- // received, we don't want to generate an error for the
1089
- // watchers, because this ADS response may be in reaction to an
1090
- // earlier request that did not yet request the new resource, so
1091
- // its absence from the response does not necessarily indicate
1092
- // that the resource does not exist. For that case, we rely on
1093
- // the request timeout instead.
1094
- if (resource_state.resource == nullptr) continue;
1095
- if (xds_channel()->server_.IgnoreResourceDeletion()) {
1096
- if (!resource_state.ignored_deletion) {
1097
- LOG(ERROR)
1098
- << "[xds_client " << xds_client() << "] xds server "
1099
- << xds_channel()->server_.server_uri()
1100
- << ": ignoring deletion for resource type "
1101
- << result.type_url << " name "
1102
- << XdsClient::ConstructFullXdsResourceName(
1103
- authority, result.type_url.c_str(), resource_key);
1104
- resource_state.ignored_deletion = true;
1105
- }
1106
- } else {
1107
- resource_state.resource.reset();
1108
- resource_state.meta.client_status =
1109
- XdsApi::ResourceMetadata::DOES_NOT_EXIST;
1110
- xds_client()->NotifyWatchersOnResourceDoesNotExist(
1111
- resource_state.watchers, read_delay_handle);
1112
- }
1113
- }
1324
+ << ": ADS response invalid for resource type "
1325
+ << context.type_url << " version " << context.version
1326
+ << ", will NACK: nonce=" << state.nonce
1327
+ << " status=" << state.status;
1328
+ }
1329
+ // Delete resources not seen in update if needed.
1330
+ if (context.type->AllResourcesRequiredInSotW()) {
1331
+ for (auto& [authority, authority_state] :
1332
+ xds_client()->authority_state_map_) {
1333
+ // Skip authorities that are not using this xDS channel.
1334
+ if (authority_state.xds_channels.back() != xds_channel()) {
1335
+ continue;
1336
+ }
1337
+ auto seen_authority_it = context.resources_seen.find(authority);
1338
+ // Find this resource type.
1339
+ auto type_it = authority_state.type_map.find(context.type);
1340
+ if (type_it == authority_state.type_map.end()) continue;
1341
+ // Iterate over resource ids.
1342
+ for (auto& [resource_key, resource_state] : type_it->second) {
1343
+ if (seen_authority_it == context.resources_seen.end() ||
1344
+ seen_authority_it->second.find(resource_key) ==
1345
+ seen_authority_it->second.end()) {
1346
+ // If the resource was newly requested but has not yet been
1347
+ // received, we don't want to generate an error for the
1348
+ // watchers, because this ADS response may be in reaction to an
1349
+ // earlier request that did not yet request the new resource, so
1350
+ // its absence from the response does not necessarily indicate
1351
+ // that the resource does not exist. For that case, we rely on
1352
+ // the request timeout instead.
1353
+ if (!resource_state.HasResource()) continue;
1354
+ const bool drop_cached_resource =
1355
+ XdsDataErrorHandlingEnabled()
1356
+ ? xds_channel()->server_.FailOnDataErrors()
1357
+ : !xds_channel()->server_.IgnoreResourceDeletion();
1358
+ resource_state.SetDoesNotExistOnLdsOrCdsDeletion(
1359
+ context.version, context.update_time, drop_cached_resource);
1360
+ xds_client()->NotifyWatchersOnError(resource_state,
1361
+ context.read_delay_handle);
1114
1362
  }
1115
1363
  }
1116
1364
  }
1117
- // If we had valid resources or the update was empty, update the version.
1118
- if (result.num_valid_resources > 0 || result.errors.empty()) {
1119
- xds_channel()->resource_type_version_map_[result.type] =
1120
- std::move(result.version);
1121
- }
1122
- // Send ACK or NACK.
1123
- SendMessageLocked(result.type);
1124
1365
  }
1125
- // Update metrics.
1126
- if (xds_client()->metrics_reporter_ != nullptr) {
1127
- xds_client()->metrics_reporter_->ReportResourceUpdates(
1128
- xds_channel()->server_.server_uri(), result.type_url,
1129
- result.num_valid_resources, result.num_invalid_resources);
1366
+ // If we had valid resources or the update was empty, update the version.
1367
+ if (context.num_valid_resources > 0 || context.errors.empty()) {
1368
+ xds_channel()->resource_type_version_map_[context.type] =
1369
+ std::move(context.version);
1130
1370
  }
1371
+ // Send ACK or NACK.
1372
+ SendMessageLocked(context.type);
1373
+ }
1374
+ // Update metrics.
1375
+ if (xds_client()->metrics_reporter_ != nullptr) {
1376
+ xds_client()->metrics_reporter_->ReportResourceUpdates(
1377
+ xds_channel()->server_.server_uri(), context.type_url,
1378
+ context.num_valid_resources, context.num_invalid_resources);
1131
1379
  }
1132
- xds_client()->work_serializer_.DrainQueue();
1133
1380
  }
1134
1381
 
1135
1382
  void XdsClient::XdsChannel::AdsCall::OnStatusReceived(absl::Status status) {
1136
- {
1137
- MutexLock lock(&xds_client()->mu_);
1138
- GRPC_TRACE_LOG(xds_client, INFO)
1139
- << "[xds_client " << xds_client() << "] xds server "
1140
- << xds_channel()->server_.server_uri()
1141
- << ": ADS call status received (xds_channel=" << xds_channel()
1142
- << ", ads_call=" << this << ", streaming_call=" << streaming_call_.get()
1143
- << "): " << status;
1144
- // Cancel any does-not-exist timers that may be pending.
1145
- for (const auto& p : state_map_) {
1146
- for (const auto& q : p.second.subscribed_resources) {
1147
- for (auto& r : q.second) {
1148
- r.second->MaybeCancelTimer();
1149
- }
1383
+ MutexLock lock(&xds_client()->mu_);
1384
+ GRPC_TRACE_LOG(xds_client, INFO)
1385
+ << "[xds_client " << xds_client() << "] xds server "
1386
+ << xds_channel()->server_.server_uri()
1387
+ << ": ADS call status received (xds_channel=" << xds_channel()
1388
+ << ", ads_call=" << this << ", streaming_call=" << streaming_call_.get()
1389
+ << "): " << status;
1390
+ // Cancel any does-not-exist timers that may be pending.
1391
+ for (const auto& [_, resource_type_state] : state_map_) {
1392
+ for (const auto& [_, resource_map] :
1393
+ resource_type_state.subscribed_resources) {
1394
+ for (auto& [_, resource_timer] : resource_map) {
1395
+ resource_timer->MaybeCancelTimer();
1150
1396
  }
1151
1397
  }
1152
- // Ignore status from a stale call.
1153
- if (IsCurrentCallOnChannel()) {
1154
- // Try to restart the call.
1155
- retryable_call_->OnCallFinishedLocked();
1156
- // If we didn't receive a response on the stream, report the
1157
- // stream failure as a connectivity failure, which will report the
1158
- // error to all watchers of resources on this channel.
1159
- if (!seen_response_) {
1160
- xds_channel()->SetChannelStatusLocked(absl::UnavailableError(
1161
- absl::StrCat("xDS call failed with no responses received; status: ",
1162
- status.ToString())));
1163
- }
1398
+ }
1399
+ // Ignore status from a stale call.
1400
+ if (IsCurrentCallOnChannel()) {
1401
+ // Try to restart the call.
1402
+ retryable_call_->OnCallFinishedLocked();
1403
+ // If we didn't receive a response on the stream, report the
1404
+ // stream failure as a connectivity failure, which will report the
1405
+ // error to all watchers of resources on this channel.
1406
+ if (!seen_response_) {
1407
+ xds_channel()->SetChannelStatusLocked(absl::UnavailableError(
1408
+ absl::StrCat("xDS call failed with no responses received; status: ",
1409
+ status.ToString())));
1164
1410
  }
1165
1411
  }
1166
- xds_client()->work_serializer_.DrainQueue();
1167
1412
  }
1168
1413
 
1169
1414
  bool XdsClient::XdsChannel::AdsCall::IsCurrentCallOnChannel() const {
@@ -1179,13 +1424,10 @@ XdsClient::XdsChannel::AdsCall::ResourceNamesForRequest(
1179
1424
  std::vector<std::string> resource_names;
1180
1425
  auto it = state_map_.find(type);
1181
1426
  if (it != state_map_.end()) {
1182
- for (auto& a : it->second.subscribed_resources) {
1183
- const std::string& authority = a.first;
1184
- for (auto& p : a.second) {
1185
- const XdsResourceKey& resource_key = p.first;
1427
+ for (auto& [authority, authority_state] : it->second.subscribed_resources) {
1428
+ for (auto& [resource_key, resource_timer] : authority_state) {
1186
1429
  resource_names.emplace_back(XdsClient::ConstructFullXdsResourceName(
1187
1430
  authority, type->type_url(), resource_key));
1188
- OrphanablePtr<ResourceTimer>& resource_timer = p.second;
1189
1431
  resource_timer->MarkSubscriptionSendStarted();
1190
1432
  }
1191
1433
  }
@@ -1193,6 +1435,144 @@ XdsClient::XdsChannel::AdsCall::ResourceNamesForRequest(
1193
1435
  return resource_names;
1194
1436
  }
1195
1437
 
1438
+ //
1439
+ // XdsClient::ResourceState
1440
+ //
1441
+
1442
+ void XdsClient::ResourceState::SetAcked(
1443
+ std::shared_ptr<const XdsResourceType::ResourceData> resource,
1444
+ std::string serialized_proto, std::string version, Timestamp update_time) {
1445
+ resource_ = std::move(resource);
1446
+ client_status_ = ClientResourceStatus::ACKED;
1447
+ serialized_proto_ = std::move(serialized_proto);
1448
+ update_time_ = update_time;
1449
+ version_ = std::move(version);
1450
+ failed_version_.clear();
1451
+ failed_status_ = absl::OkStatus();
1452
+ }
1453
+
1454
+ void XdsClient::ResourceState::SetNacked(const std::string& version,
1455
+ absl::string_view details,
1456
+ Timestamp update_time,
1457
+ bool drop_cached_resource) {
1458
+ if (drop_cached_resource) {
1459
+ resource_.reset();
1460
+ serialized_proto_.clear();
1461
+ }
1462
+ client_status_ = ClientResourceStatus::NACKED;
1463
+ failed_status_ =
1464
+ absl::InvalidArgumentError(absl::StrCat("invalid resource: ", details));
1465
+ failed_version_ = version;
1466
+ failed_update_time_ = update_time;
1467
+ }
1468
+
1469
+ void XdsClient::ResourceState::SetReceivedError(const std::string& version,
1470
+ absl::Status status,
1471
+ Timestamp update_time,
1472
+ bool drop_cached_resource) {
1473
+ if (drop_cached_resource) {
1474
+ resource_.reset();
1475
+ serialized_proto_.clear();
1476
+ }
1477
+ client_status_ = ClientResourceStatus::RECEIVED_ERROR;
1478
+ failed_version_ = version;
1479
+ failed_status_ = std::move(status);
1480
+ failed_update_time_ = update_time;
1481
+ }
1482
+
1483
+ void XdsClient::ResourceState::SetDoesNotExistOnLdsOrCdsDeletion(
1484
+ const std::string& version, Timestamp update_time,
1485
+ bool drop_cached_resource) {
1486
+ if (drop_cached_resource) {
1487
+ resource_.reset();
1488
+ serialized_proto_.clear();
1489
+ }
1490
+ client_status_ = ClientResourceStatus::DOES_NOT_EXIST;
1491
+ failed_status_ = absl::NotFoundError("does not exist");
1492
+ failed_version_ = version;
1493
+ failed_update_time_ = update_time;
1494
+ }
1495
+
1496
+ void XdsClient::ResourceState::SetDoesNotExistOnTimeout() {
1497
+ client_status_ = ClientResourceStatus::DOES_NOT_EXIST;
1498
+ failed_status_ = absl::NotFoundError("does not exist");
1499
+ failed_version_.clear();
1500
+ }
1501
+
1502
+ void XdsClient::ResourceState::SetTimeout(const std::string& details) {
1503
+ client_status_ = ClientResourceStatus::TIMEOUT;
1504
+ failed_status_ = absl::UnavailableError(details);
1505
+ failed_version_.clear();
1506
+ }
1507
+
1508
+ absl::string_view XdsClient::ResourceState::CacheStateString() const {
1509
+ switch (client_status_) {
1510
+ case ClientResourceStatus::REQUESTED:
1511
+ return "requested";
1512
+ case ClientResourceStatus::DOES_NOT_EXIST:
1513
+ return resource_ != nullptr ? "does_not_exist_but_cached"
1514
+ : "does_not_exist";
1515
+ case ClientResourceStatus::ACKED:
1516
+ return "acked";
1517
+ case ClientResourceStatus::NACKED:
1518
+ return resource_ != nullptr ? "nacked_but_cached" : "nacked";
1519
+ case ClientResourceStatus::RECEIVED_ERROR:
1520
+ return resource_ != nullptr ? "received_error_but_cached"
1521
+ : "received_error";
1522
+ case ClientResourceStatus::TIMEOUT:
1523
+ return "timeout";
1524
+ }
1525
+ Crash("unknown resource state");
1526
+ }
1527
+
1528
+ namespace {
1529
+
1530
+ google_protobuf_Timestamp* EncodeTimestamp(Timestamp value, upb_Arena* arena) {
1531
+ google_protobuf_Timestamp* timestamp = google_protobuf_Timestamp_new(arena);
1532
+ gpr_timespec timespec = value.as_timespec(GPR_CLOCK_REALTIME);
1533
+ google_protobuf_Timestamp_set_seconds(timestamp, timespec.tv_sec);
1534
+ google_protobuf_Timestamp_set_nanos(timestamp, timespec.tv_nsec);
1535
+ return timestamp;
1536
+ }
1537
+
1538
+ } // namespace
1539
+
1540
+ void XdsClient::ResourceState::FillGenericXdsConfig(
1541
+ upb_StringView type_url, upb_StringView resource_name, upb_Arena* arena,
1542
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig* entry) const {
1543
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_type_url(entry,
1544
+ type_url);
1545
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_name(entry,
1546
+ resource_name);
1547
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_client_status(
1548
+ entry, client_status_);
1549
+ if (!serialized_proto_.empty()) {
1550
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_version_info(
1551
+ entry, StdStringToUpbString(version_));
1552
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_last_updated(
1553
+ entry, EncodeTimestamp(update_time_, arena));
1554
+ auto* any_field =
1555
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_mutable_xds_config(
1556
+ entry, arena);
1557
+ google_protobuf_Any_set_type_url(any_field, type_url);
1558
+ google_protobuf_Any_set_value(any_field,
1559
+ StdStringToUpbString(serialized_proto_));
1560
+ }
1561
+ if (!failed_status_.ok()) {
1562
+ auto* update_failure_state = envoy_admin_v3_UpdateFailureState_new(arena);
1563
+ envoy_admin_v3_UpdateFailureState_set_details(
1564
+ update_failure_state, StdStringToUpbString(failed_status_.message()));
1565
+ if (!failed_version_.empty()) {
1566
+ envoy_admin_v3_UpdateFailureState_set_version_info(
1567
+ update_failure_state, StdStringToUpbString(failed_version_));
1568
+ envoy_admin_v3_UpdateFailureState_set_last_update_attempt(
1569
+ update_failure_state, EncodeTimestamp(failed_update_time_, arena));
1570
+ }
1571
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_error_state(
1572
+ entry, update_failure_state);
1573
+ }
1574
+ }
1575
+
1196
1576
  //
1197
1577
  // XdsClient
1198
1578
  //
@@ -1209,11 +1589,11 @@ XdsClient::XdsClient(
1209
1589
  : DualRefCounted<XdsClient>(
1210
1590
  GRPC_TRACE_FLAG_ENABLED(xds_client_refcount) ? "XdsClient" : nullptr),
1211
1591
  bootstrap_(std::move(bootstrap)),
1592
+ user_agent_name_(std::move(user_agent_name)),
1593
+ user_agent_version_(std::move(user_agent_version)),
1212
1594
  transport_factory_(std::move(transport_factory)),
1213
1595
  request_timeout_(resource_request_timeout),
1214
1596
  xds_federation_enabled_(XdsFederationEnabled()),
1215
- api_(this, &xds_client_trace, bootstrap_->node(), &def_pool_,
1216
- std::move(user_agent_name), std::move(user_agent_version)),
1217
1597
  work_serializer_(engine),
1218
1598
  engine_(std::move(engine)),
1219
1599
  metrics_reporter_(std::move(metrics_reporter)) {
@@ -1238,7 +1618,12 @@ void XdsClient::Orphaned() {
1238
1618
  MutexLock lock(&mu_);
1239
1619
  shutting_down_ = true;
1240
1620
  // Clear cache and any remaining watchers that may not have been cancelled.
1241
- authority_state_map_.clear();
1621
+ // Note: We move authority_state_map_ out of the way before clearing
1622
+ // it, because clearing the map will trigger calls to
1623
+ // MaybeRemoveUnsubscribedCacheEntriesForTypeLocked(), which would try to
1624
+ // modify the map while we are iterating over it.
1625
+ auto authority_state_map = std::move(authority_state_map_);
1626
+ authority_state_map.clear();
1242
1627
  invalid_watchers_.clear();
1243
1628
  }
1244
1629
 
@@ -1257,10 +1642,11 @@ RefCountedPtr<XdsClient::XdsChannel> XdsClient::GetOrCreateXdsChannelLocked(
1257
1642
  }
1258
1643
 
1259
1644
  bool XdsClient::HasUncachedResources(const AuthorityState& authority_state) {
1260
- for (const auto& type_resource : authority_state.resource_map) {
1261
- for (const auto& key_state : type_resource.second) {
1262
- if (key_state.second.meta.client_status ==
1263
- XdsApi::ResourceMetadata::REQUESTED) {
1645
+ for (const auto& [_, resource_map] : authority_state.type_map) {
1646
+ for (const auto& [_, resource_state] : resource_map) {
1647
+ if (resource_state.HasWatchers() &&
1648
+ resource_state.client_status() ==
1649
+ ResourceState::ClientResourceStatus::REQUESTED) {
1264
1650
  return true;
1265
1651
  }
1266
1652
  }
@@ -1271,24 +1657,19 @@ bool XdsClient::HasUncachedResources(const AuthorityState& authority_state) {
1271
1657
  void XdsClient::WatchResource(const XdsResourceType* type,
1272
1658
  absl::string_view name,
1273
1659
  RefCountedPtr<ResourceWatcherInterface> watcher) {
1274
- ResourceWatcherInterface* w = watcher.get();
1275
1660
  // Lambda for handling failure cases.
1276
1661
  auto fail = [&](absl::Status status) mutable {
1277
1662
  {
1278
1663
  MutexLock lock(&mu_);
1279
1664
  MaybeRegisterResourceTypeLocked(type);
1280
- invalid_watchers_[w] = watcher;
1665
+ invalid_watchers_.insert(watcher);
1281
1666
  }
1282
- work_serializer_.Run(
1283
- [watcher = std::move(watcher), status = std::move(status)]()
1284
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&work_serializer_) {
1285
- watcher->OnError(status, ReadDelayHandle::NoWait());
1286
- },
1287
- DEBUG_LOCATION);
1667
+ NotifyWatchersOnResourceChanged(std::move(status), {watcher},
1668
+ ReadDelayHandle::NoWait());
1288
1669
  };
1289
1670
  auto resource_name = ParseXdsResourceName(name, type);
1290
1671
  if (!resource_name.ok()) {
1291
- fail(absl::UnavailableError(
1672
+ fail(absl::InvalidArgumentError(
1292
1673
  absl::StrCat("Unable to parse resource name ", name)));
1293
1674
  return;
1294
1675
  }
@@ -1298,7 +1679,7 @@ void XdsClient::WatchResource(const XdsResourceType* type,
1298
1679
  auto* authority =
1299
1680
  bootstrap_->LookupAuthority(std::string(resource_name->authority));
1300
1681
  if (authority == nullptr) {
1301
- fail(absl::UnavailableError(
1682
+ fail(absl::FailedPreconditionError(
1302
1683
  absl::StrCat("authority \"", resource_name->authority,
1303
1684
  "\" not present in bootstrap config")));
1304
1685
  return;
@@ -1306,103 +1687,67 @@ void XdsClient::WatchResource(const XdsResourceType* type,
1306
1687
  xds_servers = authority->servers();
1307
1688
  }
1308
1689
  if (xds_servers.empty()) xds_servers = bootstrap_->servers();
1309
- {
1310
- MutexLock lock(&mu_);
1311
- MaybeRegisterResourceTypeLocked(type);
1312
-
1313
- AuthorityState& authority_state =
1314
- authority_state_map_[resource_name->authority];
1315
- auto it_is_new = authority_state.resource_map[type].emplace(
1316
- resource_name->key, ResourceState());
1317
- bool first_watcher_for_resource = it_is_new.second;
1318
- ResourceState& resource_state = it_is_new.first->second;
1319
- resource_state.watchers[w] = watcher;
1320
- if (first_watcher_for_resource) {
1321
- // We try to add new channels in 2 cases:
1322
- // - This is the first resource for this authority (i.e., the list
1323
- // of channels is empty).
1324
- // - The last channel in the list is failing. That failure may not
1325
- // have previously triggered fallback if there were no uncached
1326
- // resources, but we've just added a new uncached resource,
1327
- // so we need to trigger fallback now.
1328
- //
1329
- // Note that when we add a channel, it might already be failing
1330
- // due to being used in a different authority. So we keep going
1331
- // until either we add one that isn't failing or we've added them all.
1332
- if (authority_state.xds_channels.empty() ||
1333
- !authority_state.xds_channels.back()->status().ok()) {
1334
- for (size_t i = authority_state.xds_channels.size();
1335
- i < xds_servers.size(); ++i) {
1336
- authority_state.xds_channels.emplace_back(
1337
- GetOrCreateXdsChannelLocked(*xds_servers[i], "start watch"));
1338
- if (authority_state.xds_channels.back()->status().ok()) {
1339
- break;
1340
- }
1341
- }
1342
- }
1343
- for (const auto& channel : authority_state.xds_channels) {
1344
- channel->SubscribeLocked(type, *resource_name);
1345
- }
1346
- } else {
1347
- // If we already have a cached value for the resource, notify the new
1348
- // watcher immediately.
1349
- if (resource_state.resource != nullptr) {
1350
- GRPC_TRACE_LOG(xds_client, INFO)
1351
- << "[xds_client " << this << "] returning cached listener data for "
1352
- << name;
1353
- work_serializer_.Schedule(
1354
- [watcher, value = resource_state.resource]()
1355
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&work_serializer_) {
1356
- watcher->OnGenericResourceChanged(value,
1357
- ReadDelayHandle::NoWait());
1358
- },
1359
- DEBUG_LOCATION);
1360
- } else if (resource_state.meta.client_status ==
1361
- XdsApi::ResourceMetadata::DOES_NOT_EXIST) {
1362
- GRPC_TRACE_LOG(xds_client, INFO)
1363
- << "[xds_client " << this
1364
- << "] reporting cached does-not-exist for " << name;
1365
- work_serializer_.Schedule(
1366
- [watcher]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(&work_serializer_) {
1367
- watcher->OnResourceDoesNotExist(ReadDelayHandle::NoWait());
1368
- },
1369
- DEBUG_LOCATION);
1370
- } else if (resource_state.meta.client_status ==
1371
- XdsApi::ResourceMetadata::NACKED) {
1372
- GRPC_TRACE_LOG(xds_client, INFO)
1373
- << "[xds_client " << this
1374
- << "] reporting cached validation failure for " << name << ": "
1375
- << resource_state.meta.failed_details;
1376
- std::string details = resource_state.meta.failed_details;
1377
- const auto* node = bootstrap_->node();
1378
- if (node != nullptr) {
1379
- absl::StrAppend(&details, " (node ID:", bootstrap_->node()->id(),
1380
- ")");
1690
+ MutexLock lock(&mu_);
1691
+ MaybeRegisterResourceTypeLocked(type);
1692
+ AuthorityState& authority_state =
1693
+ authority_state_map_[resource_name->authority];
1694
+ auto [it, created_entry] = authority_state.type_map[type].emplace(
1695
+ resource_name->key, ResourceState());
1696
+ ResourceState& resource_state = it->second;
1697
+ resource_state.AddWatcher(watcher);
1698
+ if (created_entry) {
1699
+ // We try to add new channels in 2 cases:
1700
+ // - This is the first resource for this authority (i.e., the list
1701
+ // of channels is empty).
1702
+ // - The last channel in the list is failing. That failure may not
1703
+ // have previously triggered fallback if there were no uncached
1704
+ // resources, but we've just added a new uncached resource,
1705
+ // so we need to trigger fallback now.
1706
+ //
1707
+ // Note that when we add a channel, it might already be failing
1708
+ // due to being used in a different authority. So we keep going
1709
+ // until either we add one that isn't failing or we've added them all.
1710
+ if (authority_state.xds_channels.empty() ||
1711
+ !authority_state.xds_channels.back()->status().ok()) {
1712
+ for (size_t i = authority_state.xds_channels.size();
1713
+ i < xds_servers.size(); ++i) {
1714
+ authority_state.xds_channels.emplace_back(
1715
+ GetOrCreateXdsChannelLocked(*xds_servers[i], "start watch"));
1716
+ if (authority_state.xds_channels.back()->status().ok()) {
1717
+ break;
1381
1718
  }
1382
- work_serializer_.Schedule(
1383
- [watcher, details = std::move(details)]()
1384
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&work_serializer_) {
1385
- watcher->OnError(absl::UnavailableError(absl::StrCat(
1386
- "invalid resource: ", details)),
1387
- ReadDelayHandle::NoWait());
1388
- },
1389
- DEBUG_LOCATION);
1390
1719
  }
1391
1720
  }
1392
- absl::Status channel_status = authority_state.xds_channels.back()->status();
1393
- if (!channel_status.ok()) {
1721
+ } else {
1722
+ // If we already have a cached value for the resource, notify the new
1723
+ // watcher immediately.
1724
+ if (resource_state.HasResource()) {
1725
+ GRPC_TRACE_LOG(xds_client, INFO)
1726
+ << "[xds_client " << this << "] returning cached data for " << name;
1727
+ NotifyWatchersOnResourceChanged(resource_state.resource(), {watcher},
1728
+ ReadDelayHandle::NoWait());
1729
+ }
1730
+ if (!resource_state.failed_status().ok()) {
1394
1731
  GRPC_TRACE_LOG(xds_client, INFO)
1395
- << "[xds_client " << this << "] returning cached channel error for "
1396
- << name << ": " << channel_status;
1397
- work_serializer_.Schedule(
1398
- [watcher = std::move(watcher), status = std::move(channel_status)]()
1399
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&work_serializer_) mutable {
1400
- watcher->OnError(std::move(status), ReadDelayHandle::NoWait());
1401
- },
1402
- DEBUG_LOCATION);
1732
+ << "[xds_client " << this << "] returning cached error for " << name
1733
+ << ": " << resource_state.failed_status();
1734
+ NotifyWatchersOnError(resource_state, ReadDelayHandle::NoWait(),
1735
+ {watcher});
1403
1736
  }
1404
1737
  }
1405
- work_serializer_.DrainQueue();
1738
+ // Make sure all channels are subscribing to the resource.
1739
+ for (const auto& channel : authority_state.xds_channels) {
1740
+ channel->SubscribeLocked(type, *resource_name);
1741
+ }
1742
+ // If the channel is not connected, report an error to the watcher.
1743
+ absl::Status channel_status = authority_state.xds_channels.back()->status();
1744
+ if (!channel_status.ok()) {
1745
+ GRPC_TRACE_LOG(xds_client, INFO)
1746
+ << "[xds_client " << this << "] returning cached channel error for "
1747
+ << name << ": " << channel_status;
1748
+ NotifyWatchersOnError(resource_state, ReadDelayHandle::NoWait(), {watcher},
1749
+ std::move(channel_status));
1750
+ }
1406
1751
  }
1407
1752
 
1408
1753
  void XdsClient::CancelResourceWatch(const XdsResourceType* type,
@@ -1420,34 +1765,63 @@ void XdsClient::CancelResourceWatch(const XdsResourceType* type,
1420
1765
  if (authority_it == authority_state_map_.end()) return;
1421
1766
  AuthorityState& authority_state = authority_it->second;
1422
1767
  // Find type map.
1423
- auto type_it = authority_state.resource_map.find(type);
1424
- if (type_it == authority_state.resource_map.end()) return;
1425
- auto& type_map = type_it->second;
1768
+ auto type_it = authority_state.type_map.find(type);
1769
+ if (type_it == authority_state.type_map.end()) return;
1770
+ auto& resource_map = type_it->second;
1426
1771
  // Find resource key.
1427
- auto resource_it = type_map.find(resource_name->key);
1428
- if (resource_it == type_map.end()) return;
1772
+ auto resource_it = resource_map.find(resource_name->key);
1773
+ if (resource_it == resource_map.end()) return;
1429
1774
  ResourceState& resource_state = resource_it->second;
1430
1775
  // Remove watcher.
1431
- resource_state.watchers.erase(watcher);
1432
- // Clean up empty map entries, if any.
1433
- if (resource_state.watchers.empty()) {
1434
- if (resource_state.ignored_deletion) {
1435
- LOG(INFO) << "[xds_client " << this
1436
- << "] unsubscribing from a resource for which we "
1437
- << "previously ignored a deletion: type " << type->type_url()
1438
- << " name " << name;
1439
- }
1776
+ resource_state.RemoveWatcher(watcher);
1777
+ // If this was the last watcher, clean up.
1778
+ if (!resource_state.HasWatchers()) {
1779
+ // Unsubscribe from this resource on all XdsChannels.
1440
1780
  for (const auto& xds_channel : authority_state.xds_channels) {
1441
1781
  xds_channel->UnsubscribeLocked(type, *resource_name,
1442
1782
  delay_unsubscription);
1443
1783
  }
1444
- type_map.erase(resource_it);
1445
- if (type_map.empty()) {
1446
- authority_state.resource_map.erase(type_it);
1447
- if (authority_state.resource_map.empty()) {
1448
- authority_state.xds_channels.clear();
1784
+ // Note: We wait to remove the cache entry until we actualle send
1785
+ // the unsubscription message on the ADS stream, so that if a watch is
1786
+ // stopped and then started again before we send the next request
1787
+ // for that resource type, we don't lose the cache entry without the
1788
+ // xDS server knowing it needs to re-send it.
1789
+ //
1790
+ // Note: Because the cache cleanup may have been triggered by the
1791
+ // unsubscription, it's no longer safe to access any of the
1792
+ // iterators that we have from above.
1793
+ }
1794
+ }
1795
+
1796
+ void XdsClient::MaybeRemoveUnsubscribedCacheEntriesForTypeLocked(
1797
+ XdsChannel* xds_channel, const XdsResourceType* type) {
1798
+ for (auto authority_it = authority_state_map_.begin();
1799
+ authority_it != authority_state_map_.end();) {
1800
+ AuthorityState& authority_state = authority_it->second;
1801
+ if (authority_state.xds_channels.back() == xds_channel) {
1802
+ // Find type map.
1803
+ auto type_it = authority_state.type_map.find(type);
1804
+ if (type_it != authority_state.type_map.end()) {
1805
+ auto& resource_map = type_it->second;
1806
+ // Remove the cache entry for any resource without watchers.
1807
+ for (auto resource_it = resource_map.begin();
1808
+ resource_it != resource_map.end();) {
1809
+ ResourceState& resource_state = resource_it->second;
1810
+ if (!resource_state.HasWatchers()) {
1811
+ resource_map.erase(resource_it++);
1812
+ } else {
1813
+ ++resource_it;
1814
+ }
1815
+ }
1816
+ // Clean up empty entries in the map.
1817
+ if (resource_map.empty()) authority_state.type_map.erase(type_it);
1449
1818
  }
1450
1819
  }
1820
+ if (authority_state.type_map.empty()) {
1821
+ authority_state_map_.erase(authority_it++);
1822
+ } else {
1823
+ ++authority_it;
1824
+ }
1451
1825
  }
1452
1826
  }
1453
1827
 
@@ -1490,9 +1864,9 @@ absl::StatusOr<XdsClient::XdsResourceName> XdsClient::ParseXdsResourceName(
1490
1864
  }
1491
1865
  // Canonicalize order of query params.
1492
1866
  std::vector<URI::QueryParam> query_params;
1493
- for (const auto& p : uri->query_parameter_map()) {
1867
+ for (const auto& [key, value] : uri->query_parameter_map()) {
1494
1868
  query_params.emplace_back(
1495
- URI::QueryParam{std::string(p.first), std::string(p.second)});
1869
+ URI::QueryParam{std::string(key), std::string(value)});
1496
1870
  }
1497
1871
  return XdsResourceName{
1498
1872
  uri->authority(),
@@ -1515,94 +1889,65 @@ std::string XdsClient::ConstructFullXdsResourceName(
1515
1889
 
1516
1890
  void XdsClient::ResetBackoff() {
1517
1891
  MutexLock lock(&mu_);
1518
- for (auto& p : xds_channel_map_) {
1519
- p.second->ResetBackoff();
1892
+ for (auto& [_, xds_channel] : xds_channel_map_) {
1893
+ xds_channel->ResetBackoff();
1520
1894
  }
1521
1895
  }
1522
1896
 
1523
- void XdsClient::NotifyWatchersOnErrorLocked(
1524
- const std::map<ResourceWatcherInterface*,
1525
- RefCountedPtr<ResourceWatcherInterface>>& watchers,
1526
- absl::Status status, RefCountedPtr<ReadDelayHandle> read_delay_handle) {
1897
+ absl::Status XdsClient::AppendNodeToStatus(const absl::Status& status) const {
1527
1898
  const auto* node = bootstrap_->node();
1528
- if (node != nullptr) {
1529
- status = absl::Status(
1530
- status.code(),
1531
- absl::StrCat(status.message(), " (node ID:", node->id(), ")"));
1532
- }
1533
- work_serializer_.Schedule(
1534
- [watchers, status = std::move(status),
1899
+ if (node == nullptr) return status;
1900
+ return absl::Status(
1901
+ status.code(), absl::StrCat(status.message(),
1902
+ " (node ID:", bootstrap_->node()->id(), ")"));
1903
+ }
1904
+
1905
+ void XdsClient::NotifyWatchersOnResourceChanged(
1906
+ absl::StatusOr<std::shared_ptr<const XdsResourceType::ResourceData>>
1907
+ resource,
1908
+ WatcherSet watchers, RefCountedPtr<ReadDelayHandle> read_delay_handle) {
1909
+ if (!resource.ok()) resource = AppendNodeToStatus(resource.status());
1910
+ work_serializer_.Run(
1911
+ [watchers = std::move(watchers), resource = std::move(resource),
1535
1912
  read_delay_handle = std::move(read_delay_handle)]()
1536
1913
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&work_serializer_) {
1537
- for (const auto& p : watchers) {
1538
- p.first->OnError(status, read_delay_handle);
1914
+ for (const auto& watcher : watchers) {
1915
+ watcher->OnGenericResourceChanged(resource, read_delay_handle);
1539
1916
  }
1540
1917
  },
1541
1918
  DEBUG_LOCATION);
1542
1919
  }
1543
1920
 
1544
- void XdsClient::NotifyWatchersOnResourceDoesNotExist(
1545
- const std::map<ResourceWatcherInterface*,
1546
- RefCountedPtr<ResourceWatcherInterface>>& watchers,
1921
+ void XdsClient::NotifyWatchersOnAmbientError(
1922
+ absl::Status status, WatcherSet watchers,
1547
1923
  RefCountedPtr<ReadDelayHandle> read_delay_handle) {
1548
- work_serializer_.Schedule(
1549
- [watchers, read_delay_handle = std::move(read_delay_handle)]()
1924
+ if (!status.ok()) status = AppendNodeToStatus(status);
1925
+ work_serializer_.Run(
1926
+ [watchers = std::move(watchers), status = std::move(status),
1927
+ read_delay_handle = std::move(read_delay_handle)]()
1550
1928
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&work_serializer_) {
1551
- for (const auto& p : watchers) {
1552
- p.first->OnResourceDoesNotExist(read_delay_handle);
1929
+ for (const auto& watcher : watchers) {
1930
+ watcher->OnAmbientError(status, read_delay_handle);
1553
1931
  }
1554
1932
  },
1555
1933
  DEBUG_LOCATION);
1556
1934
  }
1557
1935
 
1558
- namespace {
1559
-
1560
- google_protobuf_Timestamp* EncodeTimestamp(Timestamp value, upb_Arena* arena) {
1561
- google_protobuf_Timestamp* timestamp = google_protobuf_Timestamp_new(arena);
1562
- gpr_timespec timespec = value.as_timespec(GPR_CLOCK_REALTIME);
1563
- google_protobuf_Timestamp_set_seconds(timestamp, timespec.tv_sec);
1564
- google_protobuf_Timestamp_set_nanos(timestamp, timespec.tv_nsec);
1565
- return timestamp;
1566
- }
1567
-
1568
- void FillGenericXdsConfig(
1569
- const XdsApi::ResourceMetadata& metadata, upb_StringView type_url,
1570
- upb_StringView resource_name, upb_Arena* arena,
1571
- envoy_service_status_v3_ClientConfig_GenericXdsConfig* entry) {
1572
- envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_type_url(entry,
1573
- type_url);
1574
- envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_name(entry,
1575
- resource_name);
1576
- envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_client_status(
1577
- entry, metadata.client_status);
1578
- if (!metadata.serialized_proto.empty()) {
1579
- envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_version_info(
1580
- entry, StdStringToUpbString(metadata.version));
1581
- envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_last_updated(
1582
- entry, EncodeTimestamp(metadata.update_time, arena));
1583
- auto* any_field =
1584
- envoy_service_status_v3_ClientConfig_GenericXdsConfig_mutable_xds_config(
1585
- entry, arena);
1586
- google_protobuf_Any_set_type_url(any_field, type_url);
1587
- google_protobuf_Any_set_value(
1588
- any_field, StdStringToUpbString(metadata.serialized_proto));
1589
- }
1590
- if (metadata.client_status == XdsApi::ResourceMetadata::NACKED) {
1591
- auto* update_failure_state = envoy_admin_v3_UpdateFailureState_new(arena);
1592
- envoy_admin_v3_UpdateFailureState_set_details(
1593
- update_failure_state, StdStringToUpbString(metadata.failed_details));
1594
- envoy_admin_v3_UpdateFailureState_set_version_info(
1595
- update_failure_state, StdStringToUpbString(metadata.failed_version));
1596
- envoy_admin_v3_UpdateFailureState_set_last_update_attempt(
1597
- update_failure_state,
1598
- EncodeTimestamp(metadata.failed_update_time, arena));
1599
- envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_error_state(
1600
- entry, update_failure_state);
1936
+ void XdsClient::NotifyWatchersOnError(
1937
+ const ResourceState& resource_state,
1938
+ RefCountedPtr<ReadDelayHandle> read_delay_handle, WatcherSet watchers,
1939
+ absl::Status status) {
1940
+ if (watchers.empty()) watchers = resource_state.watchers();
1941
+ if (status.ok()) status = resource_state.failed_status();
1942
+ if (!resource_state.HasResource()) {
1943
+ NotifyWatchersOnResourceChanged(std::move(status), std::move(watchers),
1944
+ std::move(read_delay_handle));
1945
+ } else {
1946
+ NotifyWatchersOnAmbientError(std::move(status), std::move(watchers),
1947
+ std::move(read_delay_handle));
1601
1948
  }
1602
1949
  }
1603
1950
 
1604
- } // namespace
1605
-
1606
1951
  void XdsClient::DumpClientConfig(
1607
1952
  std::set<std::string>* string_pool, upb_Arena* arena,
1608
1953
  envoy_service_status_v3_ClientConfig* client_config) {
@@ -1610,70 +1955,51 @@ void XdsClient::DumpClientConfig(
1610
1955
  // Fill-in the node information
1611
1956
  auto* node =
1612
1957
  envoy_service_status_v3_ClientConfig_mutable_node(client_config, arena);
1613
- api_.PopulateNode(node, arena);
1958
+ PopulateXdsNode(bootstrap_->node(), user_agent_name_, user_agent_version_,
1959
+ node, arena);
1614
1960
  // Dump each resource.
1615
- for (const auto& a : authority_state_map_) { // authority
1616
- const std::string& authority = a.first;
1617
- for (const auto& t : a.second.resource_map) { // type
1618
- const XdsResourceType* type = t.first;
1961
+ for (const auto& [authority, authority_state] : authority_state_map_) {
1962
+ for (const auto& [type, resource_map] : authority_state.type_map) {
1619
1963
  auto it =
1620
1964
  string_pool
1621
1965
  ->emplace(absl::StrCat("type.googleapis.com/", type->type_url()))
1622
1966
  .first;
1623
1967
  upb_StringView type_url = StdStringToUpbString(*it);
1624
- for (const auto& r : t.second) { // resource id
1968
+ for (const auto& [resource_key, resource_state] : resource_map) {
1969
+ if (!resource_state.HasWatchers()) continue;
1625
1970
  auto it2 = string_pool
1626
1971
  ->emplace(ConstructFullXdsResourceName(
1627
- authority, type->type_url(), r.first))
1972
+ authority, type->type_url(), resource_key))
1628
1973
  .first;
1629
1974
  upb_StringView resource_name = StdStringToUpbString(*it2);
1630
1975
  envoy_service_status_v3_ClientConfig_GenericXdsConfig* entry =
1631
1976
  envoy_service_status_v3_ClientConfig_add_generic_xds_configs(
1632
1977
  client_config, arena);
1633
- FillGenericXdsConfig(r.second.meta, type_url, resource_name, arena,
1634
- entry);
1978
+ resource_state.FillGenericXdsConfig(type_url, resource_name, arena,
1979
+ entry);
1635
1980
  }
1636
1981
  }
1637
1982
  }
1638
1983
  }
1639
1984
 
1640
- namespace {
1641
-
1642
- absl::string_view CacheStateForEntry(const XdsApi::ResourceMetadata& metadata,
1643
- bool resource_cached) {
1644
- switch (metadata.client_status) {
1645
- case XdsApi::ResourceMetadata::REQUESTED:
1646
- return "requested";
1647
- case XdsApi::ResourceMetadata::DOES_NOT_EXIST:
1648
- return "does_not_exist";
1649
- case XdsApi::ResourceMetadata::ACKED:
1650
- return "acked";
1651
- case XdsApi::ResourceMetadata::NACKED:
1652
- return resource_cached ? "nacked_but_cached" : "nacked";
1653
- }
1654
- Crash("unknown resource state");
1655
- }
1656
-
1657
- } // namespace
1658
-
1659
1985
  void XdsClient::ReportResourceCounts(
1660
1986
  absl::FunctionRef<void(const ResourceCountLabels&, uint64_t)> func) {
1661
1987
  ResourceCountLabels labels;
1662
- for (const auto& a : authority_state_map_) { // authority
1663
- labels.xds_authority = a.first;
1664
- for (const auto& t : a.second.resource_map) { // type
1665
- labels.resource_type = t.first->type_url();
1988
+ for (const auto& [authority, authority_state] : authority_state_map_) {
1989
+ labels.xds_authority = authority;
1990
+ for (const auto& [type, resource_map] : authority_state.type_map) {
1991
+ labels.resource_type = type->type_url();
1666
1992
  // Count the number of entries in each state.
1667
1993
  std::map<absl::string_view, uint64_t> counts;
1668
- for (const auto& r : t.second) { // resource id
1669
- absl::string_view cache_state =
1670
- CacheStateForEntry(r.second.meta, r.second.resource != nullptr);
1671
- ++counts[cache_state];
1994
+ for (const auto& [_, resource_state] : resource_map) {
1995
+ if (resource_state.HasWatchers()) {
1996
+ ++counts[resource_state.CacheStateString()];
1997
+ }
1672
1998
  }
1673
1999
  // Report the count for each state.
1674
- for (const auto& c : counts) {
1675
- labels.cache_state = c.first;
1676
- func(labels, c.second);
2000
+ for (const auto& [state, count] : counts) {
2001
+ labels.cache_state = state;
2002
+ func(labels, count);
1677
2003
  }
1678
2004
  }
1679
2005
  }
@@ -1681,8 +2007,8 @@ void XdsClient::ReportResourceCounts(
1681
2007
 
1682
2008
  void XdsClient::ReportServerConnections(
1683
2009
  absl::FunctionRef<void(absl::string_view, bool)> func) {
1684
- for (const auto& p : xds_channel_map_) {
1685
- func(p.second->server_uri(), p.second->status().ok());
2010
+ for (const auto& [_, xds_channel] : xds_channel_map_) {
2011
+ func(xds_channel->server_uri(), xds_channel->status().ok());
1686
2012
  }
1687
2013
  }
1688
2014