grpc 1.34.0 → 1.37.0

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

Potentially problematic release.


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

Files changed (806) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +893 -2840
  3. data/etc/roots.pem +257 -573
  4. data/include/grpc/compression.h +1 -1
  5. data/include/grpc/grpc.h +28 -0
  6. data/include/grpc/grpc_security.h +77 -14
  7. data/include/grpc/impl/codegen/atm_windows.h +4 -0
  8. data/include/grpc/impl/codegen/byte_buffer.h +1 -1
  9. data/include/grpc/impl/codegen/grpc_types.h +1 -1
  10. data/include/grpc/impl/codegen/log.h +0 -2
  11. data/include/grpc/impl/codegen/port_platform.h +2 -0
  12. data/include/grpc/impl/codegen/sync_windows.h +4 -0
  13. data/include/grpc/slice_buffer.h +3 -3
  14. data/include/grpc/support/sync.h +3 -3
  15. data/include/grpc/support/time.h +7 -7
  16. data/src/core/ext/filters/client_channel/backend_metric.cc +2 -4
  17. data/src/core/ext/filters/client_channel/client_channel.cc +2823 -1559
  18. data/src/core/ext/filters/client_channel/client_channel.h +0 -6
  19. data/src/core/ext/filters/client_channel/client_channel_factory.h +2 -1
  20. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +1 -1
  21. data/src/core/ext/filters/client_channel/config_selector.h +13 -1
  22. data/src/core/ext/filters/client_channel/dynamic_filters.cc +191 -0
  23. data/src/core/ext/filters/client_channel/dynamic_filters.h +99 -0
  24. data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +24 -142
  25. data/src/core/ext/filters/client_channel/global_subchannel_pool.h +15 -10
  26. data/src/core/ext/filters/client_channel/health/health_check_client.cc +6 -6
  27. data/src/core/ext/filters/client_channel/health/health_check_client.h +2 -2
  28. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +6 -7
  29. data/src/core/ext/filters/client_channel/http_proxy.cc +21 -20
  30. data/src/core/ext/filters/client_channel/lb_policy.cc +4 -1
  31. data/src/core/ext/filters/client_channel/lb_policy.h +2 -3
  32. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +35 -35
  33. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +1 -2
  34. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +1 -2
  35. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +3 -3
  36. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +1 -1
  37. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +1 -1
  38. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +8 -6
  39. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +23 -0
  40. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +27 -0
  41. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +369 -108
  42. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +0 -8
  43. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +29 -0
  44. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +13 -27
  45. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +2 -2
  46. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +1384 -0
  47. data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +27 -67
  48. data/src/core/ext/filters/client_channel/local_subchannel_pool.h +10 -9
  49. data/src/core/ext/filters/client_channel/resolver.cc +5 -5
  50. data/src/core/ext/filters/client_channel/resolver.h +1 -12
  51. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +41 -57
  52. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +1 -32
  53. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +4 -4
  54. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +3 -1
  55. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +444 -22
  56. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +5 -0
  57. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +21 -22
  58. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +20 -17
  59. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +377 -0
  60. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +21 -34
  61. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +310 -160
  62. data/src/core/ext/filters/client_channel/resolver_factory.h +6 -6
  63. data/src/core/ext/filters/client_channel/resolver_registry.cc +40 -39
  64. data/src/core/ext/filters/client_channel/resolver_registry.h +2 -2
  65. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +11 -13
  66. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +8 -8
  67. data/src/core/ext/filters/client_channel/retry_throttle.cc +5 -3
  68. data/src/core/ext/filters/client_channel/retry_throttle.h +3 -1
  69. data/src/core/ext/filters/client_channel/server_address.cc +9 -0
  70. data/src/core/ext/filters/client_channel/server_address.h +31 -0
  71. data/src/core/ext/filters/client_channel/service_config_call_data.h +19 -1
  72. data/src/core/ext/filters/client_channel/subchannel.cc +100 -193
  73. data/src/core/ext/filters/client_channel/subchannel.h +73 -111
  74. data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +16 -2
  75. data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +10 -8
  76. data/src/core/ext/filters/client_idle/client_idle_filter.cc +1 -1
  77. data/src/core/ext/filters/deadline/deadline_filter.cc +4 -2
  78. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +495 -0
  79. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +39 -0
  80. data/src/core/ext/filters/fault_injection/service_config_parser.cc +189 -0
  81. data/src/core/ext/filters/fault_injection/service_config_parser.h +85 -0
  82. data/src/core/ext/filters/http/client_authority_filter.cc +6 -6
  83. data/src/core/ext/filters/http/http_filters_plugin.cc +6 -3
  84. data/src/core/ext/filters/max_age/max_age_filter.cc +35 -32
  85. data/src/core/ext/filters/message_size/message_size_filter.cc +1 -1
  86. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +1 -1
  87. data/src/core/ext/filters/workarounds/workaround_utils.cc +1 -1
  88. data/src/core/ext/transport/chttp2/client/authority.cc +3 -3
  89. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -2
  90. data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +23 -10
  91. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +21 -10
  92. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +29 -16
  93. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +623 -219
  94. data/src/core/ext/transport/chttp2/server/chttp2_server.h +11 -2
  95. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +11 -1
  96. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +12 -5
  97. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +62 -18
  98. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +46 -15
  99. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +12 -1
  100. data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -1
  101. data/src/core/ext/transport/chttp2/transport/frame_data.cc +5 -1
  102. data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -1
  103. data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +6 -6
  104. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +1 -1
  105. data/src/core/ext/transport/chttp2/transport/internal.h +1 -0
  106. data/src/core/ext/transport/chttp2/transport/writing.cc +1 -1
  107. data/src/core/ext/transport/inproc/inproc_transport.cc +42 -8
  108. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +406 -0
  109. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +1459 -0
  110. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +1 -0
  111. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +1 -1
  112. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +7 -0
  113. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +27 -28
  114. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +139 -40
  115. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +350 -0
  116. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +1348 -0
  117. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +13 -13
  118. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +44 -17
  119. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +119 -124
  120. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +450 -284
  121. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +3 -3
  122. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +13 -5
  123. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +24 -23
  124. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +62 -21
  125. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +21 -21
  126. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +88 -39
  127. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +4 -4
  128. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +15 -6
  129. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +69 -45
  130. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +275 -78
  131. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +19 -19
  132. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +80 -43
  133. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +1 -1
  134. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +7 -0
  135. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +7 -7
  136. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +27 -11
  137. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +30 -30
  138. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +136 -49
  139. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +41 -41
  140. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +172 -89
  141. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +4 -4
  142. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +17 -9
  143. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +53 -47
  144. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +188 -78
  145. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +1 -2
  146. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +7 -0
  147. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +2 -2
  148. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +9 -2
  149. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +11 -5
  150. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +48 -7
  151. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +13 -14
  152. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +59 -36
  153. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +16 -16
  154. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +61 -29
  155. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +26 -26
  156. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +101 -66
  157. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +2 -2
  158. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +11 -3
  159. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +34 -32
  160. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +151 -61
  161. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +33 -29
  162. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +138 -54
  163. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +2 -3
  164. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +13 -0
  165. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +144 -0
  166. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +488 -0
  167. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +141 -0
  168. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +452 -0
  169. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +16 -16
  170. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +81 -35
  171. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +15 -13
  172. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +70 -37
  173. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +257 -216
  174. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +995 -495
  175. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +5 -5
  176. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +26 -6
  177. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +3 -4
  178. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +17 -3
  179. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.c +29 -0
  180. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +67 -0
  181. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +79 -0
  182. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +268 -0
  183. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +78 -0
  184. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +281 -0
  185. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +41 -0
  186. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +113 -0
  187. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +96 -98
  188. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +378 -226
  189. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +0 -1
  190. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +1 -0
  191. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +28 -25
  192. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +124 -53
  193. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +9 -12
  194. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +29 -24
  195. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +32 -33
  196. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +118 -67
  197. data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.c +1 -1
  198. data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.h +7 -0
  199. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.c +1 -1
  200. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +7 -0
  201. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +51 -44
  202. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +179 -129
  203. data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.c +1 -4
  204. data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.h +7 -0
  205. data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.c +1 -4
  206. data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.h +7 -0
  207. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +7 -8
  208. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +31 -16
  209. data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.c +1 -3
  210. data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.h +7 -0
  211. data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.c +1 -1
  212. data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.h +7 -0
  213. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +93 -0
  214. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +323 -0
  215. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +5 -5
  216. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +25 -11
  217. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +36 -0
  218. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +90 -0
  219. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +1 -1
  220. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +7 -0
  221. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +1 -1
  222. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +7 -0
  223. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +6 -6
  224. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +29 -8
  225. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +2 -3
  226. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +16 -3
  227. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +46 -0
  228. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +124 -0
  229. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +3 -3
  230. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +19 -0
  231. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +7 -7
  232. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +46 -3
  233. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +8 -8
  234. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +41 -8
  235. data/src/core/ext/upb-generated/envoy/type/v3/http.upb.h +1 -0
  236. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +3 -3
  237. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +15 -2
  238. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +3 -3
  239. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +19 -0
  240. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.c +1 -1
  241. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +7 -0
  242. data/src/core/ext/upb-generated/google/api/annotations.upb.h +1 -0
  243. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +34 -34
  244. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +149 -72
  245. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +54 -37
  246. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +171 -59
  247. data/src/core/ext/upb-generated/google/api/http.upb.c +3 -3
  248. data/src/core/ext/upb-generated/google/api/http.upb.h +25 -6
  249. data/src/core/ext/upb-generated/google/protobuf/any.upb.c +1 -1
  250. data/src/core/ext/upb-generated/google/protobuf/any.upb.h +7 -0
  251. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +90 -90
  252. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +455 -292
  253. data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +1 -1
  254. data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +7 -0
  255. data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +1 -1
  256. data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +7 -0
  257. data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +4 -4
  258. data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +22 -3
  259. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +1 -1
  260. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +7 -0
  261. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +9 -9
  262. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +55 -0
  263. data/src/core/ext/upb-generated/google/rpc/status.upb.c +1 -1
  264. data/src/core/ext/upb-generated/google/rpc/status.upb.h +10 -3
  265. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +4 -4
  266. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +11 -3
  267. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +41 -41
  268. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +149 -76
  269. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +5 -5
  270. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +21 -6
  271. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +2 -2
  272. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +13 -0
  273. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +17 -17
  274. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +82 -25
  275. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +3 -3
  276. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +19 -0
  277. data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +1 -1
  278. data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +7 -0
  279. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +1 -0
  280. data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +2 -2
  281. data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +9 -2
  282. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +1 -1
  283. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +7 -0
  284. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +3 -3
  285. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +7 -0
  286. data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.c +33 -0
  287. data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.h +77 -0
  288. data/src/core/ext/upb-generated/validate/validate.upb.c +64 -64
  289. data/src/core/ext/upb-generated/validate/validate.upb.h +296 -157
  290. data/src/core/ext/upb-generated/{udpa/core/v1 → xds/core/v3}/authority.upb.c +6 -6
  291. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.h +60 -0
  292. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +52 -0
  293. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.h +143 -0
  294. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +42 -0
  295. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.h +84 -0
  296. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.c +36 -0
  297. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.h +94 -0
  298. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +54 -0
  299. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.h +166 -0
  300. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +36 -0
  301. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.h +85 -0
  302. data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.c +354 -0
  303. data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.h +140 -0
  304. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +168 -171
  305. data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +383 -0
  306. data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.h +115 -0
  307. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +405 -420
  308. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.h +2 -2
  309. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/outlier_detection.upbdefs.c +12 -9
  310. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +177 -171
  311. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.h +10 -0
  312. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +88 -88
  313. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +153 -153
  314. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +10 -7
  315. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.h +5 -0
  316. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/proxy_protocol.upbdefs.c +4 -7
  317. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.c +33 -20
  318. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint.upbdefs.c +56 -59
  319. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.c +116 -111
  320. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.c +129 -121
  321. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.c +21 -24
  322. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.c +141 -0
  323. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.h +70 -0
  324. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +141 -0
  325. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +70 -0
  326. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +17 -13
  327. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +753 -724
  328. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +10 -0
  329. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/http_tracer.upbdefs.c +22 -25
  330. data/src/core/ext/upbdefs-generated/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.c +51 -0
  331. data/src/core/ext/upbdefs-generated/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.h +35 -0
  332. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.c +102 -0
  333. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.h +55 -0
  334. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +120 -0
  335. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.h +45 -0
  336. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +76 -0
  337. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.h +35 -0
  338. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +371 -377
  339. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.c +12 -16
  340. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +112 -108
  341. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.c +45 -53
  342. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +177 -180
  343. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.c +92 -102
  344. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.h +5 -0
  345. data/src/core/ext/upbdefs-generated/envoy/service/endpoint/v3/eds.upbdefs.c +32 -42
  346. data/src/core/ext/upbdefs-generated/envoy/service/listener/v3/lds.upbdefs.c +30 -40
  347. data/src/core/ext/upbdefs-generated/envoy/service/load_stats/v3/lrs.upbdefs.c +4 -7
  348. data/src/core/ext/upbdefs-generated/envoy/service/route/v3/rds.upbdefs.c +38 -44
  349. data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.c +130 -0
  350. data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.h +50 -0
  351. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.c +56 -0
  352. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.h +35 -0
  353. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/string.upbdefs.c +30 -33
  354. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.c +63 -0
  355. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.h +40 -0
  356. data/src/core/ext/upbdefs-generated/google/protobuf/any.upbdefs.c +8 -7
  357. data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c +9 -9
  358. data/src/core/ext/upbdefs-generated/google/protobuf/duration.upbdefs.c +9 -8
  359. data/src/core/ext/upbdefs-generated/google/protobuf/empty.upbdefs.c +8 -8
  360. data/src/core/ext/upbdefs-generated/google/protobuf/struct.upbdefs.c +8 -8
  361. data/src/core/ext/upbdefs-generated/google/protobuf/timestamp.upbdefs.c +9 -8
  362. data/src/core/ext/upbdefs-generated/google/protobuf/wrappers.upbdefs.c +8 -8
  363. data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.c +44 -0
  364. data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.h +35 -0
  365. data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.c +14 -11
  366. data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.c +42 -0
  367. data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.h +35 -0
  368. data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.c +62 -0
  369. data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.h +40 -0
  370. data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.c +45 -0
  371. data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.h +40 -0
  372. data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.c +49 -0
  373. data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.h +35 -0
  374. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.c +67 -0
  375. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.h +40 -0
  376. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.c +50 -0
  377. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.h +35 -0
  378. data/src/core/ext/xds/certificate_provider_store.cc +10 -7
  379. data/src/core/ext/xds/certificate_provider_store.h +12 -7
  380. data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +25 -0
  381. data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +1 -4
  382. data/src/core/ext/xds/xds_api.cc +2265 -593
  383. data/src/core/ext/xds/xds_api.h +335 -102
  384. data/src/core/ext/xds/xds_bootstrap.cc +80 -45
  385. data/src/core/ext/xds/xds_bootstrap.h +17 -6
  386. data/src/core/ext/xds/xds_certificate_provider.cc +232 -67
  387. data/src/core/ext/xds/xds_certificate_provider.h +103 -26
  388. data/src/core/ext/xds/xds_client.cc +212 -63
  389. data/src/core/ext/xds/xds_client.h +35 -1
  390. data/src/core/ext/xds/xds_client_stats.cc +4 -3
  391. data/src/core/ext/xds/xds_client_stats.h +2 -2
  392. data/src/core/ext/xds/xds_http_fault_filter.cc +226 -0
  393. data/src/core/ext/xds/xds_http_fault_filter.h +63 -0
  394. data/src/core/ext/xds/xds_http_filters.cc +114 -0
  395. data/src/core/ext/xds/xds_http_filters.h +130 -0
  396. data/src/core/ext/xds/xds_server_config_fetcher.cc +532 -0
  397. data/src/core/lib/channel/channel_args.cc +8 -8
  398. data/src/core/lib/channel/channel_stack.cc +12 -0
  399. data/src/core/lib/channel/channel_stack.h +7 -0
  400. data/src/core/lib/channel/channel_trace.h +1 -1
  401. data/src/core/lib/channel/channelz.cc +105 -18
  402. data/src/core/lib/channel/channelz.h +30 -2
  403. data/src/core/lib/channel/channelz_registry.cc +14 -0
  404. data/src/core/lib/channel/channelz_registry.h +0 -1
  405. data/src/core/lib/channel/handshaker.cc +4 -46
  406. data/src/core/lib/channel/handshaker.h +1 -18
  407. data/src/core/lib/channel/status_util.cc +12 -2
  408. data/src/core/lib/channel/status_util.h +5 -0
  409. data/src/core/lib/compression/compression_args.cc +3 -2
  410. data/src/core/lib/debug/stats.h +2 -2
  411. data/src/core/lib/debug/stats_data.h +13 -13
  412. data/src/core/lib/gpr/alloc.cc +3 -2
  413. data/src/core/lib/gpr/log.cc +59 -17
  414. data/src/core/lib/gpr/log_linux.cc +3 -1
  415. data/src/core/lib/gpr/log_posix.cc +3 -1
  416. data/src/core/lib/gpr/log_windows.cc +3 -1
  417. data/src/core/lib/gpr/spinlock.h +10 -2
  418. data/src/core/lib/gpr/string.cc +22 -21
  419. data/src/core/lib/gpr/string.h +5 -6
  420. data/src/core/lib/gpr/sync.cc +4 -4
  421. data/src/core/lib/gpr/sync_abseil.cc +3 -6
  422. data/src/core/lib/gpr/sync_windows.cc +2 -2
  423. data/src/core/lib/gpr/time.cc +12 -12
  424. data/src/core/lib/gprpp/arena.h +3 -2
  425. data/src/core/lib/gprpp/atomic.h +3 -3
  426. data/src/core/lib/gprpp/dual_ref_counted.h +3 -3
  427. data/src/core/lib/gprpp/mpscq.cc +2 -2
  428. data/src/core/lib/gprpp/ref_counted.h +2 -2
  429. data/src/core/lib/gprpp/ref_counted_ptr.h +11 -1
  430. data/src/core/lib/gprpp/sync.h +129 -40
  431. data/src/core/lib/gprpp/thd.h +1 -1
  432. data/src/core/lib/gprpp/thd_posix.cc +6 -1
  433. data/src/core/lib/gprpp/thd_windows.cc +3 -1
  434. data/src/core/lib/gprpp/time_util.cc +77 -0
  435. data/src/core/lib/gprpp/time_util.h +42 -0
  436. data/src/core/lib/http/httpcli.cc +1 -1
  437. data/src/core/lib/http/httpcli.h +2 -3
  438. data/src/core/lib/http/httpcli_security_connector.cc +3 -3
  439. data/src/core/lib/http/parser.cc +1 -2
  440. data/src/core/lib/iomgr/buffer_list.h +1 -1
  441. data/src/core/lib/iomgr/call_combiner.cc +8 -5
  442. data/src/core/lib/iomgr/cfstream_handle.cc +2 -2
  443. data/src/core/lib/iomgr/combiner.cc +2 -1
  444. data/src/core/lib/iomgr/endpoint.h +1 -1
  445. data/src/core/lib/iomgr/error.cc +15 -11
  446. data/src/core/lib/iomgr/error.h +1 -1
  447. data/src/core/lib/iomgr/error_internal.h +1 -1
  448. data/src/core/lib/iomgr/ev_apple.cc +11 -8
  449. data/src/core/lib/iomgr/ev_epoll1_linux.cc +23 -16
  450. data/src/core/lib/iomgr/ev_epollex_linux.cc +21 -17
  451. data/src/core/lib/iomgr/ev_poll_posix.cc +9 -7
  452. data/src/core/lib/iomgr/ev_posix.cc +3 -3
  453. data/src/core/lib/iomgr/exec_ctx.cc +6 -2
  454. data/src/core/lib/iomgr/exec_ctx.h +6 -4
  455. data/src/core/lib/iomgr/executor.cc +2 -1
  456. data/src/core/lib/iomgr/executor.h +1 -1
  457. data/src/core/lib/iomgr/executor/threadpool.h +1 -1
  458. data/src/core/lib/iomgr/iomgr.cc +1 -1
  459. data/src/core/lib/iomgr/iomgr_posix.cc +0 -1
  460. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +0 -1
  461. data/src/core/lib/iomgr/load_file.h +1 -1
  462. data/src/core/lib/iomgr/lockfree_event.cc +19 -14
  463. data/src/core/lib/iomgr/lockfree_event.h +2 -2
  464. data/src/core/lib/iomgr/parse_address.cc +52 -46
  465. data/src/core/lib/iomgr/parse_address.h +13 -9
  466. data/src/core/lib/iomgr/poller/eventmanager_libuv.h +1 -1
  467. data/src/core/lib/iomgr/pollset_set_custom.cc +1 -1
  468. data/src/core/lib/iomgr/python_util.h +1 -1
  469. data/src/core/lib/iomgr/resolve_address.cc +4 -4
  470. data/src/core/lib/iomgr/resource_quota.cc +5 -5
  471. data/src/core/lib/iomgr/sockaddr_utils.cc +131 -11
  472. data/src/core/lib/iomgr/sockaddr_utils.h +26 -1
  473. data/src/core/lib/iomgr/socket_factory_posix.cc +3 -2
  474. data/src/core/lib/iomgr/socket_mutator.cc +3 -2
  475. data/src/core/lib/iomgr/socket_utils_common_posix.cc +1 -0
  476. data/src/core/lib/iomgr/tcp_client.cc +3 -3
  477. data/src/core/lib/iomgr/tcp_client_custom.cc +7 -6
  478. data/src/core/lib/iomgr/tcp_client_posix.cc +1 -1
  479. data/src/core/lib/iomgr/tcp_custom.cc +22 -17
  480. data/src/core/lib/iomgr/tcp_posix.cc +14 -14
  481. data/src/core/lib/iomgr/tcp_server_custom.cc +28 -22
  482. data/src/core/lib/iomgr/tcp_uv.cc +2 -2
  483. data/src/core/lib/iomgr/timer_custom.cc +3 -3
  484. data/src/core/lib/iomgr/timer_generic.cc +5 -5
  485. data/src/core/lib/iomgr/timer_manager.cc +3 -3
  486. data/src/core/lib/iomgr/udp_server.cc +1 -2
  487. data/src/core/lib/iomgr/udp_server.h +1 -2
  488. data/src/core/lib/iomgr/unix_sockets_posix.cc +17 -18
  489. data/src/core/lib/iomgr/wakeup_fd_nospecial.cc +1 -1
  490. data/src/core/lib/json/json.h +10 -0
  491. data/src/core/lib/matchers/matchers.cc +339 -0
  492. data/src/core/lib/matchers/matchers.h +160 -0
  493. data/src/core/lib/security/context/security_context.cc +4 -3
  494. data/src/core/lib/security/credentials/alts/alts_credentials.cc +2 -1
  495. data/src/core/lib/security/credentials/alts/alts_credentials.h +1 -1
  496. data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +1 -1
  497. data/src/core/lib/security/credentials/credentials.cc +6 -6
  498. data/src/core/lib/security/credentials/credentials.h +2 -1
  499. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +413 -0
  500. data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +80 -0
  501. data/src/core/lib/security/credentials/external/aws_request_signer.cc +15 -10
  502. data/src/core/lib/security/credentials/external/aws_request_signer.h +1 -2
  503. data/src/core/lib/security/credentials/external/external_account_credentials.cc +217 -31
  504. data/src/core/lib/security/credentials/external/external_account_credentials.h +7 -5
  505. data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +5 -6
  506. data/src/core/lib/security/credentials/external/file_external_account_credentials.h +3 -4
  507. data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +20 -18
  508. data/src/core/lib/security/credentials/external/url_external_account_credentials.h +5 -6
  509. data/src/core/lib/security/credentials/fake/fake_credentials.cc +3 -2
  510. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +25 -18
  511. data/src/core/lib/security/credentials/insecure/insecure_credentials.cc +18 -5
  512. data/src/core/lib/security/credentials/jwt/json_token.cc +1 -4
  513. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +3 -6
  514. data/src/core/lib/security/credentials/local/local_credentials.cc +2 -1
  515. data/src/core/lib/security/credentials/local/local_credentials.h +1 -1
  516. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +37 -44
  517. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +5 -4
  518. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +1 -1
  519. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +7 -6
  520. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +2 -2
  521. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +1 -6
  522. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +1 -6
  523. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +326 -5
  524. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +64 -0
  525. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +1 -1
  526. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +0 -1
  527. data/src/core/lib/security/credentials/tls/tls_credentials.cc +3 -2
  528. data/src/core/lib/security/credentials/tls/tls_credentials.h +1 -1
  529. data/src/core/lib/security/credentials/tls/tls_utils.cc +91 -0
  530. data/src/core/lib/security/credentials/tls/tls_utils.h +38 -0
  531. data/src/core/lib/security/credentials/xds/xds_credentials.cc +209 -10
  532. data/src/core/lib/security/credentials/xds/xds_credentials.h +27 -9
  533. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +1 -1
  534. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +1 -1
  535. data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +50 -17
  536. data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +23 -6
  537. data/src/core/lib/security/security_connector/local/local_security_connector.cc +1 -1
  538. data/src/core/lib/security/security_connector/security_connector.cc +3 -2
  539. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +4 -4
  540. data/src/core/lib/security/security_connector/ssl_utils.cc +11 -6
  541. data/src/core/lib/security/security_connector/ssl_utils.h +12 -19
  542. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +89 -26
  543. data/src/core/lib/security/security_connector/tls/tls_security_connector.h +2 -3
  544. data/src/core/lib/security/transport/secure_endpoint.cc +2 -2
  545. data/src/core/lib/security/transport/security_handshaker.cc +35 -7
  546. data/src/core/lib/slice/slice_intern.cc +9 -11
  547. data/src/core/lib/slice/slice_internal.h +2 -2
  548. data/src/core/lib/surface/call.cc +32 -24
  549. data/src/core/lib/surface/call_details.cc +8 -8
  550. data/src/core/lib/surface/channel.cc +16 -10
  551. data/src/core/lib/surface/channel.h +6 -5
  552. data/src/core/lib/surface/channel_init.cc +1 -1
  553. data/src/core/lib/surface/completion_queue.cc +24 -19
  554. data/src/core/lib/surface/completion_queue.h +16 -16
  555. data/src/core/lib/surface/init.cc +19 -20
  556. data/src/core/lib/surface/lame_client.cc +47 -54
  557. data/src/core/lib/surface/lame_client.h +5 -0
  558. data/src/core/lib/surface/server.cc +102 -51
  559. data/src/core/lib/surface/server.h +112 -18
  560. data/src/core/lib/surface/version.cc +2 -2
  561. data/src/core/lib/transport/authority_override.cc +6 -4
  562. data/src/core/lib/transport/authority_override.h +5 -2
  563. data/src/core/lib/transport/connectivity_state.h +6 -4
  564. data/src/core/lib/transport/error_utils.h +1 -1
  565. data/src/core/lib/transport/metadata.cc +6 -2
  566. data/src/core/lib/transport/metadata_batch.cc +27 -0
  567. data/src/core/lib/transport/metadata_batch.h +18 -4
  568. data/src/core/lib/transport/static_metadata.cc +1 -1
  569. data/src/core/lib/transport/status_metadata.cc +4 -3
  570. data/src/core/lib/transport/transport.h +7 -7
  571. data/src/core/lib/uri/uri_parser.cc +131 -249
  572. data/src/core/lib/uri/uri_parser.h +57 -21
  573. data/src/core/plugin_registry/grpc_plugin_registry.cc +22 -4
  574. data/src/core/tsi/alts/crypt/gsec.cc +5 -4
  575. data/src/core/tsi/alts/frame_protector/frame_handler.cc +8 -6
  576. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +19 -25
  577. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +39 -44
  578. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +1 -1
  579. data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +1 -3
  580. data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc +8 -6
  581. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +4 -4
  582. data/src/core/tsi/fake_transport_security.cc +16 -5
  583. data/src/core/tsi/ssl/session_cache/ssl_session.h +0 -3
  584. data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -1
  585. data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +0 -2
  586. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +2 -4
  587. data/src/core/tsi/ssl_transport_security.cc +62 -52
  588. data/src/core/tsi/ssl_transport_security.h +6 -9
  589. data/src/core/tsi/transport_security.cc +6 -6
  590. data/src/core/tsi/transport_security_interface.h +1 -1
  591. data/src/ruby/ext/grpc/extconf.rb +9 -1
  592. data/src/ruby/ext/grpc/rb_channel.c +10 -1
  593. data/src/ruby/ext/grpc/rb_channel_credentials.c +11 -1
  594. data/src/ruby/ext/grpc/rb_channel_credentials.h +4 -0
  595. data/src/ruby/ext/grpc/rb_compression_options.c +1 -1
  596. data/src/ruby/ext/grpc/rb_enable_cpp.cc +1 -1
  597. data/src/ruby/ext/grpc/rb_event_thread.c +2 -0
  598. data/src/ruby/ext/grpc/rb_grpc.c +4 -0
  599. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +14 -0
  600. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +34 -13
  601. data/src/ruby/ext/grpc/rb_server.c +13 -1
  602. data/src/ruby/ext/grpc/rb_server_credentials.c +19 -3
  603. data/src/ruby/ext/grpc/rb_server_credentials.h +4 -0
  604. data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +215 -0
  605. data/src/ruby/ext/grpc/rb_xds_channel_credentials.h +35 -0
  606. data/src/ruby/ext/grpc/rb_xds_server_credentials.c +169 -0
  607. data/src/ruby/ext/grpc/rb_xds_server_credentials.h +35 -0
  608. data/src/ruby/lib/grpc/generic/client_stub.rb +4 -2
  609. data/src/ruby/lib/grpc/version.rb +1 -1
  610. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +35 -0
  611. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +18 -0
  612. data/src/ruby/spec/call_spec.rb +1 -1
  613. data/src/ruby/spec/channel_credentials_spec.rb +32 -0
  614. data/src/ruby/spec/channel_spec.rb +17 -6
  615. data/src/ruby/spec/client_auth_spec.rb +27 -1
  616. data/src/ruby/spec/errors_spec.rb +1 -1
  617. data/src/ruby/spec/generic/active_call_spec.rb +2 -2
  618. data/src/ruby/spec/generic/client_stub_spec.rb +4 -4
  619. data/src/ruby/spec/generic/rpc_server_spec.rb +1 -1
  620. data/src/ruby/spec/pb/codegen/package_option_spec.rb +2 -6
  621. data/src/ruby/spec/server_credentials_spec.rb +25 -0
  622. data/src/ruby/spec/server_spec.rb +22 -0
  623. data/third_party/abseil-cpp/absl/container/flat_hash_map.h +606 -0
  624. data/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h +197 -0
  625. data/third_party/abseil-cpp/absl/status/internal/statusor_internal.h +399 -0
  626. data/third_party/abseil-cpp/absl/status/statusor.cc +71 -0
  627. data/third_party/abseil-cpp/absl/status/statusor.h +760 -0
  628. data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +1 -0
  629. data/third_party/boringssl-with-bazel/err_data.c +715 -713
  630. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bitstr.c +3 -3
  631. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_enum.c +2 -2
  632. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_int.c +5 -5
  633. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +3 -10
  634. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_octet.c +3 -3
  635. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_type.c +4 -2
  636. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +2 -2
  637. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +15 -14
  638. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_locl.h +30 -0
  639. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +28 -79
  640. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +39 -85
  641. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_fre.c +5 -16
  642. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_new.c +10 -61
  643. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_typ.c +0 -2
  644. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_utl.c +2 -2
  645. data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +4 -0
  646. data/third_party/boringssl-with-bazel/src/crypto/blake2/blake2.c +158 -0
  647. data/third_party/boringssl-with-bazel/src/crypto/bn_extra/bn_asn1.c +3 -10
  648. data/third_party/boringssl-with-bazel/src/crypto/bytestring/ber.c +8 -9
  649. data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.c +60 -45
  650. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_chacha20poly1305.c +6 -81
  651. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/internal.h +87 -0
  652. data/third_party/boringssl-with-bazel/src/crypto/cpu-aarch64-win.c +41 -0
  653. data/third_party/boringssl-with-bazel/src/crypto/cpu-arm-linux.c +11 -2
  654. data/third_party/boringssl-with-bazel/src/crypto/cpu-arm.c +3 -3
  655. data/third_party/boringssl-with-bazel/src/crypto/{dh → dh_extra}/dh_asn1.c +0 -0
  656. data/third_party/boringssl-with-bazel/src/crypto/{dh → dh_extra}/params.c +179 -0
  657. data/third_party/boringssl-with-bazel/src/crypto/digest_extra/digest_extra.c +25 -0
  658. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_asn1.c +2 -17
  659. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +3 -1
  660. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/bn.c +13 -20
  661. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +2 -3
  662. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +9 -1
  663. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/cipher.c +21 -13
  664. data/third_party/boringssl-with-bazel/src/crypto/{dh → fipsmodule/dh}/check.c +0 -0
  665. data/third_party/boringssl-with-bazel/src/crypto/{dh → fipsmodule/dh}/dh.c +136 -213
  666. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +12 -0
  667. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +9 -1
  668. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +28 -0
  669. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +135 -43
  670. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +0 -7
  671. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +51 -32
  672. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +147 -0
  673. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +18 -29
  674. data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +13 -4
  675. data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305.c +10 -7
  676. data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305_arm.c +13 -11
  677. data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305_vec.c +4 -0
  678. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/passive.c +34 -0
  679. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/rand_extra.c +4 -0
  680. data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +7 -13
  681. data/third_party/boringssl-with-bazel/src/crypto/x509/rsa_pss.c +5 -1
  682. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +1 -29
  683. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_ext.c +10 -7
  684. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_r2x.c +1 -1
  685. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +8 -8
  686. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +1 -1
  687. data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +29 -23
  688. data/third_party/boringssl-with-bazel/src/crypto/x509/x_attrib.c +22 -17
  689. data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +1 -2
  690. data/third_party/boringssl-with-bazel/src/crypto/x509/x_pkey.c +2 -2
  691. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +39 -4
  692. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509a.c +2 -2
  693. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_akey.c +3 -3
  694. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +11 -10
  695. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_bitst.c +3 -3
  696. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +25 -25
  697. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +2 -2
  698. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_enum.c +2 -1
  699. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_genn.c +40 -20
  700. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_ia5.c +3 -4
  701. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +25 -36
  702. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +1 -1
  703. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +6 -6
  704. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +6 -6
  705. data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +3 -3
  706. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +652 -545
  707. data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +0 -167
  708. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +10 -5
  709. data/third_party/boringssl-with-bazel/src/include/openssl/blake2.h +62 -0
  710. data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +22 -7
  711. data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +19 -0
  712. data/third_party/boringssl-with-bazel/src/include/openssl/cpu.h +22 -32
  713. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +56 -26
  714. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +1 -0
  715. data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +15 -0
  716. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +12 -2
  717. data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +3 -0
  718. data/third_party/boringssl-with-bazel/src/include/openssl/span.h +2 -1
  719. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +67 -33
  720. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +27 -8
  721. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +287 -99
  722. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +139 -36
  723. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +4 -3
  724. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +11 -20
  725. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +10 -5
  726. data/third_party/boringssl-with-bazel/src/ssl/internal.h +37 -16
  727. data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +0 -1
  728. data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +7 -8
  729. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +20 -14
  730. data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +7 -8
  731. data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +2 -2
  732. data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +5 -7
  733. data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +362 -50
  734. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +2 -2
  735. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +48 -15
  736. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +66 -24
  737. data/third_party/upb/third_party/wyhash/wyhash.h +145 -0
  738. data/third_party/upb/upb/decode.c +248 -167
  739. data/third_party/upb/upb/decode.h +20 -1
  740. data/third_party/upb/upb/decode.int.h +163 -0
  741. data/third_party/upb/upb/decode_fast.c +1040 -0
  742. data/third_party/upb/upb/decode_fast.h +126 -0
  743. data/third_party/upb/upb/def.c +525 -516
  744. data/third_party/upb/upb/def.h +16 -31
  745. data/third_party/upb/upb/def.hpp +37 -123
  746. data/third_party/upb/upb/encode.c +227 -169
  747. data/third_party/upb/upb/encode.h +27 -2
  748. data/third_party/upb/upb/msg.c +167 -88
  749. data/third_party/upb/upb/msg.h +174 -34
  750. data/third_party/upb/upb/port_def.inc +74 -61
  751. data/third_party/upb/upb/port_undef.inc +3 -7
  752. data/third_party/upb/upb/reflection.c +36 -19
  753. data/third_party/upb/upb/table.c +34 -197
  754. data/third_party/upb/upb/table.int.h +14 -5
  755. data/third_party/upb/upb/text_encode.c +45 -22
  756. data/third_party/upb/upb/text_encode.h +4 -1
  757. data/third_party/upb/upb/upb.c +18 -41
  758. data/third_party/upb/upb/upb.h +36 -7
  759. data/third_party/upb/upb/upb.hpp +4 -4
  760. data/third_party/upb/upb/upb.int.h +29 -0
  761. data/third_party/xxhash/xxhash.h +5443 -0
  762. metadata +152 -82
  763. data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +0 -909
  764. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +0 -485
  765. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +0 -68
  766. data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +0 -355
  767. data/src/core/ext/filters/client_channel/resolving_lb_policy.h +0 -138
  768. data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.h +0 -53
  769. data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.c +0 -52
  770. data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.h +0 -129
  771. data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.c +0 -42
  772. data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.h +0 -77
  773. data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.c +0 -36
  774. data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.h +0 -85
  775. data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.c +0 -54
  776. data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.h +0 -160
  777. data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.c +0 -36
  778. data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.h +0 -84
  779. data/src/core/ext/upbdefs-generated/udpa/core/v1/authority.upbdefs.c +0 -42
  780. data/src/core/ext/upbdefs-generated/udpa/core/v1/authority.upbdefs.h +0 -35
  781. data/src/core/ext/upbdefs-generated/udpa/core/v1/collection_entry.upbdefs.c +0 -62
  782. data/src/core/ext/upbdefs-generated/udpa/core/v1/collection_entry.upbdefs.h +0 -40
  783. data/src/core/ext/upbdefs-generated/udpa/core/v1/context_params.upbdefs.c +0 -45
  784. data/src/core/ext/upbdefs-generated/udpa/core/v1/context_params.upbdefs.h +0 -40
  785. data/src/core/ext/upbdefs-generated/udpa/core/v1/resource.upbdefs.c +0 -49
  786. data/src/core/ext/upbdefs-generated/udpa/core/v1/resource.upbdefs.h +0 -35
  787. data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_locator.upbdefs.c +0 -68
  788. data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_locator.upbdefs.h +0 -40
  789. data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_name.upbdefs.c +0 -51
  790. data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_name.upbdefs.h +0 -35
  791. data/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.cc +0 -265
  792. data/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.h +0 -104
  793. data/src/core/lib/gprpp/map.h +0 -53
  794. data/src/core/lib/iomgr/iomgr_posix.h +0 -26
  795. data/src/core/lib/security/authorization/authorization_engine.cc +0 -177
  796. data/src/core/lib/security/authorization/authorization_engine.h +0 -84
  797. data/src/core/lib/security/authorization/evaluate_args.cc +0 -153
  798. data/src/core/lib/security/authorization/evaluate_args.h +0 -59
  799. data/src/core/lib/security/authorization/mock_cel/activation.h +0 -57
  800. data/src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h +0 -44
  801. data/src/core/lib/security/authorization/mock_cel/cel_expression.h +0 -69
  802. data/src/core/lib/security/authorization/mock_cel/cel_value.h +0 -97
  803. data/src/core/lib/security/authorization/mock_cel/evaluator_core.h +0 -67
  804. data/src/core/lib/security/authorization/mock_cel/flat_expr_builder.h +0 -57
  805. data/third_party/abseil-cpp/absl/container/flat_hash_set.h +0 -504
  806. data/third_party/upb/upb/port.c +0 -26
