grpc 1.56.2 → 1.57.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (383) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +29 -22
  3. data/include/grpc/event_engine/event_engine.h +22 -32
  4. data/include/grpc/impl/grpc_types.h +3 -0
  5. data/include/grpc/support/port_platform.h +29 -23
  6. data/src/core/ext/filters/client_channel/client_channel.cc +44 -8
  7. data/src/core/ext/filters/client_channel/dynamic_filters.h +3 -3
  8. data/src/core/ext/filters/client_channel/http_proxy.cc +5 -0
  9. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +21 -52
  10. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +19 -7
  11. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +25 -35
  12. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +78 -132
  13. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +2 -1
  14. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +4 -3
  15. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +3 -1
  16. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +38 -15
  17. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.h +3 -5
  18. data/src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h +22 -6
  19. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric_internal.h +2 -0
  20. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +97 -71
  21. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +2 -16
  22. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +56 -11
  23. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.h +25 -0
  24. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +6 -32
  25. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +4 -6
  26. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +20 -79
  27. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +1 -1
  28. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +31 -19
  29. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +1 -1
  30. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +7 -41
  31. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +3 -67
  32. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +8 -0
  33. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +31 -74
  34. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +7 -51
  35. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +16 -87
  36. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +16 -50
  37. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +12 -74
  38. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -4
  39. data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +69 -59
  40. data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +7 -2
  41. data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +1 -0
  42. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +25 -13
  43. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +366 -311
  44. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +17 -1
  45. data/src/core/ext/filters/client_channel/retry_filter.cc +39 -2498
  46. data/src/core/ext/filters/client_channel/retry_filter.h +91 -1
  47. data/src/core/ext/filters/client_channel/retry_filter_legacy_call_data.cc +2052 -0
  48. data/src/core/ext/filters/client_channel/retry_filter_legacy_call_data.h +442 -0
  49. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +38 -58
  50. data/src/core/ext/filters/client_channel/subchannel.h +3 -3
  51. data/src/core/ext/filters/client_channel/subchannel_interface_internal.h +3 -0
  52. data/src/core/ext/filters/rbac/rbac_filter.cc +40 -111
  53. data/src/core/ext/filters/rbac/rbac_filter.h +12 -30
  54. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +162 -86
  55. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +0 -6
  56. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +7 -4
  57. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +131 -186
  58. data/src/core/ext/transport/chttp2/transport/decode_huff.cc +6569 -174
  59. data/src/core/ext/transport/chttp2/transport/decode_huff.h +2278 -441
  60. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -3
  61. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +4 -3
  62. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +9 -8
  63. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +4 -4
  64. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +3 -2
  65. data/src/core/ext/transport/chttp2/transport/internal.h +8 -4
  66. data/src/core/ext/transport/chttp2/transport/parsing.cc +15 -3
  67. data/src/core/ext/transport/chttp2/transport/writing.cc +2 -3
  68. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +27 -6
  69. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +143 -0
  70. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +2 -9
  71. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +0 -39
  72. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +13 -8
  73. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +35 -6
  74. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +17 -13
  75. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +85 -20
  76. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +26 -7
  77. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +45 -3
  78. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.c +4 -3
  79. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.h +21 -0
  80. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +30 -6
  81. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +180 -0
  82. data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.c +558 -0
  83. data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.h +2710 -0
  84. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +30 -11
  85. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +53 -24
  86. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +30 -5
  87. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +110 -0
  88. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +41 -15
  89. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +150 -27
  90. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.c +1 -0
  91. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.c +47 -0
  92. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.h +93 -0
  93. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +88 -76
  94. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.h +5 -0
  95. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +11 -12
  96. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.h +0 -5
  97. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.c +162 -160
  98. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +129 -118
  99. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +141 -135
  100. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/metrics_service.upbdefs.c +19 -12
  101. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +38 -30
  102. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +5 -0
  103. data/src/core/ext/upbdefs-generated/envoy/data/accesslog/v3/accesslog.upbdefs.c +402 -0
  104. data/src/core/ext/upbdefs-generated/envoy/data/accesslog/v3/accesslog.upbdefs.h +111 -0
  105. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +80 -74
  106. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +63 -47
  107. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.h +5 -0
  108. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +315 -293
  109. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
  110. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +29 -29
  111. data/src/core/ext/xds/xds_bootstrap_grpc.cc +33 -30
  112. data/src/core/ext/xds/xds_bootstrap_grpc.h +5 -13
  113. data/src/core/ext/xds/xds_client_grpc.cc +11 -6
  114. data/src/core/ext/xds/xds_client_grpc.h +16 -2
  115. data/src/core/ext/xds/xds_client_stats.h +10 -0
  116. data/src/core/ext/xds/xds_cluster.cc +26 -16
  117. data/src/core/ext/xds/xds_endpoint.cc +4 -7
  118. data/src/core/ext/xds/xds_health_status.cc +0 -17
  119. data/src/core/ext/xds/xds_health_status.h +5 -25
  120. data/src/core/ext/xds/xds_lb_policy_registry.cc +39 -0
  121. data/src/core/ext/xds/xds_route_config.cc +4 -0
  122. data/src/core/ext/xds/xds_transport_grpc.cc +1 -3
  123. data/src/core/lib/address_utils/parse_address.cc +63 -1
  124. data/src/core/lib/address_utils/parse_address.h +8 -0
  125. data/src/core/lib/address_utils/sockaddr_utils.cc +46 -1
  126. data/src/core/lib/address_utils/sockaddr_utils.h +2 -2
  127. data/src/core/lib/channel/channel_args.cc +21 -10
  128. data/src/core/lib/channel/channel_args.h +3 -0
  129. data/src/core/lib/channel/connected_channel.cc +4 -1
  130. data/src/core/lib/channel/promise_based_filter.h +1 -0
  131. data/src/core/lib/debug/trace.cc +1 -4
  132. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +2 -1
  133. data/src/core/lib/event_engine/cf_engine/cf_engine.h +1 -1
  134. data/src/core/lib/event_engine/event_engine.cc +0 -12
  135. data/src/core/lib/event_engine/forkable.cc +47 -42
  136. data/src/core/lib/event_engine/handle_containers.h +0 -4
  137. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +4 -6
  138. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -6
  139. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +25 -11
  140. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +3 -1
  141. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +2 -1
  142. data/src/core/lib/event_engine/posix_engine/posix_engine.h +8 -12
  143. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +37 -27
  144. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +2 -0
  145. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +4 -2
  146. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +42 -2
  147. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +6 -0
  148. data/src/core/lib/event_engine/posix_engine/timer.h +10 -37
  149. data/src/core/lib/event_engine/tcp_socket_utils.cc +67 -7
  150. data/src/core/lib/event_engine/tcp_socket_utils.h +3 -0
  151. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +90 -37
  152. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +32 -12
  153. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc +12 -21
  154. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.h +8 -12
  155. data/src/core/lib/event_engine/windows/windows_endpoint.cc +55 -54
  156. data/src/core/lib/event_engine/windows/windows_endpoint.h +15 -12
  157. data/src/core/lib/event_engine/windows/windows_engine.cc +2 -1
  158. data/src/core/lib/event_engine/windows/windows_engine.h +8 -12
  159. data/src/core/lib/experiments/config.cc +60 -22
  160. data/src/core/lib/experiments/config.h +20 -8
  161. data/src/core/lib/experiments/experiments.cc +278 -0
  162. data/src/core/lib/experiments/experiments.h +59 -1
  163. data/src/core/lib/gprpp/dual_ref_counted.h +9 -9
  164. data/src/core/lib/gprpp/fork.cc +8 -9
  165. data/src/core/lib/gprpp/fork.h +6 -5
  166. data/src/core/lib/gprpp/if_list.h +4530 -0
  167. data/src/core/lib/gprpp/orphanable.h +3 -3
  168. data/src/core/lib/gprpp/ref_counted.h +6 -6
  169. data/src/core/lib/gprpp/sorted_pack.h +3 -12
  170. data/src/core/lib/gprpp/status_helper.h +16 -15
  171. data/src/core/lib/gprpp/time.h +12 -0
  172. data/src/core/lib/gprpp/type_list.h +32 -0
  173. data/src/core/lib/http/httpcli.h +6 -9
  174. data/src/core/lib/iomgr/error.cc +32 -2
  175. data/src/core/lib/iomgr/error.h +9 -10
  176. data/src/core/lib/iomgr/ev_epoll1_linux.cc +5 -7
  177. data/src/core/lib/iomgr/ev_poll_posix.cc +6 -5
  178. data/src/core/lib/iomgr/exec_ctx.h +11 -0
  179. data/src/core/lib/iomgr/pollset.h +4 -5
  180. data/src/core/lib/iomgr/port.h +10 -0
  181. data/src/core/lib/iomgr/resolve_address.cc +13 -1
  182. data/src/core/lib/iomgr/resolve_address.h +17 -3
  183. data/src/core/lib/iomgr/sockaddr_posix.h +7 -0
  184. data/src/core/lib/iomgr/socket_utils_common_posix.cc +29 -0
  185. data/src/core/lib/iomgr/socket_utils_posix.cc +2 -0
  186. data/src/core/lib/iomgr/socket_utils_posix.h +6 -0
  187. data/src/core/lib/iomgr/tcp_client_posix.cc +4 -1
  188. data/src/core/lib/iomgr/tcp_posix.cc +21 -4
  189. data/src/core/lib/iomgr/tcp_server_posix.cc +3 -2
  190. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -2
  191. data/src/core/lib/iomgr/tcp_windows.cc +1 -3
  192. data/src/core/lib/iomgr/vsock.cc +59 -0
  193. data/src/core/lib/iomgr/vsock.h +38 -0
  194. data/src/core/lib/iomgr/wakeup_fd_posix.h +3 -6
  195. data/src/core/lib/load_balancing/delegating_helper.h +115 -0
  196. data/src/core/lib/load_balancing/lb_policy.h +20 -0
  197. data/src/core/lib/load_balancing/subchannel_interface.h +6 -0
  198. data/src/core/lib/promise/party.h +1 -1
  199. data/src/core/lib/resolver/resolver_factory.h +3 -2
  200. data/src/core/lib/resolver/server_address.cc +9 -94
  201. data/src/core/lib/resolver/server_address.h +10 -64
  202. data/src/core/lib/resource_quota/memory_quota.h +1 -1
  203. data/src/core/lib/security/credentials/channel_creds_registry.h +51 -27
  204. data/src/core/lib/security/credentials/channel_creds_registry_init.cc +169 -9
  205. data/src/core/lib/security/credentials/composite/composite_credentials.cc +1 -1
  206. data/src/core/lib/security/credentials/composite/composite_credentials.h +3 -1
  207. data/src/core/lib/security/credentials/external/external_account_credentials.cc +40 -1
  208. data/src/core/lib/security/credentials/external/external_account_credentials.h +6 -0
  209. data/src/core/lib/security/credentials/fake/fake_credentials.cc +30 -38
  210. data/src/core/lib/security/credentials/fake/fake_credentials.h +28 -0
  211. data/src/core/lib/security/credentials/tls/tls_credentials.cc +1 -1
  212. data/src/core/lib/security/credentials/tls/tls_credentials.h +3 -1
  213. data/src/core/lib/service_config/service_config_call_data.h +5 -0
  214. data/src/core/lib/slice/slice.h +16 -0
  215. data/src/core/lib/surface/call.cc +31 -29
  216. data/src/core/lib/surface/server.h +2 -2
  217. data/src/core/lib/surface/version.cc +2 -2
  218. data/src/core/lib/transport/metadata_batch.cc +7 -7
  219. data/src/core/lib/transport/metadata_batch.h +86 -48
  220. data/src/core/lib/transport/parsed_metadata.h +34 -20
  221. data/src/core/lib/transport/simple_slice_based_metadata.h +9 -2
  222. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +4 -6
  223. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +1 -2
  224. data/src/core/tsi/ssl_transport_security.cc +28 -7
  225. data/src/ruby/bin/math_pb.rb +24 -18
  226. data/src/ruby/ext/grpc/extconf.rb +19 -18
  227. data/src/ruby/ext/grpc/rb_call.c +62 -39
  228. data/src/ruby/ext/grpc/rb_call_credentials.c +0 -1
  229. data/src/ruby/ext/grpc/rb_channel.c +126 -49
  230. data/src/ruby/ext/grpc/rb_channel.h +1 -0
  231. data/src/ruby/ext/grpc/rb_channel_args.c +16 -2
  232. data/src/ruby/ext/grpc/rb_channel_args.h +4 -0
  233. data/src/ruby/ext/grpc/rb_channel_credentials.c +0 -1
  234. data/src/ruby/ext/grpc/rb_compression_options.c +0 -1
  235. data/src/ruby/ext/grpc/rb_event_thread.c +22 -6
  236. data/src/ruby/ext/grpc/rb_event_thread.h +1 -0
  237. data/src/ruby/ext/grpc/rb_grpc.c +192 -30
  238. data/src/ruby/ext/grpc/rb_grpc.h +8 -2
  239. data/src/ruby/ext/grpc/rb_server.c +62 -45
  240. data/src/ruby/ext/grpc/rb_server_credentials.c +0 -1
  241. data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +0 -1
  242. data/src/ruby/ext/grpc/rb_xds_server_credentials.c +0 -1
  243. data/src/ruby/lib/grpc/generic/bidi_call.rb +2 -0
  244. data/src/ruby/lib/grpc/version.rb +1 -1
  245. data/src/ruby/pb/grpc/health/v1/health_pb.rb +24 -13
  246. data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +24 -3
  247. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +25 -111
  248. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +25 -2
  249. data/third_party/boringssl-with-bazel/err_data.c +552 -552
  250. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +5 -5
  251. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +34 -1
  252. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +4 -1
  253. data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +3 -3
  254. data/third_party/boringssl-with-bazel/src/crypto/bio/bio_mem.c +7 -8
  255. data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +2 -2
  256. data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +2 -2
  257. data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +8 -8
  258. data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +2 -2
  259. data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +2 -2
  260. data/third_party/boringssl-with-bazel/src/crypto/chacha/chacha.c +19 -1
  261. data/third_party/boringssl-with-bazel/src/crypto/chacha/internal.h +8 -1
  262. data/third_party/boringssl-with-bazel/src/crypto/conf/conf.c +28 -185
  263. data/third_party/boringssl-with-bazel/src/crypto/conf/conf_def.h +3 -7
  264. data/third_party/boringssl-with-bazel/src/crypto/conf/internal.h +8 -0
  265. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_apple.c +3 -0
  266. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +49 -46
  267. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_64_adx.c +18 -0
  268. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +2809 -7417
  269. data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +27 -5
  270. data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +20 -0
  271. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_asn1.c +110 -72
  272. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_derive.c +4 -3
  273. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +15 -14
  274. data/third_party/boringssl-with-bazel/src/crypto/err/err.c +13 -10
  275. data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +35 -12
  276. data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec.c +2 -4
  277. data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec_asn1.c +3 -7
  278. data/third_party/boringssl-with-bazel/src/crypto/evp/pbkdf.c +3 -3
  279. data/third_party/boringssl-with-bazel/src/crypto/evp/print.c +7 -6
  280. data/third_party/boringssl-with-bazel/src/crypto/ex_data.c +34 -72
  281. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +1 -1
  282. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +12 -5
  283. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd.c +5 -6
  284. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +12 -6
  285. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.c +17 -18
  286. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery_inv.c +51 -15
  287. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/rsaz_exp.c +7 -7
  288. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/delocate.h +5 -6
  289. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/internal.h +2 -0
  290. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/builtin_curves.h +277 -0
  291. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +180 -404
  292. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +3 -3
  293. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +24 -57
  294. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/felem.c +17 -13
  295. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +33 -71
  296. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +18 -17
  297. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +5 -7
  298. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.c +15 -18
  299. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +9 -11
  300. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +24 -24
  301. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +11 -27
  302. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +8 -8
  303. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +4 -4
  304. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +9 -3
  305. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hkdf/hkdf.c +1 -1
  306. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +40 -26
  307. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +21 -7
  308. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +38 -19
  309. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +2 -29
  310. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +55 -0
  311. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +33 -52
  312. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +3 -8
  313. data/third_party/boringssl-with-bazel/src/crypto/internal.h +198 -79
  314. data/third_party/boringssl-with-bazel/src/crypto/kyber/kyber.c +5 -4
  315. data/third_party/boringssl-with-bazel/src/crypto/mem.c +7 -8
  316. data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +19 -23
  317. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +3 -3
  318. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/p5_pbev2.c +3 -3
  319. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8.c +7 -7
  320. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +8 -5
  321. data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +1 -0
  322. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +7 -6
  323. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/forkunsafe.c +6 -12
  324. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/getentropy.c +48 -0
  325. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{fuchsia.c → ios.c} +8 -8
  326. data/third_party/boringssl-with-bazel/src/crypto/{refcount_no_threads.c → rand_extra/trusty.c} +15 -19
  327. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +41 -19
  328. data/third_party/boringssl-with-bazel/src/crypto/{refcount_c11.c → refcount.c} +11 -17
  329. data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +147 -72
  330. data/third_party/boringssl-with-bazel/src/crypto/thread_none.c +0 -8
  331. data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +6 -35
  332. data/third_party/boringssl-with-bazel/src/crypto/thread_win.c +5 -26
  333. data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +14 -18
  334. data/third_party/boringssl-with-bazel/src/crypto/trust_token/voprf.c +54 -143
  335. data/third_party/boringssl-with-bazel/src/crypto/x509/by_dir.c +7 -13
  336. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +1 -1
  337. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +1 -1
  338. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_lu.c +2 -4
  339. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +2 -2
  340. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +1 -1
  341. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +8 -12
  342. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +19 -20
  343. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +11 -15
  344. data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +5 -5
  345. data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +1 -1
  346. data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +7 -7
  347. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +2 -3
  348. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +4 -6
  349. data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +4 -119
  350. data/third_party/boringssl-with-bazel/src/include/openssl/asm_base.h +207 -0
  351. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +5 -0
  352. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +2 -116
  353. data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +0 -2
  354. data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +6 -0
  355. data/third_party/boringssl-with-bazel/src/include/openssl/conf.h +5 -1
  356. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +0 -21
  357. data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +21 -2
  358. data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +19 -6
  359. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +11 -7
  360. data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +13 -14
  361. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +0 -61
  362. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +127 -81
  363. data/third_party/boringssl-with-bazel/src/include/openssl/stack.h +224 -209
  364. data/third_party/boringssl-with-bazel/src/include/openssl/target.h +154 -0
  365. data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +1 -29
  366. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +4 -4
  367. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +3 -2
  368. data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +9 -65
  369. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +20 -20
  370. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +1 -1
  371. data/third_party/boringssl-with-bazel/src/ssl/internal.h +4 -11
  372. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +24 -18
  373. data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +37 -30
  374. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +125 -26
  375. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +2 -3
  376. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_adx.h +691 -0
  377. data/third_party/upb/upb/collections/map.c +3 -3
  378. metadata +27 -12
  379. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc +0 -42
  380. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h +0 -64
  381. data/src/core/ext/transport/chttp2/transport/stream_map.cc +0 -177
  382. data/src/core/ext/transport/chttp2/transport/stream_map.h +0 -68
  383. data/third_party/boringssl-with-bazel/src/crypto/refcount_win.c +0 -89
