grpc 1.43.1 → 1.44.0.pre2

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

Potentially problematic release.


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

Files changed (382) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +84 -64
  3. data/include/grpc/grpc_security.h +10 -0
  4. data/include/grpc/impl/codegen/compression_types.h +0 -2
  5. data/include/grpc/impl/codegen/grpc_types.h +6 -0
  6. data/src/core/ext/filters/client_channel/backend_metric.h +1 -1
  7. data/src/core/ext/filters/client_channel/client_channel.cc +62 -68
  8. data/src/core/ext/filters/client_channel/client_channel.h +8 -8
  9. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +1 -1
  10. data/src/core/ext/filters/client_channel/config_selector.h +4 -4
  11. data/src/core/ext/filters/client_channel/dynamic_filters.h +1 -1
  12. data/src/core/ext/filters/client_channel/health/health_check_client.cc +16 -14
  13. data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
  14. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +1 -1
  15. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +4 -3
  16. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +6 -5
  17. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +3 -7
  18. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +31 -32
  19. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +0 -7
  20. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +1 -1
  21. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +1 -1
  22. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +1 -1
  23. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +43 -29
  24. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +6 -2
  25. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +120 -68
  26. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +60 -48
  27. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +62 -61
  28. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +16 -11
  29. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +11 -5
  30. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +19 -15
  31. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +1 -1
  32. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +14 -12
  33. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +3 -2
  34. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +50 -105
  35. data/src/core/ext/filters/client_channel/lb_policy.cc +15 -14
  36. data/src/core/ext/filters/client_channel/lb_policy.h +19 -3
  37. data/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc +3 -3
  38. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +207 -81
  39. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +22 -12
  40. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +19 -15
  41. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +23 -38
  42. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +118 -207
  43. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +25 -32
  44. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +1 -1
  45. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +82 -73
  46. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +10 -10
  47. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +2 -1
  48. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +2 -5
  49. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +5 -5
  50. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +157 -67
  51. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +1 -1
  52. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +2 -2
  53. data/src/core/ext/filters/client_channel/retry_filter.cc +37 -64
  54. data/src/core/ext/filters/client_channel/retry_service_config.cc +1 -1
  55. data/src/core/ext/filters/client_channel/retry_service_config.h +1 -1
  56. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +1 -1
  57. data/src/core/ext/filters/client_channel/subchannel.cc +12 -16
  58. data/src/core/ext/filters/client_channel/subchannel.h +2 -3
  59. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +37 -48
  60. data/src/core/ext/filters/fault_injection/service_config_parser.cc +6 -8
  61. data/src/core/ext/filters/fault_injection/service_config_parser.h +1 -1
  62. data/src/core/ext/filters/http/client/http_client_filter.cc +51 -122
  63. data/src/core/ext/filters/http/client_authority_filter.cc +8 -24
  64. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +42 -140
  65. data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +5 -25
  66. data/src/core/ext/filters/http/server/http_server_filter.cc +50 -135
  67. data/src/core/ext/filters/message_size/message_size_filter.cc +1 -1
  68. data/src/core/ext/filters/message_size/message_size_filter.h +1 -1
  69. data/src/core/ext/filters/rbac/rbac_filter.cc +157 -0
  70. data/src/core/ext/filters/rbac/rbac_filter.h +74 -0
  71. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +605 -0
  72. data/src/core/ext/filters/rbac/rbac_service_config_parser.h +70 -0
  73. data/src/core/ext/filters/server_config_selector/server_config_selector.h +3 -2
  74. data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +11 -6
  75. data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +1 -1
  76. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +1 -1
  77. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +89 -29
  78. data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +0 -1
  79. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +45 -186
  80. data/src/core/ext/transport/chttp2/transport/frame_data.cc +0 -1
  81. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +341 -279
  82. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +69 -159
  83. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +1 -1
  84. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +2 -0
  85. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +19 -32
  86. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +0 -1
  87. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +94 -1
  88. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +2 -24
  89. data/src/core/ext/transport/chttp2/transport/internal.h +0 -33
  90. data/src/core/ext/transport/chttp2/transport/parsing.cc +0 -6
  91. data/src/core/ext/transport/chttp2/transport/writing.cc +47 -116
  92. data/src/core/ext/transport/inproc/inproc_plugin.cc +0 -4
  93. data/src/core/ext/transport/inproc/inproc_transport.cc +11 -63
  94. data/src/core/ext/transport/inproc/inproc_transport.h +0 -3
  95. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.c +61 -0
  96. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +146 -0
  97. data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.c +188 -0
  98. data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.h +70 -0
  99. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.c +56 -0
  100. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.h +40 -0
  101. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/checked.upbdefs.c +154 -0
  102. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/checked.upbdefs.h +95 -0
  103. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/eval.upbdefs.c +58 -0
  104. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/eval.upbdefs.h +55 -0
  105. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/explain.upbdefs.c +44 -0
  106. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/explain.upbdefs.h +40 -0
  107. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/syntax.upbdefs.c +153 -0
  108. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/syntax.upbdefs.h +100 -0
  109. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/value.upbdefs.c +75 -0
  110. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/value.upbdefs.h +55 -0
  111. data/src/core/ext/xds/upb_utils.h +65 -0
  112. data/src/core/ext/xds/xds_api.cc +81 -3458
  113. data/src/core/ext/xds/xds_api.h +56 -611
  114. data/src/core/ext/xds/xds_bootstrap.cc +189 -125
  115. data/src/core/ext/xds/xds_bootstrap.h +20 -15
  116. data/src/core/ext/xds/xds_certificate_provider.h +1 -0
  117. data/src/core/ext/xds/xds_channel_creds.cc +108 -0
  118. data/src/core/ext/xds/xds_channel_creds.h +50 -0
  119. data/src/core/ext/xds/xds_client.cc +584 -994
  120. data/src/core/ext/xds/xds_client.h +78 -135
  121. data/src/core/ext/xds/xds_cluster.cc +451 -0
  122. data/src/core/ext/xds/xds_cluster.h +111 -0
  123. data/src/core/ext/xds/xds_common_types.cc +388 -0
  124. data/src/core/ext/xds/xds_common_types.h +110 -0
  125. data/src/core/ext/xds/xds_endpoint.cc +364 -0
  126. data/src/core/ext/xds/xds_endpoint.h +135 -0
  127. data/src/core/ext/xds/xds_http_filters.cc +5 -0
  128. data/src/core/ext/xds/xds_http_rbac_filter.cc +563 -0
  129. data/src/core/ext/xds/xds_http_rbac_filter.h +54 -0
  130. data/src/core/ext/xds/xds_listener.cc +1036 -0
  131. data/src/core/ext/xds/xds_listener.h +220 -0
  132. data/src/core/ext/{transport/chttp2/transport/hpack_utils.h → xds/xds_resource_type.cc} +12 -9
  133. data/src/core/ext/xds/xds_resource_type.h +98 -0
  134. data/src/core/ext/xds/xds_resource_type_impl.h +87 -0
  135. data/src/core/ext/xds/xds_route_config.cc +993 -0
  136. data/src/core/ext/xds/xds_route_config.h +215 -0
  137. data/src/core/ext/xds/xds_routing.cc +11 -8
  138. data/src/core/ext/xds/xds_routing.h +8 -5
  139. data/src/core/ext/xds/xds_server_config_fetcher.cc +159 -99
  140. data/src/core/lib/address_utils/parse_address.cc +20 -0
  141. data/src/core/lib/address_utils/parse_address.h +5 -0
  142. data/src/core/lib/address_utils/sockaddr_utils.cc +33 -36
  143. data/src/core/lib/address_utils/sockaddr_utils.h +1 -16
  144. data/src/core/lib/backoff/backoff.cc +4 -30
  145. data/src/core/lib/backoff/backoff.h +3 -3
  146. data/src/core/lib/channel/channel_args.cc +0 -1
  147. data/src/core/lib/channel/channel_stack.cc +8 -0
  148. data/src/core/lib/channel/channel_stack.h +1 -1
  149. data/src/core/lib/channel/channel_stack_builder.cc +5 -9
  150. data/src/core/lib/channel/channel_stack_builder.h +4 -7
  151. data/src/core/lib/channel/channelz.cc +1 -0
  152. data/src/core/lib/compression/compression.cc +19 -111
  153. data/src/core/lib/compression/compression_internal.cc +142 -202
  154. data/src/core/lib/compression/compression_internal.h +64 -69
  155. data/src/core/lib/compression/message_compress.cc +11 -11
  156. data/src/core/lib/compression/message_compress.h +2 -2
  157. data/src/core/lib/gpr/useful.h +4 -0
  158. data/src/core/lib/gprpp/bitset.h +7 -0
  159. data/src/core/lib/gprpp/chunked_vector.h +45 -3
  160. data/src/core/lib/gprpp/status_helper.cc +20 -28
  161. data/src/core/lib/gprpp/status_helper.h +6 -19
  162. data/src/core/lib/gprpp/table.h +11 -0
  163. data/src/core/lib/http/httpcli.cc +37 -46
  164. data/src/core/lib/http/httpcli.h +3 -15
  165. data/src/core/lib/iomgr/call_combiner.cc +15 -4
  166. data/src/core/lib/iomgr/closure.h +29 -9
  167. data/src/core/lib/iomgr/combiner.cc +25 -3
  168. data/src/core/lib/iomgr/error.cc +2 -0
  169. data/src/core/lib/iomgr/error.h +3 -0
  170. data/src/core/lib/iomgr/event_engine/iomgr.cc +3 -2
  171. data/src/core/lib/iomgr/event_engine/resolved_address_internal.cc +6 -0
  172. data/src/core/lib/iomgr/event_engine/resolved_address_internal.h +2 -0
  173. data/src/core/lib/iomgr/event_engine/resolver.cc +66 -48
  174. data/src/core/lib/iomgr/event_engine/resolver.h +56 -0
  175. data/src/core/lib/iomgr/exec_ctx.cc +22 -9
  176. data/src/core/lib/iomgr/executor.cc +10 -1
  177. data/src/core/lib/iomgr/fork_posix.cc +3 -2
  178. data/src/core/lib/iomgr/iomgr_custom.cc +4 -1
  179. data/src/core/lib/iomgr/iomgr_posix.cc +2 -2
  180. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +2 -2
  181. data/src/core/lib/iomgr/iomgr_windows.cc +2 -2
  182. data/src/core/lib/iomgr/port.h +2 -2
  183. data/src/core/lib/iomgr/resolve_address.cc +5 -24
  184. data/src/core/lib/iomgr/resolve_address.h +47 -44
  185. data/src/core/lib/iomgr/resolve_address_custom.cc +131 -109
  186. data/src/core/lib/iomgr/resolve_address_custom.h +101 -19
  187. data/src/core/lib/iomgr/resolve_address_impl.h +59 -0
  188. data/src/core/lib/iomgr/resolve_address_posix.cc +82 -66
  189. data/src/core/lib/iomgr/resolve_address_posix.h +47 -0
  190. data/src/core/lib/iomgr/resolve_address_windows.cc +93 -74
  191. data/src/core/lib/iomgr/resolve_address_windows.h +47 -0
  192. data/src/core/lib/iomgr/resolved_address.h +39 -0
  193. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +1 -0
  194. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +1 -0
  195. data/src/core/lib/iomgr/unix_sockets_posix.cc +22 -34
  196. data/src/core/lib/iomgr/unix_sockets_posix.h +4 -7
  197. data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +6 -15
  198. data/src/core/lib/matchers/matchers.cc +1 -1
  199. data/src/core/lib/promise/activity.h +49 -20
  200. data/src/core/lib/promise/detail/status.h +5 -0
  201. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver.cc +17 -25
  202. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver.h +43 -44
  203. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver_factory.h +10 -5
  204. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver_registry.cc +3 -2
  205. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver_registry.h +4 -5
  206. data/src/core/{ext/filters/client_channel → lib/resolver}/server_address.cc +1 -1
  207. data/src/core/{ext/filters/client_channel → lib/resolver}/server_address.h +4 -4
  208. data/src/core/lib/resource_quota/api.h +0 -1
  209. data/src/core/lib/{gprpp → resource_quota}/arena.cc +16 -13
  210. data/src/core/lib/{gprpp → resource_quota}/arena.h +24 -13
  211. data/src/core/lib/security/authorization/evaluate_args.cc +30 -15
  212. data/src/core/lib/security/authorization/evaluate_args.h +1 -0
  213. data/src/core/lib/security/authorization/grpc_authorization_engine.cc +60 -0
  214. data/src/core/lib/security/authorization/grpc_authorization_engine.h +62 -0
  215. data/src/core/lib/security/authorization/matchers.cc +227 -0
  216. data/src/core/lib/security/authorization/matchers.h +211 -0
  217. data/src/core/lib/security/authorization/rbac_policy.cc +442 -0
  218. data/src/core/lib/security/authorization/rbac_policy.h +170 -0
  219. data/src/core/lib/security/context/security_context.cc +4 -2
  220. data/src/core/lib/security/context/security_context.h +1 -1
  221. data/src/core/lib/security/credentials/composite/composite_credentials.cc +5 -5
  222. data/src/core/lib/security/credentials/composite/composite_credentials.h +4 -3
  223. data/src/core/lib/security/credentials/credentials.h +10 -20
  224. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +6 -9
  225. data/src/core/lib/security/credentials/external/external_account_credentials.cc +7 -9
  226. data/src/core/lib/security/credentials/external/external_account_credentials.h +2 -7
  227. data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +2 -3
  228. data/src/core/lib/security/credentials/fake/fake_credentials.cc +5 -4
  229. data/src/core/lib/security/credentials/fake/fake_credentials.h +8 -7
  230. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +2 -5
  231. data/src/core/lib/security/credentials/iam/iam_credentials.cc +16 -19
  232. data/src/core/lib/security/credentials/iam/iam_credentials.h +6 -5
  233. data/src/core/lib/security/credentials/jwt/json_token.cc +4 -6
  234. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +16 -28
  235. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +8 -8
  236. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +6 -13
  237. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +44 -57
  238. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +13 -15
  239. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +6 -7
  240. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +5 -4
  241. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +1 -10
  242. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +6 -0
  243. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +7 -0
  244. data/src/core/lib/security/credentials/xds/xds_credentials.h +1 -1
  245. data/src/core/lib/security/security_connector/security_connector.cc +0 -4
  246. data/src/core/lib/security/security_connector/security_connector.h +5 -1
  247. data/src/core/lib/security/security_connector/ssl_utils.cc +14 -24
  248. data/src/core/lib/security/security_connector/ssl_utils.h +5 -14
  249. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +2 -3
  250. data/src/core/lib/security/transport/auth_filters.h +7 -0
  251. data/src/core/lib/security/transport/client_auth_filter.cc +53 -33
  252. data/src/core/lib/security/transport/server_auth_filter.cc +40 -35
  253. data/src/core/{ext → lib}/service_config/service_config.cc +2 -2
  254. data/src/core/{ext → lib}/service_config/service_config.h +4 -4
  255. data/src/core/{ext → lib}/service_config/service_config_call_data.h +5 -5
  256. data/src/core/{ext → lib}/service_config/service_config_parser.cc +1 -1
  257. data/src/core/{ext → lib}/service_config/service_config_parser.h +3 -3
  258. data/src/core/lib/slice/slice.cc +3 -1
  259. data/src/core/lib/slice/slice.h +43 -13
  260. data/src/core/lib/slice/slice_intern.cc +3 -101
  261. data/src/core/lib/slice/slice_internal.h +1 -2
  262. data/src/core/lib/slice/slice_refcount.h +4 -13
  263. data/src/core/lib/slice/slice_refcount_base.h +0 -16
  264. data/src/core/lib/surface/call.cc +140 -382
  265. data/src/core/lib/surface/call.h +4 -4
  266. data/src/core/lib/surface/channel.cc +42 -44
  267. data/src/core/lib/surface/channel.h +4 -4
  268. data/src/core/lib/surface/init.cc +0 -2
  269. data/src/core/lib/surface/lame_client.cc +0 -1
  270. data/src/core/lib/surface/server.cc +12 -29
  271. data/src/core/lib/surface/server.h +2 -2
  272. data/src/core/lib/surface/version.cc +2 -2
  273. data/src/core/lib/transport/error_utils.h +14 -0
  274. data/src/core/lib/transport/metadata_batch.h +799 -717
  275. data/src/core/lib/transport/parsed_metadata.cc +2 -0
  276. data/src/core/lib/transport/parsed_metadata.h +95 -92
  277. data/src/core/lib/transport/timeout_encoding.cc +200 -66
  278. data/src/core/lib/transport/timeout_encoding.h +40 -10
  279. data/src/core/lib/transport/transport.h +1 -1
  280. data/src/core/lib/transport/transport_op_string.cc +6 -39
  281. data/src/core/lib/uri/uri_parser.cc +223 -53
  282. data/src/core/lib/uri/uri_parser.h +36 -23
  283. data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -3
  284. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
  285. data/src/core/tsi/ssl/session_cache/ssl_session.h +2 -4
  286. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +3 -5
  287. data/src/core/tsi/ssl_transport_security.cc +53 -13
  288. data/src/core/tsi/ssl_transport_security.h +18 -6
  289. data/src/ruby/ext/grpc/extconf.rb +10 -3
  290. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
  291. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
  292. data/src/ruby/lib/grpc/version.rb +1 -1
  293. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +2 -1
  294. data/third_party/abseil-cpp/absl/base/internal/fast_type_id.h +48 -0
  295. data/third_party/abseil-cpp/absl/random/bernoulli_distribution.h +200 -0
  296. data/third_party/abseil-cpp/absl/random/beta_distribution.h +427 -0
  297. data/third_party/abseil-cpp/absl/random/discrete_distribution.cc +98 -0
  298. data/third_party/abseil-cpp/absl/random/discrete_distribution.h +247 -0
  299. data/third_party/abseil-cpp/absl/random/distributions.h +452 -0
  300. data/third_party/abseil-cpp/absl/random/exponential_distribution.h +165 -0
  301. data/third_party/abseil-cpp/absl/random/gaussian_distribution.cc +104 -0
  302. data/third_party/abseil-cpp/absl/random/gaussian_distribution.h +275 -0
  303. data/third_party/abseil-cpp/absl/random/internal/distribution_caller.h +92 -0
  304. data/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h +268 -0
  305. data/third_party/abseil-cpp/absl/random/internal/fastmath.h +57 -0
  306. data/third_party/abseil-cpp/absl/random/internal/generate_real.h +144 -0
  307. data/third_party/abseil-cpp/absl/random/internal/iostream_state_saver.h +245 -0
  308. data/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h +150 -0
  309. data/third_party/abseil-cpp/absl/random/internal/pcg_engine.h +308 -0
  310. data/third_party/abseil-cpp/absl/random/internal/platform.h +171 -0
  311. data/third_party/abseil-cpp/absl/random/internal/pool_urbg.cc +253 -0
  312. data/third_party/abseil-cpp/absl/random/internal/pool_urbg.h +131 -0
  313. data/third_party/abseil-cpp/absl/random/internal/randen.cc +91 -0
  314. data/third_party/abseil-cpp/absl/random/internal/randen.h +102 -0
  315. data/third_party/abseil-cpp/absl/random/internal/randen_detect.cc +221 -0
  316. data/third_party/abseil-cpp/absl/random/internal/randen_detect.h +33 -0
  317. data/third_party/abseil-cpp/absl/random/internal/randen_engine.h +239 -0
  318. data/third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc +526 -0
  319. data/third_party/abseil-cpp/absl/random/internal/randen_hwaes.h +50 -0
  320. data/third_party/abseil-cpp/absl/random/internal/randen_round_keys.cc +462 -0
  321. data/third_party/abseil-cpp/absl/random/internal/randen_slow.cc +471 -0
  322. data/third_party/abseil-cpp/absl/random/internal/randen_slow.h +40 -0
  323. data/third_party/abseil-cpp/absl/random/internal/randen_traits.h +88 -0
  324. data/third_party/abseil-cpp/absl/random/internal/salted_seed_seq.h +167 -0
  325. data/third_party/abseil-cpp/absl/random/internal/seed_material.cc +267 -0
  326. data/third_party/abseil-cpp/absl/random/internal/seed_material.h +104 -0
  327. data/third_party/abseil-cpp/absl/random/internal/traits.h +101 -0
  328. data/third_party/abseil-cpp/absl/random/internal/uniform_helper.h +244 -0
  329. data/third_party/abseil-cpp/absl/random/internal/wide_multiply.h +111 -0
  330. data/third_party/abseil-cpp/absl/random/log_uniform_int_distribution.h +257 -0
  331. data/third_party/abseil-cpp/absl/random/poisson_distribution.h +258 -0
  332. data/third_party/abseil-cpp/absl/random/random.h +189 -0
  333. data/third_party/abseil-cpp/absl/random/seed_gen_exception.cc +46 -0
  334. data/third_party/abseil-cpp/absl/random/seed_gen_exception.h +55 -0
  335. data/third_party/abseil-cpp/absl/random/seed_sequences.cc +29 -0
  336. data/third_party/abseil-cpp/absl/random/seed_sequences.h +110 -0
  337. data/third_party/abseil-cpp/absl/random/uniform_int_distribution.h +275 -0
  338. data/third_party/abseil-cpp/absl/random/uniform_real_distribution.h +202 -0
  339. data/third_party/abseil-cpp/absl/random/zipf_distribution.h +271 -0
  340. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +1 -0
  341. data/third_party/boringssl-with-bazel/src/crypto/base64/base64.c +13 -0
  342. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +21 -0
  343. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/cipher.c +12 -0
  344. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +1 -2
  345. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +2 -2
  346. data/third_party/boringssl-with-bazel/src/crypto/mem.c +1 -1
  347. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7.c +29 -0
  348. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +0 -1
  349. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8.c +1 -1
  350. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +1 -1
  351. data/third_party/boringssl-with-bazel/src/include/openssl/base64.h +8 -0
  352. data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +13 -1
  353. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +10 -0
  354. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +1 -1
  355. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +9 -4
  356. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs8.h +6 -1
  357. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +23 -2
  358. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +4 -0
  359. data/third_party/xxhash/xxhash.h +607 -352
  360. metadata +149 -77
  361. data/src/core/ext/transport/chttp2/transport/hpack_encoder_index.h +0 -107
  362. data/src/core/ext/transport/chttp2/transport/hpack_utils.cc +0 -46
  363. data/src/core/ext/transport/chttp2/transport/popularity_count.h +0 -60
  364. data/src/core/lib/compression/algorithm_metadata.h +0 -62
  365. data/src/core/lib/compression/compression_args.cc +0 -140
  366. data/src/core/lib/compression/compression_args.h +0 -58
  367. data/src/core/lib/compression/stream_compression.cc +0 -81
  368. data/src/core/lib/compression/stream_compression.h +0 -117
  369. data/src/core/lib/compression/stream_compression_gzip.cc +0 -231
  370. data/src/core/lib/compression/stream_compression_gzip.h +0 -28
  371. data/src/core/lib/compression/stream_compression_identity.cc +0 -91
  372. data/src/core/lib/compression/stream_compression_identity.h +0 -29
  373. data/src/core/lib/security/credentials/credentials_metadata.cc +0 -61
  374. data/src/core/lib/slice/static_slice.cc +0 -377
  375. data/src/core/lib/slice/static_slice.h +0 -300
  376. data/src/core/lib/transport/metadata.cc +0 -714
  377. data/src/core/lib/transport/metadata.h +0 -449
  378. data/src/core/lib/transport/metadata_batch.cc +0 -99
  379. data/src/core/lib/transport/static_metadata.cc +0 -1032
  380. data/src/core/lib/transport/static_metadata.h +0 -322
  381. data/src/core/lib/transport/status_metadata.cc +0 -63
  382. data/src/core/lib/transport/status_metadata.h +0 -48