@@ -26,8 +26,6 @@
26
26
  #include "src/core/ext/filters/client_channel/resolver.h"
27
27
  #include "src/core/lib/channel/channel_stack.h"
28
28
 
29
- extern grpc_core::TraceFlag grpc_client_channel_trace;
30
-
31
29
  // Channel arg key for server URI string.
32
30
  #define GRPC_ARG_SERVER_URI "grpc.server_uri"
33
31
 
@@ -75,8 +73,4 @@ void grpc_client_channel_stop_connectivity_watch(
75
73
  grpc_channel_element* elem,
76
74
  grpc_core::AsyncConnectivityStateWatcherInterface* watcher);
77
75
 
78
- /* Debug helper: pull the subchannel call from a call stack element */
79
- grpc_core::RefCountedPtr<grpc_core::SubchannelCall>
80
- grpc_client_channel_get_subchannel_call(grpc_call_element* elem);
81
-
82
76
  #endif // GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CLIENT_CHANNEL_H
@@ -32,7 +32,8 @@ class ClientChannelFactory {
32
32
  virtual ~ClientChannelFactory() = default;
33
33
 
34
34
  // Creates a subchannel with the specified args.
35
- virtual Subchannel* CreateSubchannel(const grpc_channel_args* args) = 0;
35
+ virtual RefCountedPtr<Subchannel> CreateSubchannel(
36
+ const grpc_channel_args* args) = 0;
36
37
 
37
38
  // Returns a channel arg containing the specified factory.
38
39
  static grpc_arg CreateChannelArg(ClientChannelFactory* factory);
@@ -54,7 +54,7 @@ void grpc_client_channel_init(void) {
54
54
  grpc_core::GlobalSubchannelPool::Init();
55
55
  grpc_channel_init_register_stage(
56
56
  GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, append_filter,
57
- (void*)&grpc_client_channel_filter);
57
+ const_cast<grpc_channel_filter*>(&grpc_client_channel_filter));
58
58
  grpc_http_connect_register_handshaker_factory();
59
59
  grpc_client_channel_global_init_backup_polling();
60
60
  }