@@ -20,12 +20,14 @@
20
20
  #include <grpc/support/port_platform.h>
21
21
 
22
22
  #include <map>
23
- #include <memory>
24
23
  #include <string>
24
+ #include <utility>
25
25
  #include <vector>
26
26
 
27
27
  #include "absl/status/statusor.h"
28
+ #include "absl/strings/string_view.h"
28
29
 
30
+ #include "src/core/lib/gprpp/ref_counted.h"
29
31
  #include "src/core/lib/resolver/server_address.h"
30
32
 
31
33
  // The resolver returns a flat list of addresses. When a hierarchy of
@@ -82,13 +84,23 @@
82
84
 
83
85
  namespace grpc_core {
84
86
 
85
- // The attribute key to be used for hierarchical paths in ServerAddress.
86
- extern const char* kHierarchicalPathAttributeKey;
87
-
88
- // Constructs an address attribute containing the hierarchical path
87
+ // An address channel arg containing the hierarchical path
89
88
  // to be associated with the address.
90
- std::unique_ptr<ServerAddress::AttributeInterface>
91
- MakeHierarchicalPathAttribute(std::vector<std::string> path);
89
+ class HierarchicalPathArg : public RefCounted<HierarchicalPathArg> {
90
+ public:
91
+ explicit HierarchicalPathArg(std::vector<std::string> path)
92
+ : path_(std::move(path)) {}
93
+
94
+ // Channel arg traits methods.
95
+ static absl::string_view ChannelArgName();
96
+ static int ChannelArgsCompare(const HierarchicalPathArg* a,
97
+ const HierarchicalPathArg* b);
98
+
99
+ const std::vector<std::string>& path() const { return path_; }
100
+
101
+ private:
102
+ std::vector<std::string> path_;
103
+ };
92
104
 
93
105
  // A map from the next path element to the addresses that fall under
94
106
  // that path element.
@@ -25,7 +25,6 @@
25
25
  #include "absl/strings/str_cat.h"
26
26
  #include "absl/strings/string_view.h"
27
27
 
28
- #include <grpc/event_engine/event_engine.h>
29
28
  #include <grpc/impl/connectivity_state.h>
30
29
  #include <grpc/support/log.h>
31
30
 
@@ -33,6 +32,7 @@
33
32
  #include "src/core/lib/config/core_configuration.h"
34
33
  #include "src/core/lib/gprpp/debug_location.h"
35
34
  #include "src/core/lib/iomgr/pollset_set.h"
35
+ #include "src/core/lib/load_balancing/delegating_helper.h"
36
36
  #include "src/core/lib/load_balancing/lb_policy_registry.h"
37
37
  #include "src/core/lib/load_balancing/subchannel_interface.h"
38
38
  #include "src/core/lib/resolver/server_address.h"
@@ -45,78 +45,69 @@ namespace grpc_core {
45
45
  //
46
46
 
47
47
  class ChildPolicyHandler::Helper
48
- : public LoadBalancingPolicy::ChannelControlHelper {
48
+ : public LoadBalancingPolicy::ParentOwningDelegatingChannelControlHelper<
49
+ ChildPolicyHandler> {
49
50
  public:
50
51
  explicit Helper(RefCountedPtr<ChildPolicyHandler> parent)
51
- : parent_(std::move(parent)) {}
52
-
53
- ~Helper() override { parent_.reset(DEBUG_LOCATION, "Helper"); }
52
+ : ParentOwningDelegatingChannelControlHelper(std::move(parent)) {}
54
53
 
55
54
  RefCountedPtr<SubchannelInterface> CreateSubchannel(
56
55
  ServerAddress address, const ChannelArgs& args) override {
57
- if (parent_->shutting_down_) return nullptr;
56
+ if (parent()->shutting_down_) return nullptr;
58
57
  if (!CalledByCurrentChild() && !CalledByPendingChild()) return nullptr;
59
- return parent_->channel_control_helper()->CreateSubchannel(
58
+ return parent()->channel_control_helper()->CreateSubchannel(
60
59
  std::move(address), args);
61
60
  }
62
61
 
63
62
  void UpdateState(grpc_connectivity_state state, const absl::Status& status,
64
63
  RefCountedPtr<SubchannelPicker> picker) override {
65
- if (parent_->shutting_down_) return;
64
+ if (parent()->shutting_down_) return;
66
65
  // If this request is from the pending child policy, ignore it until
67
66
  // it reports something other than CONNECTING, at which point we swap it
68
67
  // into place.
69
68
  if (CalledByPendingChild()) {
70
- if (GRPC_TRACE_FLAG_ENABLED(*(parent_->tracer_))) {
69
+ if (GRPC_TRACE_FLAG_ENABLED(*(parent()->tracer_))) {
71
70
  gpr_log(GPR_INFO,
72
71
  "[child_policy_handler %p] helper %p: pending child policy %p "
73
72
  "reports state=%s (%s)",
74
- parent_.get(), this, child_, ConnectivityStateName(state),
73
+ parent(), this, child_, ConnectivityStateName(state),
75
74
  status.ToString().c_str());
76
75
  }
77
76
  if (state == GRPC_CHANNEL_CONNECTING) return;
78
77
  grpc_pollset_set_del_pollset_set(
79
- parent_->child_policy_->interested_parties(),
80
- parent_->interested_parties());
81
- parent_->child_policy_ = std::move(parent_->pending_child_policy_);
78
+ parent()->child_policy_->interested_parties(),
79
+ parent()->interested_parties());
80
+ parent()->child_policy_ = std::move(parent()->pending_child_policy_);
82
81
  } else if (!CalledByCurrentChild()) {
83
82
  // This request is from an outdated child, so ignore it.
84
83
  return;
85
84
  }
86
- parent_->channel_control_helper()->UpdateState(state, status,
87
- std::move(picker));
85
+ parent()->channel_control_helper()->UpdateState(state, status,
86
+ std::move(picker));
88
87
  }
89
88
 
90
89
  void RequestReresolution() override {
91
- if (parent_->shutting_down_) return;
90
+ if (parent()->shutting_down_) return;
92
91
  // Only forward re-resolution requests from the most recent child,
93
92
  // since that's the one that will be receiving any update we receive
94
93
  // from the resolver.
95
94
  const LoadBalancingPolicy* latest_child_policy =
96
- parent_->pending_child_policy_ != nullptr
97
- ? parent_->pending_child_policy_.get()
98
- : parent_->child_policy_.get();
95
+ parent()->pending_child_policy_ != nullptr
96
+ ? parent()->pending_child_policy_.get()
97
+ : parent()->child_policy_.get();
99
98
  if (child_ != latest_child_policy) return;
100
- if (GRPC_TRACE_FLAG_ENABLED(*(parent_->tracer_))) {
99
+ if (GRPC_TRACE_FLAG_ENABLED(*(parent()->tracer_))) {
101
100
  gpr_log(GPR_INFO, "[child_policy_handler %p] started name re-resolving",
102
- parent_.get());
101
+ parent());
103
102
  }
104
- parent_->channel_control_helper()->RequestReresolution();
105
- }
106
-
107
- absl::string_view GetAuthority() override {
108
- return parent_->channel_control_helper()->GetAuthority();
109
- }
110
-
111
- grpc_event_engine::experimental::EventEngine* GetEventEngine() override {
112
- return parent_->channel_control_helper()->GetEventEngine();
103
+ parent()->channel_control_helper()->RequestReresolution();
113
104
  }
114
105
 
115
106
  void AddTraceEvent(TraceSeverity severity,
116
107
  absl::string_view message) override {
117
- if (parent_->shutting_down_) return;
108
+ if (parent()->shutting_down_) return;
118
109
  if (!CalledByPendingChild() && !CalledByCurrentChild()) return;
119
- parent_->channel_control_helper()->AddTraceEvent(severity, message);
110
+ parent()->channel_control_helper()->AddTraceEvent(severity, message);
120
111
  }
121
112
 
122
113
  void set_child(LoadBalancingPolicy* child) { child_ = child; }
@@ -124,15 +115,14 @@ class ChildPolicyHandler::Helper
124
115
  private:
125
116
  bool CalledByPendingChild() const {
126
117
  GPR_ASSERT(child_ != nullptr);
127
- return child_ == parent_->pending_child_policy_.get();
118
+ return child_ == parent()->pending_child_policy_.get();
128
119
  }
129
120
 
130
121
  bool CalledByCurrentChild() const {
131
122
  GPR_ASSERT(child_ != nullptr);
132
- return child_ == parent_->child_policy_.get();
123
+ return child_ == parent()->child_policy_.get();
133
124
  };
134
125
 
135
- RefCountedPtr<ChildPolicyHandler> parent_;
136
126
  LoadBalancingPolicy* child_ = nullptr;
137
127
  };
138
128
 
@@ -78,7 +78,6 @@
78
78
  #include "absl/strings/str_format.h"
79
79
  #include "absl/strings/str_join.h"
80
80
  #include "absl/strings/string_view.h"
81
- #include "absl/strings/strip.h"
82
81
  #include "absl/types/optional.h"
83
82
  #include "absl/types/variant.h"
84
83
  #include "upb/upb.hpp"
@@ -128,6 +127,7 @@
128
127
  #include "src/core/lib/json/json.h"
129
128
  #include "src/core/lib/json/json_args.h"
130
129
  #include "src/core/lib/json/json_object_loader.h"
130
+ #include "src/core/lib/load_balancing/delegating_helper.h"
131
131
  #include "src/core/lib/load_balancing/lb_policy.h"
132
132
  #include "src/core/lib/load_balancing/lb_policy_factory.h"
133
133
  #include "src/core/lib/load_balancing/lb_policy_registry.h"
@@ -143,7 +143,6 @@
143
143
  #include "src/core/lib/surface/channel_stack_type.h"
144
144
  #include "src/core/lib/transport/connectivity_state.h"
145
145
  #include "src/core/lib/transport/metadata_batch.h"
146
- #include "src/core/lib/uri/uri_parser.h"
147
146
 
148
147
  #define GRPC_GRPCLB_INITIAL_CONNECT_BACKOFF_SECONDS 1
149
148
  #define GRPC_GRPCLB_RECONNECT_BACKOFF_MULTIPLIER 1.6
@@ -152,12 +151,14 @@
152
151
  #define GRPC_GRPCLB_DEFAULT_FALLBACK_TIMEOUT_MS 10000
153
152
  #define GRPC_GRPCLB_DEFAULT_SUBCHANNEL_DELETION_DELAY_MS 10000
154
153
 
154
+ // Channel arg used to enable load reporting filter.
155
+ #define GRPC_ARG_GRPCLB_ENABLE_LOAD_REPORTING_FILTER \
156
+ "grpc.internal.grpclb_enable_load_reporting_filter"
157
+
155
158
  namespace grpc_core {
156
159
 
157
160
  TraceFlag grpc_lb_glb_trace(false, "glb");
158
161
 
159
- const char kGrpcLbAddressAttributeKey[] = "grpclb";
160
-
161
162
  namespace {
162
163
 
163
164
  using ::grpc_event_engine::experimental::EventEngine;
@@ -331,30 +332,22 @@ class GrpcLb : public LoadBalancingPolicy {
331
332
  RefCountedPtr<GrpcLbClientStats> client_stats_;
332
333
  };
333
334
 
334
- class TokenAndClientStatsAttribute
335
- : public ServerAddress::AttributeInterface {
335
+ class TokenAndClientStatsArg : public RefCounted<TokenAndClientStatsArg> {
336
336
  public:
337
- TokenAndClientStatsAttribute(std::string lb_token,
338
- RefCountedPtr<GrpcLbClientStats> client_stats)
337
+ TokenAndClientStatsArg(std::string lb_token,
338
+ RefCountedPtr<GrpcLbClientStats> client_stats)
339
339
  : lb_token_(std::move(lb_token)),
340
340
  client_stats_(std::move(client_stats)) {}
341
341
 
342
- std::unique_ptr<AttributeInterface> Copy() const override {
343
- return std::make_unique<TokenAndClientStatsAttribute>(lb_token_,
344
- client_stats_);
342
+ static absl::string_view ChannelArgName() {
343
+ return GRPC_ARG_NO_SUBCHANNEL_PREFIX "grpclb_token_and_client_stats";
345
344
  }
346
345
 
347
- int Cmp(const AttributeInterface* other_base) const override {
348
- const TokenAndClientStatsAttribute* other =
349
- static_cast<const TokenAndClientStatsAttribute*>(other_base);
350
- int r = lb_token_.compare(other->lb_token_);
346
+ static int ChannelArgsCompare(const TokenAndClientStatsArg* a,
347
+ const TokenAndClientStatsArg* b) {
348
+ int r = a->lb_token_.compare(b->lb_token_);
351
349
  if (r != 0) return r;
352
- return QsortCompare(client_stats_.get(), other->client_stats_.get());
353
- }
354
-
355
- std::string ToString() const override {
356
- return absl::StrFormat("lb_token=\"%s\" client_stats=%p", lb_token_,
357
- client_stats_.get());
350
+ return QsortCompare(a->client_stats_.get(), b->client_stats_.get());
358
351
  }
359
352
 
360
353
  const std::string& lb_token() const { return lb_token_; }
@@ -454,23 +447,16 @@ class GrpcLb : public LoadBalancingPolicy {
454
447
  RefCountedPtr<GrpcLbClientStats> client_stats_;
455
448
  };
456
449
 
457
- class Helper : public ChannelControlHelper {
450
+ class Helper : public ParentOwningDelegatingChannelControlHelper<GrpcLb> {
458
451
  public:
459
452
  explicit Helper(RefCountedPtr<GrpcLb> parent)
460
- : parent_(std::move(parent)) {}
453
+ : ParentOwningDelegatingChannelControlHelper(std::move(parent)) {}
461
454
 
462
455
  RefCountedPtr<SubchannelInterface> CreateSubchannel(
463
456
  ServerAddress address, const ChannelArgs& args) override;
464
457
  void UpdateState(grpc_connectivity_state state, const absl::Status& status,
465
458
  RefCountedPtr<SubchannelPicker> picker) override;
466
459
  void RequestReresolution() override;
467
- absl::string_view GetAuthority() override;
468
- grpc_event_engine::experimental::EventEngine* GetEventEngine() override;
469
- void AddTraceEvent(TraceSeverity severity,
470
- absl::string_view message) override;
471
-
472
- private:
473
- RefCountedPtr<GrpcLb> parent_;
474
460
  };
475
461
 
476
462
  class StateWatcher : public AsyncConnectivityStateWatcherInterface {
@@ -509,7 +495,7 @@ class GrpcLb : public LoadBalancingPolicy {
509
495
  void ShutdownLocked() override;
510
496
 
511
497
  // Helper functions used in UpdateLocked().
512
- absl::Status UpdateBalancerChannelLocked(const ChannelArgs& args);
498
+ absl::Status UpdateBalancerChannelLocked();
513
499
 
514
500
  void CancelBalancerChannelConnectivityWatchLocked();
515
501
 
@@ -535,8 +521,6 @@ class GrpcLb : public LoadBalancingPolicy {
535
521
  void StartSubchannelCacheTimerLocked();
536
522
  void OnSubchannelCacheTimerLocked();
537
523
 
538
- // Who the client is trying to communicate with.
539
- std::string server_name_;
540
524
  // Configurations for the policy.
541
525
  RefCountedPtr<GrpcLbConfig> config_;
542
526
 
@@ -693,14 +677,10 @@ ServerAddressList GrpcLb::Serverlist::GetServerAddressList(
693
677
  addr_uri.ok() ? addr_uri->c_str()
694
678
  : addr_uri.status().ToString().c_str());
695
679
  }
696
- // Attach attribute to address containing LB token and stats object.
697
- std::map<const char*, std::unique_ptr<ServerAddress::AttributeInterface>>
698
- attributes;
699
- attributes[kGrpcLbAddressAttributeKey] =
700
- std::make_unique<TokenAndClientStatsAttribute>(std::move(lb_token),
701
- stats);
702
- // Add address.
703
- addresses.emplace_back(addr, ChannelArgs(), std::move(attributes));
680
+ // Add address with a channel arg containing LB token and stats object.
681
+ addresses.emplace_back(
682
+ addr, ChannelArgs().SetObject(MakeRefCounted<TokenAndClientStatsArg>(
683
+ std::move(lb_token), stats)));
704
684
  }
705
685
  return addresses;
706
686
  }
@@ -786,32 +766,30 @@ GrpcLb::PickResult GrpcLb::Picker::Pick(PickArgs args) {
786
766
 
787
767
  RefCountedPtr<SubchannelInterface> GrpcLb::Helper::CreateSubchannel(
788
768
  ServerAddress address, const ChannelArgs& args) {
789
- if (parent_->shutting_down_) return nullptr;
790
- const TokenAndClientStatsAttribute* attribute =
791
- static_cast<const TokenAndClientStatsAttribute*>(
792
- address.GetAttribute(kGrpcLbAddressAttributeKey));
793
- if (attribute == nullptr) {
794
- Crash(absl::StrFormat(
795
- "[grpclb %p] no TokenAndClientStatsAttribute for address %p",
796
- parent_.get(), address.ToString().c_str()));
769
+ if (parent()->shutting_down_) return nullptr;
770
+ const auto* arg = address.args().GetObject<TokenAndClientStatsArg>();
771
+ if (arg == nullptr) {
772
+ Crash(
773
+ absl::StrFormat("[grpclb %p] no TokenAndClientStatsArg for address %p",
774
+ parent(), address.ToString().c_str()));
797
775
  }
798
- std::string lb_token = attribute->lb_token();
799
- RefCountedPtr<GrpcLbClientStats> client_stats = attribute->client_stats();
776
+ std::string lb_token = arg->lb_token();
777
+ RefCountedPtr<GrpcLbClientStats> client_stats = arg->client_stats();
800
778
  return MakeRefCounted<SubchannelWrapper>(
801
- parent_->channel_control_helper()->CreateSubchannel(std::move(address),
802
- args),
803
- parent_->Ref(DEBUG_LOCATION, "SubchannelWrapper"), std::move(lb_token),
779
+ parent()->channel_control_helper()->CreateSubchannel(std::move(address),
780
+ args),
781
+ parent()->Ref(DEBUG_LOCATION, "SubchannelWrapper"), std::move(lb_token),
804
782
  std::move(client_stats));
805
783
  }
806
784
 
807
785
  void GrpcLb::Helper::UpdateState(grpc_connectivity_state state,
808
786
  const absl::Status& status,
809
787
  RefCountedPtr<SubchannelPicker> picker) {
810
- if (parent_->shutting_down_) return;
788
+ if (parent()->shutting_down_) return;
811
789
  // Record whether child policy reports READY.
812
- parent_->child_policy_ready_ = state == GRPC_CHANNEL_READY;
790
+ parent()->child_policy_ready_ = state == GRPC_CHANNEL_READY;
813
791
  // Enter fallback mode if needed.
814
- parent_->MaybeEnterFallbackModeAfterStartup();
792
+ parent()->MaybeEnterFallbackModeAfterStartup();
815
793
  // We pass the serverlist to the picker so that it can handle drops.
816
794
  // However, we don't want to handle drops in the case where the child
817
795
  // policy is reporting a state other than READY (unless we are
@@ -822,55 +800,41 @@ void GrpcLb::Helper::UpdateState(grpc_connectivity_state state,
822
800
  // a null serverlist to the picker, which tells it not to do drops.
823
801
  RefCountedPtr<Serverlist> serverlist;
824
802
  if (state == GRPC_CHANNEL_READY ||
825
- (parent_->serverlist_ != nullptr &&
826
- parent_->serverlist_->ContainsAllDropEntries())) {
827
- serverlist = parent_->serverlist_;
803
+ (parent()->serverlist_ != nullptr &&
804
+ parent()->serverlist_->ContainsAllDropEntries())) {
805
+ serverlist = parent()->serverlist_;
828
806
  }
829
807
  RefCountedPtr<GrpcLbClientStats> client_stats;
830
- if (parent_->lb_calld_ != nullptr &&
831
- parent_->lb_calld_->client_stats() != nullptr) {
832
- client_stats = parent_->lb_calld_->client_stats()->Ref();
808
+ if (parent()->lb_calld_ != nullptr &&
809
+ parent()->lb_calld_->client_stats() != nullptr) {
810
+ client_stats = parent()->lb_calld_->client_stats()->Ref();
833
811
  }
834
812
  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_glb_trace)) {
835
813
  gpr_log(GPR_INFO,
836
814
  "[grpclb %p helper %p] state=%s (%s) wrapping child "
837
815
  "picker %p (serverlist=%p, client_stats=%p)",
838
- parent_.get(), this, ConnectivityStateName(state),
816
+ parent(), this, ConnectivityStateName(state),
839
817
  status.ToString().c_str(), picker.get(), serverlist.get(),
840
818
  client_stats.get());
841
819
  }
842
- parent_->channel_control_helper()->UpdateState(
820
+ parent()->channel_control_helper()->UpdateState(
843
821
  state, status,
844
822
  MakeRefCounted<Picker>(std::move(serverlist), std::move(picker),
845
823
  std::move(client_stats)));
846
824
  }
847
825
 
848
826
  void GrpcLb::Helper::RequestReresolution() {
849
- if (parent_->shutting_down_) return;
827
+ if (parent()->shutting_down_) return;
850
828
  // If we are talking to a balancer, we expect to get updated addresses
851
829
  // from the balancer, so we can ignore the re-resolution request from
852
830
  // the child policy. Otherwise, pass the re-resolution request up to the
853
831
  // channel.
854
- if (parent_->lb_calld_ == nullptr ||
855
- !parent_->lb_calld_->seen_initial_response()) {
856
- parent_->channel_control_helper()->RequestReresolution();
832
+ if (parent()->lb_calld_ == nullptr ||
833
+ !parent()->lb_calld_->seen_initial_response()) {
834
+ parent()->channel_control_helper()->RequestReresolution();
857
835
  }
858
836
  }
859
837
 
860
- absl::string_view GrpcLb::Helper::GetAuthority() {
861
- return parent_->channel_control_helper()->GetAuthority();
862
- }
863
-
864
- grpc_event_engine::experimental::EventEngine* GrpcLb::Helper::GetEventEngine() {
865
- return parent_->channel_control_helper()->GetEventEngine();
866
- }
867
-
868
- void GrpcLb::Helper::AddTraceEvent(TraceSeverity severity,
869
- absl::string_view message) {
870
- if (parent_->shutting_down_) return;
871
- parent_->channel_control_helper()->AddTraceEvent(severity, message);
872
- }
873
-
874
838
  //
875
839
  // GrpcLb::BalancerCallState
876
840
  //
@@ -886,8 +850,6 @@ GrpcLb::BalancerCallState::BalancerCallState(
886
850
  // Init the LB call. Note that the LB call will progress every time there's
887
851
  // activity in grpclb_policy_->interested_parties(), which is comprised of
888
852
  // the polling entities from client_channel.
889
- GPR_ASSERT(!grpclb_policy()->server_name_.empty());
890
- // Closure Initialization
891
853
  GRPC_CLOSURE_INIT(&lb_on_initial_request_sent_, OnInitialRequestSent, this,
892
854
  grpc_schedule_on_exec_ctx);
893
855
  GRPC_CLOSURE_INIT(&lb_on_balancer_message_received_,
@@ -909,8 +871,8 @@ GrpcLb::BalancerCallState::BalancerCallState(
909
871
  upb::Arena arena;
910
872
  grpc_slice request_payload_slice = GrpcLbRequestCreate(
911
873
  grpclb_policy()->config_->service_name().empty()
912
- ? grpclb_policy()->server_name_.c_str()
913
- : grpclb_policy()->config_->service_name().c_str(),
874
+ ? grpclb_policy()->channel_control_helper()->GetAuthority()
875
+ : grpclb_policy()->config_->service_name(),
914
876
  arena.ptr());
915
877
  send_message_payload_ =
916
878
  grpc_raw_byte_buffer_create(&request_payload_slice, 1);
@@ -1404,10 +1366,6 @@ ChannelArgs BuildBalancerChannelArgs(
1404
1366
  // Strip out the service config, since we don't want the LB policy
1405
1367
  // config specified for the parent channel to affect the LB channel.
1406
1368
  .Remove(GRPC_ARG_SERVICE_CONFIG)
1407
- // The channel arg for the server URI, since that will be different
1408
- // for the LB channel than for the parent channel. The client
1409
- // channel factory will re-add this arg with the right value.
1410
- .Remove(GRPC_ARG_SERVER_URI)
1411
1369
  // The fake resolver response generator, because we are replacing it
1412
1370
  // with the one from the grpclb policy, used to propagate updates to
1413
1371
  // the LB channel.
@@ -1429,21 +1387,11 @@ ChannelArgs BuildBalancerChannelArgs(
1429
1387
  // credentials.
1430
1388
  .Remove(GRPC_ARG_CHANNEL_CREDENTIALS);
1431
1389
  }
1432
- // Create channel args for channel credentials that does not contain bearer
1433
- // token credentials.
1434
- auto* channel_credentials = args.GetObject<grpc_channel_credentials>();
1435
- GPR_ASSERT(channel_credentials != nullptr);
1436
- RefCountedPtr<grpc_channel_credentials> creds_sans_call_creds =
1437
- channel_credentials->duplicate_without_call_credentials();
1438
- GPR_ASSERT(creds_sans_call_creds != nullptr);
1439
1390
  return grpclb_channel_args
1440
1391
  // A channel arg indicating the target is a grpclb load balancer.
1441
1392
  .Set(GRPC_ARG_ADDRESS_IS_GRPCLB_LOAD_BALANCER, 1)
1442
1393
  // Tells channelz that this is an internal channel.
1443
1394
  .Set(GRPC_ARG_CHANNELZ_IS_INTERNAL_CHANNEL, 1)
1444
- // A channel args for new channel credentials that does not contain bearer
1445
- // tokens.
1446
- .SetObject(creds_sans_call_creds)
1447
1395
  // The fake resolver response generator, which we use to inject
1448
1396
  // address updates into the LB channel.
1449
1397
  .SetObject(response_generator->Ref());
@@ -1453,16 +1401,8 @@ ChannelArgs BuildBalancerChannelArgs(
1453
1401
  // ctor and dtor
1454
1402
  //
1455
1403
 
1456
- std::string GetServerNameFromChannelArgs(const ChannelArgs& args) {
1457
- absl::StatusOr<URI> uri =
1458
- URI::Parse(args.GetString(GRPC_ARG_SERVER_URI).value());
1459
- GPR_ASSERT(uri.ok() && !uri->path().empty());
1460
- return std::string(absl::StripPrefix(uri->path(), "/"));
1461
- }
1462
-
1463
1404
  GrpcLb::GrpcLb(Args args)
1464
1405
  : LoadBalancingPolicy(std::move(args)),
1465
- server_name_(GetServerNameFromChannelArgs(channel_args())),
1466
1406
  response_generator_(MakeRefCounted<FakeResolverResponseGenerator>()),
1467
1407
  lb_call_timeout_(std::max(
1468
1408
  Duration::Zero(),
@@ -1493,7 +1433,8 @@ GrpcLb::GrpcLb(Args args)
1493
1433
  if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_glb_trace)) {
1494
1434
  gpr_log(GPR_INFO,
1495
1435
  "[grpclb %p] Will use '%s' as the server name for LB request.",
1496
- this, server_name_.c_str());
1436
+ this,
1437
+ std::string(channel_control_helper()->GetAuthority()).c_str());
1497
1438
  }
1498
1439
  }
1499
1440
 
@@ -1554,19 +1495,21 @@ absl::Status GrpcLb::UpdateLocked(UpdateArgs args) {
1554
1495
  const bool is_initial_update = lb_channel_ == nullptr;
1555
1496
  config_ = args.config;
1556
1497
  GPR_ASSERT(config_ != nullptr);
1498
+ args_ = std::move(args.args);
1557
1499
  // Update fallback address list.
1558
1500
  fallback_backend_addresses_ = std::move(args.addresses);
1559
1501
  if (fallback_backend_addresses_.ok()) {
1560
1502
  // Add null LB token attributes.
1561
1503
  for (ServerAddress& address : *fallback_backend_addresses_) {
1562
- address = address.WithAttribute(
1563
- kGrpcLbAddressAttributeKey,
1564
- std::make_unique<TokenAndClientStatsAttribute>("", nullptr));
1504
+ address = ServerAddress(
1505
+ address.address(),
1506
+ address.args().SetObject(
1507
+ MakeRefCounted<TokenAndClientStatsArg>("", nullptr)));
1565
1508
  }
1566
1509
  }
1567
1510
  resolution_note_ = std::move(args.resolution_note);
1568
1511
  // Update balancer channel.
1569
- absl::Status status = UpdateBalancerChannelLocked(args.args);
1512
+ absl::Status status = UpdateBalancerChannelLocked();
1570
1513
  // Update the existing child policy, if any.
1571
1514
  if (child_policy_ != nullptr) CreateOrUpdateChildPolicyLocked();
1572
1515
  // If this is the initial update, start the fallback-at-startup checks
@@ -1607,33 +1550,31 @@ absl::Status GrpcLb::UpdateLocked(UpdateArgs args) {
1607
1550
  // helpers for UpdateLocked()
1608
1551
  //
1609
1552
 
1610
- absl::Status GrpcLb::UpdateBalancerChannelLocked(const ChannelArgs& args) {
1611
- // Make sure that GRPC_ARG_LB_POLICY_NAME is set in channel args,
1612
- // since we use this to trigger the client_load_reporting filter.
1613
- args_ = args.Set(GRPC_ARG_LB_POLICY_NAME, "grpclb");
1553
+ absl::Status GrpcLb::UpdateBalancerChannelLocked() {
1614
1554
  // Get balancer addresses.
1615
- ServerAddressList balancer_addresses = ExtractBalancerAddresses(args);
1555
+ ServerAddressList balancer_addresses = ExtractBalancerAddresses(args_);
1616
1556
  absl::Status status;
1617
1557
  if (balancer_addresses.empty()) {
1618
1558
  status = absl::UnavailableError("balancer address list must be non-empty");
1619
1559
  }
1560
+ // Create channel credentials that do not contain call credentials.
1561
+ auto channel_credentials = channel_control_helper()->GetChannelCredentials();
1620
1562
  // Construct args for balancer channel.
1621
1563
  ChannelArgs lb_channel_args =
1622
- BuildBalancerChannelArgs(response_generator_.get(), args);
1564
+ BuildBalancerChannelArgs(response_generator_.get(), args_);
1623
1565
  // Create balancer channel if needed.
1624
1566
  if (lb_channel_ == nullptr) {
1625
- std::string uri_str = absl::StrCat("fake:///", server_name_);
1626
- auto* creds = lb_channel_args.GetObject<grpc_channel_credentials>();
1627
- GPR_ASSERT(creds != nullptr);
1628
- lb_channel_ = grpc_channel_create(
1629
- uri_str.c_str(), creds,
1630
- lb_channel_args.Remove(GRPC_ARG_CHANNEL_CREDENTIALS).ToC().get());
1567
+ std::string uri_str =
1568
+ absl::StrCat("fake:///", channel_control_helper()->GetAuthority());
1569
+ lb_channel_ =
1570
+ grpc_channel_create(uri_str.c_str(), channel_credentials.get(),
1571
+ lb_channel_args.ToC().get());
1631
1572
  GPR_ASSERT(lb_channel_ != nullptr);
1632
1573
  // Set up channelz linkage.
1633
1574
  channelz::ChannelNode* child_channelz_node =
1634
1575
  grpc_channel_get_channelz_node(lb_channel_);
1635
1576
  channelz::ChannelNode* parent_channelz_node =
1636
- args.GetObject<channelz::ChannelNode>();
1577
+ args_.GetObject<channelz::ChannelNode>();
1637
1578
  if (child_channelz_node != nullptr && parent_channelz_node != nullptr) {
1638
1579
  parent_channelz_node->AddChildChannel(child_channelz_node->uuid());
1639
1580
  parent_channelz_node_ = parent_channelz_node->Ref();
@@ -1643,7 +1584,9 @@ absl::Status GrpcLb::UpdateBalancerChannelLocked(const ChannelArgs& args) {
1643
1584
  // resolver.
1644
1585
  Resolver::Result result;
1645
1586
  result.addresses = std::move(balancer_addresses);
1646
- result.args = lb_channel_args;
1587
+ // Pass channel creds via channel args, since the fake resolver won't
1588
+ // do this automatically.
1589
+ result.args = lb_channel_args.SetObject(std::move(channel_credentials));
1647
1590
  response_generator_->SetResponse(std::move(result));
1648
1591
  // Return status.
1649
1592
  return status;
@@ -1756,8 +1699,10 @@ void GrpcLb::OnFallbackTimerLocked() {
1756
1699
  ChannelArgs GrpcLb::CreateChildPolicyArgsLocked(
1757
1700
  bool is_backend_from_grpclb_load_balancer) {
1758
1701
  ChannelArgs r =
1759
- args_.Set(GRPC_ARG_ADDRESS_IS_BACKEND_FROM_GRPCLB_LOAD_BALANCER,
1760
- is_backend_from_grpclb_load_balancer);
1702
+ args_
1703
+ .Set(GRPC_ARG_ADDRESS_IS_BACKEND_FROM_GRPCLB_LOAD_BALANCER,
1704
+ is_backend_from_grpclb_load_balancer)
1705
+ .Set(GRPC_ARG_GRPCLB_ENABLE_LOAD_REPORTING_FILTER, 1);
1761
1706
  if (is_backend_from_grpclb_load_balancer) {
1762
1707
  r = r.Set(GRPC_ARG_INHIBIT_HEALTH_CHECKING, 1);
1763
1708
  }
@@ -1909,8 +1854,9 @@ void RegisterGrpcLbPolicy(CoreConfiguration::Builder* builder) {
1909
1854
  builder->channel_init()->RegisterStage(
1910
1855
  GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
1911
1856
  [](ChannelStackBuilder* builder) {
1912
- if (builder->channel_args().GetString(GRPC_ARG_LB_POLICY_NAME) ==
1913
- "grpclb") {
1857
+ auto enable = builder->channel_args().GetBool(
1858
+ GRPC_ARG_GRPCLB_ENABLE_LOAD_REPORTING_FILTER);
1859
+ if (enable.has_value() && *enable) {
1914
1860
  builder->PrependFilter(&ClientLoadReportingFilter::kFilter);
1915
1861
  }
1916
1862
  return true;
@@ -26,7 +26,8 @@
26
26
  #include "src/core/lib/gpr/useful.h"
27
27
 
28
28
  // Channel arg key for the list of balancer addresses.
29
- #define GRPC_ARG_GRPCLB_BALANCER_ADDRESSES "grpc.grpclb_balancer_addresses"
29
+ #define GRPC_ARG_GRPCLB_BALANCER_ADDRESSES \
30
+ GRPC_ARG_NO_SUBCHANNEL_PREFIX "grpc.grpclb_balancer_addresses"
30
31
 
31
32
  namespace grpc_core {
32
33
 
@@ -59,15 +59,16 @@ grpc_slice grpc_grpclb_request_encode(
59
59
 
60
60
  } // namespace
61
61
 
62
- grpc_slice GrpcLbRequestCreate(const char* lb_service_name, upb_Arena* arena) {
62
+ grpc_slice GrpcLbRequestCreate(absl::string_view lb_service_name,
63
+ upb_Arena* arena) {
63
64
  grpc_lb_v1_LoadBalanceRequest* req = grpc_lb_v1_LoadBalanceRequest_new(arena);
64
65
  grpc_lb_v1_InitialLoadBalanceRequest* initial_request =
65
66
  grpc_lb_v1_LoadBalanceRequest_mutable_initial_request(req, arena);
66
- size_t name_len = std::min(strlen(lb_service_name),
67
+ size_t name_len = std::min(lb_service_name.size(),
67
68
  size_t{GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH});
68
69
  grpc_lb_v1_InitialLoadBalanceRequest_set_name(
69
70
  initial_request,
70
- upb_StringView_FromDataAndSize(lb_service_name, name_len));
71
+ upb_StringView_FromDataAndSize(lb_service_name.data(), name_len));
71
72
  return grpc_grpclb_request_encode(req, arena);
72
73
  }
73
74