@@ -48,13 +48,10 @@
48
48
  #include "src/core/ext/filters/client_channel/lb_policy_registry.h"
49
49
  #include "src/core/ext/filters/client_channel/local_subchannel_pool.h"
50
50
  #include "src/core/ext/filters/client_channel/proxy_mapper_registry.h"
51
- #include "src/core/ext/filters/client_channel/resolver_registry.h"
52
51
  #include "src/core/ext/filters/client_channel/resolver_result_parsing.h"
53
52
  #include "src/core/ext/filters/client_channel/retry_filter.h"
54
53
  #include "src/core/ext/filters/client_channel/subchannel.h"
55
54
  #include "src/core/ext/filters/deadline/deadline_filter.h"
56
- #include "src/core/ext/service_config/service_config.h"
57
- #include "src/core/ext/service_config/service_config_call_data.h"
58
55
  #include "src/core/lib/backoff/backoff.h"
59
56
  #include "src/core/lib/channel/channel_args.h"
60
57
  #include "src/core/lib/channel/connected_channel.h"
@@ -65,15 +62,15 @@
65
62
  #include "src/core/lib/iomgr/polling_entity.h"
66
63
  #include "src/core/lib/iomgr/work_serializer.h"
67
64
  #include "src/core/lib/profiling/timers.h"