@@ -21,6 +21,7 @@
21
21
 
22
22
  #include <functional>
23
23
  #include <map>
24
+ #include <vector>
24
25
 
25
26
  #include "absl/strings/string_view.h"
26
27
 
@@ -28,6 +29,7 @@
28
29
 
29
30
  #include "src/core/ext/filters/client_channel/service_config.h"
30
31
  #include "src/core/ext/filters/client_channel/service_config_parser.h"
32
+ #include "src/core/lib/channel/channel_stack.h"
31
33
  #include "src/core/lib/gprpp/arena.h"
32
34
  #include "src/core/lib/gprpp/ref_counted.h"
33
35
  #include "src/core/lib/gprpp/ref_counted_ptr.h"
@@ -80,6 +82,16 @@ class ConfigSelector : public RefCounted<ConfigSelector> {
80
82
  return cs1->Equals(cs2);
81
83
  }
82
84
 
85
+ // The channel will call this when the resolver returns a new ConfigSelector
86
+ // to determine what set of dynamic filters will be configured.
87
+ virtual std::vector<const grpc_channel_filter*> GetFilters() { return {}; }
88
+
89
+ // Modifies channel args to be passed to the dynamic filter stack.
90
+ // Takes ownership of argument. Caller takes ownership of result.
91
+ virtual grpc_channel_args* ModifyChannelArgs(grpc_channel_args* args) {
92
+ return args;
93
+ }
94
+
83
95
  virtual CallConfig GetCallConfig(GetCallConfigArgs args) = 0;
