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
@@ -33,18 +33,14 @@ void grpc_create_socketpair_if_unix(int /* sv */[2]) {
33
33
  GPR_ASSERT(0);
34
34
  }
35
35
 
36
- grpc_error_handle grpc_resolve_unix_domain_address(
37
- absl::string_view /* name */, grpc_resolved_addresses** addresses) {
38
- *addresses = NULL;
39
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
40
- "Unix domain sockets are not supported on Windows");
36
+ absl::StatusOr<std::vector<grpc_resolved_address>>
37
+ grpc_resolve_unix_domain_address(absl::string_view /* name */) {
38
+ return absl::UnknownError("Unix domain sockets are not supported on Windows");
41
39
  }
42
40
 
43
- grpc_error_handle grpc_resolve_unix_abstract_domain_address(
44
- absl::string_view, grpc_resolved_addresses** addresses) {
45
- *addresses = NULL;
46
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
47
- "Unix domain sockets are not supported on Windows");
41
+ absl::StatusOr<std::vector<grpc_resolved_address>>
42
+ grpc_resolve_unix_abstract_domain_address(absl::string_view /* name */) {
43
+ return absl::UnknownError("Unix domain sockets are not supported on Windows");
48
44
  }
49
45
 
50
46
  int grpc_is_unix_socket(const grpc_resolved_address* /* addr */) {
@@ -54,9 +50,4 @@ int grpc_is_unix_socket(const grpc_resolved_address* /* addr */) {
54
50
  void grpc_unlink_if_unix_domain_socket(
55
51
  const grpc_resolved_address* /* addr */) {}
56
52
 
57
- std::string grpc_sockaddr_to_uri_unix_if_possible(
58
- const grpc_resolved_address* /* addr */) {
59
- return "";
60
- }
61
-
62
53
  #endif
@@ -291,7 +291,7 @@ bool HeaderMatcher::Match(
291
291
  match = value.has_value() == present_match_;
292
292
  } else if (!value.has_value()) {
293
293
  // All other types fail to match if field is not present.
294
- match = false;
294
+ return false;
295
295
  } else if (type_ == Type::kRange) {
296
296
  int64_t int_value;
297
297
  match = absl::SimpleAtoi(value.value(), &int_value) &&
@@ -24,6 +24,7 @@
24
24
  #include <atomic>
25
25
  #include <functional>
26
26
  #include <memory>
27
+ #include <type_traits>
27
28
  #include <utility>
28
29
 
29
30
  #include "absl/base/thread_annotations.h"
@@ -267,6 +268,8 @@ namespace promise_detail {
267
268
  template <typename Context>
268
269
  class ContextHolder {
269
270
  public:
271
+ using ContextType = Context;
272
+
270
273
  explicit ContextHolder(Context value) : value_(std::move(value)) {}
271
274
  Context* GetContext() { return &value_; }
272
275
 
@@ -277,6 +280,8 @@ class ContextHolder {
277
280
  template <typename Context>
278
281
  class ContextHolder<Context*> {
279
282
  public:
283
+ using ContextType = Context;
284
+
280
285
  explicit ContextHolder(Context* value) : value_(value) {}
281
286
  Context* GetContext() { return value_; }
282
287
 
@@ -284,11 +289,35 @@ class ContextHolder<Context*> {
284
289
  Context* value_;
285
290
  };
286
291
 
292
+ template <typename Context, typename Deleter>
293
+ class ContextHolder<std::unique_ptr<Context, Deleter>> {
294
+ public:
295
+ using ContextType = Context;
296
+
297
+ explicit ContextHolder(std::unique_ptr<Context, Deleter> value)
298
+ : value_(std::move(value)) {}
299
+ Context* GetContext() { return value_.get(); }
300
+
301
+ private:
302
+ std::unique_ptr<Context, Deleter> value_;
303
+ };
304
+
305
+ template <typename HeldContext>
306
+ using ContextTypeFromHeld = typename ContextHolder<HeldContext>::ContextType;
307
+
287
308
  template <typename... Contexts>
288
- class EnterContexts : public promise_detail::Context<Contexts>... {
309
+ class ActivityContexts : public ContextHolder<Contexts>... {
289
310
  public:
290
- explicit EnterContexts(Contexts*... contexts)
291
- : promise_detail::Context<Contexts>(contexts)... {}
311
+ explicit ActivityContexts(Contexts&&... contexts)
312
+ : ContextHolder<Contexts>(std::forward<Contexts>(contexts))... {}
313
+
314
+ class ScopedContext : public Context<ContextTypeFromHeld<Contexts>>... {
315
+ public:
316
+ explicit ScopedContext(ActivityContexts* contexts)
317
+ : Context<ContextTypeFromHeld<Contexts>>(
318
+ static_cast<ContextHolder<Contexts>*>(contexts)
319
+ ->GetContext())... {}
320
+ };
292
321
  };
293
322
 
294
323
  // Implementation details for an Activity of an arbitrary type of promise.
@@ -303,15 +332,14 @@ class EnterContexts : public promise_detail::Context<Contexts>... {
303
332
  // invoked, and that a given activity will not be concurrently scheduled again
304
333
  // until its RunScheduledWakeup() has been invoked.
305
334
  template <class F, class WakeupScheduler, class OnDone, typename... Contexts>
306
- class PromiseActivity final
307
- : public Activity,
308
- private promise_detail::ContextHolder<Contexts>... {
335
+ class PromiseActivity final : public Activity,
336
+ private ActivityContexts<Contexts...> {
309
337
  public:
310
338
  using Factory = PromiseFactory<void, F>;
311
339
  PromiseActivity(F promise_factory, WakeupScheduler wakeup_scheduler,
312
- OnDone on_done, Contexts... contexts)
340
+ OnDone on_done, Contexts&&... contexts)
313
341
  : Activity(),
314
- ContextHolder<Contexts>(std::move(contexts))...,
342
+ ActivityContexts<Contexts...>(std::forward<Contexts>(contexts)...),
315
343
  wakeup_scheduler_(std::move(wakeup_scheduler)),
316
344
  on_done_(std::move(on_done)) {
317
345
  // Lock, construct an initial promise from the factory, and step it.
@@ -361,6 +389,8 @@ class PromiseActivity final
361
389
  }
362
390
 
363
391
  private:
392
+ using typename ActivityContexts<Contexts...>::ScopedContext;
393
+
364
394
  // Wakeup this activity. Arrange to poll the activity again at a convenient
365
395
  // time: this could be inline if it's deemed safe, or it could be by passing
366
396
  // the activity to an external threadpool to run. If the activity is already
@@ -412,28 +442,27 @@ class PromiseActivity final
412
442
  }
413
443
 
414
444
  // The main body of a step: set the current activity, and any contexts, and
415
- // then run the main polling loop. Contained in a function by itself in order
416
- // to keep the scoping rules a little easier in Step().
445
+ // then run the main polling loop. Contained in a function by itself in
446
+ // order to keep the scoping rules a little easier in Step().
417
447
  absl::optional<absl::Status> RunStep() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_) {
418
448
  ScopedActivity scoped_activity(this);
419
- EnterContexts<Contexts...> contexts(
420
- static_cast<ContextHolder<Contexts>*>(this)->GetContext()...);
449
+ ScopedContext contexts(this);
421
450
  return StepLoop();
422
451
  }
423
452
 
424
- // Similarly to RunStep, but additionally construct the promise from a promise
425
- // factory before entering the main loop. Called once from the constructor.
453
+ // Similarly to RunStep, but additionally construct the promise from a
454
+ // promise factory before entering the main loop. Called once from the
455
+ // constructor.
426
456
  absl::optional<absl::Status> Start(Factory promise_factory)
427
457
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_) {
428
458
  ScopedActivity scoped_activity(this);
429
- EnterContexts<Contexts...> contexts(
430
- static_cast<ContextHolder<Contexts>*>(this)->GetContext()...);
459
+ ScopedContext contexts(this);
431
460
  Construct(&promise_holder_.promise, promise_factory.Once());
432
461
  return StepLoop();
433
462
  }
434
463
 
435
- // Until there are no wakeups from within and the promise is incomplete: poll
436
- // the promise.
464
+ // Until there are no wakeups from within and the promise is incomplete:
465
+ // poll the promise.
437
466
  absl::optional<absl::Status> StepLoop() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_) {
438
467
  GPR_ASSERT(is_current());
439
468
  while (true) {
@@ -486,12 +515,12 @@ template <typename Factory, typename WakeupScheduler, typename OnDone,
486
515
  typename... Contexts>
487
516
  ActivityPtr MakeActivity(Factory promise_factory,
488
517
  WakeupScheduler wakeup_scheduler, OnDone on_done,
489
- Contexts... contexts) {
518
+ Contexts&&... contexts) {
490
519
  return ActivityPtr(
491
520
  new promise_detail::PromiseActivity<Factory, WakeupScheduler, OnDone,
492
521
  Contexts...>(
493
522
  std::move(promise_factory), std::move(wakeup_scheduler),
494
- std::move(on_done), std::move(contexts)...));
523
+ std::move(on_done), std::forward<Contexts>(contexts)...));
495
524
  }
496
525
 
497
526
  } // namespace grpc_core
@@ -41,4 +41,9 @@ inline absl::Status IntoStatus(absl::Status* status) {
41
41
  } // namespace promise_detail
42
42
  } // namespace grpc_core
43
43
 
44
+ // Return true if the status represented by the argument is ok, false if not.
45
+ // By implementing this function for other, non-absl::Status types, those types
46
+ // can participate in TrySeq as result types that affect control flow.
47
+ inline bool IsStatusOk(const absl::Status& status) { return status.ok(); }
48
+
44
49
  #endif // GRPC_CORE_LIB_PROMISE_DETAIL_STATUS_H
@@ -18,7 +18,7 @@
18
18
 
19
19
  #include <grpc/support/port_platform.h>
20
20
 
21
- #include "src/core/ext/filters/client_channel/resolver.h"
21
+ #include "src/core/lib/resolver/resolver.h"
22
22
 
23
23
  grpc_core::DebugOnlyTraceFlag grpc_trace_resolver_refcount(false,
24
24
  "resolver_refcount");
@@ -38,35 +38,28 @@ Resolver::Resolver()
38
38
  // Resolver::Result
39
39
  //
40
40
 
41
- Resolver::Result::~Result() {
42
- GRPC_ERROR_UNREF(service_config_error);
43
- grpc_channel_args_destroy(args);
44
- }
41
+ Resolver::Result::~Result() { grpc_channel_args_destroy(args); }
45
42
 
46
- Resolver::Result::Result(const Result& other) {
47
- addresses = other.addresses;
48
- service_config = other.service_config;
49
- service_config_error = GRPC_ERROR_REF(other.service_config_error);
50
- args = grpc_channel_args_copy(other.args);
51
- }
43
+ Resolver::Result::Result(const Result& other)
44
+ : addresses(other.addresses),
45
+ service_config(other.service_config),
46
+ resolution_note(other.resolution_note),
47
+ args(grpc_channel_args_copy(other.args)) {}
52
48
 
53
- Resolver::Result::Result(Result&& other) noexcept {
54
- addresses = std::move(other.addresses);
55
- service_config = std::move(other.service_config);
56
- service_config_error = other.service_config_error;
57
- other.service_config_error = GRPC_ERROR_NONE;
58
- args = other.args;
49
+ Resolver::Result::Result(Result&& other) noexcept
50
+ : addresses(std::move(other.addresses)),
51
+ service_config(std::move(other.service_config)),
52
+ resolution_note(std::move(other.resolution_note)),
53
+ // TODO(roth): Use std::move() once channel args is converted to C++.
54
+ args(other.args) {
59
55
  other.args = nullptr;
60
56
  }
61
57
 
62
58
  Resolver::Result& Resolver::Result::operator=(const Result& other) {
63
- if (&other == this) {
64
- return *this;
65
- }
59
+ if (&other == this) return *this;
66
60
  addresses = other.addresses;
67
61
  service_config = other.service_config;
68
- GRPC_ERROR_UNREF(service_config_error);
69
- service_config_error = GRPC_ERROR_REF(other.service_config_error);
62
+ resolution_note = other.resolution_note;
70
63
  grpc_channel_args_destroy(args);
71
64
  args = grpc_channel_args_copy(other.args);
72
65
  return *this;
@@ -75,9 +68,8 @@ Resolver::Result& Resolver::Result::operator=(const Result& other) {
75
68
  Resolver::Result& Resolver::Result::operator=(Result&& other) noexcept {
76
69
  addresses = std::move(other.addresses);
77
70
  service_config = std::move(other.service_config);
78
- GRPC_ERROR_UNREF(service_config_error);
79
- service_config_error = other.service_config_error;
80
- other.service_config_error = GRPC_ERROR_NONE;
71
+ resolution_note = std::move(other.resolution_note);
72
+ // TODO(roth): Use std::move() once channel args is converted to C++.
81
73
  grpc_channel_args_destroy(args);
82
74
  args = other.args;
83
75
  other.args = nullptr;
@@ -1,34 +1,32 @@
1
- /*
2
- *
3
- * Copyright 2015 gRPC authors.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- *
17
- */
18
-
19
- #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_H
20
- #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_H
1
+ //
2
+ // Copyright 2015 gRPC authors.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
16
+
17
+ #ifndef GRPC_CORE_LIB_RESOLVER_RESOLVER_H
18
+ #define GRPC_CORE_LIB_RESOLVER_RESOLVER_H
21
19
 
22
20
  #include <grpc/support/port_platform.h>
23
21
 
22
+ #include "absl/status/statusor.h"
23
+
24
24
  #include <grpc/impl/codegen/grpc_types.h>
25
25
 
26
- #include "src/core/ext/filters/client_channel/server_address.h"
27
- #include "src/core/ext/service_config/service_config.h"
28
26
  #include "src/core/lib/gprpp/orphanable.h"
29
27
  #include "src/core/lib/gprpp/ref_counted_ptr.h"
30
- #include "src/core/lib/iomgr/iomgr.h"
31
- #include "src/core/lib/iomgr/work_serializer.h"
28
+ #include "src/core/lib/resolver/server_address.h"
29
+ #include "src/core/lib/service_config/service_config.h"
32
30
 
33
31
  extern grpc_core::DebugOnlyTraceFlag grpc_trace_resolver_refcount;
34
32
 
@@ -53,13 +51,23 @@ class Resolver : public InternallyRefCounted<Resolver> {
53
51
  public:
54
52
  /// Results returned by the resolver.
55
53
  struct Result {
56
- ServerAddressList addresses;
57
- RefCountedPtr<ServiceConfig> service_config;
58
- grpc_error_handle service_config_error = GRPC_ERROR_NONE;
54
+ /// A list of addresses, or an error.
55
+ absl::StatusOr<ServerAddressList> addresses;
56
+ /// A service config, or an error.
57
+ absl::StatusOr<RefCountedPtr<ServiceConfig>> service_config = nullptr;
58
+ /// An optional human-readable note describing context about the resolution,
59
+ /// to be passed along to the LB policy for inclusion in RPC failure status
60
+ /// messages in cases where neither \a addresses nor \a service_config
61
+ /// has a non-OK status. For example, a resolver that returns an empty
62
+ /// address list but a valid service config may set to this to something
63
+ /// like "no DNS entries found for <name>".
64
+ std::string resolution_note;
65
+ // TODO(roth): Before making this a public API, figure out a way to
66
+ // avoid exposing channel args this way.
59
67
  const grpc_channel_args* args = nullptr;
60
68
 
61
- // TODO(roth): Remove everything below once grpc_error and
62
- // grpc_channel_args are convert to copyable and movable C++ objects.
69
+ // TODO(roth): Remove everything below once grpc_channel_args is
70
+ // converted to a copyable and movable C++ object.
63
71
  Result() = default;
64
72
  ~Result();
65
73
  Result(const Result& other);
@@ -74,17 +82,11 @@ class Resolver : public InternallyRefCounted<Resolver> {
74
82
  public:
75
83
  virtual ~ResultHandler() {}
76
84
 
77
- /// Returns a result to the channel.
78
- /// Takes ownership of \a result.args.
79
- virtual void ReturnResult(Result result) = 0; // NOLINT
80
-
81
- /// Returns a transient error to the channel.
82
- /// If the resolver does not set the GRPC_ERROR_INT_GRPC_STATUS
83
- /// attribute on the error, calls will be failed with status UNKNOWN.
84
- virtual void ReturnError(grpc_error_handle error) = 0;
85
-
86
- // TODO(yashkt): As part of the service config error handling
87
- // changes, add a method to parse the service config JSON string.
85
+ /// Reports a result to the channel.
86
+ // TODO(roth): Add a mechanism for the resolver to get back a signal
87
+ // indicating if the result was accepted by the LB policy, so that it
88
+ // knows whether to go into backoff to retry to resolution.
89
+ virtual void ReportResult(Result result) = 0; // NOLINT
88
90
  };
89
91
 
90
92
  // Not copyable nor movable.
@@ -113,9 +115,6 @@ class Resolver : public InternallyRefCounted<Resolver> {
113
115
  /// Resets the re-resolution backoff, if any.
114
116
  /// This needs to be implemented only by pull-based implementations;
115
117
  /// for push-based implementations, it will be a no-op.
116
- /// TODO(roth): Pull the backoff code out of resolver and into
117
- /// client_channel, so that it can be shared across resolver
118
- /// implementations. At that point, this method can go away.
119
118
  virtual void ResetBackoffLocked() {}
120
119
 
121
120
  // Note: This must be invoked while holding the work_serializer.
@@ -133,4 +132,4 @@ class Resolver : public InternallyRefCounted<Resolver> {
133
132
 
134
133
  } // namespace grpc_core
135
134
 
136
- #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_H */
135
+ #endif // GRPC_CORE_LIB_RESOLVER_RESOLVER_H
@@ -16,8 +16,8 @@
16
16
  *
17
17
  */
18
18
 
19
- #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FACTORY_H
20
- #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FACTORY_H
19
+ #ifndef GRPC_CORE_LIB_RESOLVER_RESOLVER_FACTORY_H
20
+ #define GRPC_CORE_LIB_RESOLVER_RESOLVER_FACTORY_H
21
21
 
22
22
  #include <grpc/support/port_platform.h>
23
23
 
@@ -25,14 +25,19 @@
25
25
 
26
26
  #include <grpc/support/string_util.h>
27
27
 
28
- #include "src/core/ext/filters/client_channel/resolver.h"
29
28
  #include "src/core/lib/gprpp/memory.h"
30
29
  #include "src/core/lib/gprpp/orphanable.h"
31
- #include "src/core/lib/iomgr/pollset_set.h"
30
+ #include "src/core/lib/resolver/resolver.h"
32
31
  #include "src/core/lib/uri/uri_parser.h"
33
32
 
33
+ typedef struct grpc_pollset_set grpc_pollset_set;
34
+
34
35
  namespace grpc_core {
35
36
 
37
+ // TODO(yashkt): Move WorkSerializer to its own Bazel target, depend on that
38
+ // target from this one, and remove this forward declaration.
39
+ class WorkSerializer;
40
+
36
41
  struct ResolverArgs {
37
42
  /// The parsed URI to resolve.
38
43
  URI uri;
@@ -72,4 +77,4 @@ class ResolverFactory {
72
77
 
73
78
  } // namespace grpc_core
74
79
 
75
- #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_FACTORY_H */
80
+ #endif /* GRPC_CORE_LIB_RESOLVER_RESOLVER_FACTORY_H */
@@ -18,11 +18,12 @@
18
18
 
19
19
  #include <grpc/support/port_platform.h>
20
20
 
21
- #include "src/core/ext/filters/client_channel/resolver_registry.h"
21
+ #include "src/core/lib/resolver/resolver_registry.h"
22
22
 
23
23
  #include <string.h>
24
24
 
25
- #include "absl/container/inlined_vector.h"
25
+ #include <vector>
26
+
26
27
  #include "absl/strings/str_cat.h"
27
28
  #include "absl/strings/str_format.h"
28
29
 
@@ -16,15 +16,14 @@
16
16
  *
17
17
  */
18
18
 
19
- #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H
20
- #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H
19
+ #ifndef GRPC_CORE_LIB_RESOLVER_RESOLVER_REGISTRY_H
20
+ #define GRPC_CORE_LIB_RESOLVER_RESOLVER_REGISTRY_H
21
21
 
22
22
  #include <grpc/support/port_platform.h>
23
23
 
24
- #include "src/core/ext/filters/client_channel/resolver_factory.h"
25
24
  #include "src/core/lib/gprpp/memory.h"
26
25
  #include "src/core/lib/gprpp/orphanable.h"
27
- #include "src/core/lib/iomgr/pollset_set.h"
26
+ #include "src/core/lib/resolver/resolver_factory.h"
28
27
 
29
28
  namespace grpc_core {
30
29
 
@@ -85,4 +84,4 @@ class ResolverRegistry {
85
84
 
86
85
  } // namespace grpc_core
87
86
 
88
- #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H */
87
+ #endif /* GRPC_CORE_LIB_RESOLVER_RESOLVER_REGISTRY_H */
@@ -18,7 +18,7 @@
18
18
 
19
19
  #include <grpc/support/port_platform.h>
20
20
 
21
- #include "src/core/ext/filters/client_channel/server_address.h"
21
+ #include "src/core/lib/resolver/server_address.h"
22
22
 
23
23
  #include <memory>
24
24
  #include <string>
@@ -16,8 +16,8 @@
16
16
  *
17
17
  */
18
18
 
19
- #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_SERVER_ADDRESS_H
20
- #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_SERVER_ADDRESS_H
19
+ #ifndef GRPC_CORE_LIB_RESOLVER_SERVER_ADDRESS_H
20
+ #define GRPC_CORE_LIB_RESOLVER_SERVER_ADDRESS_H
21
21
 
22
22
  #include <grpc/support/port_platform.h>
23
23
 
@@ -29,7 +29,7 @@
29
29
 
30
30
  #include "src/core/lib/channel/channel_args.h"
31
31
  #include "src/core/lib/gpr/useful.h"
32
- #include "src/core/lib/iomgr/resolve_address.h"
32
+ #include "src/core/lib/iomgr/resolved_address.h"
33
33
 
34
34
  namespace grpc_core {
35
35
 
@@ -141,4 +141,4 @@ class ServerAddressWeightAttribute : public ServerAddress::AttributeInterface {
141
141
 
142
142
  } // namespace grpc_core
143
143
 
144
- #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_SERVER_ADDRESS_H */
144
+ #endif /* GRPC_CORE_LIB_RESOLVER_SERVER_ADDRESS_H */
@@ -27,7 +27,6 @@ namespace grpc_core {
27
27
 
28
28
  // TODO(ctiller): This is a hack. We need to do real accounting instead of
29
29
  // hard coding.
30
- constexpr size_t kResourceQuotaCallSize = 15 * 1024;
31
30
  constexpr size_t kResourceQuotaChannelSize = 50 * 1024;
32
31
 
33
32
  // Retrieve the resource quota from the channel args.
@@ -18,7 +18,7 @@
18
18
 
19
19
  #include <grpc/support/port_platform.h>
20
20
 
21
- #include "src/core/lib/gprpp/arena.h"
21
+ #include "src/core/lib/resource_quota/arena.h"
22
22
 
23
23
  #include <string.h>
24
24
 
@@ -61,22 +61,24 @@ Arena::~Arena() {
61
61
  }
62
62
  }
63
63
 
64
- Arena* Arena::Create(size_t initial_size) {
65
- return new (ArenaStorage(initial_size)) Arena(initial_size);
64
+ Arena* Arena::Create(size_t initial_size, MemoryAllocator* memory_allocator) {
65
+ return new (ArenaStorage(initial_size))
66
+ Arena(initial_size, 0, memory_allocator);
66
67
  }
67
68
 
68
- std::pair<Arena*, void*> Arena::CreateWithAlloc(size_t initial_size,
69
- size_t alloc_size) {
69
+ std::pair<Arena*, void*> Arena::CreateWithAlloc(
70
+ size_t initial_size, size_t alloc_size, MemoryAllocator* memory_allocator) {
70
71
  static constexpr size_t base_size =
71
72
  GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(Arena));
72
- auto* new_arena =
73
- new (ArenaStorage(initial_size)) Arena(initial_size, alloc_size);
73
+ auto* new_arena = new (ArenaStorage(initial_size))
74
+ Arena(initial_size, alloc_size, memory_allocator);
74
75
  void* first_alloc = reinterpret_cast<char*>(new_arena) + base_size;
75
76
  return std::make_pair(new_arena, first_alloc);
76
77
  }
77
78
 
78
79
  size_t Arena::Destroy() {
79
80
  size_t size = total_used_.load(std::memory_order_relaxed);
81
+ memory_allocator_->Release(total_allocated_.load(std::memory_order_relaxed));
80
82
  this->~Arena();
81
83
  gpr_free_aligned(this);
82
84
  return size;
@@ -91,13 +93,14 @@ void* Arena::AllocZone(size_t size) {
91
93
  static constexpr size_t zone_base_size =
92
94
  GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(Zone));
93
95
  size_t alloc_size = zone_base_size + size;
96
+ memory_allocator_->Reserve(alloc_size);
97
+ total_allocated_.fetch_add(alloc_size, std::memory_order_relaxed);
94
98
  Zone* z = new (gpr_malloc_aligned(alloc_size, GPR_MAX_ALIGNMENT)) Zone();
95
- {
96
- gpr_spinlock_lock(&arena_growth_spinlock_);
97
- z->prev = last_zone_;
98
- last_zone_ = z;
99
- gpr_spinlock_unlock(&arena_growth_spinlock_);
100
- }
99
+ auto* prev = last_zone_.load(std::memory_order_relaxed);
100
+ do {
101
+ z->prev = prev;
102
+ } while (!last_zone_.compare_exchange_weak(prev, z, std::memory_order_relaxed,
103
+ std::memory_order_relaxed));
101
104
  return reinterpret_cast<char*>(z) + zone_base_size;
102
105
  }
103
106