65
+ #include "src/core/lib/resolver/resolver_registry.h"
66
+ #include "src/core/lib/service_config/service_config.h"
67
+ #include "src/core/lib/service_config/service_config_call_data.h"
68
68
  #include "src/core/lib/slice/slice_internal.h"
69
69
  #include "src/core/lib/slice/slice_string_helpers.h"
70
70
  #include "src/core/lib/surface/channel.h"
71
71
  #include "src/core/lib/transport/connectivity_state.h"
72
72
  #include "src/core/lib/transport/error_utils.h"
73
- #include "src/core/lib/transport/metadata.h"
74
73
  #include "src/core/lib/transport/metadata_batch.h"
75
- #include "src/core/lib/transport/static_metadata.h"
76
- #include "src/core/lib/transport/status_metadata.h"
77
74
 
78
75
  //
79
76
  // Client channel filter
@@ -417,16 +414,11 @@ class ClientChannel::ResolverResultHandler : public Resolver::ResultHandler {
417
414
  GRPC_CHANNEL_STACK_UNREF(chand_->owning_stack_, "ResolverResultHandler");
418
415
  }
419
416
 
420
- void ReturnResult(Resolver::Result result) override
417
+ void ReportResult(Resolver::Result result) override
421
418
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(chand_->work_serializer_) {
422
419
  chand_->OnResolverResultChangedLocked(std::move(result));
423
420
  }