84
96
 
85
97
  grpc_arg MakeChannelArg() const;
@@ -102,7 +114,7 @@ class DefaultConfigSelector : public ConfigSelector {
102
114
 
103
115
  // Only comparing the ConfigSelector itself, not the underlying
104
116
  // service config, so we always return true.
105
- bool Equals(const ConfigSelector* other) const override { return true; }
117
+ bool Equals(const ConfigSelector* /*other*/) const override { return true; }
106
118
 
107
119
  CallConfig GetCallConfig(GetCallConfigArgs args) override {
108
120
  CallConfig call_config;
@@ -0,0 +1,191 @@
1
+ //
2
+ // Copyright 2020 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
+ #include <grpc/support/port_platform.h>
18
+
19
+ #include "src/core/ext/filters/client_channel/dynamic_filters.h"
20
+
21
+ #include "src/core/lib/channel/channel_args.h"
22
+ #include "src/core/lib/channel/channel_stack.h"
23
+ #include "src/core/lib/surface/lame_client.h"
24
+
25
+ // Conversion between call and call stack.
26
+ #define CALL_TO_CALL_STACK(call) \
27
+ (grpc_call_stack*)((char*)(call) + GPR_ROUND_UP_TO_ALIGNMENT_SIZE( \
28
+ sizeof(DynamicFilters::Call)))
29
+ #define CALL_STACK_TO_CALL(callstack) \
30
+ (DynamicFilters::Call*)(((char*)(call_stack)) - \
31
+ GPR_ROUND_UP_TO_ALIGNMENT_SIZE( \
32
+ sizeof(DynamicFilters::Call)))
33
+
34
+ namespace grpc_core {
35
+
36
+ //
37
+ // DynamicFilters::Call
38
+ //
39
+
40
+ DynamicFilters::Call::Call(Args args, grpc_error** error)
41
+ : channel_stack_(std::move(args.channel_stack)) {
42
+ grpc_call_stack* call_stack = CALL_TO_CALL_STACK(this);
43
+ const grpc_call_element_args call_args = {
44
+ call_stack, /* call_stack */
45
+ nullptr, /* server_transport_data */
46
+ args.context, /* context */
47
+ args.path, /* path */
48
+ args.start_time, /* start_time */
49
+ args.deadline, /* deadline */
50
+ args.arena, /* arena */
51
+ args.call_combiner /* call_combiner */
52
+ };
53
+ *error = grpc_call_stack_init(channel_stack_->channel_stack_, 1, Destroy,
54
+ this, &call_args);
55
+ if (GPR_UNLIKELY(*error != GRPC_ERROR_NONE)) {
56
+ const char* error_string = grpc_error_string(*error);
57
+ gpr_log(GPR_ERROR, "error: %s", error_string);
58
+ return;
59
+ }
60
+ grpc_call_stack_set_pollset_or_pollset_set(call_stack, args.pollent);
61
+ }
62
+
63
+ void DynamicFilters::Call::StartTransportStreamOpBatch(
64
+ grpc_transport_stream_op_batch* batch) {
65
+ grpc_call_stack* call_stack = CALL_TO_CALL_STACK(this);
66
+ grpc_call_element* top_elem = grpc_call_stack_element(call_stack, 0);
67
+ GRPC_CALL_LOG_OP(GPR_INFO, top_elem, batch);
68
+ top_elem->filter->start_transport_stream_op_batch(top_elem, batch);
69
+ }
70
+
71
+ void DynamicFilters::Call::SetAfterCallStackDestroy(grpc_closure* closure) {
72
+ GPR_ASSERT(after_call_stack_destroy_ == nullptr);
73
+ GPR_ASSERT(closure != nullptr);
74
+ after_call_stack_destroy_ = closure;
75
+ }
76
+
77
+ RefCountedPtr<DynamicFilters::Call> DynamicFilters::Call::Ref() {
78
+ IncrementRefCount();
79
+ return RefCountedPtr<DynamicFilters::Call>(this);
80
+ }
81
+
82
+ RefCountedPtr<DynamicFilters::Call> DynamicFilters::Call::Ref(
83
+ const grpc_core::DebugLocation& location, const char* reason) {
84
+ IncrementRefCount(location, reason);
85
+ return RefCountedPtr<DynamicFilters::Call>(this);
86
+ }
87
+
88
+ void DynamicFilters::Call::Unref() {
89
+ GRPC_CALL_STACK_UNREF(CALL_TO_CALL_STACK(this), "");
90
+ }
91
+
92
+ void DynamicFilters::Call::Unref(const DebugLocation& /*location*/,
93
+ const char* reason) {
94
+ GRPC_CALL_STACK_UNREF(CALL_TO_CALL_STACK(this), reason);
95
+ }
96
+
97
+ void DynamicFilters::Call::Destroy(void* arg, grpc_error* /*error*/) {
98
+ DynamicFilters::Call* self = static_cast<DynamicFilters::Call*>(arg);
99
+ // Keep some members before destroying the subchannel call.
100
+ grpc_closure* after_call_stack_destroy = self->after_call_stack_destroy_;
101
+ RefCountedPtr<DynamicFilters> channel_stack = std::move(self->channel_stack_);
102
+ // Destroy the subchannel call.
103
+ self->~Call();
104
+ // Destroy the call stack. This should be after destroying the call, because
105
+ // call->after_call_stack_destroy(), if not null, will free the call arena.
106
+ grpc_call_stack_destroy(CALL_TO_CALL_STACK(self), nullptr,
107
+ after_call_stack_destroy);
108
+ // Automatically reset channel_stack. This should be after destroying the call
109
+ // stack, because destroying call stack needs access to the channel stack.
110
+ }
111
+
112
+ void DynamicFilters::Call::IncrementRefCount() {
113
+ GRPC_CALL_STACK_REF(CALL_TO_CALL_STACK(this), "");
114
+ }
115
+
116
+ void DynamicFilters::Call::IncrementRefCount(
117
+ const grpc_core::DebugLocation& /*location*/, const char* reason) {
118
+ GRPC_CALL_STACK_REF(CALL_TO_CALL_STACK(this), reason);
119
+ }
120
+
121
+ //
122
+ // DynamicFilters
123
+ //
124
+
125
+ namespace {
126
+
127
+ void DestroyChannelStack(void* arg, grpc_error* /*error*/) {
128
+ grpc_channel_stack* channel_stack = static_cast<grpc_channel_stack*>(arg);
129
+ grpc_channel_stack_destroy(channel_stack);
130
+ gpr_free(channel_stack);
131
+ }
132
+
133
+ std::pair<grpc_channel_stack*, grpc_error*> CreateChannelStack(
134
+ const grpc_channel_args* args,
135
+ std::vector<const grpc_channel_filter*> filters) {
136
+ // Allocate memory for channel stack.
137
+ const size_t channel_stack_size =
138
+ grpc_channel_stack_size(filters.data(), filters.size());
139
+ grpc_channel_stack* channel_stack =
140
+ reinterpret_cast<grpc_channel_stack*>(gpr_zalloc(channel_stack_size));
141
+ // Initialize stack.
142
+ grpc_error* error = grpc_channel_stack_init(
143
+ /*initial_refs=*/1, DestroyChannelStack, channel_stack, filters.data(),
144
+ filters.size(), args, /*optional_transport=*/nullptr, "DynamicFilters",
145
+ channel_stack);
146
+ if (error != GRPC_ERROR_NONE) {
147
+ gpr_log(GPR_ERROR, "error initializing client internal stack: %s",
148
+ grpc_error_string(error));
149
+ grpc_channel_stack_destroy(channel_stack);
150
+ gpr_free(channel_stack);
151
+ return {nullptr, error};
152
+ }
153
+ return {channel_stack, GRPC_ERROR_NONE};
154
+ }
155
+
156
+ } // namespace
157
+
158
+ RefCountedPtr<DynamicFilters> DynamicFilters::Create(
159
+ const grpc_channel_args* args,
160
+ std::vector<const grpc_channel_filter*> filters) {
161
+ // Attempt to create channel stack from requested filters.
162
+ auto p = CreateChannelStack(args, std::move(filters));
163
+ if (p.second != GRPC_ERROR_NONE) {
164
+ // Channel stack creation failed with requested filters.
165
+ // Create with lame filter instead.
166
+ grpc_error* error = p.second;
167
+ grpc_arg error_arg = MakeLameClientErrorArg(error);
168
+ grpc_channel_args* new_args =
169
+ grpc_channel_args_copy_and_add(args, &error_arg, 1);
170
+ GRPC_ERROR_UNREF(error);
171
+ p = CreateChannelStack(new_args, {&grpc_lame_filter});
172
+ GPR_ASSERT(p.second == GRPC_ERROR_NONE);
173
+ grpc_channel_args_destroy(new_args);
174
+ }
175
+ return MakeRefCounted<DynamicFilters>(p.first);
176
+ }
177
+
178
+ DynamicFilters::~DynamicFilters() {
179
+ GRPC_CHANNEL_STACK_UNREF(channel_stack_, "~DynamicFilters");
180
+ }
181
+
182
+ RefCountedPtr<DynamicFilters::Call> DynamicFilters::CreateCall(
183
+ DynamicFilters::Call::Args args, grpc_error** error) {
184
+ size_t allocation_size = GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(Call)) +
185
+ channel_stack_->call_stack_size;
186
+ Call* call = static_cast<Call*>(args.arena->Alloc(allocation_size));
187
+ new (call) Call(std::move(args), error);
188
+ return call;
189
+ }
190
+
191
+ } // namespace grpc_core
@@ -0,0 +1,99 @@
1
+ //
2
+ // Copyright 2020 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_EXT_FILTERS_CLIENT_CHANNEL_DYNAMIC_FILTERS_H
18
+ #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_DYNAMIC_FILTERS_H
19
+
20
+ #include <grpc/support/port_platform.h>
21
+
22
+ #include <vector>
23
+
24
+ #include "src/core/lib/channel/channel_stack.h"
25
+ #include "src/core/lib/gpr/time_precise.h"
26
+ #include "src/core/lib/gprpp/arena.h"
27
+ #include "src/core/lib/gprpp/ref_counted.h"
28
+ #include "src/core/lib/iomgr/exec_ctx.h"
29
+ #include "src/core/lib/iomgr/polling_entity.h"
30
+
31
+ namespace grpc_core {
32
+
33
+ class DynamicFilters : public RefCounted<DynamicFilters> {
34
+ public:
35
+ // Implements the interface of RefCounted<>.
36
+ class Call {
37
+ public:
38
+ struct Args {
39
+ RefCountedPtr<DynamicFilters> channel_stack;
40
+ grpc_polling_entity* pollent;
41
+ grpc_slice path;
42
+ gpr_cycle_counter start_time;
43
+ grpc_millis deadline;
44
+ Arena* arena;
45
+ grpc_call_context_element* context;
46
+ CallCombiner* call_combiner;
47
+ };
48
+
49
+ Call(Args args, grpc_error** error);
50
+
51
+ // Continues processing a transport stream op batch.
52
+ void StartTransportStreamOpBatch(grpc_transport_stream_op_batch* batch);
53
+
54
+ // Sets the 'then_schedule_closure' argument for call stack destruction.
55
+ // Must be called once per call.
56
+ void SetAfterCallStackDestroy(grpc_closure* closure);
57
+
58
+ // Interface of RefCounted<>.
59
+ RefCountedPtr<Call> Ref() GRPC_MUST_USE_RESULT;
60
+ RefCountedPtr<Call> Ref(const DebugLocation& location,
61
+ const char* reason) GRPC_MUST_USE_RESULT;
62
+ // When refcount drops to 0, destroys itself and the associated call stack,
63
+ // but does NOT free the memory because it's in the call arena.
64
+ void Unref();
65
+ void Unref(const DebugLocation& location, const char* reason);
66
+
67
+ private:
68
+ // Allow RefCountedPtr<> to access IncrementRefCount().
69
+ template <typename T>
70
+ friend class RefCountedPtr;
71
+
72
+ // Interface of RefCounted<>.
73
+ void IncrementRefCount();
74
+ void IncrementRefCount(const DebugLocation& location, const char* reason);
75
+
76
+ static void Destroy(void* arg, grpc_error* error);
77
+
78
+ RefCountedPtr<DynamicFilters> channel_stack_;
79
+ grpc_closure* after_call_stack_destroy_ = nullptr;
80
+ };
81
+
82
+ static RefCountedPtr<DynamicFilters> Create(
83
+ const grpc_channel_args* args,
84
+ std::vector<const grpc_channel_filter*> filters);
85
+
86
+ explicit DynamicFilters(grpc_channel_stack* channel_stack)
87
+ : channel_stack_(channel_stack) {}
88
+
89
+ ~DynamicFilters() override;
90
+
91
+ RefCountedPtr<Call> CreateCall(Call::Args args, grpc_error** error);
92
+
93
+ private:
94
+ grpc_channel_stack* channel_stack_;
95
+ };
96
+
97
+ } // namespace grpc_core
98
+
99
+ #endif // GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_DYNAMIC_FILTERS_H
@@ -27,16 +27,6 @@ namespace grpc_core {
27
27
  #define GRPC_REGISTER_SUBCHANNEL_CALM_DOWN_AFTER_ATTEMPTS 100
28
28
  #define GRPC_REGISTER_SUBCHANNEL_CALM_DOWN_MICROS 10
29
29
 
30
- GlobalSubchannelPool::GlobalSubchannelPool() {
31
- subchannel_map_ = grpc_avl_create(&subchannel_avl_vtable_);
32
- gpr_mu_init(&mu_);
33
- }
34
-
35
- GlobalSubchannelPool::~GlobalSubchannelPool() {
36
- gpr_mu_destroy(&mu_);
37
- grpc_avl_unref(subchannel_map_, nullptr);
38
- }
39
-
40
30
  void GlobalSubchannelPool::Init() {
41
31
  instance_ = new RefCountedPtr<GlobalSubchannelPool>(
42
32
  MakeRefCounted<GlobalSubchannelPool>());
@@ -57,145 +47,37 @@ RefCountedPtr<GlobalSubchannelPool> GlobalSubchannelPool::instance() {
57
47
  return *instance_;
58
48
  }
59
49
 
60
- Subchannel* GlobalSubchannelPool::RegisterSubchannel(SubchannelKey* key,
61
- Subchannel* constructed) {
62
- Subchannel* c = nullptr;
63
- // Compare and swap (CAS) loop:
64
- for (int attempt_count = 0; c == nullptr; attempt_count++) {
65
- // Ref the shared map to have a local copy.
66
- gpr_mu_lock(&mu_);
67
- grpc_avl old_map = grpc_avl_ref(subchannel_map_, nullptr);
68
- gpr_mu_unlock(&mu_);
69
- // Check to see if a subchannel already exists.
70
- c = static_cast<Subchannel*>(grpc_avl_get(old_map, key, nullptr));
71
- if (c != nullptr) {
72
- // The subchannel already exists. Try to reuse it.
73
- c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(c, "subchannel_register+reuse");
74
- if (c != nullptr) {
75
- GRPC_SUBCHANNEL_UNREF(constructed,
76
- "subchannel_register+found_existing");
77
- // Exit the CAS loop without modifying the shared map.
78
- } else {
79
- // Reuse of the subchannel failed, so retry CAS loop
80
- if (attempt_count >=
81
- GRPC_REGISTER_SUBCHANNEL_CALM_DOWN_AFTER_ATTEMPTS) {
82
- // GRPC_SUBCHANNEL_REF_FROM_WEAK_REF returning nullptr means that the
83
- // subchannel we got is no longer valid and it's going to be removed
84
- // from the AVL tree soon. Spinning here excesively here can actually
85
- // prevent another thread from removing the subchannel, basically
86
- // resulting in a live lock. See b/157516542 for more details.
87
- // TODO(jtattermusch): the entire ref-counting mechanism for
88
- // subchannels should be overhaulded, but the current workaround
89
- // is fine for short-term.
90
- // TODO(jtattermusch): gpr does not support thread yield operation,
91
- // so a very short wait is the best we can do.
92
- gpr_sleep_until(gpr_time_add(
93
- gpr_now(GPR_CLOCK_REALTIME),
94
- gpr_time_from_micros(GRPC_REGISTER_SUBCHANNEL_CALM_DOWN_MICROS,
95
- GPR_TIMESPAN)));
96
- }
97
- }
98
- } else {
99
- // There hasn't been such subchannel. Add one.
100
- // Note that we should ref the old map first because grpc_avl_add() will
101
- // unref it while we still need to access it later.
102
- grpc_avl new_map = grpc_avl_add(
103
- grpc_avl_ref(old_map, nullptr), new SubchannelKey(*key),
104
- GRPC_SUBCHANNEL_WEAK_REF(constructed, "subchannel_register+new"),
105
- nullptr);
106
- // Try to publish the change to the shared map. It may happen (but
107
- // unlikely) that some other thread has changed the shared map, so compare
108
- // to make sure it's unchanged before swapping. Retry if it's changed.
109
- gpr_mu_lock(&mu_);
110
- if (old_map.root == subchannel_map_.root) {
111
- GPR_SWAP(grpc_avl, new_map, subchannel_map_);
112
- c = constructed;
113
- }
114
- gpr_mu_unlock(&mu_);
115
- grpc_avl_unref(new_map, nullptr);
116
- }
117
- grpc_avl_unref(old_map, nullptr);
118
- }
119
- return c;
120
- }
121
-
122
- void GlobalSubchannelPool::UnregisterSubchannel(SubchannelKey* key) {
123
- bool done = false;
124
- // Compare and swap (CAS) loop:
125
- while (!done) {
126
- // Ref the shared map to have a local copy.
127
- gpr_mu_lock(&mu_);
128
- grpc_avl old_map = grpc_avl_ref(subchannel_map_, nullptr);
129
- gpr_mu_unlock(&mu_);
130
- // Remove the subchannel.
131
- // Note that we should ref the old map first because grpc_avl_remove() will
132
- // unref it while we still need to access it later.
133
- grpc_avl new_map =
134
- grpc_avl_remove(grpc_avl_ref(old_map, nullptr), key, nullptr);
135
- // Try to publish the change to the shared map. It may happen (but
136
- // unlikely) that some other thread has changed the shared map, so compare
137
- // to make sure it's unchanged before swapping. Retry if it's changed.
138
- gpr_mu_lock(&mu_);
139
- if (old_map.root == subchannel_map_.root) {
140
- GPR_SWAP(grpc_avl, new_map, subchannel_map_);
141
- done = true;
142
- }
143
- gpr_mu_unlock(&mu_);
144
- grpc_avl_unref(new_map, nullptr);
145
- grpc_avl_unref(old_map, nullptr);
50
+ RefCountedPtr<Subchannel> GlobalSubchannelPool::RegisterSubchannel(
51
+ const SubchannelKey& key, RefCountedPtr<Subchannel> constructed) {
52
+ MutexLock lock(&mu_);
53
+ auto it = subchannel_map_.find(key);
54
+ if (it != subchannel_map_.end()) {
55
+ RefCountedPtr<Subchannel> existing = it->second->RefIfNonZero();
56
+ if (existing != nullptr) return existing;
146
57
  }
147
- }
148
-
149
- Subchannel* GlobalSubchannelPool::FindSubchannel(SubchannelKey* key) {
150
- // Lock, and take a reference to the subchannel map.
151
- // We don't need to do the search under a lock as AVL's are immutable.
152
- gpr_mu_lock(&mu_);
153
- grpc_avl index = grpc_avl_ref(subchannel_map_, nullptr);
154
- gpr_mu_unlock(&mu_);
155
- Subchannel* c = static_cast<Subchannel*>(grpc_avl_get(index, key, nullptr));
156
- if (c != nullptr) c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(c, "found_from_pool");
157
- grpc_avl_unref(index, nullptr);
158
- return c;
58
+ subchannel_map_[key] = constructed.get();
59
+ return constructed;
159
60
  }
160
61
 
161
62
  RefCountedPtr<GlobalSubchannelPool>* GlobalSubchannelPool::instance_ = nullptr;
162
63
 
163
- namespace {
164
-
165
- void sck_avl_destroy(void* p, void* /*user_data*/) {
166
- SubchannelKey* key = static_cast<SubchannelKey*>(p);
167
- delete key;
168
- }
169
-
170
- void* sck_avl_copy(void* p, void* /*unused*/) {
171
- const SubchannelKey* key = static_cast<const SubchannelKey*>(p);
172
- auto* new_key = new SubchannelKey(*key);
173
- return static_cast<void*>(new_key);
174
- }
175
-
176
- long sck_avl_compare(void* a, void* b, void* /*unused*/) {
177
- const SubchannelKey* key_a = static_cast<const SubchannelKey*>(a);
178
- const SubchannelKey* key_b = static_cast<const SubchannelKey*>(b);
179
- return key_a->Cmp(*key_b);
180
- }
181
-
182
- void scv_avl_destroy(void* p, void* /*user_data*/) {
183
- GRPC_SUBCHANNEL_WEAK_UNREF((Subchannel*)p, "global_subchannel_pool");
64
+ void GlobalSubchannelPool::UnregisterSubchannel(const SubchannelKey& key,
65
+ Subchannel* subchannel) {
66
+ MutexLock lock(&mu_);
67
+ auto it = subchannel_map_.find(key);
68
+ // delete only if key hasn't been re-registered to a different subchannel
69
+ // between strong-unreffing and unregistration of subchannel.
70
+ if (it != subchannel_map_.end() && it->second == subchannel) {
71
+ subchannel_map_.erase(it);
72
+ }
184
73
  }
185
74
 
186
- void* scv_avl_copy(void* p, void* /*unused*/) {
187
- GRPC_SUBCHANNEL_WEAK_REF((Subchannel*)p, "global_subchannel_pool");
188
- return p;
75
+ RefCountedPtr<Subchannel> GlobalSubchannelPool::FindSubchannel(
76
+ const SubchannelKey& key) {
77
+ MutexLock lock(&mu_);
78
+ auto it = subchannel_map_.find(key);
79
+ if (it == subchannel_map_.end()) return nullptr;
80
+ return it->second->RefIfNonZero();
189
81
  }
190
82
 
191
- } // namespace
192
-
193
- const grpc_avl_vtable GlobalSubchannelPool::subchannel_avl_vtable_ = {
194
- sck_avl_destroy, // destroy_key
195
- sck_avl_copy, // copy_key
196
- sck_avl_compare, // compare_keys
197
- scv_avl_destroy, // destroy_value
198
- scv_avl_copy // copy_value
199
- };
200
-
201
83
  } // namespace grpc_core