424
421
 
425
- void ReturnError(grpc_error_handle error) override
426
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(chand_->work_serializer_) {
427
- chand_->OnResolverErrorLocked(error);
428
- }
429
-
430
422
  private:
431
423
  ClientChannel* chand_;
432
424
  };
@@ -1122,7 +1114,6 @@ ClientChannel::~ClientChannel() {
1122
1114
  }
1123
1115
  DestroyResolverAndLbPolicyLocked();
1124
1116
  grpc_channel_args_destroy(channel_args_);
1125
- GRPC_ERROR_UNREF(resolver_transient_failure_error_);
1126
1117
  // Stop backup polling.
1127
1118
  grpc_client_channel_stop_backup_polling(interested_parties_);
1128
1119
  grpc_pollset_set_destroy(interested_parties_);
@@ -1203,26 +1194,29 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
1203
1194
  //
1204
1195
  // We track a list of strings to eventually be concatenated and traced.
1205
1196
  absl::InlinedVector<const char*, 3> trace_strings;
1206
- if (result.addresses.empty() && previous_resolution_contained_addresses_) {
1197
+ const bool resolution_contains_addresses =
1198
+ result.addresses.ok() && !result.addresses->empty();
1199
+ if (!resolution_contains_addresses &&
1200
+ previous_resolution_contained_addresses_) {
1207
1201
  trace_strings.push_back("Address list became empty");
1208
- } else if (!result.addresses.empty() &&
1202
+ } else if (resolution_contains_addresses &&
1209
1203
  !previous_resolution_contained_addresses_) {
1210
1204
  trace_strings.push_back("Address list became non-empty");
1211
1205
  }
1212
- previous_resolution_contained_addresses_ = !result.addresses.empty();
1206
+ previous_resolution_contained_addresses_ = resolution_contains_addresses;
1213
1207
  std::string service_config_error_string_storage;
1214
- if (result.service_config_error != GRPC_ERROR_NONE) {
1208
+ if (!result.service_config.ok()) {
1215
1209
  service_config_error_string_storage =
1216
- grpc_error_std_string(result.service_config_error);
1210
+ result.service_config.status().ToString();
1217
1211
  trace_strings.push_back(service_config_error_string_storage.c_str());
1218
1212
  }
1219
1213
  // Choose the service config.
1220
1214
  RefCountedPtr<ServiceConfig> service_config;
1221
1215
  RefCountedPtr<ConfigSelector> config_selector;
1222
- if (result.service_config_error != GRPC_ERROR_NONE) {
1216
+ if (!result.service_config.ok()) {
1223
1217
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1224
1218
  gpr_log(GPR_INFO, "chand=%p: resolver returned service config error: %s",
1225
- this, grpc_error_std_string(result.service_config_error).c_str());
1219
+ this, result.service_config.status().ToString().c_str());
1226
1220
  }
1227
1221
  // If the service config was invalid, then fallback to the
1228
1222
  // previously returned service config.
@@ -1236,13 +1230,13 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
1236
1230
  service_config = saved_service_config_;
1237
1231
  config_selector = saved_config_selector_;
1238
1232
  } else {
1239
- // We received an invalid service config and we don't have a
1233
+ // We received a service config error and we don't have a
1240
1234
  // previous service config to fall back to. Put the channel into
1241
1235
  // TRANSIENT_FAILURE.
1242
- OnResolverErrorLocked(GRPC_ERROR_REF(result.service_config_error));
1236
+ OnResolverErrorLocked(result.service_config.status());
1243
1237
  trace_strings.push_back("no valid service config");
1244
1238
  }
1245
- } else if (result.service_config == nullptr) {
1239
+ } else if (*result.service_config == nullptr) {
1246
1240
  // Resolver did not return any service config.
1247
1241
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1248
1242
  gpr_log(GPR_INFO,
@@ -1253,9 +1247,12 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
1253
1247
  service_config = default_service_config_;
1254
1248
  } else {
1255
1249
  // Use ServiceConfig and ConfigSelector returned by resolver.
1256
- service_config = result.service_config;
1250
+ service_config = std::move(*result.service_config);
1257
1251
  config_selector = ConfigSelector::GetFromChannelArgs(*result.args);
1258
1252
  }
1253
+ // Note: The only case in which service_config is null here is if the resolver
1254
+ // returned a service config error and we don't have a previous service
1255
+ // config to fall back to.
1259
1256
  if (service_config != nullptr) {
1260
1257
  // Extract global config for client channel.
1261
1258
  const internal::ClientChannelGlobalParsedConfig* parsed_service_config =
@@ -1307,28 +1304,21 @@ void ClientChannel::OnResolverResultChangedLocked(Resolver::Result result) {
1307
1304
  }
1308
1305
  }
1309
1306
 
1310
- void ClientChannel::OnResolverErrorLocked(grpc_error_handle error) {
1311
- if (resolver_ == nullptr) {
1312
- GRPC_ERROR_UNREF(error);
1313
- return;
1314
- }
1307
+ void ClientChannel::OnResolverErrorLocked(absl::Status status) {
1308
+ if (resolver_ == nullptr) return;
1315
1309
  if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
1316
1310
  gpr_log(GPR_INFO, "chand=%p: resolver transient failure: %s", this,
1317
- grpc_error_std_string(error).c_str());
1311
+ status.ToString().c_str());
1318
1312
  }
1319
1313
  // If we already have an LB policy from a previous resolution
1320
1314
  // result, then we continue to let it set the connectivity state.
1321
1315
  // Otherwise, we go into TRANSIENT_FAILURE.
1322
1316
  if (lb_policy_ == nullptr) {
1323
- grpc_error_handle state_error =
1324
- GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
1325
- "Resolver transient failure", &error, 1);
1326
- absl::Status status = grpc_error_to_absl_status(state_error);
1317
+ grpc_error_handle error = absl_status_to_grpc_error(status);
1327
1318
  {
1328
1319
  MutexLock lock(&resolution_mu_);
1329
1320
  // Update resolver transient failure.
1330
- GRPC_ERROR_UNREF(resolver_transient_failure_error_);
1331
- resolver_transient_failure_error_ = state_error;
1321
+ resolver_transient_failure_error_ = status;
1332
1322
  // Process calls that were queued waiting for the resolver result.
1333
1323
  for (ResolverQueuedCall* call = resolver_queued_calls_; call != nullptr;
1334
1324
  call = call->next) {
@@ -1340,12 +1330,12 @@ void ClientChannel::OnResolverErrorLocked(grpc_error_handle error) {
1340
1330
  }
1341
1331
  }
1342
1332
  }
1333
+ GRPC_ERROR_UNREF(error);
1343
1334
  // Update connectivity state.
1344
1335
  UpdateStateAndPickerLocked(
1345
1336
  GRPC_CHANNEL_TRANSIENT_FAILURE, status, "resolver failure",
1346
1337
  absl::make_unique<LoadBalancingPolicy::TransientFailurePicker>(status));
1347
1338
  }
1348
- GRPC_ERROR_UNREF(error);
1349
1339
  }
1350
1340
 
1351
1341
  void ClientChannel::CreateOrUpdateLbPolicyLocked(
@@ -1356,6 +1346,7 @@ void ClientChannel::CreateOrUpdateLbPolicyLocked(
1356
1346
  LoadBalancingPolicy::UpdateArgs update_args;
1357
1347
  update_args.addresses = std::move(result.addresses);
1358
1348
  update_args.config = std::move(lb_policy_config);
1349
+ update_args.resolution_note = std::move(result.resolution_note);
1359
1350
  // Add health check service name to channel args.
1360
1351
  absl::InlinedVector<grpc_arg, 1> args_to_add;
1361
1352
  if (health_check_service_name.has_value()) {
@@ -1496,8 +1487,7 @@ void ClientChannel::UpdateServiceConfigInDataPlaneLocked() {
1496
1487
  // after releasing the lock to keep the critical section small.
1497
1488
  {
1498
1489
  MutexLock lock(&resolution_mu_);
1499
- GRPC_ERROR_UNREF(resolver_transient_failure_error_);
1500
- resolver_transient_failure_error_ = GRPC_ERROR_NONE;
1490
+ resolver_transient_failure_error_ = absl::OkStatus();
1501
1491
  // Update service config.
1502
1492
  received_service_config_data_ = true;
1503
1493
  // Old values will be unreffed after lock is released.
@@ -2353,12 +2343,11 @@ bool ClientChannel::CallData::CheckResolutionLocked(grpc_call_element* elem,
2353
2343
  if (GPR_UNLIKELY(!chand->received_service_config_data_)) {
2354
2344
  // If the resolver returned transient failure before returning the
2355
2345
  // first service config, fail any non-wait_for_ready calls.
2356
- grpc_error_handle resolver_error = chand->resolver_transient_failure_error_;
2357
- if (resolver_error != GRPC_ERROR_NONE &&
2358
- (send_initial_metadata_flags & GRPC_INITIAL_METADATA_WAIT_FOR_READY) ==
2359
- 0) {
2346
+ absl::Status resolver_error = chand->resolver_transient_failure_error_;
2347
+ if (!resolver_error.ok() && (send_initial_metadata_flags &
2348
+ GRPC_INITIAL_METADATA_WAIT_FOR_READY) == 0) {
2360
2349
  MaybeRemoveCallFromResolverQueuedCallsLocked(elem);
2361
- *error = GRPC_ERROR_REF(resolver_error);
2350
+ *error = absl_status_to_grpc_error(resolver_error);
2362
2351
  return true;
2363
2352
  }
2364
2353
  // Either the resolver has not yet returned a result, or it has
@@ -2414,16 +2403,25 @@ void ClientChannel::CallData::CreateDynamicCall(grpc_call_element* elem) {
2414
2403
  class ClientChannel::LoadBalancedCall::Metadata
2415
2404
  : public LoadBalancingPolicy::MetadataInterface {
2416
2405
  public:
2417
- Metadata(LoadBalancedCall* lb_call, grpc_metadata_batch* batch)
2418
- : lb_call_(lb_call), batch_(batch) {}
2406
+ explicit Metadata(grpc_metadata_batch* batch) : batch_(batch) {}
2419
2407
 
2420
2408
  void Add(absl::string_view key, absl::string_view value) override {
2421
- grpc_linked_mdelem* linked_mdelem = static_cast<grpc_linked_mdelem*>(
2422
- lb_call_->arena_->Alloc(sizeof(grpc_linked_mdelem)));
2423
- linked_mdelem->md = grpc_mdelem_from_slices(
2424
- ExternallyManagedSlice(key.data(), key.size()),
2425
- ExternallyManagedSlice(value.data(), value.size()));
2426
- GPR_ASSERT(batch_->LinkTail(linked_mdelem) == GRPC_ERROR_NONE);
2409
+ // Gross, egregious hack to support legacy grpclb behavior.
2410
+ // TODO(ctiller): Use a promise context for this once that plumbing is done.
2411
+ if (key == GrpcLbClientStatsMetadata::key()) {
2412
+ batch_->Set(
2413
+ GrpcLbClientStatsMetadata(),
2414
+ const_cast<GrpcLbClientStats*>(
2415
+ reinterpret_cast<const GrpcLbClientStats*>(value.data())));
2416
+ return;
2417
+ }
2418
+ batch_->Append(key, Slice::FromStaticString(value),
2419
+ [key](absl::string_view error, const Slice& value) {
2420
+ gpr_log(GPR_ERROR, "%s",
2421
+ absl::StrCat(error, " key:", key,
2422
+ " value:", value.as_string_view())
2423
+ .c_str());
2424
+ });
2427
2425
  }
2428
2426
 
2429
2427
  std::vector<std::pair<std::string, std::string>> TestOnlyCopyToVector()
@@ -2435,18 +2433,15 @@ class ClientChannel::LoadBalancedCall::Metadata
2435
2433
 
2436
2434
  absl::optional<absl::string_view> Lookup(absl::string_view key,
2437
2435
  std::string* buffer) const override {
2438
- return batch_->GetValue(key, buffer);
2436
+ return batch_->GetStringValue(key, buffer);
2439
2437
  }
2440
2438
 
2441
2439
  private:
2442
2440
  class Encoder {
2443
2441
  public:
2444
- void Encode(grpc_mdelem md) {
2445
- auto key = StringViewFromSlice(GRPC_MDKEY(md));
2446
- if (key != ":path") {
2447
- out_.emplace_back(std::string(key),
2448
- std::string(StringViewFromSlice(GRPC_MDVALUE(md))));
2449
- }
2442
+ void Encode(const Slice& key, const Slice& value) {
2443
+ out_.emplace_back(std::string(key.as_string_view()),
2444
+ std::string(value.as_string_view()));
2450
2445
  }
2451
2446
 
2452
2447
  template <class Which>
@@ -2457,6 +2452,9 @@ class ClientChannel::LoadBalancedCall::Metadata
2457
2452
  }
2458
2453
 
2459
2454
  void Encode(GrpcTimeoutMetadata, grpc_millis) {}
2455
+ void Encode(HttpPathMetadata, const Slice&) {}
2456
+ void Encode(HttpMethodMetadata,
2457
+ const typename HttpMethodMetadata::ValueType&) {}
2460
2458
 
2461
2459
  std::vector<std::pair<std::string, std::string>> Take() {
2462
2460
  return std::move(out_);
@@ -2466,7 +2464,6 @@ class ClientChannel::LoadBalancedCall::Metadata
2466
2464
  std::vector<std::pair<std::string, std::string>> out_;
2467
2465
  };
2468
2466
 
2469
- LoadBalancedCall* lb_call_;
2470
2467
  grpc_metadata_batch* batch_;
2471
2468
  };
2472
2469
 
@@ -2558,7 +2555,6 @@ ClientChannel::LoadBalancedCall::LoadBalancedCall(
2558
2555
  GetCallAttemptTracer(args.context, is_transparent_retry)) {}
2559
2556
 
2560
2557
  ClientChannel::LoadBalancedCall::~LoadBalancedCall() {
2561
- grpc_slice_unref_internal(path_);
2562
2558
  GRPC_ERROR_UNREF(cancel_error_);
2563
2559
  GRPC_ERROR_UNREF(failure_error_);
2564
2560
  if (backend_metric_data_ != nullptr) {
@@ -2877,10 +2873,8 @@ void ClientChannel::LoadBalancedCall::RecvTrailingMetadataReady(
2877
2873
  } else {
2878
2874
  // Get status from headers.
2879
2875
  const auto& md = *self->recv_trailing_metadata_;
2880
- const auto& fields = md.legacy_index()->named;
2881
- GPR_ASSERT(fields.grpc_status != nullptr);
2882
2876
  grpc_status_code code =
2883
- grpc_get_status_code_from_metadata(fields.grpc_status->md);
2877
+ md.get(GrpcStatusMetadata()).value_or(GRPC_STATUS_UNKNOWN);
2884
2878
  if (code != GRPC_STATUS_OK) {
2885
2879
  absl::string_view message;
2886
2880
  if (const auto* grpc_message = md.get_pointer(GrpcMessageMetadata())) {
@@ -2898,7 +2892,7 @@ void ClientChannel::LoadBalancedCall::RecvTrailingMetadataReady(
2898
2892
  // If the LB policy requested a callback for trailing metadata, invoke
2899
2893
  // the callback.
2900
2894
  if (self->lb_subchannel_call_tracker_ != nullptr) {
2901
- Metadata trailing_metadata(self, self->recv_trailing_metadata_);
2895
+ Metadata trailing_metadata(self->recv_trailing_metadata_);
2902
2896
  BackendMetricAccessor backend_metric_accessor(self);
2903
2897
  LoadBalancingPolicy::SubchannelCallTrackerInterface::FinishArgs args = {
2904
2898
  status, &trailing_metadata, &backend_metric_accessor};
@@ -2919,7 +2913,7 @@ void ClientChannel::LoadBalancedCall::RecvTrailingMetadataReady(
2919
2913
 
2920
2914
  void ClientChannel::LoadBalancedCall::CreateSubchannelCall() {
2921
2915
  SubchannelCall::Args call_args = {
2922
- std::move(connected_subchannel_), pollent_, path_, /*start_time=*/0,
2916
+ std::move(connected_subchannel_), pollent_, path_.Ref(), /*start_time=*/0,
2923
2917
  deadline_, arena_,
2924
2918
  // TODO(roth): When we implement hedging support, we will probably
2925
2919
  // need to use a separate call context for each subchannel call.
@@ -3063,10 +3057,10 @@ bool ClientChannel::LoadBalancedCall::PickSubchannelLocked(
3063
3057
  send_initial_metadata.send_initial_metadata_flags;
3064
3058
  // Perform LB pick.
3065
3059
  LoadBalancingPolicy::PickArgs pick_args;
3066
- pick_args.path = StringViewFromSlice(path_);
3060
+ pick_args.path = path_.as_string_view();
3067
3061
  LbCallState lb_call_state(this);
3068
3062
  pick_args.call_state = &lb_call_state;
3069
- Metadata initial_metadata(this, initial_metadata_batch);
3063
+ Metadata initial_metadata(initial_metadata_batch);
3070
3064
  pick_args.initial_metadata = &initial_metadata;
3071
3065
  auto result = chand_->picker_->Pick(pick_args);
3072
3066
  return HandlePickResult<bool>(
@@ -33,14 +33,10 @@
33
33
  #include "src/core/ext/filters/client_channel/config_selector.h"
34
34
  #include "src/core/ext/filters/client_channel/dynamic_filters.h"
35
35
  #include "src/core/ext/filters/client_channel/lb_policy.h"
36
- #include "src/core/ext/filters/client_channel/resolver.h"
37
36
  #include "src/core/ext/filters/client_channel/resolver_result_parsing.h"
38
37
  #include "src/core/ext/filters/client_channel/retry_throttle.h"
39
38
  #include "src/core/ext/filters/client_channel/subchannel.h"
40
39
  #include "src/core/ext/filters/client_channel/subchannel_pool_interface.h"
41
- #include "src/core/ext/service_config/service_config.h"
42
- #include "src/core/ext/service_config/service_config_call_data.h"
43
- #include "src/core/ext/service_config/service_config_parser.h"
44
40
  #include "src/core/lib/channel/call_tracer.h"
45
41
  #include "src/core/lib/channel/context.h"
46
42
  #include "src/core/lib/gprpp/ref_counted_ptr.h"
@@ -48,6 +44,10 @@
48
44
  #include "src/core/lib/iomgr/error.h"
49
45
  #include "src/core/lib/iomgr/polling_entity.h"
50
46
  #include "src/core/lib/iomgr/work_serializer.h"
47
+ #include "src/core/lib/resolver/resolver.h"
48
+ #include "src/core/lib/service_config/service_config.h"
49
+ #include "src/core/lib/service_config/service_config_call_data.h"
50
+ #include "src/core/lib/service_config/service_config_parser.h"
51
51
  #include "src/core/lib/surface/channel.h"
52
52
  #include "src/core/lib/transport/connectivity_state.h"
53
53
 
@@ -216,7 +216,7 @@ class ClientChannel {
216
216
 
217
217
  void OnResolverResultChangedLocked(Resolver::Result result)
218
218
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(work_serializer_);
219
- void OnResolverErrorLocked(grpc_error_handle error)
219
+ void OnResolverErrorLocked(absl::Status status)
220
220
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(work_serializer_);
221
221
 
222
222
  void CreateOrUpdateLbPolicyLocked(
@@ -288,8 +288,8 @@ class ClientChannel {
288
288
  ResolverQueuedCall* resolver_queued_calls_ ABSL_GUARDED_BY(resolution_mu_) =
289
289
  nullptr;
290
290
  // Data from service config.
291
- grpc_error_handle resolver_transient_failure_error_
292
- ABSL_GUARDED_BY(resolution_mu_) = GRPC_ERROR_NONE;
291
+ absl::Status resolver_transient_failure_error_
292
+ ABSL_GUARDED_BY(resolution_mu_);
293
293
  bool received_service_config_data_ ABSL_GUARDED_BY(resolution_mu_) = false;
294
294
  RefCountedPtr<ServiceConfig> service_config_ ABSL_GUARDED_BY(resolution_mu_);
295
295
  RefCountedPtr<ConfigSelector> config_selector_
@@ -447,7 +447,7 @@ class ClientChannel::LoadBalancedCall
447
447
  // TODO(roth): Instead of duplicating these fields in every filter
448
448
  // that uses any one of them, we should store them in the call
449
449
  // context. This will save per-call memory overhead.
450
- grpc_slice path_; // Request path.
450
+ Slice path_; // Request path.
451
451
  grpc_millis deadline_;
452
452
  Arena* arena_;
453
453
  grpc_call_stack* owning_call_;
@@ -32,11 +32,11 @@
32
32
  #include "src/core/ext/filters/client_channel/http_proxy.h"
33
33
  #include "src/core/ext/filters/client_channel/lb_policy_registry.h"
34
34
  #include "src/core/ext/filters/client_channel/proxy_mapper_registry.h"
35
- #include "src/core/ext/filters/client_channel/resolver_registry.h"
36
35
  #include "src/core/ext/filters/client_channel/resolver_result_parsing.h"
37
36
  #include "src/core/ext/filters/client_channel/retry_service_config.h"
38
37
  #include "src/core/ext/filters/client_channel/retry_throttle.h"
39
38
  #include "src/core/lib/config/core_configuration.h"
39
+ #include "src/core/lib/resolver/resolver_registry.h"
40
40
 
41
41
  void grpc_client_channel_init(void) {
42
42
  grpc_core::internal::ClientChannelServiceConfigParser::Register();
@@ -27,13 +27,13 @@
27
27
 
28
28
  #include <grpc/grpc.h>
29
29
 
30
- #include "src/core/ext/service_config/service_config.h"
31
- #include "src/core/ext/service_config/service_config_call_data.h"
32
- #include "src/core/ext/service_config/service_config_parser.h"
33
30
  #include "src/core/lib/channel/channel_stack.h"
34
- #include "src/core/lib/gprpp/arena.h"
35
31
  #include "src/core/lib/gprpp/ref_counted.h"
36
32
  #include "src/core/lib/gprpp/ref_counted_ptr.h"
33
+ #include "src/core/lib/resource_quota/arena.h"
34
+ #include "src/core/lib/service_config/service_config.h"
35
+ #include "src/core/lib/service_config/service_config_call_data.h"
36
+ #include "src/core/lib/service_config/service_config_parser.h"
37
37
  #include "src/core/lib/transport/metadata_batch.h"
38
38
 
39
39
  // Channel arg key for ConfigSelector.
@@ -23,10 +23,10 @@
23
23
 
24
24
  #include "src/core/lib/channel/channel_stack.h"
25
25
  #include "src/core/lib/gpr/time_precise.h"
26
- #include "src/core/lib/gprpp/arena.h"
27
26
  #include "src/core/lib/gprpp/ref_counted.h"
28
27
  #include "src/core/lib/iomgr/exec_ctx.h"
29
28
  #include "src/core/lib/iomgr/polling_entity.h"
29
+ #include "src/core/lib/resource_quota/arena.h"
30
30
 
31
31
  namespace grpc_core {
32
32
 
@@ -25,11 +25,13 @@
25
25
 
26
26
  #include "upb/upb.hpp"
27
27
 
28
+ #include <grpc/status.h>
29
+
28
30
  #include "src/core/lib/debug/trace.h"
29
31
  #include "src/core/lib/gprpp/sync.h"
32
+ #include "src/core/lib/resource_quota/api.h"
30
33
  #include "src/core/lib/slice/slice_internal.h"
31
34
  #include "src/core/lib/transport/error_utils.h"
32
- #include "src/core/lib/transport/status_metadata.h"
33
35
  #include "src/proto/grpc/health/v1/health.upb.h"
34
36
 
35
37
  #define HEALTH_CHECK_INITIAL_CONNECT_BACKOFF_SECONDS 1
@@ -59,6 +61,10 @@ HealthCheckClient::HealthCheckClient(
59
61
  connected_subchannel_(std::move(connected_subchannel)),
60
62
  interested_parties_(interested_parties),
61
63
  channelz_node_(std::move(channelz_node)),
64
+ call_allocator_(
65
+ ResourceQuotaFromChannelArgs(connected_subchannel_->args())
66
+ ->memory_quota()
67
+ ->CreateMemoryAllocator(service_name_)),
62
68
  watcher_(std::move(watcher)),
63
69
  retry_backoff_(
64
70
  BackOff::Options()
@@ -253,7 +259,8 @@ HealthCheckClient::CallState::CallState(
253
259
  : health_check_client_(std::move(health_check_client)),
254
260
  pollent_(grpc_polling_entity_create_from_pollset_set(interested_parties)),
255
261
  arena_(Arena::Create(health_check_client_->connected_subchannel_
256
- ->GetInitialCallSizeEstimate())),
262
+ ->GetInitialCallSizeEstimate(),
263
+ &health_check_client_->call_allocator_)),
257
264
  payload_(context_),
258
265
  send_initial_metadata_(arena_),
259
266
  send_trailing_metadata_(arena_),
@@ -287,7 +294,7 @@ void HealthCheckClient::CallState::StartCall() {
287
294
  SubchannelCall::Args args = {
288
295
  health_check_client_->connected_subchannel_,
289
296
  &pollent_,
290
- GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH,
297
+ Slice::FromStaticString("/grpc.health.v1.Health/Watch"),
291
298
  gpr_get_cycle_counter(), // start_time
292
299
  GRPC_MILLIS_INF_FUTURE, // deadline
293
300
  arena_,
@@ -319,12 +326,9 @@ void HealthCheckClient::CallState::StartCall() {
319
326
  batch_.on_complete = GRPC_CLOSURE_INIT(&on_complete_, OnComplete, this,
320
327
  grpc_schedule_on_exec_ctx);
321
328
  // Add send_initial_metadata op.
322
- error = grpc_metadata_batch_add_head(
323
- &send_initial_metadata_, &path_metadata_storage_,
324
- grpc_mdelem_from_slices(
325
- GRPC_MDSTR_PATH,
326
- GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH),
327
- GRPC_BATCH_PATH);
329
+ send_initial_metadata_.Set(
330
+ HttpPathMetadata(),
331
+ Slice::FromStaticString("/grpc.health.v1.Health/Watch"));
328
332
  GPR_ASSERT(error == GRPC_ERROR_NONE);
329
333
  payload_.send_initial_metadata.send_initial_metadata =
330
334
  &send_initial_metadata_;
@@ -553,15 +557,13 @@ void HealthCheckClient::CallState::RecvTrailingMetadataReady(
553
557
  GRPC_CALL_COMBINER_STOP(&self->call_combiner_,
554
558
  "recv_trailing_metadata_ready");
555
559
  // Get call status.
556
- grpc_status_code status = GRPC_STATUS_UNKNOWN;
560
+ grpc_status_code status =
561
+ self->recv_trailing_metadata_.get(GrpcStatusMetadata())
562
+ .value_or(GRPC_STATUS_UNKNOWN);
557
563
  if (error != GRPC_ERROR_NONE) {
558
564
  grpc_error_get_status(error, GRPC_MILLIS_INF_FUTURE, &status,
559
565
  nullptr /* slice */, nullptr /* http_error */,
560
566
  nullptr /* error_string */);
561
- } else if (self->recv_trailing_metadata_.legacy_index()->named.grpc_status !=
562
- nullptr) {
563
- status = grpc_get_status_code_from_metadata(
564
- self->recv_trailing_metadata_.legacy_index()->named.grpc_status->md);
565
567
  }
566
568
  if (GRPC_TRACE_FLAG_ENABLED(grpc_health_check_client_trace)) {
567
569
  gpr_log(GPR_INFO,
@@ -29,7 +29,6 @@
29
29
  #include "src/core/ext/filters/client_channel/client_channel_channelz.h"
30
30
  #include "src/core/ext/filters/client_channel/subchannel.h"
31
31
  #include "src/core/lib/backoff/backoff.h"
32
- #include "src/core/lib/gprpp/arena.h"
33
32
  #include "src/core/lib/gprpp/orphanable.h"
34
33
  #include "src/core/lib/gprpp/ref_counted_ptr.h"
35
34
  #include "src/core/lib/gprpp/sync.h"
@@ -37,6 +36,7 @@
37
36
  #include "src/core/lib/iomgr/closure.h"
38
37
  #include "src/core/lib/iomgr/polling_entity.h"
39
38
  #include "src/core/lib/iomgr/timer.h"
39
+ #include "src/core/lib/resource_quota/arena.h"
40
40
  #include "src/core/lib/transport/byte_stream.h"
41
41
  #include "src/core/lib/transport/metadata_batch.h"
42
42
  #include "src/core/lib/transport/transport.h"
@@ -60,7 +60,7 @@ class HealthCheckClient : public InternallyRefCounted<HealthCheckClient> {
60
60
  class CallState : public Orphanable {
61
61
  public:
62
62
  CallState(RefCountedPtr<HealthCheckClient> health_check_client,
63
- grpc_pollset_set* interested_parties_);
63
+ grpc_pollset_set* interested_parties);
64
64
  ~CallState() override;
65
65
 
66
66
  void Orphan() override;
@@ -111,7 +111,6 @@ class HealthCheckClient : public InternallyRefCounted<HealthCheckClient> {
111
111
 
112
112
  // send_initial_metadata
113
113
  grpc_metadata_batch send_initial_metadata_;
114
- grpc_linked_mdelem path_metadata_storage_;
115
114
 
116
115
  // send_message
117
116
  ManualConstructor<SliceBufferByteStream> send_message_;
@@ -155,6 +154,7 @@ class HealthCheckClient : public InternallyRefCounted<HealthCheckClient> {
155
154
  RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
156
155
  grpc_pollset_set* interested_parties_; // Do not own.
157
156
  RefCountedPtr<channelz::SubchannelNode> channelz_node_;
157
+ MemoryAllocator call_allocator_;
158
158
 
159
159
  Mutex mu_;
160
160
  RefCountedPtr<ConnectivityStateWatcherInterface> watcher_
@@ -30,7 +30,6 @@
30
30
  #include <grpc/support/string_util.h>
31
31
 
32
32
  #include "src/core/ext/filters/client_channel/client_channel.h"
33
- #include "src/core/ext/filters/client_channel/resolver_registry.h"
34
33
  #include "src/core/lib/channel/channel_args.h"
35
34
  #include "src/core/lib/channel/handshaker.h"
36
35
  #include "src/core/lib/channel/handshaker_registry.h"
@@ -39,6 +38,7 @@
39
38
  #include "src/core/lib/gprpp/sync.h"
40
39
  #include "src/core/lib/http/format_request.h"
41
40
  #include "src/core/lib/http/parser.h"
41
+ #include "src/core/lib/resolver/resolver_registry.h"
42
42
  #include "src/core/lib/slice/slice_internal.h"
43
43
  #include "src/core/lib/uri/uri_parser.h"
44
44
 
@@ -69,10 +69,11 @@ MakeHierarchicalPathAttribute(std::vector<std::string> path) {
69
69
  return absl::make_unique<HierarchicalPathAttribute>(std::move(path));
70
70
  }
71
71
 
72
- HierarchicalAddressMap MakeHierarchicalAddressMap(
73
- const ServerAddressList& addresses) {
72
+ absl::StatusOr<HierarchicalAddressMap> MakeHierarchicalAddressMap(
73
+ const absl::StatusOr<ServerAddressList>& addresses) {
74
+ if (!addresses.ok()) return addresses.status();
74
75
  HierarchicalAddressMap result;
75
- for (const ServerAddress& address : addresses) {
76
+ for (const ServerAddress& address : *addresses) {
76
77
  const HierarchicalPathAttribute* path_attribute =
77
78
  static_cast<const HierarchicalPathAttribute*>(
78
79
  address.GetAttribute(kHierarchicalPathAttributeKey));
@@ -23,7 +23,9 @@
23
23
  #include <string>
24
24
  #include <vector>
25
25
 
26
- #include "src/core/ext/filters/client_channel/server_address.h"
26
+ #include "absl/status/statusor.h"
27
+
28
+ #include "src/core/lib/resolver/server_address.h"
27
29
 
28
30
  // The resolver returns a flat list of addresses. When a hierarchy of
29
31
  // LB policies is in use, each leaf of the hierarchy will need a
@@ -92,10 +94,9 @@ MakeHierarchicalPathAttribute(std::vector<std::string> path);
92
94
  using HierarchicalAddressMap = std::map<std::string, ServerAddressList>;
93
95
 
94
96
  // Splits up the addresses into a separate list for each child.
95
- HierarchicalAddressMap MakeHierarchicalAddressMap(
96
- const ServerAddressList& addresses);
97
+ absl::StatusOr<HierarchicalAddressMap> MakeHierarchicalAddressMap(
98
+ const absl::StatusOr<ServerAddressList>& addresses);
97
99
 
98
100
  } // namespace grpc_core
99
101
 
100
- #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_ADDRESS_FILTERING_H \
101
- */
102
+ #endif // GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_ADDRESS_FILTERING_H
@@ -102,14 +102,10 @@ static void clr_start_transport_stream_op_batch(
102
102
  if (batch->send_initial_metadata) {
103
103
  // Grab client stats object from metadata.
104
104
  auto client_stats_md =
105
- batch->payload->send_initial_metadata.send_initial_metadata->Remove(
106
- grpc_slice_from_static_string(
107
- grpc_core::kGrpcLbClientStatsMetadataKey));
105
+ batch->payload->send_initial_metadata.send_initial_metadata->Take(
106
+ grpc_core::GrpcLbClientStatsMetadata());
108
107
  if (client_stats_md.has_value()) {
109
- grpc_core::GrpcLbClientStats* client_stats =
110
- const_cast<grpc_core::GrpcLbClientStats*>(
111
- reinterpret_cast<const grpc_core::GrpcLbClientStats*>(
112
- GRPC_SLICE_START_PTR(*client_stats_md)));
108
+ grpc_core::GrpcLbClientStats* client_stats = *client_stats_md;
113
109
  if (client_stats != nullptr) {
114
110
  calld->client_stats.reset(client_stats);
115
111
  // Intercept completion.