grpc 1.42.0 → 1.45.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 (1465) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +405 -221
  3. data/include/grpc/event_engine/event_engine.h +37 -13
  4. data/include/grpc/event_engine/internal/memory_allocator_impl.h +1 -31
  5. data/include/grpc/event_engine/memory_allocator.h +27 -11
  6. data/include/grpc/event_engine/memory_request.h +57 -0
  7. data/include/grpc/grpc.h +40 -14
  8. data/include/grpc/grpc_posix.h +20 -19
  9. data/include/grpc/grpc_security.h +312 -195
  10. data/include/grpc/grpc_security_constants.h +1 -14
  11. data/include/grpc/impl/codegen/compression_types.h +0 -2
  12. data/include/grpc/impl/codegen/grpc_types.h +17 -8
  13. data/include/grpc/impl/codegen/port_platform.h +7 -3
  14. data/include/grpc/impl/codegen/slice.h +4 -1
  15. data/include/grpc/slice.h +0 -11
  16. data/src/core/ext/filters/client_channel/backend_metric.cc +9 -10
  17. data/src/core/ext/filters/client_channel/backend_metric.h +4 -3
  18. data/src/core/ext/filters/client_channel/backup_poller.cc +12 -8
  19. data/src/core/ext/filters/client_channel/channel_connectivity.cc +5 -5
  20. data/src/core/ext/filters/client_channel/client_channel.cc +213 -156
  21. data/src/core/ext/filters/client_channel/client_channel.h +43 -41
  22. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +6 -13
  23. data/src/core/ext/filters/client_channel/config_selector.h +4 -4
  24. data/src/core/ext/filters/client_channel/connector.h +1 -1
  25. data/src/core/ext/filters/client_channel/dynamic_filters.cc +5 -6
  26. data/src/core/ext/filters/client_channel/dynamic_filters.h +2 -2
  27. data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +2 -22
  28. data/src/core/ext/filters/client_channel/global_subchannel_pool.h +3 -15
  29. data/src/core/ext/filters/client_channel/health/health_check_client.cc +32 -31
  30. data/src/core/ext/filters/client_channel/health/health_check_client.h +5 -5
  31. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +22 -27
  32. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +4 -3
  33. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +6 -5
  34. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +4 -7
  35. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +100 -81
  36. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +0 -7
  37. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +1 -1
  38. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +1 -2
  39. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +2 -2
  40. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +15 -15
  41. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +4 -4
  42. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +50 -32
  43. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +28 -19
  44. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +122 -71
  45. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +161 -112
  46. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +62 -61
  47. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +16 -11
  48. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +13 -7
  49. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +55 -99
  50. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +1 -1
  51. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +147 -70
  52. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +5 -3
  53. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +114 -206
  54. data/src/core/ext/filters/client_channel/lb_policy.cc +15 -14
  55. data/src/core/ext/filters/client_channel/lb_policy.h +94 -62
  56. data/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc +10 -16
  57. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +261 -122
  58. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +22 -12
  59. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +19 -15
  60. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +31 -50
  61. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +136 -226
  62. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +25 -32
  63. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +1 -1
  64. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +122 -115
  65. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +18 -17
  66. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +2 -1
  67. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +84 -68
  68. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +40 -39
  69. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +390 -373
  70. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +8 -11
  71. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +13 -7
  72. data/src/core/ext/filters/client_channel/retry_filter.cc +236 -169
  73. data/src/core/ext/filters/client_channel/retry_service_config.cc +16 -18
  74. data/src/core/ext/filters/client_channel/retry_service_config.h +18 -12
  75. data/src/core/ext/filters/client_channel/retry_throttle.cc +9 -23
  76. data/src/core/ext/filters/client_channel/retry_throttle.h +11 -5
  77. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +8 -7
  78. data/src/core/ext/filters/client_channel/subchannel.cc +49 -56
  79. data/src/core/ext/filters/client_channel/subchannel.h +7 -7
  80. data/src/core/ext/filters/client_idle/client_idle_filter.cc +96 -159
  81. data/src/core/ext/filters/client_idle/idle_filter_state.h +2 -2
  82. data/src/core/ext/filters/deadline/deadline_filter.cc +15 -14
  83. data/src/core/ext/filters/deadline/deadline_filter.h +3 -2
  84. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +53 -58
  85. data/src/core/ext/filters/fault_injection/service_config_parser.cc +11 -13
  86. data/src/core/ext/filters/fault_injection/service_config_parser.h +10 -4
  87. data/src/core/ext/filters/http/client/http_client_filter.cc +70 -153
  88. data/src/core/ext/filters/http/client_authority_filter.cc +28 -87
  89. data/src/core/ext/filters/http/client_authority_filter.h +23 -5
  90. data/src/core/ext/filters/http/http_filters_plugin.cc +14 -17
  91. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +43 -140
  92. data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +15 -27
  93. data/src/core/ext/filters/http/server/http_server_filter.cc +60 -161
  94. data/src/core/ext/filters/max_age/max_age_filter.cc +46 -40
  95. data/src/core/ext/filters/message_size/message_size_filter.cc +27 -35
  96. data/src/core/ext/filters/message_size/message_size_filter.h +10 -3
  97. data/src/core/ext/filters/rbac/rbac_filter.cc +162 -0
  98. data/src/core/ext/filters/rbac/rbac_filter.h +76 -0
  99. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +606 -0
  100. data/src/core/ext/filters/rbac/rbac_service_config_parser.h +75 -0
  101. data/src/core/ext/filters/server_config_selector/server_config_selector.cc +67 -0
  102. data/src/core/ext/filters/server_config_selector/server_config_selector.h +71 -0
  103. data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +271 -0
  104. data/src/core/ext/{transport/chttp2/transport/hpack_utils.h → filters/server_config_selector/server_config_selector_filter.h} +9 -7
  105. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +238 -20
  106. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +0 -2
  107. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +283 -106
  108. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +204 -291
  109. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +9 -4
  110. data/src/core/ext/transport/chttp2/transport/context_list.cc +2 -3
  111. data/src/core/ext/transport/chttp2/transport/context_list.h +2 -3
  112. data/src/core/ext/transport/chttp2/transport/flow_control.cc +10 -10
  113. data/src/core/ext/transport/chttp2/transport/flow_control.h +5 -5
  114. data/src/core/ext/transport/chttp2/transport/frame_data.cc +0 -1
  115. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +4 -4
  116. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +5 -0
  117. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +365 -240
  118. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +87 -145
  119. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +1 -1
  120. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +2 -0
  121. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +74 -149
  122. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +0 -1
  123. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +94 -1
  124. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +2 -24
  125. data/src/core/ext/transport/chttp2/transport/internal.h +12 -41
  126. data/src/core/ext/transport/chttp2/transport/parsing.cc +3 -9
  127. data/src/core/ext/transport/chttp2/transport/writing.cc +62 -128
  128. data/src/core/ext/transport/inproc/inproc_plugin.cc +0 -4
  129. data/src/core/ext/transport/inproc/inproc_transport.cc +42 -81
  130. data/src/core/ext/transport/inproc/inproc_transport.h +1 -4
  131. data/src/core/ext/upb-generated/envoy/admin/v3/certs.upb.c +114 -0
  132. data/src/core/ext/upb-generated/envoy/admin/v3/certs.upb.h +402 -0
  133. data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.c +119 -0
  134. data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.h +453 -0
  135. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +243 -209
  136. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +799 -574
  137. data/src/core/ext/upb-generated/envoy/admin/v3/init_dump.upb.c +56 -0
  138. data/src/core/ext/upb-generated/envoy/admin/v3/init_dump.upb.h +138 -0
  139. data/src/core/ext/upb-generated/envoy/admin/v3/listeners.upb.c +62 -0
  140. data/src/core/ext/upb-generated/envoy/admin/v3/listeners.upb.h +146 -0
  141. data/src/core/ext/upb-generated/envoy/admin/v3/memory.upb.c +46 -0
  142. data/src/core/ext/upb-generated/envoy/admin/v3/memory.upb.h +106 -0
  143. data/src/core/ext/upb-generated/envoy/admin/v3/metrics.upb.c +43 -0
  144. data/src/core/ext/upb-generated/envoy/admin/v3/metrics.upb.h +93 -0
  145. data/src/core/ext/upb-generated/envoy/admin/v3/mutex_stats.upb.c +43 -0
  146. data/src/core/ext/upb-generated/envoy/admin/v3/mutex_stats.upb.h +88 -0
  147. data/src/core/ext/upb-generated/envoy/admin/v3/server_info.upb.c +103 -0
  148. data/src/core/ext/upb-generated/envoy/admin/v3/server_info.upb.h +466 -0
  149. data/src/core/ext/upb-generated/envoy/admin/v3/tap.upb.c +48 -0
  150. data/src/core/ext/upb-generated/envoy/admin/v3/tap.upb.h +95 -0
  151. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.c +43 -0
  152. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +19 -0
  153. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +30 -4
  154. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +33 -18
  155. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +143 -116
  156. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +422 -316
  157. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +231 -199
  158. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +788 -570
  159. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +43 -28
  160. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +116 -78
  161. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +308 -271
  162. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +955 -661
  163. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +20 -7
  164. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +34 -22
  165. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +40 -27
  166. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +128 -78
  167. data/src/core/ext/upb-generated/envoy/config/common/matcher/v3/matcher.upb.c +290 -0
  168. data/src/core/ext/upb-generated/envoy/config/common/matcher/v3/matcher.upb.h +1122 -0
  169. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +72 -53
  170. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +222 -158
  171. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +20 -7
  172. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +34 -22
  173. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +213 -176
  174. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +692 -498
  175. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +62 -45
  176. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +179 -129
  177. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +19 -6
  178. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +26 -18
  179. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +31 -17
  180. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +75 -52
  181. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_method_list.upb.c +58 -0
  182. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_method_list.upb.h +138 -0
  183. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +143 -117
  184. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +450 -328
  185. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +111 -91
  186. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +366 -263
  187. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +21 -8
  188. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +37 -25
  189. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +184 -125
  190. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +676 -344
  191. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +17 -4
  192. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +26 -16
  193. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.c +27 -13
  194. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.h +60 -41
  195. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +22 -9
  196. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +40 -24
  197. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +26 -13
  198. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +46 -34
  199. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.c +21 -8
  200. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.h +35 -23
  201. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +51 -35
  202. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +114 -84
  203. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +73 -55
  204. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +211 -150
  205. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +70 -53
  206. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +211 -141
  207. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +19 -6
  208. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +29 -19
  209. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +91 -71
  210. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +282 -191
  211. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +97 -78
  212. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +287 -217
  213. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +29 -16
  214. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +63 -41
  215. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +24 -10
  216. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +54 -37
  217. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.c +53 -0
  218. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.h +120 -0
  219. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +81 -61
  220. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +245 -184
  221. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +86 -65
  222. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +261 -191
  223. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +123 -103
  224. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +236 -190
  225. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +49 -34
  226. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +143 -111
  227. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +642 -572
  228. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +2038 -1506
  229. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +38 -19
  230. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +108 -63
  231. data/src/core/ext/upb-generated/envoy/config/tap/v3/common.upb.c +216 -0
  232. data/src/core/ext/upb-generated/envoy/config/tap/v3/common.upb.h +870 -0
  233. data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.c +44 -0
  234. data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.h +82 -0
  235. data/src/core/ext/upb-generated/envoy/config/trace/v3/dynamic_ot.upb.c +49 -0
  236. data/src/core/ext/upb-generated/envoy/config/trace/v3/dynamic_ot.upb.h +95 -0
  237. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +27 -13
  238. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +56 -39
  239. data/src/core/ext/upb-generated/envoy/config/trace/v3/lightstep.upb.c +52 -0
  240. data/src/core/ext/upb-generated/envoy/config/trace/v3/lightstep.upb.h +119 -0
  241. data/src/core/ext/upb-generated/envoy/config/trace/v3/opencensus.upb.c +62 -0
  242. data/src/core/ext/upb-generated/envoy/config/trace/v3/opencensus.upb.h +203 -0
  243. data/src/core/ext/upb-generated/envoy/config/trace/v3/service.upb.c +47 -0
  244. data/src/core/ext/upb-generated/envoy/config/trace/v3/service.upb.h +89 -0
  245. data/src/core/ext/upb-generated/envoy/config/trace/v3/skywalking.upb.c +69 -0
  246. data/src/core/ext/upb-generated/envoy/config/trace/v3/skywalking.upb.h +184 -0
  247. data/src/core/ext/upb-generated/envoy/config/trace/v3/trace.upb.c +32 -0
  248. data/src/core/ext/upb-generated/envoy/config/trace/v3/trace.upb.h +42 -0
  249. data/src/core/ext/upb-generated/envoy/config/trace/v3/xray.upb.c +71 -0
  250. data/src/core/ext/upb-generated/envoy/config/trace/v3/xray.upb.h +192 -0
  251. data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.c +54 -0
  252. data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.h +126 -0
  253. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.c +17 -4
  254. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +30 -22
  255. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +45 -28
  256. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +125 -91
  257. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +51 -36
  258. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +150 -104
  259. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.c +63 -0
  260. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +165 -0
  261. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +26 -13
  262. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +54 -36
  263. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +254 -223
  264. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +804 -558
  265. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +9 -0
  266. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +6 -3
  267. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +99 -60
  268. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +369 -193
  269. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +41 -26
  270. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +96 -70
  271. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +101 -83
  272. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +267 -192
  273. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.c +62 -0
  274. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.h +146 -0
  275. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.c +15 -2
  276. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +22 -14
  277. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +91 -72
  278. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +298 -217
  279. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +31 -17
  280. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +74 -53
  281. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +73 -56
  282. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +198 -144
  283. data/src/core/ext/upb-generated/envoy/type/http/v3/cookie.upb.c +48 -0
  284. data/src/core/ext/upb-generated/envoy/type/http/v3/cookie.upb.h +101 -0
  285. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.c +34 -18
  286. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.h +91 -68
  287. data/src/core/ext/upb-generated/envoy/type/matcher/v3/http_inputs.upb.c +74 -0
  288. data/src/core/ext/upb-generated/envoy/type/matcher/v3/http_inputs.upb.h +202 -0
  289. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +28 -14
  290. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +65 -46
  291. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +21 -8
  292. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +35 -25
  293. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +20 -7
  294. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +26 -18
  295. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +19 -6
  296. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +26 -18
  297. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +35 -20
  298. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +86 -60
  299. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +31 -17
  300. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +66 -51
  301. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +26 -12
  302. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +57 -42
  303. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +37 -22
  304. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +75 -57
  305. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +50 -31
  306. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +163 -123
  307. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +53 -36
  308. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +158 -112
  309. data/src/core/ext/upb-generated/envoy/type/v3/hash_policy.upb.c +66 -0
  310. data/src/core/ext/upb-generated/envoy/type/v3/hash_policy.upb.h +183 -0
  311. data/src/core/ext/upb-generated/envoy/type/v3/http.upb.c +9 -0
  312. data/src/core/ext/upb-generated/envoy/type/v3/http.upb.h +3 -0
  313. data/src/core/ext/upb-generated/envoy/type/v3/http_status.upb.c +42 -0
  314. data/src/core/ext/upb-generated/envoy/type/v3/http_status.upb.h +136 -0
  315. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +23 -9
  316. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +52 -33
  317. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +30 -15
  318. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +81 -51
  319. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.c +26 -0
  320. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.h +41 -0
  321. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.c +19 -6
  322. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +32 -18
  323. data/src/core/ext/upb-generated/envoy/type/v3/token_bucket.upb.c +51 -0
  324. data/src/core/ext/upb-generated/envoy/type/v3/token_bucket.upb.h +114 -0
  325. data/src/core/ext/upb-generated/google/api/annotations.upb.c +22 -0
  326. data/src/core/ext/upb-generated/google/api/annotations.upb.h +8 -0
  327. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +150 -125
  328. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +372 -280
  329. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +152 -126
  330. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +410 -297
  331. data/src/core/ext/upb-generated/google/api/http.upb.c +43 -28
  332. data/src/core/ext/upb-generated/google/api/http.upb.h +118 -88
  333. data/src/core/ext/upb-generated/google/api/httpbody.upb.c +46 -0
  334. data/src/core/ext/upb-generated/google/api/httpbody.upb.h +99 -0
  335. data/src/core/ext/upb-generated/google/protobuf/any.upb.c +18 -5
  336. data/src/core/ext/upb-generated/google/protobuf/any.upb.h +33 -21
  337. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +366 -276
  338. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +1089 -763
  339. data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +18 -5
  340. data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +29 -17
  341. data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +15 -2
  342. data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +22 -14
  343. data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +47 -31
  344. data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +81 -63
  345. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +18 -5
  346. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +29 -17
  347. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +57 -36
  348. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +214 -148
  349. data/src/core/ext/upb-generated/google/rpc/status.upb.c +21 -8
  350. data/src/core/ext/upb-generated/google/rpc/status.upb.h +37 -25
  351. data/src/core/ext/upb-generated/opencensus/proto/trace/v1/trace_config.upb.c +84 -0
  352. data/src/core/ext/upb-generated/opencensus/proto/trace/v1/trace_config.upb.h +276 -0
  353. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +32 -18
  354. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +61 -41
  355. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +131 -107
  356. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +397 -284
  357. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +26 -12
  358. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +59 -38
  359. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +22 -8
  360. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +51 -34
  361. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +81 -61
  362. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +272 -202
  363. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c +34 -19
  364. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h +77 -56
  365. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +75 -13
  366. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +108 -57
  367. data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +31 -5
  368. data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +34 -17
  369. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c +21 -0
  370. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +8 -0
  371. data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +31 -5
  372. data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +34 -17
  373. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +30 -4
  374. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +33 -18
  375. data/src/core/ext/upb-generated/validate/validate.upb.c +395 -310
  376. data/src/core/ext/upb-generated/validate/validate.upb.h +1118 -725
  377. data/src/core/ext/upb-generated/xds/annotations/v3/migrate.upb.c +110 -0
  378. data/src/core/ext/upb-generated/xds/annotations/v3/migrate.upb.h +191 -0
  379. data/src/core/ext/upb-generated/xds/annotations/v3/security.upb.c +55 -0
  380. data/src/core/ext/upb-generated/xds/annotations/v3/security.upb.h +87 -0
  381. data/src/core/ext/upb-generated/xds/annotations/v3/sensitive.upb.c +38 -0
  382. data/src/core/ext/upb-generated/xds/annotations/v3/sensitive.upb.h +38 -0
  383. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.c +64 -17
  384. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.h +113 -65
  385. data/src/core/ext/upb-generated/xds/annotations/v3/versioning.upb.c +53 -0
  386. data/src/core/ext/upb-generated/xds/annotations/v3/versioning.upb.h +81 -0
  387. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.c +17 -4
  388. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.h +28 -18
  389. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +30 -16
  390. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.h +64 -45
  391. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +25 -11
  392. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.h +32 -24
  393. data/src/core/ext/upb-generated/xds/core/v3/extension.upb.c +46 -0
  394. data/src/core/ext/upb-generated/xds/core/v3/extension.upb.h +95 -0
  395. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.c +22 -9
  396. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.h +40 -26
  397. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +33 -19
  398. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.h +74 -53
  399. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +22 -9
  400. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.h +44 -28
  401. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +36 -21
  402. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +44 -30
  403. data/src/core/ext/upb-generated/xds/type/matcher/v3/matcher.upb.c +203 -0
  404. data/src/core/ext/upb-generated/xds/type/matcher/v3/matcher.upb.h +726 -0
  405. data/src/core/ext/upb-generated/xds/type/matcher/v3/regex.upb.c +52 -0
  406. data/src/core/ext/upb-generated/xds/type/matcher/v3/regex.upb.h +132 -0
  407. data/src/core/ext/upb-generated/xds/type/matcher/v3/string.upb.c +65 -0
  408. data/src/core/ext/upb-generated/xds/type/matcher/v3/string.upb.h +173 -0
  409. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.c +20 -7
  410. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.h +34 -22
  411. data/src/core/ext/upbdefs-generated/envoy/admin/v3/certs.upbdefs.c +84 -0
  412. data/src/core/ext/upbdefs-generated/envoy/admin/v3/certs.upbdefs.h +55 -0
  413. data/src/core/ext/upbdefs-generated/envoy/admin/v3/clusters.upbdefs.c +127 -0
  414. data/src/core/ext/upbdefs-generated/envoy/admin/v3/clusters.upbdefs.h +50 -0
  415. data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.c +16 -61
  416. data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.h +67 -67
  417. data/src/core/ext/upbdefs-generated/envoy/admin/v3/init_dump.upbdefs.c +43 -0
  418. data/src/core/ext/upbdefs-generated/envoy/admin/v3/init_dump.upbdefs.h +40 -0
  419. data/src/core/ext/upbdefs-generated/envoy/admin/v3/listeners.upbdefs.c +53 -0
  420. data/src/core/ext/upbdefs-generated/envoy/admin/v3/listeners.upbdefs.h +40 -0
  421. data/src/core/ext/upbdefs-generated/envoy/admin/v3/memory.upbdefs.c +49 -0
  422. data/src/core/ext/upbdefs-generated/envoy/admin/v3/memory.upbdefs.h +35 -0
  423. data/src/core/ext/upbdefs-generated/envoy/admin/v3/metrics.upbdefs.c +46 -0
  424. data/src/core/ext/upbdefs-generated/envoy/admin/v3/metrics.upbdefs.h +35 -0
  425. data/src/core/ext/upbdefs-generated/envoy/admin/v3/mutex_stats.upbdefs.c +46 -0
  426. data/src/core/ext/upbdefs-generated/envoy/admin/v3/mutex_stats.upbdefs.h +35 -0
  427. data/src/core/ext/upbdefs-generated/envoy/admin/v3/server_info.upbdefs.c +142 -0
  428. data/src/core/ext/upbdefs-generated/envoy/admin/v3/server_info.upbdefs.h +40 -0
  429. data/src/core/ext/upbdefs-generated/envoy/admin/v3/tap.upbdefs.c +51 -0
  430. data/src/core/ext/upbdefs-generated/envoy/admin/v3/tap.upbdefs.h +35 -0
  431. data/src/core/ext/upbdefs-generated/envoy/annotations/deprecation.upbdefs.c +10 -8
  432. data/src/core/ext/upbdefs-generated/envoy/annotations/deprecation.upbdefs.h +1 -1
  433. data/src/core/ext/upbdefs-generated/envoy/annotations/resource.upbdefs.c +10 -13
  434. data/src/core/ext/upbdefs-generated/envoy/annotations/resource.upbdefs.h +4 -4
  435. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +22 -52
  436. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.h +46 -46
  437. data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +250 -281
  438. data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.h +55 -55
  439. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/circuit_breaker.upbdefs.c +18 -24
  440. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/circuit_breaker.upbdefs.h +10 -10
  441. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +377 -426
  442. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.h +76 -76
  443. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/filter.upbdefs.c +16 -18
  444. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/filter.upbdefs.h +4 -4
  445. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/outlier_detection.upbdefs.c +18 -20
  446. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/outlier_detection.upbdefs.h +4 -4
  447. data/src/core/ext/upbdefs-generated/envoy/config/common/matcher/v3/matcher.upbdefs.c +206 -0
  448. data/src/core/ext/upbdefs-generated/envoy/config/common/matcher/v3/matcher.upbdefs.h +105 -0
  449. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.c +17 -32
  450. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.h +22 -22
  451. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/backoff.upbdefs.c +17 -19
  452. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/backoff.upbdefs.h +4 -4
  453. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +87 -133
  454. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.h +73 -73
  455. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +20 -31
  456. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.h +16 -16
  457. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/event_service_config.upbdefs.c +16 -19
  458. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/event_service_config.upbdefs.h +4 -4
  459. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/extension.upbdefs.c +17 -21
  460. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/extension.upbdefs.h +7 -7
  461. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_method_list.upbdefs.c +53 -0
  462. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_method_list.upbdefs.h +40 -0
  463. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.c +23 -51
  464. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.h +43 -43
  465. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +25 -41
  466. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.h +25 -25
  467. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/http_uri.upbdefs.c +16 -19
  468. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/http_uri.upbdefs.h +4 -4
  469. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +252 -254
  470. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.h +53 -43
  471. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/proxy_protocol.upbdefs.c +14 -16
  472. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/proxy_protocol.upbdefs.h +4 -4
  473. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/resolver.upbdefs.c +16 -20
  474. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/resolver.upbdefs.h +7 -7
  475. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.c +16 -18
  476. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.h +4 -4
  477. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.c +20 -22
  478. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.h +4 -4
  479. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/udp_socket_config.upbdefs.c +15 -18
  480. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/udp_socket_config.upbdefs.h +4 -4
  481. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint.upbdefs.c +20 -28
  482. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint.upbdefs.h +13 -13
  483. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +21 -33
  484. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.h +19 -19
  485. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/load_report.upbdefs.c +20 -30
  486. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/load_report.upbdefs.h +16 -16
  487. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/api_listener.upbdefs.c +16 -18
  488. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/api_listener.upbdefs.h +4 -4
  489. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.c +54 -62
  490. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.h +19 -19
  491. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.c +25 -39
  492. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.h +22 -22
  493. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.c +21 -23
  494. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.h +4 -4
  495. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.c +17 -21
  496. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.h +7 -7
  497. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/metrics_service.upbdefs.c +69 -0
  498. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/metrics_service.upbdefs.h +35 -0
  499. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.c +19 -35
  500. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.h +25 -25
  501. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +19 -37
  502. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +28 -28
  503. data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.c +190 -0
  504. data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.h +70 -0
  505. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +21 -27
  506. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.h +10 -10
  507. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +818 -912
  508. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +160 -160
  509. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/scoped_route.upbdefs.c +54 -48
  510. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/scoped_route.upbdefs.h +10 -10
  511. data/src/core/ext/upbdefs-generated/envoy/config/tap/v3/common.upbdefs.c +188 -0
  512. data/src/core/ext/upbdefs-generated/envoy/config/tap/v3/common.upbdefs.h +85 -0
  513. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/datadog.upbdefs.c +54 -0
  514. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/datadog.upbdefs.h +35 -0
  515. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/dynamic_ot.upbdefs.c +57 -0
  516. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/dynamic_ot.upbdefs.h +35 -0
  517. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/http_tracer.upbdefs.c +17 -21
  518. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/http_tracer.upbdefs.h +7 -7
  519. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/lightstep.upbdefs.c +72 -0
  520. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/lightstep.upbdefs.h +35 -0
  521. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/opencensus.upbdefs.c +99 -0
  522. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/opencensus.upbdefs.h +35 -0
  523. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/service.upbdefs.c +52 -0
  524. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/service.upbdefs.h +35 -0
  525. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/skywalking.upbdefs.c +71 -0
  526. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/skywalking.upbdefs.h +40 -0
  527. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/trace.upbdefs.c +57 -0
  528. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/trace.upbdefs.h +30 -0
  529. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/xray.upbdefs.c +75 -0
  530. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/xray.upbdefs.h +40 -0
  531. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/zipkin.upbdefs.c +77 -0
  532. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/zipkin.upbdefs.h +35 -0
  533. data/src/core/ext/upbdefs-generated/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.c +17 -18
  534. data/src/core/ext/upbdefs-generated/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.h +4 -4
  535. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.c +19 -29
  536. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.h +16 -16
  537. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +20 -26
  538. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.h +10 -10
  539. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.c +59 -0
  540. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.h +40 -0
  541. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +19 -20
  542. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.h +4 -4
  543. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +137 -173
  544. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +58 -58
  545. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.c +17 -13
  546. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.h +1 -1
  547. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +171 -157
  548. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.h +24 -19
  549. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.c +21 -27
  550. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.h +10 -10
  551. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +23 -34
  552. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.h +19 -19
  553. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upbdefs.c +58 -0
  554. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upbdefs.h +40 -0
  555. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/ads.upbdefs.c +16 -18
  556. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/ads.upbdefs.h +4 -4
  557. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.c +19 -33
  558. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.h +22 -22
  559. data/src/core/ext/upbdefs-generated/envoy/service/load_stats/v3/lrs.upbdefs.c +18 -22
  560. data/src/core/ext/upbdefs-generated/envoy/service/load_stats/v3/lrs.upbdefs.h +7 -7
  561. data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.c +22 -32
  562. data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.h +16 -16
  563. data/src/core/ext/upbdefs-generated/envoy/type/http/v3/cookie.upbdefs.c +46 -0
  564. data/src/core/ext/upbdefs-generated/envoy/type/http/v3/cookie.upbdefs.h +35 -0
  565. data/src/core/ext/upbdefs-generated/envoy/type/http/v3/path_transformation.upbdefs.c +15 -23
  566. data/src/core/ext/upbdefs-generated/envoy/type/http/v3/path_transformation.upbdefs.h +13 -13
  567. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/http_inputs.upbdefs.c +52 -0
  568. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/http_inputs.upbdefs.h +50 -0
  569. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/metadata.upbdefs.c +17 -21
  570. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/metadata.upbdefs.h +7 -7
  571. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.c +17 -19
  572. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.h +4 -4
  573. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/number.upbdefs.c +17 -19
  574. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/number.upbdefs.h +4 -4
  575. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/path.upbdefs.c +17 -19
  576. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/path.upbdefs.h +4 -4
  577. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +17 -23
  578. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.h +10 -10
  579. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/string.upbdefs.c +17 -21
  580. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/string.upbdefs.h +7 -7
  581. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.c +16 -21
  582. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.h +7 -7
  583. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/value.upbdefs.c +18 -24
  584. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/value.upbdefs.h +10 -10
  585. data/src/core/ext/upbdefs-generated/envoy/type/metadata/v3/metadata.upbdefs.c +15 -29
  586. data/src/core/ext/upbdefs-generated/envoy/type/metadata/v3/metadata.upbdefs.h +22 -22
  587. data/src/core/ext/upbdefs-generated/envoy/type/tracing/v3/custom_tag.upbdefs.c +16 -26
  588. data/src/core/ext/upbdefs-generated/envoy/type/tracing/v3/custom_tag.upbdefs.h +16 -16
  589. data/src/core/ext/upbdefs-generated/envoy/type/v3/hash_policy.upbdefs.c +53 -0
  590. data/src/core/ext/upbdefs-generated/envoy/type/v3/hash_policy.upbdefs.h +45 -0
  591. data/src/core/ext/upbdefs-generated/envoy/type/v3/http.upbdefs.c +12 -10
  592. data/src/core/ext/upbdefs-generated/envoy/type/v3/http.upbdefs.h +1 -1
  593. data/src/core/ext/upbdefs-generated/envoy/type/v3/http_status.upbdefs.c +94 -0
  594. data/src/core/ext/upbdefs-generated/envoy/type/v3/http_status.upbdefs.h +35 -0
  595. data/src/core/ext/upbdefs-generated/envoy/type/v3/percent.upbdefs.c +14 -19
  596. data/src/core/ext/upbdefs-generated/envoy/type/v3/percent.upbdefs.h +7 -7
  597. data/src/core/ext/upbdefs-generated/envoy/type/v3/range.upbdefs.c +13 -19
  598. data/src/core/ext/upbdefs-generated/envoy/type/v3/range.upbdefs.h +10 -10
  599. data/src/core/ext/upbdefs-generated/envoy/type/v3/ratelimit_unit.upbdefs.c +38 -0
  600. data/src/core/ext/upbdefs-generated/envoy/type/v3/ratelimit_unit.upbdefs.h +30 -0
  601. data/src/core/ext/upbdefs-generated/envoy/type/v3/semantic_version.upbdefs.c +13 -16
  602. data/src/core/ext/upbdefs-generated/envoy/type/v3/semantic_version.upbdefs.h +4 -4
  603. data/src/core/ext/upbdefs-generated/envoy/type/v3/token_bucket.upbdefs.c +57 -0
  604. data/src/core/ext/upbdefs-generated/envoy/type/v3/token_bucket.upbdefs.h +35 -0
  605. data/src/core/ext/upbdefs-generated/google/api/annotations.upbdefs.c +7 -7
  606. data/src/core/ext/upbdefs-generated/google/api/annotations.upbdefs.h +1 -1
  607. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/checked.upbdefs.c +154 -0
  608. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/checked.upbdefs.h +95 -0
  609. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/syntax.upbdefs.c +153 -0
  610. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/syntax.upbdefs.h +100 -0
  611. data/src/core/ext/upbdefs-generated/google/api/http.upbdefs.c +5 -14
  612. data/src/core/ext/upbdefs-generated/google/api/http.upbdefs.h +10 -10
  613. data/src/core/ext/upbdefs-generated/google/api/httpbody.upbdefs.c +39 -0
  614. data/src/core/ext/upbdefs-generated/google/api/httpbody.upbdefs.h +35 -0
  615. data/src/core/ext/upbdefs-generated/google/protobuf/any.upbdefs.c +5 -10
  616. data/src/core/ext/upbdefs-generated/google/protobuf/any.upbdefs.h +4 -4
  617. data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c +5 -62
  618. data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.h +82 -82
  619. data/src/core/ext/upbdefs-generated/google/protobuf/duration.upbdefs.c +5 -10
  620. data/src/core/ext/upbdefs-generated/google/protobuf/duration.upbdefs.h +4 -4
  621. data/src/core/ext/upbdefs-generated/google/protobuf/empty.upbdefs.c +5 -10
  622. data/src/core/ext/upbdefs-generated/google/protobuf/empty.upbdefs.h +4 -4
  623. data/src/core/ext/upbdefs-generated/google/protobuf/struct.upbdefs.c +5 -16
  624. data/src/core/ext/upbdefs-generated/google/protobuf/struct.upbdefs.h +13 -13
  625. data/src/core/ext/upbdefs-generated/google/protobuf/timestamp.upbdefs.c +5 -10
  626. data/src/core/ext/upbdefs-generated/google/protobuf/timestamp.upbdefs.h +4 -4
  627. data/src/core/ext/upbdefs-generated/google/protobuf/wrappers.upbdefs.c +5 -26
  628. data/src/core/ext/upbdefs-generated/google/protobuf/wrappers.upbdefs.h +28 -28
  629. data/src/core/ext/upbdefs-generated/google/rpc/status.upbdefs.c +6 -11
  630. data/src/core/ext/upbdefs-generated/google/rpc/status.upbdefs.h +4 -4
  631. data/src/core/ext/upbdefs-generated/opencensus/proto/trace/v1/trace_config.upbdefs.c +67 -0
  632. data/src/core/ext/upbdefs-generated/opencensus/proto/trace/v1/trace_config.upbdefs.h +50 -0
  633. data/src/core/ext/upbdefs-generated/udpa/annotations/migrate.upbdefs.c +6 -15
  634. data/src/core/ext/upbdefs-generated/udpa/annotations/migrate.upbdefs.h +10 -10
  635. data/src/core/ext/upbdefs-generated/udpa/annotations/security.upbdefs.c +7 -12
  636. data/src/core/ext/upbdefs-generated/udpa/annotations/security.upbdefs.h +4 -4
  637. data/src/core/ext/upbdefs-generated/udpa/annotations/sensitive.upbdefs.c +6 -6
  638. data/src/core/ext/upbdefs-generated/udpa/annotations/sensitive.upbdefs.h +1 -1
  639. data/src/core/ext/upbdefs-generated/udpa/annotations/status.upbdefs.c +6 -11
  640. data/src/core/ext/upbdefs-generated/udpa/annotations/status.upbdefs.h +4 -4
  641. data/src/core/ext/upbdefs-generated/udpa/annotations/versioning.upbdefs.c +6 -11
  642. data/src/core/ext/upbdefs-generated/udpa/annotations/versioning.upbdefs.h +4 -4
  643. data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.c +8 -57
  644. data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.h +70 -70
  645. data/src/core/ext/upbdefs-generated/xds/annotations/v3/migrate.upbdefs.c +63 -0
  646. data/src/core/ext/upbdefs-generated/xds/annotations/v3/migrate.upbdefs.h +45 -0
  647. data/src/core/ext/upbdefs-generated/xds/annotations/v3/security.upbdefs.c +47 -0
  648. data/src/core/ext/upbdefs-generated/xds/annotations/v3/security.upbdefs.h +35 -0
  649. data/src/core/ext/upbdefs-generated/xds/annotations/v3/sensitive.upbdefs.c +35 -0
  650. data/src/core/ext/upbdefs-generated/xds/annotations/v3/sensitive.upbdefs.h +30 -0
  651. data/src/core/ext/upbdefs-generated/xds/annotations/v3/status.upbdefs.c +6 -17
  652. data/src/core/ext/upbdefs-generated/xds/annotations/v3/status.upbdefs.h +13 -13
  653. data/src/core/ext/upbdefs-generated/xds/annotations/v3/versioning.upbdefs.c +40 -0
  654. data/src/core/ext/upbdefs-generated/xds/annotations/v3/versioning.upbdefs.h +35 -0
  655. data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.c +7 -12
  656. data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.h +4 -4
  657. data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.c +9 -16
  658. data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.h +7 -7
  659. data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.c +6 -13
  660. data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.h +7 -7
  661. data/src/core/ext/upbdefs-generated/xds/core/v3/extension.upbdefs.c +41 -0
  662. data/src/core/ext/upbdefs-generated/xds/core/v3/extension.upbdefs.h +35 -0
  663. data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.c +8 -13
  664. data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.h +4 -4
  665. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.c +8 -15
  666. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.h +7 -7
  667. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.c +8 -13
  668. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.h +4 -4
  669. data/src/core/ext/upbdefs-generated/xds/type/matcher/v3/matcher.upbdefs.c +126 -0
  670. data/src/core/ext/upbdefs-generated/xds/type/matcher/v3/matcher.upbdefs.h +80 -0
  671. data/src/core/ext/upbdefs-generated/xds/type/matcher/v3/regex.upbdefs.c +40 -0
  672. data/src/core/ext/upbdefs-generated/xds/type/matcher/v3/regex.upbdefs.h +40 -0
  673. data/src/core/ext/upbdefs-generated/xds/type/matcher/v3/string.upbdefs.c +52 -0
  674. data/src/core/ext/upbdefs-generated/xds/type/matcher/v3/string.upbdefs.h +40 -0
  675. data/src/core/ext/upbdefs-generated/xds/type/v3/typed_struct.upbdefs.c +7 -12
  676. data/src/core/ext/upbdefs-generated/xds/type/v3/typed_struct.upbdefs.h +4 -4
  677. data/src/core/ext/xds/certificate_provider_registry.cc +1 -1
  678. data/src/core/ext/xds/certificate_provider_store.h +1 -1
  679. data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +4 -4
  680. data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +2 -2
  681. data/src/core/ext/xds/upb_utils.h +67 -0
  682. data/src/core/ext/xds/xds_api.cc +162 -3417
  683. data/src/core/ext/xds/xds_api.h +60 -613
  684. data/src/core/ext/xds/xds_bootstrap.cc +221 -122
  685. data/src/core/ext/xds/xds_bootstrap.h +31 -15
  686. data/src/core/ext/xds/xds_certificate_provider.h +2 -2
  687. data/src/core/ext/xds/xds_channel_stack_modifier.cc +16 -20
  688. data/src/core/ext/xds/xds_channel_stack_modifier.h +4 -3
  689. data/src/core/ext/xds/xds_client.cc +794 -1065
  690. data/src/core/ext/xds/xds_client.h +109 -149
  691. data/src/core/ext/xds/xds_client_stats.cc +15 -15
  692. data/src/core/ext/xds/xds_client_stats.h +5 -4
  693. data/src/core/ext/xds/xds_cluster.cc +453 -0
  694. data/src/core/ext/xds/xds_cluster.h +108 -0
  695. data/src/core/ext/xds/xds_common_types.cc +388 -0
  696. data/src/core/ext/xds/xds_common_types.h +95 -0
  697. data/src/core/ext/xds/xds_endpoint.cc +364 -0
  698. data/src/core/ext/xds/xds_endpoint.h +135 -0
  699. data/src/core/ext/xds/xds_http_fault_filter.cc +6 -6
  700. data/src/core/ext/xds/xds_http_fault_filter.h +3 -3
  701. data/src/core/ext/xds/xds_http_filters.cc +11 -5
  702. data/src/core/ext/xds/xds_http_filters.h +4 -4
  703. data/src/core/ext/xds/xds_http_rbac_filter.cc +563 -0
  704. data/src/core/ext/xds/xds_http_rbac_filter.h +54 -0
  705. data/src/core/ext/xds/xds_listener.cc +1039 -0
  706. data/src/core/ext/xds/xds_listener.h +220 -0
  707. data/src/core/ext/xds/xds_resource_type.cc +33 -0
  708. data/src/core/ext/xds/xds_resource_type.h +98 -0
  709. data/src/core/ext/xds/xds_resource_type_impl.h +87 -0
  710. data/src/core/ext/xds/xds_route_config.cc +985 -0
  711. data/src/core/ext/xds/xds_route_config.h +215 -0
  712. data/src/core/ext/xds/xds_routing.cc +250 -0
  713. data/src/core/ext/xds/xds_routing.h +101 -0
  714. data/src/core/ext/xds/xds_server_config_fetcher.cc +1061 -286
  715. data/src/core/lib/address_utils/parse_address.cc +20 -0
  716. data/src/core/lib/address_utils/parse_address.h +5 -0
  717. data/src/core/lib/address_utils/sockaddr_utils.cc +33 -36
  718. data/src/core/lib/address_utils/sockaddr_utils.h +1 -16
  719. data/src/core/lib/avl/avl.h +389 -88
  720. data/src/core/lib/backoff/backoff.cc +9 -38
  721. data/src/core/lib/backoff/backoff.h +11 -11
  722. data/src/core/lib/channel/call_finalization.h +86 -0
  723. data/src/core/lib/channel/channel_args.cc +77 -18
  724. data/src/core/lib/channel/channel_args.h +13 -10
  725. data/src/core/lib/channel/channel_args_preconditioning.cc +48 -0
  726. data/src/core/lib/channel/channel_args_preconditioning.h +62 -0
  727. data/src/core/lib/channel/channel_stack.cc +10 -3
  728. data/src/core/lib/channel/channel_stack.h +42 -6
  729. data/src/core/lib/channel/channel_stack_builder.cc +66 -250
  730. data/src/core/lib/channel/channel_stack_builder.h +95 -147
  731. data/src/core/lib/channel/channel_trace.cc +3 -6
  732. data/src/core/lib/channel/channelz.cc +2 -1
  733. data/src/core/lib/channel/connected_channel.cc +9 -4
  734. data/src/core/lib/channel/connected_channel.h +1 -1
  735. data/src/core/lib/channel/context.h +11 -0
  736. data/src/core/lib/channel/handshaker.cc +1 -1
  737. data/src/core/lib/channel/handshaker.h +1 -1
  738. data/src/core/lib/channel/promise_based_filter.cc +669 -0
  739. data/src/core/lib/channel/promise_based_filter.h +423 -0
  740. data/src/core/lib/compression/compression.cc +20 -112
  741. data/src/core/lib/compression/compression_internal.cc +143 -203
  742. data/src/core/lib/compression/compression_internal.h +64 -69
  743. data/src/core/lib/compression/message_compress.cc +11 -11
  744. data/src/core/lib/compression/message_compress.h +2 -2
  745. data/src/core/lib/config/core_configuration.cc +11 -3
  746. data/src/core/lib/config/core_configuration.h +50 -0
  747. data/src/core/lib/debug/trace.h +2 -2
  748. data/src/core/lib/event_engine/{endpoint_config.cc → channel_args_endpoint_config.cc} +2 -1
  749. data/src/core/lib/event_engine/{endpoint_config_internal.h → channel_args_endpoint_config.h} +3 -3
  750. data/src/core/lib/event_engine/default_event_engine_factory.cc +27 -0
  751. data/src/core/lib/event_engine/event_engine.cc +21 -19
  752. data/src/core/lib/event_engine/event_engine_factory.h +36 -0
  753. data/src/core/lib/event_engine/memory_allocator.cc +66 -0
  754. data/src/core/lib/event_engine/resolved_address.cc +39 -0
  755. data/src/core/lib/gpr/sync_posix.cc +1 -0
  756. data/src/core/lib/gpr/time.cc +2 -1
  757. data/src/core/lib/gpr/tls.h +6 -0
  758. data/src/core/lib/gpr/useful.h +18 -0
  759. data/src/core/lib/gprpp/bitset.h +7 -0
  760. data/src/core/lib/gprpp/capture.h +76 -0
  761. data/src/core/lib/gprpp/chunked_vector.h +45 -3
  762. data/src/core/lib/gprpp/cpp_impl_of.h +45 -0
  763. data/src/core/lib/gprpp/debug_location.h +2 -0
  764. data/src/core/lib/gprpp/global_config_env.cc +7 -7
  765. data/src/core/lib/gprpp/global_config_env.h +2 -2
  766. data/src/core/lib/gprpp/manual_constructor.h +2 -3
  767. data/src/core/lib/gprpp/orphanable.h +1 -1
  768. data/src/core/lib/gprpp/ref_counted.h +1 -1
  769. data/src/core/lib/gprpp/ref_counted_ptr.h +2 -4
  770. data/src/core/lib/gprpp/status_helper.cc +30 -38
  771. data/src/core/lib/gprpp/status_helper.h +6 -19
  772. data/src/core/lib/gprpp/table.h +24 -1
  773. data/src/core/lib/gprpp/time.cc +186 -0
  774. data/src/core/lib/gprpp/time.h +292 -0
  775. data/src/core/lib/http/format_request.cc +27 -23
  776. data/src/core/lib/http/format_request.h +7 -6
  777. data/src/core/lib/http/httpcli.cc +310 -238
  778. data/src/core/lib/http/httpcli.h +183 -88
  779. data/src/core/lib/http/httpcli_security_connector.cc +62 -73
  780. data/src/core/lib/http/httpcli_ssl_credentials.h +37 -0
  781. data/src/core/lib/http/parser.h +1 -1
  782. data/src/core/lib/iomgr/buffer_list.cc +9 -9
  783. data/src/core/lib/iomgr/buffer_list.h +18 -18
  784. data/src/core/lib/iomgr/call_combiner.cc +17 -7
  785. data/src/core/lib/iomgr/closure.h +29 -9
  786. data/src/core/lib/iomgr/combiner.cc +25 -3
  787. data/src/core/lib/iomgr/endpoint.h +0 -1
  788. data/src/core/lib/iomgr/endpoint_cfstream.cc +7 -24
  789. data/src/core/lib/iomgr/endpoint_cfstream.h +4 -4
  790. data/src/core/lib/iomgr/endpoint_pair_posix.cc +9 -11
  791. data/src/core/lib/iomgr/endpoint_pair_windows.cc +5 -14
  792. data/src/core/lib/iomgr/error.cc +13 -10
  793. data/src/core/lib/iomgr/error.h +0 -2
  794. data/src/core/lib/iomgr/ev_apple.cc +6 -5
  795. data/src/core/lib/iomgr/ev_epoll1_linux.cc +8 -7
  796. data/src/core/lib/iomgr/ev_epollex_linux.cc +12 -9
  797. data/src/core/lib/iomgr/ev_poll_posix.cc +7 -7
  798. data/src/core/lib/iomgr/ev_posix.cc +3 -3
  799. data/src/core/lib/iomgr/ev_posix.h +1 -1
  800. data/src/core/lib/iomgr/event_engine/endpoint.cc +2 -3
  801. data/src/core/lib/iomgr/event_engine/iomgr.cc +8 -27
  802. data/src/core/lib/iomgr/event_engine/pollset.cc +2 -3
  803. data/src/core/lib/iomgr/event_engine/resolved_address_internal.cc +6 -0
  804. data/src/core/lib/iomgr/event_engine/resolved_address_internal.h +2 -0
  805. data/src/core/lib/iomgr/event_engine/resolver.cc +68 -49
  806. data/src/core/lib/iomgr/event_engine/resolver.h +56 -0
  807. data/src/core/lib/iomgr/event_engine/tcp.cc +11 -8
  808. data/src/core/lib/iomgr/event_engine/timer.cc +7 -7
  809. data/src/core/lib/iomgr/exec_ctx.cc +25 -97
  810. data/src/core/lib/iomgr/exec_ctx.h +18 -34
  811. data/src/core/lib/iomgr/executor.cc +22 -16
  812. data/src/core/lib/iomgr/executor.h +1 -1
  813. data/src/core/lib/iomgr/fork_posix.cc +3 -2
  814. data/src/core/lib/iomgr/iocp_windows.cc +9 -9
  815. data/src/core/lib/iomgr/iocp_windows.h +1 -1
  816. data/src/core/lib/iomgr/iomgr_posix.cc +2 -2
  817. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +2 -2
  818. data/src/core/lib/iomgr/iomgr_windows.cc +2 -2
  819. data/src/core/lib/iomgr/polling_entity.h +6 -0
  820. data/src/core/lib/iomgr/pollset.cc +1 -1
  821. data/src/core/lib/iomgr/pollset.h +4 -4
  822. data/src/core/lib/iomgr/pollset_windows.cc +2 -2
  823. data/src/core/lib/iomgr/port.h +6 -9
  824. data/src/core/lib/iomgr/resolve_address.cc +5 -24
  825. data/src/core/lib/iomgr/resolve_address.h +47 -44
  826. data/src/core/lib/iomgr/resolve_address_impl.h +59 -0
  827. data/src/core/lib/iomgr/resolve_address_posix.cc +83 -67
  828. data/src/core/lib/iomgr/resolve_address_posix.h +47 -0
  829. data/src/core/lib/iomgr/resolve_address_windows.cc +93 -74
  830. data/src/core/lib/iomgr/resolve_address_windows.h +47 -0
  831. data/src/core/lib/iomgr/resolved_address.h +39 -0
  832. data/src/core/lib/iomgr/sockaddr_utils_posix.cc +62 -0
  833. data/src/core/lib/iomgr/socket_utils_common_posix.cc +0 -17
  834. data/src/core/lib/iomgr/tcp_client.cc +3 -5
  835. data/src/core/lib/iomgr/tcp_client.h +4 -5
  836. data/src/core/lib/iomgr/tcp_client_cfstream.cc +2 -10
  837. data/src/core/lib/iomgr/tcp_client_posix.cc +8 -24
  838. data/src/core/lib/iomgr/tcp_client_posix.h +3 -4
  839. data/src/core/lib/iomgr/tcp_client_windows.cc +2 -11
  840. data/src/core/lib/iomgr/tcp_posix.cc +30 -34
  841. data/src/core/lib/iomgr/tcp_posix.h +1 -3
  842. data/src/core/lib/iomgr/tcp_server.cc +4 -6
  843. data/src/core/lib/iomgr/tcp_server.h +6 -8
  844. data/src/core/lib/iomgr/tcp_server_posix.cc +18 -22
  845. data/src/core/lib/iomgr/tcp_server_utils_posix.h +19 -18
  846. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +1 -0
  847. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +1 -0
  848. data/src/core/lib/iomgr/tcp_server_windows.cc +5 -12
  849. data/src/core/lib/iomgr/tcp_windows.cc +19 -17
  850. data/src/core/lib/iomgr/tcp_windows.h +1 -2
  851. data/src/core/lib/iomgr/timer.cc +2 -2
  852. data/src/core/lib/iomgr/timer.h +11 -6
  853. data/src/core/lib/iomgr/timer_generic.cc +96 -77
  854. data/src/core/lib/iomgr/timer_manager.cc +15 -14
  855. data/src/core/lib/iomgr/unix_sockets_posix.cc +22 -34
  856. data/src/core/lib/iomgr/unix_sockets_posix.h +4 -7
  857. data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +6 -15
  858. data/src/core/lib/iomgr/work_serializer.cc +120 -44
  859. data/src/core/lib/iomgr/work_serializer.h +16 -4
  860. data/src/core/lib/json/json_reader.cc +83 -35
  861. data/src/core/lib/json/json_util.cc +5 -5
  862. data/src/core/lib/json/json_util.h +2 -2
  863. data/src/core/lib/matchers/matchers.cc +1 -1
  864. data/src/core/lib/promise/activity.cc +121 -0
  865. data/src/core/lib/promise/activity.h +540 -0
  866. data/src/core/lib/promise/arena_promise.h +188 -0
  867. data/src/core/lib/promise/context.h +86 -0
  868. data/src/core/lib/promise/detail/basic_seq.h +496 -0
  869. data/src/core/lib/promise/detail/promise_factory.h +189 -0
  870. data/src/core/lib/promise/detail/promise_like.h +85 -0
  871. data/src/core/lib/promise/detail/status.h +49 -0
  872. data/src/core/lib/promise/detail/switch.h +1455 -0
  873. data/src/core/lib/promise/exec_ctx_wakeup_scheduler.h +48 -0
  874. data/src/core/lib/promise/loop.h +134 -0
  875. data/src/core/lib/promise/map.h +88 -0
  876. data/src/core/lib/promise/poll.h +66 -0
  877. data/src/core/lib/promise/promise.h +95 -0
  878. data/src/core/lib/promise/race.h +84 -0
  879. data/src/core/lib/promise/seq.h +89 -0
  880. data/src/core/lib/promise/sleep.cc +74 -0
  881. data/src/core/lib/promise/sleep.h +66 -0
  882. data/src/core/lib/promise/try_seq.h +157 -0
  883. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver.cc +17 -25
  884. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver.h +43 -44
  885. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver_factory.h +32 -31
  886. data/src/core/lib/resolver/resolver_registry.cc +156 -0
  887. data/src/core/lib/resolver/resolver_registry.h +113 -0
  888. data/src/core/{ext/filters/client_channel → lib/resolver}/server_address.cc +1 -1
  889. data/src/core/{ext/filters/client_channel → lib/resolver}/server_address.h +4 -4
  890. data/src/core/lib/resource_quota/api.cc +108 -0
  891. data/src/core/lib/resource_quota/api.h +40 -0
  892. data/src/core/lib/{gprpp → resource_quota}/arena.cc +16 -13
  893. data/src/core/lib/{gprpp → resource_quota}/arena.h +24 -13
  894. data/src/core/lib/resource_quota/memory_quota.cc +478 -0
  895. data/src/core/lib/resource_quota/memory_quota.h +457 -0
  896. data/src/core/lib/resource_quota/resource_quota.cc +33 -0
  897. data/src/core/lib/resource_quota/resource_quota.h +58 -0
  898. data/src/core/lib/resource_quota/thread_quota.cc +43 -0
  899. data/src/core/lib/resource_quota/thread_quota.h +57 -0
  900. data/src/core/lib/resource_quota/trace.cc +19 -0
  901. data/src/core/lib/resource_quota/trace.h +24 -0
  902. data/src/core/lib/security/authorization/evaluate_args.cc +37 -38
  903. data/src/core/lib/security/authorization/evaluate_args.h +3 -2
  904. data/src/core/lib/security/authorization/grpc_authorization_engine.cc +60 -0
  905. data/src/core/lib/security/authorization/grpc_authorization_engine.h +62 -0
  906. data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +109 -0
  907. data/src/core/lib/security/authorization/grpc_server_authz_filter.h +51 -0
  908. data/src/core/lib/security/authorization/matchers.cc +227 -0
  909. data/src/core/lib/security/authorization/matchers.h +211 -0
  910. data/src/core/lib/security/authorization/rbac_policy.cc +442 -0
  911. data/src/core/lib/security/authorization/rbac_policy.h +171 -0
  912. data/src/core/lib/security/context/security_context.cc +4 -2
  913. data/src/core/lib/security/context/security_context.h +1 -1
  914. data/src/core/lib/security/credentials/alts/alts_credentials.h +6 -0
  915. data/src/core/lib/security/credentials/call_creds_util.cc +87 -0
  916. data/src/core/lib/security/credentials/call_creds_util.h +42 -0
  917. data/src/core/lib/security/credentials/channel_creds_registry.h +97 -0
  918. data/src/core/lib/security/credentials/channel_creds_registry_init.cc +70 -0
  919. data/src/core/lib/security/credentials/composite/composite_credentials.cc +17 -81
  920. data/src/core/lib/security/credentials/composite/composite_credentials.h +21 -9
  921. data/src/core/lib/security/credentials/credentials.cc +2 -3
  922. data/src/core/lib/security/credentials/credentials.h +68 -57
  923. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +48 -33
  924. data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +1 -0
  925. data/src/core/lib/security/credentials/external/external_account_credentials.cc +52 -35
  926. data/src/core/lib/security/credentials/external/external_account_credentials.h +5 -9
  927. data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +0 -1
  928. data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +33 -14
  929. data/src/core/lib/security/credentials/external/url_external_account_credentials.h +1 -0
  930. data/src/core/lib/security/credentials/fake/fake_credentials.cc +18 -18
  931. data/src/core/lib/security/credentials/fake/fake_credentials.h +14 -16
  932. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +17 -16
  933. data/src/core/lib/security/credentials/google_default/google_default_credentials.h +6 -0
  934. data/src/core/lib/security/credentials/iam/iam_credentials.cc +19 -27
  935. data/src/core/lib/security/credentials/iam/iam_credentials.h +11 -9
  936. data/src/core/lib/security/credentials/insecure/insecure_credentials.cc +13 -7
  937. data/src/core/lib/security/credentials/jwt/json_token.cc +4 -6
  938. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +28 -44
  939. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +12 -12
  940. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +54 -43
  941. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +1 -1
  942. data/src/core/lib/security/credentials/local/local_credentials.h +6 -0
  943. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +148 -173
  944. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +52 -33
  945. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +95 -153
  946. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +54 -27
  947. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +1 -10
  948. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +6 -3
  949. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +11 -12
  950. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +7 -8
  951. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc +201 -0
  952. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +106 -0
  953. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +33 -87
  954. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +36 -83
  955. data/src/core/lib/security/credentials/tls/tls_credentials.cc +21 -10
  956. data/src/core/lib/security/credentials/tls/tls_credentials.h +6 -0
  957. data/src/core/lib/security/credentials/xds/xds_credentials.cc +28 -33
  958. data/src/core/lib/security/credentials/xds/xds_credentials.h +6 -1
  959. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +11 -17
  960. data/src/core/lib/security/security_connector/alts/alts_security_connector.h +3 -3
  961. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +7 -16
  962. data/src/core/lib/security/security_connector/fake/fake_security_connector.h +0 -2
  963. data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +8 -18
  964. data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +11 -16
  965. data/src/core/lib/security/security_connector/load_system_roots_linux.cc +1 -2
  966. data/src/core/lib/security/security_connector/local/local_security_connector.cc +12 -17
  967. data/src/core/lib/security/security_connector/security_connector.cc +3 -15
  968. data/src/core/lib/security/security_connector/security_connector.h +16 -21
  969. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +6 -11
  970. data/src/core/lib/security/security_connector/ssl_utils.cc +38 -32
  971. data/src/core/lib/security/security_connector/ssl_utils.h +14 -18
  972. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +361 -204
  973. data/src/core/lib/security/security_connector/tls/tls_security_connector.h +70 -47
  974. data/src/core/lib/security/transport/auth_filters.h +37 -4
  975. data/src/core/lib/security/transport/client_auth_filter.cc +87 -358
  976. data/src/core/lib/security/transport/security_handshaker.cc +16 -8
  977. data/src/core/lib/security/transport/server_auth_filter.cc +41 -35
  978. data/src/core/lib/service_config/service_config.h +82 -0
  979. data/src/core/{ext → lib}/service_config/service_config_call_data.h +5 -5
  980. data/src/core/{ext/service_config/service_config.cc → lib/service_config/service_config_impl.cc} +20 -17
  981. data/src/core/{ext/service_config/service_config.h → lib/service_config/service_config_impl.h} +16 -18
  982. data/src/core/{ext → lib}/service_config/service_config_parser.cc +31 -27
  983. data/src/core/{ext → lib}/service_config/service_config_parser.h +39 -30
  984. data/src/core/lib/slice/percent_encoding.cc +30 -86
  985. data/src/core/lib/slice/percent_encoding.h +5 -11
  986. data/src/core/lib/slice/slice.cc +78 -181
  987. data/src/core/lib/slice/slice.h +384 -0
  988. data/src/core/lib/slice/slice_buffer.cc +4 -0
  989. data/src/core/lib/slice/slice_internal.h +12 -31
  990. data/src/core/lib/slice/slice_refcount.cc +18 -0
  991. data/src/core/lib/slice/slice_refcount.h +8 -83
  992. data/src/core/lib/slice/slice_refcount_base.h +21 -133
  993. data/src/core/lib/surface/builtins.cc +6 -6
  994. data/src/core/lib/surface/call.cc +204 -413
  995. data/src/core/lib/surface/call.h +5 -5
  996. data/src/core/lib/surface/channel.cc +67 -99
  997. data/src/core/lib/surface/channel.h +12 -23
  998. data/src/core/lib/surface/channel_init.cc +1 -1
  999. data/src/core/lib/surface/channel_init.h +4 -4
  1000. data/src/core/lib/surface/completion_queue.cc +12 -11
  1001. data/src/core/lib/surface/init.cc +78 -10
  1002. data/src/core/lib/surface/init.h +0 -2
  1003. data/src/core/lib/surface/lame_client.cc +26 -19
  1004. data/src/core/lib/surface/server.cc +44 -72
  1005. data/src/core/lib/surface/server.h +13 -14
  1006. data/src/core/lib/surface/validate_metadata.cc +2 -2
  1007. data/src/core/lib/surface/version.cc +2 -2
  1008. data/src/core/lib/transport/bdp_estimator.cc +10 -11
  1009. data/src/core/lib/transport/bdp_estimator.h +2 -2
  1010. data/src/core/lib/transport/byte_stream.cc +4 -0
  1011. data/src/core/lib/transport/error_utils.cc +5 -3
  1012. data/src/core/lib/transport/error_utils.h +2 -1
  1013. data/src/core/lib/transport/metadata_batch.h +1128 -793
  1014. data/src/core/lib/transport/parsed_metadata.cc +37 -0
  1015. data/src/core/lib/transport/parsed_metadata.h +228 -90
  1016. data/src/core/lib/transport/pid_controller.cc +4 -4
  1017. data/src/core/lib/transport/status_conversion.cc +2 -2
  1018. data/src/core/lib/transport/status_conversion.h +1 -1
  1019. data/src/core/lib/transport/timeout_encoding.cc +204 -67
  1020. data/src/core/lib/transport/timeout_encoding.h +40 -10
  1021. data/src/core/lib/transport/transport.cc +7 -27
  1022. data/src/core/lib/transport/transport.h +88 -4
  1023. data/src/core/lib/transport/transport_impl.h +13 -0
  1024. data/src/core/lib/transport/transport_op_string.cc +5 -47
  1025. data/src/core/lib/uri/uri_parser.cc +237 -63
  1026. data/src/core/lib/uri/uri_parser.h +39 -23
  1027. data/src/core/plugin_registry/grpc_plugin_registry.cc +22 -88
  1028. data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +85 -0
  1029. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +28 -23
  1030. data/src/core/tsi/alts/handshaker/alts_shared_resource.cc +9 -1
  1031. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +19 -11
  1032. data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +2 -2
  1033. data/src/core/tsi/alts/handshaker/alts_tsi_utils.h +1 -1
  1034. data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +2 -2
  1035. data/src/core/tsi/alts/handshaker/transport_security_common_api.h +2 -2
  1036. data/src/core/tsi/local_transport_security.cc +16 -24
  1037. data/src/core/tsi/local_transport_security.h +1 -4
  1038. data/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +141 -0
  1039. data/src/core/tsi/ssl/key_logging/ssl_key_logging.h +81 -0
  1040. data/src/core/tsi/ssl/session_cache/ssl_session.h +2 -4
  1041. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +3 -5
  1042. data/src/core/tsi/ssl_transport_security.cc +135 -15
  1043. data/src/core/tsi/ssl_transport_security.h +39 -6
  1044. data/src/ruby/ext/grpc/extconf.rb +10 -3
  1045. data/src/ruby/ext/grpc/rb_channel.c +5 -2
  1046. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +26 -34
  1047. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +39 -51
  1048. data/src/ruby/ext/grpc/rb_server.c +7 -4
  1049. data/src/ruby/lib/grpc/version.rb +1 -1
  1050. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +2 -1
  1051. data/third_party/abseil-cpp/absl/algorithm/container.h +101 -91
  1052. data/third_party/abseil-cpp/absl/base/attributes.h +64 -31
  1053. data/third_party/abseil-cpp/absl/base/config.h +67 -37
  1054. data/third_party/abseil-cpp/absl/base/dynamic_annotations.h +1 -26
  1055. data/third_party/abseil-cpp/absl/base/internal/fast_type_id.h +48 -0
  1056. data/third_party/abseil-cpp/absl/base/internal/spinlock.h +3 -1
  1057. data/third_party/abseil-cpp/absl/base/internal/spinlock_wait.h +2 -0
  1058. data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +69 -0
  1059. data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +4 -4
  1060. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +16 -0
  1061. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +4 -4
  1062. data/third_party/abseil-cpp/absl/base/options.h +1 -1
  1063. data/third_party/abseil-cpp/absl/container/fixed_array.h +0 -5
  1064. data/third_party/abseil-cpp/absl/container/inlined_vector.h +105 -97
  1065. data/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h +17 -15
  1066. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +18 -102
  1067. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +37 -78
  1068. data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +388 -423
  1069. data/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h +3 -2
  1070. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +14 -8
  1071. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +251 -120
  1072. data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +11 -1
  1073. data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc +12 -11
  1074. data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h +6 -2
  1075. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h +12 -5
  1076. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_emscripten-inl.inc +110 -0
  1077. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_riscv-inl.inc +234 -0
  1078. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +25 -7
  1079. data/third_party/abseil-cpp/absl/debugging/internal/symbolize.h +8 -2
  1080. data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc +21 -3
  1081. data/third_party/abseil-cpp/absl/debugging/stacktrace.cc +2 -0
  1082. data/third_party/abseil-cpp/absl/debugging/symbolize.cc +2 -0
  1083. data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +14 -0
  1084. data/third_party/abseil-cpp/absl/debugging/symbolize_emscripten.inc +72 -0
  1085. data/third_party/abseil-cpp/absl/functional/function_ref.h +4 -1
  1086. data/third_party/abseil-cpp/absl/hash/hash.h +22 -0
  1087. data/third_party/abseil-cpp/absl/hash/internal/hash.cc +15 -16
  1088. data/third_party/abseil-cpp/absl/hash/internal/hash.h +88 -37
  1089. data/third_party/abseil-cpp/absl/hash/internal/{wyhash.cc → low_level_hash.cc} +23 -11
  1090. data/third_party/abseil-cpp/absl/hash/internal/{wyhash.h → low_level_hash.h} +14 -12
  1091. data/third_party/abseil-cpp/absl/memory/memory.h +1 -1
  1092. data/third_party/abseil-cpp/absl/meta/type_traits.h +32 -2
  1093. data/third_party/abseil-cpp/absl/numeric/int128.cc +3 -10
  1094. data/third_party/abseil-cpp/absl/numeric/int128.h +146 -73
  1095. data/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc +19 -25
  1096. data/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc +73 -70
  1097. data/third_party/abseil-cpp/absl/{base → profiling}/internal/exponential_biased.cc +4 -4
  1098. data/third_party/abseil-cpp/absl/{base → profiling}/internal/exponential_biased.h +6 -6
  1099. data/third_party/abseil-cpp/absl/profiling/internal/sample_recorder.h +230 -0
  1100. data/third_party/abseil-cpp/absl/random/bernoulli_distribution.h +200 -0
  1101. data/third_party/abseil-cpp/absl/random/beta_distribution.h +427 -0
  1102. data/third_party/abseil-cpp/absl/random/discrete_distribution.cc +98 -0
  1103. data/third_party/abseil-cpp/absl/random/discrete_distribution.h +247 -0
  1104. data/third_party/abseil-cpp/absl/random/distributions.h +452 -0
  1105. data/third_party/abseil-cpp/absl/random/exponential_distribution.h +165 -0
  1106. data/third_party/abseil-cpp/absl/random/gaussian_distribution.cc +104 -0
  1107. data/third_party/abseil-cpp/absl/random/gaussian_distribution.h +275 -0
  1108. data/third_party/abseil-cpp/absl/random/internal/distribution_caller.h +92 -0
  1109. data/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h +268 -0
  1110. data/third_party/abseil-cpp/absl/random/internal/fastmath.h +57 -0
  1111. data/third_party/abseil-cpp/absl/random/internal/generate_real.h +144 -0
  1112. data/third_party/abseil-cpp/absl/random/internal/iostream_state_saver.h +245 -0
  1113. data/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h +150 -0
  1114. data/third_party/abseil-cpp/absl/random/internal/pcg_engine.h +308 -0
  1115. data/third_party/abseil-cpp/absl/random/internal/platform.h +171 -0
  1116. data/third_party/abseil-cpp/absl/random/internal/pool_urbg.cc +253 -0
  1117. data/third_party/abseil-cpp/absl/random/internal/pool_urbg.h +131 -0
  1118. data/third_party/abseil-cpp/absl/random/internal/randen.cc +91 -0
  1119. data/third_party/abseil-cpp/absl/random/internal/randen.h +102 -0
  1120. data/third_party/abseil-cpp/absl/random/internal/randen_detect.cc +221 -0
  1121. data/third_party/abseil-cpp/absl/random/internal/randen_detect.h +33 -0
  1122. data/third_party/abseil-cpp/absl/random/internal/randen_engine.h +239 -0
  1123. data/third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc +526 -0
  1124. data/third_party/abseil-cpp/absl/random/internal/randen_hwaes.h +50 -0
  1125. data/third_party/abseil-cpp/absl/random/internal/randen_round_keys.cc +462 -0
  1126. data/third_party/abseil-cpp/absl/random/internal/randen_slow.cc +471 -0
  1127. data/third_party/abseil-cpp/absl/random/internal/randen_slow.h +40 -0
  1128. data/third_party/abseil-cpp/absl/random/internal/randen_traits.h +88 -0
  1129. data/third_party/abseil-cpp/absl/random/internal/salted_seed_seq.h +167 -0
  1130. data/third_party/abseil-cpp/absl/random/internal/seed_material.cc +267 -0
  1131. data/third_party/abseil-cpp/absl/random/internal/seed_material.h +104 -0
  1132. data/third_party/abseil-cpp/absl/random/internal/traits.h +101 -0
  1133. data/third_party/abseil-cpp/absl/random/internal/uniform_helper.h +244 -0
  1134. data/third_party/abseil-cpp/absl/random/internal/wide_multiply.h +111 -0
  1135. data/third_party/abseil-cpp/absl/random/log_uniform_int_distribution.h +257 -0
  1136. data/third_party/abseil-cpp/absl/random/poisson_distribution.h +258 -0
  1137. data/third_party/abseil-cpp/absl/random/random.h +189 -0
  1138. data/third_party/abseil-cpp/absl/random/seed_gen_exception.cc +46 -0
  1139. data/third_party/abseil-cpp/absl/random/seed_gen_exception.h +55 -0
  1140. data/third_party/abseil-cpp/absl/random/seed_sequences.cc +29 -0
  1141. data/third_party/abseil-cpp/absl/random/seed_sequences.h +110 -0
  1142. data/third_party/abseil-cpp/absl/random/uniform_int_distribution.h +275 -0
  1143. data/third_party/abseil-cpp/absl/random/uniform_real_distribution.h +202 -0
  1144. data/third_party/abseil-cpp/absl/random/zipf_distribution.h +271 -0
  1145. data/third_party/abseil-cpp/absl/status/internal/status_internal.h +5 -5
  1146. data/third_party/abseil-cpp/absl/status/status.cc +9 -17
  1147. data/third_party/abseil-cpp/absl/status/status.h +19 -15
  1148. data/third_party/abseil-cpp/absl/status/statusor.cc +34 -2
  1149. data/third_party/abseil-cpp/absl/status/statusor.h +31 -21
  1150. data/third_party/abseil-cpp/absl/strings/charconv.cc +3 -3
  1151. data/third_party/abseil-cpp/absl/strings/charconv.h +3 -2
  1152. data/third_party/abseil-cpp/absl/strings/cord.cc +453 -359
  1153. data/third_party/abseil-cpp/absl/strings/cord.h +197 -70
  1154. data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc +1 -1
  1155. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.cc +6 -0
  1156. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +140 -63
  1157. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc +1128 -0
  1158. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.h +939 -0
  1159. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc +185 -0
  1160. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.h +265 -0
  1161. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.cc +68 -0
  1162. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.h +211 -0
  1163. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.cc +129 -0
  1164. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.h +50 -0
  1165. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_flat.h +7 -7
  1166. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.cc +55 -181
  1167. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.h +42 -24
  1168. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring_reader.h +4 -0
  1169. data/third_party/abseil-cpp/absl/strings/internal/cordz_functions.cc +96 -0
  1170. data/third_party/abseil-cpp/absl/strings/internal/cordz_functions.h +85 -0
  1171. data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.cc +139 -0
  1172. data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.h +131 -0
  1173. data/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc +445 -0
  1174. data/third_party/abseil-cpp/absl/strings/internal/cordz_info.h +298 -0
  1175. data/third_party/abseil-cpp/absl/strings/internal/cordz_statistics.h +87 -0
  1176. data/third_party/abseil-cpp/absl/strings/internal/cordz_update_scope.h +71 -0
  1177. data/third_party/abseil-cpp/absl/strings/internal/cordz_update_tracker.h +121 -0
  1178. data/third_party/abseil-cpp/absl/strings/internal/resize_uninitialized.h +48 -2
  1179. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +8 -0
  1180. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +3 -4
  1181. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +1 -1
  1182. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +6 -6
  1183. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +36 -18
  1184. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc +62 -73
  1185. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +24 -16
  1186. data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +35 -35
  1187. data/third_party/abseil-cpp/absl/strings/numbers.cc +1 -1
  1188. data/third_party/abseil-cpp/absl/strings/numbers.h +34 -0
  1189. data/third_party/abseil-cpp/absl/strings/str_cat.cc +4 -4
  1190. data/third_party/abseil-cpp/absl/strings/str_format.h +1 -2
  1191. data/third_party/abseil-cpp/absl/strings/string_view.cc +16 -21
  1192. data/third_party/abseil-cpp/absl/strings/string_view.h +120 -39
  1193. data/third_party/abseil-cpp/absl/strings/substitute.cc +2 -1
  1194. data/third_party/abseil-cpp/absl/strings/substitute.h +99 -74
  1195. data/third_party/abseil-cpp/absl/synchronization/blocking_counter.cc +25 -15
  1196. data/third_party/abseil-cpp/absl/synchronization/blocking_counter.h +5 -3
  1197. data/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc +1 -1
  1198. data/third_party/abseil-cpp/absl/synchronization/mutex.h +3 -3
  1199. data/third_party/abseil-cpp/absl/time/civil_time.cc +1 -3
  1200. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +93 -20
  1201. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc +1 -1
  1202. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h +2 -1
  1203. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +83 -21
  1204. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +49 -0
  1205. data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +1 -1
  1206. data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +2 -3
  1207. data/third_party/abseil-cpp/absl/time/time.h +67 -36
  1208. data/third_party/abseil-cpp/absl/types/bad_optional_access.h +1 -1
  1209. data/third_party/abseil-cpp/absl/types/bad_variant_access.h +2 -2
  1210. data/third_party/abseil-cpp/absl/types/span.h +3 -3
  1211. data/third_party/boringssl-with-bazel/err_data.c +681 -677
  1212. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bitstr.c +19 -11
  1213. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +41 -30
  1214. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +1 -1
  1215. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +59 -47
  1216. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn_pack.c +24 -28
  1217. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_int.c +5 -0
  1218. data/third_party/boringssl-with-bazel/src/crypto/asn1/internal.h +28 -0
  1219. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +48 -272
  1220. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +1 -0
  1221. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_typ.c +8 -6
  1222. data/third_party/boringssl-with-bazel/src/crypto/base64/base64.c +13 -0
  1223. data/third_party/boringssl-with-bazel/src/crypto/bytestring/ber.c +3 -1
  1224. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +21 -0
  1225. data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +2 -2
  1226. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/cipher.c +12 -0
  1227. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +1 -2
  1228. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +7 -7
  1229. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +2 -2
  1230. data/third_party/boringssl-with-bazel/src/crypto/mem.c +18 -0
  1231. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7.c +29 -0
  1232. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +0 -1
  1233. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8.c +1 -1
  1234. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +1 -1
  1235. data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +5 -1
  1236. data/third_party/boringssl-with-bazel/src/crypto/pool/pool.c +59 -23
  1237. data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.c +2 -18
  1238. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +8 -2
  1239. data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +216 -11
  1240. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_cache.c +1 -1
  1241. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_data.c +1 -1
  1242. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_lib.c +1 -1
  1243. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_map.c +1 -1
  1244. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_node.c +1 -1
  1245. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_tree.c +1 -1
  1246. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +1 -0
  1247. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +0 -1
  1248. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +21 -4
  1249. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +971 -253
  1250. data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +3 -3
  1251. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +0 -1
  1252. data/third_party/boringssl-with-bazel/src/include/openssl/base64.h +8 -0
  1253. data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +13 -1
  1254. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +4 -12
  1255. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +27 -41
  1256. data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +12 -27
  1257. data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +8 -10
  1258. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +29 -55
  1259. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +1 -1
  1260. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +12 -13
  1261. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs8.h +6 -1
  1262. data/third_party/boringssl-with-bazel/src/include/openssl/pool.h +7 -1
  1263. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +24 -28
  1264. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +29 -11
  1265. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +12 -43
  1266. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +4 -3
  1267. data/third_party/boringssl-with-bazel/src/ssl/internal.h +3 -3
  1268. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +4 -0
  1269. data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +4 -0
  1270. data/third_party/cares/cares/{ares.h → include/ares.h} +73 -1
  1271. data/third_party/cares/cares/{ares_dns.h → include/ares_dns.h} +9 -0
  1272. data/third_party/cares/cares/{ares_rules.h → include/ares_rules.h} +0 -0
  1273. data/third_party/cares/cares/{ares_version.h → include/ares_version.h} +3 -3
  1274. data/third_party/cares/cares/{ares__close_sockets.c → src/lib/ares__close_sockets.c} +2 -2
  1275. data/third_party/cares/cares/{ares__get_hostent.c → src/lib/ares__get_hostent.c} +1 -2
  1276. data/third_party/cares/cares/src/lib/ares__parse_into_addrinfo.c +260 -0
  1277. data/third_party/cares/cares/{ares__read_line.c → src/lib/ares__read_line.c} +0 -0
  1278. data/third_party/cares/cares/src/lib/ares__readaddrinfo.c +264 -0
  1279. data/third_party/cares/cares/src/lib/ares__sortaddrinfo.c +499 -0
  1280. data/third_party/cares/cares/{ares__timeval.c → src/lib/ares__timeval.c} +0 -0
  1281. data/third_party/cares/cares/src/lib/ares_android.c +444 -0
  1282. data/third_party/cares/cares/src/lib/ares_android.h +27 -0
  1283. data/third_party/cares/cares/{ares_cancel.c → src/lib/ares_cancel.c} +0 -0
  1284. data/third_party/cares/cares/{ares_create_query.c → src/lib/ares_create_query.c} +8 -17
  1285. data/third_party/cares/cares/{ares_data.c → src/lib/ares_data.c} +18 -0
  1286. data/third_party/cares/cares/{ares_data.h → src/lib/ares_data.h} +2 -0
  1287. data/third_party/cares/cares/{ares_destroy.c → src/lib/ares_destroy.c} +0 -0
  1288. data/third_party/cares/cares/{ares_expand_name.c → src/lib/ares_expand_name.c} +114 -23
  1289. data/third_party/cares/cares/{ares_expand_string.c → src/lib/ares_expand_string.c} +2 -5
  1290. data/third_party/cares/cares/{ares_fds.c → src/lib/ares_fds.c} +0 -0
  1291. data/third_party/cares/cares/{ares_free_hostent.c → src/lib/ares_free_hostent.c} +6 -4
  1292. data/third_party/cares/cares/{ares_free_string.c → src/lib/ares_free_string.c} +0 -0
  1293. data/third_party/cares/cares/src/lib/ares_freeaddrinfo.c +59 -0
  1294. data/third_party/cares/cares/src/lib/ares_getaddrinfo.c +772 -0
  1295. data/third_party/cares/cares/{ares_getenv.c → src/lib/ares_getenv.c} +0 -2
  1296. data/third_party/cares/cares/{ares_getenv.h → src/lib/ares_getenv.h} +0 -0
  1297. data/third_party/cares/cares/{ares_gethostbyaddr.c → src/lib/ares_gethostbyaddr.c} +2 -9
  1298. data/third_party/cares/cares/{ares_gethostbyname.c → src/lib/ares_gethostbyname.c} +25 -20
  1299. data/third_party/cares/cares/{ares_getnameinfo.c → src/lib/ares_getnameinfo.c} +4 -10
  1300. data/third_party/cares/cares/{ares_getsock.c → src/lib/ares_getsock.c} +0 -0
  1301. data/third_party/cares/cares/{ares_inet_net_pton.h → src/lib/ares_inet_net_pton.h} +0 -0
  1302. data/third_party/cares/cares/{ares_init.c → src/lib/ares_init.c} +79 -40
  1303. data/third_party/cares/cares/{ares_iphlpapi.h → src/lib/ares_iphlpapi.h} +0 -0
  1304. data/third_party/cares/cares/{ares_ipv6.h → src/lib/ares_ipv6.h} +7 -0
  1305. data/third_party/cares/cares/{ares_library_init.c → src/lib/ares_library_init.c} +7 -2
  1306. data/third_party/cares/cares/{ares_library_init.h → src/lib/ares_library_init.h} +1 -1
  1307. data/third_party/cares/cares/{ares_llist.c → src/lib/ares_llist.c} +0 -0
  1308. data/third_party/cares/cares/{ares_llist.h → src/lib/ares_llist.h} +0 -0
  1309. data/third_party/cares/cares/{ares_mkquery.c → src/lib/ares_mkquery.c} +0 -0
  1310. data/third_party/cares/cares/src/lib/ares_nameser.h +482 -0
  1311. data/third_party/cares/cares/{ares_nowarn.c → src/lib/ares_nowarn.c} +0 -0
  1312. data/third_party/cares/cares/{ares_nowarn.h → src/lib/ares_nowarn.h} +0 -0
  1313. data/third_party/cares/cares/{ares_options.c → src/lib/ares_options.c} +0 -0
  1314. data/third_party/cares/cares/src/lib/ares_parse_a_reply.c +209 -0
  1315. data/third_party/cares/cares/src/lib/ares_parse_aaaa_reply.c +212 -0
  1316. data/third_party/cares/cares/src/lib/ares_parse_caa_reply.c +199 -0
  1317. data/third_party/cares/cares/{ares_parse_mx_reply.c → src/lib/ares_parse_mx_reply.c} +2 -8
  1318. data/third_party/cares/cares/{ares_parse_naptr_reply.c → src/lib/ares_parse_naptr_reply.c} +2 -13
  1319. data/third_party/cares/cares/{ares_parse_ns_reply.c → src/lib/ares_parse_ns_reply.c} +5 -11
  1320. data/third_party/cares/cares/{ares_parse_ptr_reply.c → src/lib/ares_parse_ptr_reply.c} +53 -46
  1321. data/third_party/cares/cares/src/lib/ares_parse_soa_reply.c +179 -0
  1322. data/third_party/cares/cares/{ares_parse_srv_reply.c → src/lib/ares_parse_srv_reply.c} +2 -13
  1323. data/third_party/cares/cares/{ares_parse_txt_reply.c → src/lib/ares_parse_txt_reply.c} +3 -9
  1324. data/third_party/cares/cares/{ares_platform.c → src/lib/ares_platform.c} +0 -0
  1325. data/third_party/cares/cares/{ares_platform.h → src/lib/ares_platform.h} +0 -0
  1326. data/third_party/cares/cares/{ares_private.h → src/lib/ares_private.h} +52 -11
  1327. data/third_party/cares/cares/{ares_process.c → src/lib/ares_process.c} +127 -52
  1328. data/third_party/cares/cares/{ares_query.c → src/lib/ares_query.c} +3 -9
  1329. data/third_party/cares/cares/{ares_search.c → src/lib/ares_search.c} +5 -7
  1330. data/third_party/cares/cares/{ares_send.c → src/lib/ares_send.c} +2 -8
  1331. data/third_party/cares/cares/{ares_setup.h → src/lib/ares_setup.h} +4 -1
  1332. data/third_party/cares/cares/{ares_strcasecmp.c → src/lib/ares_strcasecmp.c} +0 -0
  1333. data/third_party/cares/cares/{ares_strcasecmp.h → src/lib/ares_strcasecmp.h} +0 -0
  1334. data/third_party/cares/cares/{ares_strdup.c → src/lib/ares_strdup.c} +0 -0
  1335. data/third_party/cares/cares/{ares_strdup.h → src/lib/ares_strdup.h} +0 -0
  1336. data/third_party/cares/cares/{ares_strerror.c → src/lib/ares_strerror.c} +0 -0
  1337. data/third_party/cares/cares/{ares_strsplit.c → src/lib/ares_strsplit.c} +4 -0
  1338. data/third_party/cares/cares/{ares_strsplit.h → src/lib/ares_strsplit.h} +0 -0
  1339. data/third_party/cares/cares/{ares_timeout.c → src/lib/ares_timeout.c} +0 -0
  1340. data/third_party/cares/cares/{ares_version.c → src/lib/ares_version.c} +0 -0
  1341. data/third_party/cares/cares/{ares_writev.c → src/lib/ares_writev.c} +0 -0
  1342. data/third_party/cares/cares/src/lib/ares_writev.h +36 -0
  1343. data/third_party/cares/cares/{bitncmp.c → src/lib/bitncmp.c} +0 -0
  1344. data/third_party/cares/cares/{bitncmp.h → src/lib/bitncmp.h} +0 -0
  1345. data/third_party/cares/cares/src/lib/config-dos.h +115 -0
  1346. data/third_party/cares/cares/{config-win32.h → src/lib/config-win32.h} +0 -0
  1347. data/third_party/cares/cares/{inet_net_pton.c → src/lib/inet_net_pton.c} +2 -8
  1348. data/third_party/cares/cares/{inet_ntop.c → src/lib/inet_ntop.c} +2 -8
  1349. data/third_party/cares/cares/{setup_once.h → src/lib/setup_once.h} +0 -0
  1350. data/third_party/cares/cares/{windows_port.c → src/lib/windows_port.c} +0 -0
  1351. data/third_party/upb/third_party/utf8_range/naive.c +92 -0
  1352. data/third_party/upb/third_party/utf8_range/range2-neon.c +157 -0
  1353. data/third_party/upb/third_party/utf8_range/range2-sse.c +170 -0
  1354. data/third_party/upb/third_party/utf8_range/utf8_range.h +9 -0
  1355. data/third_party/upb/upb/decode.c +716 -378
  1356. data/third_party/upb/upb/decode.h +43 -17
  1357. data/third_party/upb/upb/decode_fast.c +303 -301
  1358. data/third_party/upb/upb/decode_fast.h +18 -18
  1359. data/third_party/upb/upb/decode_internal.h +73 -55
  1360. data/third_party/upb/upb/def.c +2009 -979
  1361. data/third_party/upb/upb/def.h +321 -258
  1362. data/third_party/upb/upb/def.hpp +139 -169
  1363. data/third_party/upb/upb/encode.c +261 -174
  1364. data/third_party/upb/upb/encode.h +15 -17
  1365. data/third_party/upb/upb/msg.c +154 -121
  1366. data/third_party/upb/upb/msg.h +40 -33
  1367. data/third_party/upb/upb/msg_internal.h +381 -250
  1368. data/third_party/upb/upb/reflection.c +292 -212
  1369. data/third_party/upb/upb/reflection.h +91 -67
  1370. data/third_party/upb/upb/reflection.hpp +6 -6
  1371. data/third_party/upb/upb/table.c +222 -142
  1372. data/third_party/upb/upb/table_internal.h +128 -96
  1373. data/third_party/upb/upb/text_encode.c +114 -91
  1374. data/third_party/upb/upb/text_encode.h +10 -10
  1375. data/third_party/upb/upb/upb.c +118 -71
  1376. data/third_party/upb/upb/upb.h +120 -144
  1377. data/third_party/upb/upb/upb.hpp +31 -28
  1378. data/third_party/upb/upb/upb_internal.h +21 -11
  1379. data/third_party/xxhash/xxhash.h +607 -352
  1380. metadata +476 -213
  1381. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +0 -44
  1382. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +0 -83
  1383. data/src/core/ext/filters/client_channel/resolver_registry.cc +0 -195
  1384. data/src/core/ext/filters/client_channel/resolver_registry.h +0 -89
  1385. data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +0 -119
  1386. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +0 -95
  1387. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +0 -189
  1388. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +0 -53
  1389. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +0 -83
  1390. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +0 -125
  1391. data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +0 -37
  1392. data/src/core/ext/transport/chttp2/transport/hpack_encoder_index.h +0 -107
  1393. data/src/core/ext/transport/chttp2/transport/hpack_utils.cc +0 -46
  1394. data/src/core/ext/transport/chttp2/transport/popularity_count.h +0 -60
  1395. data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.c +0 -27
  1396. data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.h +0 -62
  1397. data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.c +0 -27
  1398. data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.h +0 -62
  1399. data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.c +0 -27
  1400. data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.h +0 -62
  1401. data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.c +0 -27
  1402. data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.h +0 -62
  1403. data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.c +0 -27
  1404. data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.h +0 -62
  1405. data/src/core/ext/upbdefs-generated/envoy/service/cluster/v3/cds.upbdefs.c +0 -72
  1406. data/src/core/ext/upbdefs-generated/envoy/service/cluster/v3/cds.upbdefs.h +0 -35
  1407. data/src/core/ext/upbdefs-generated/envoy/service/endpoint/v3/eds.upbdefs.c +0 -73
  1408. data/src/core/ext/upbdefs-generated/envoy/service/endpoint/v3/eds.upbdefs.h +0 -35
  1409. data/src/core/ext/upbdefs-generated/envoy/service/listener/v3/lds.upbdefs.c +0 -72
  1410. data/src/core/ext/upbdefs-generated/envoy/service/listener/v3/lds.upbdefs.h +0 -35
  1411. data/src/core/ext/upbdefs-generated/envoy/service/route/v3/rds.upbdefs.c +0 -80
  1412. data/src/core/ext/upbdefs-generated/envoy/service/route/v3/rds.upbdefs.h +0 -35
  1413. data/src/core/ext/upbdefs-generated/envoy/service/route/v3/srds.upbdefs.c +0 -74
  1414. data/src/core/ext/upbdefs-generated/envoy/service/route/v3/srds.upbdefs.h +0 -35
  1415. data/src/core/lib/avl/avl.cc +0 -306
  1416. data/src/core/lib/compression/algorithm_metadata.h +0 -62
  1417. data/src/core/lib/compression/compression_args.cc +0 -138
  1418. data/src/core/lib/compression/compression_args.h +0 -56
  1419. data/src/core/lib/compression/stream_compression.cc +0 -81
  1420. data/src/core/lib/compression/stream_compression.h +0 -117
  1421. data/src/core/lib/compression/stream_compression_gzip.cc +0 -231
  1422. data/src/core/lib/compression/stream_compression_gzip.h +0 -28
  1423. data/src/core/lib/compression/stream_compression_identity.cc +0 -91
  1424. data/src/core/lib/compression/stream_compression_identity.h +0 -29
  1425. data/src/core/lib/gprpp/match.h +0 -73
  1426. data/src/core/lib/gprpp/overload.h +0 -59
  1427. data/src/core/lib/iomgr/event_engine/iomgr.h +0 -42
  1428. data/src/core/lib/iomgr/iomgr_custom.cc +0 -79
  1429. data/src/core/lib/iomgr/iomgr_custom.h +0 -49
  1430. data/src/core/lib/iomgr/pollset_custom.cc +0 -105
  1431. data/src/core/lib/iomgr/pollset_custom.h +0 -37
  1432. data/src/core/lib/iomgr/pollset_set_custom.cc +0 -47
  1433. data/src/core/lib/iomgr/pollset_set_custom.h +0 -26
  1434. data/src/core/lib/iomgr/resolve_address_custom.cc +0 -169
  1435. data/src/core/lib/iomgr/resolve_address_custom.h +0 -44
  1436. data/src/core/lib/iomgr/resource_quota.cc +0 -1106
  1437. data/src/core/lib/iomgr/resource_quota.h +0 -226
  1438. data/src/core/lib/iomgr/tcp_client_custom.cc +0 -152
  1439. data/src/core/lib/iomgr/tcp_custom.cc +0 -377
  1440. data/src/core/lib/iomgr/tcp_custom.h +0 -86
  1441. data/src/core/lib/iomgr/tcp_server_custom.cc +0 -467
  1442. data/src/core/lib/iomgr/timer_custom.cc +0 -96
  1443. data/src/core/lib/iomgr/timer_custom.h +0 -43
  1444. data/src/core/lib/security/authorization/sdk_server_authz_filter.cc +0 -171
  1445. data/src/core/lib/security/authorization/sdk_server_authz_filter.h +0 -67
  1446. data/src/core/lib/security/credentials/credentials_metadata.cc +0 -61
  1447. data/src/core/lib/slice/slice_intern.cc +0 -367
  1448. data/src/core/lib/slice/slice_utils.h +0 -200
  1449. data/src/core/lib/slice/static_slice.cc +0 -529
  1450. data/src/core/lib/slice/static_slice.h +0 -331
  1451. data/src/core/lib/surface/init_secure.cc +0 -103
  1452. data/src/core/lib/transport/metadata.cc +0 -714
  1453. data/src/core/lib/transport/metadata.h +0 -449
  1454. data/src/core/lib/transport/metadata_batch.cc +0 -94
  1455. data/src/core/lib/transport/static_metadata.cc +0 -1117
  1456. data/src/core/lib/transport/static_metadata.h +0 -340
  1457. data/src/core/lib/transport/status_metadata.cc +0 -63
  1458. data/src/core/lib/transport/status_metadata.h +0 -48
  1459. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_enum.c +0 -93
  1460. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_int.h +0 -217
  1461. data/third_party/cares/cares/ares_getopt.c +0 -122
  1462. data/third_party/cares/cares/ares_getopt.h +0 -53
  1463. data/third_party/cares/cares/ares_parse_a_reply.c +0 -264
  1464. data/third_party/cares/cares/ares_parse_aaaa_reply.c +0 -264
  1465. data/third_party/cares/cares/ares_parse_soa_reply.c +0 -133
@@ -23,90 +23,65 @@
23
23
 
24
24
  #include <stdbool.h>
25
25
 
26
+ #include <cstdint>
27
+ #include <limits>
28
+
29
+ #include "absl/strings/escaping.h"
26
30
  #include "absl/strings/match.h"
27
31
  #include "absl/strings/str_join.h"
28
32
  #include "absl/types/optional.h"
29
33
 
30
34
  #include <grpc/grpc.h>
31
35
  #include <grpc/slice.h>
36
+ #include <grpc/status.h>
32
37
  #include <grpc/support/time.h>
33
38
 
39
+ #include "src/core/lib/compression/compression_internal.h"
34
40
  #include "src/core/lib/gprpp/chunked_vector.h"
35
41
  #include "src/core/lib/gprpp/table.h"
36
42
  #include "src/core/lib/iomgr/exec_ctx.h"
43
+ #include "src/core/lib/slice/slice.h"
37
44
  #include "src/core/lib/surface/validate_metadata.h"
38
- #include "src/core/lib/transport/metadata.h"
39
45
  #include "src/core/lib/transport/parsed_metadata.h"
40
- #include "src/core/lib/transport/static_metadata.h"
41
46
  #include "src/core/lib/transport/timeout_encoding.h"
42
47
 
43
- typedef struct grpc_linked_mdelem {
44
- grpc_linked_mdelem() {}
45
-
46
- grpc_mdelem md;
47
- struct grpc_linked_mdelem* next = nullptr;
48
- struct grpc_linked_mdelem* prev = nullptr;
49
- void* reserved;
50
- } grpc_linked_mdelem;
51
-
52
- typedef struct grpc_mdelem_list {
53
- size_t count;
54
- size_t default_count; // Number of default keys.
55
- grpc_linked_mdelem* head;
56
- grpc_linked_mdelem* tail;
57
- } grpc_mdelem_list;
58
-
59
- struct grpc_filtered_mdelem {
60
- grpc_error_handle error;
61
- grpc_mdelem md;
62
- };
63
- #define GRPC_FILTERED_ERROR(error) \
64
- { (error), GRPC_MDNULL }
65
- #define GRPC_FILTERED_MDELEM(md) \
66
- { GRPC_ERROR_NONE, (md) }
67
- #define GRPC_FILTERED_REMOVE() \
68
- { GRPC_ERROR_NONE, GRPC_MDNULL }
69
-
70
- grpc_error_handle grpc_attach_md_to_error(grpc_error_handle src,
71
- grpc_mdelem md);
72
-
73
48
  namespace grpc_core {
74
49
 
75
50
  // grpc-timeout metadata trait.
76
- // ValueType is defined as grpc_millis - an absolute timestamp (i.e. a
51
+ // ValueType is defined as Timestamp - an absolute timestamp (i.e. a
77
52
  // deadline!), that is converted to a duration by transports before being
78
53
  // sent.
79
54
  // TODO(ctiller): Move this elsewhere. During the transition we need to be able
80
55
  // to name this in MetadataMap, but ultimately once the transition is done we
81
56
  // should not need to.
82
57
  struct GrpcTimeoutMetadata {
83
- using ValueType = grpc_millis;
84
- using MementoType = grpc_millis;
85
- static const char* key() { return "grpc-timeout"; }
86
- static MementoType ParseMemento(const grpc_slice& value) {
87
- grpc_millis timeout;
88
- if (GPR_UNLIKELY(!grpc_http2_decode_timeout(value, &timeout))) {
89
- timeout = GRPC_MILLIS_INF_FUTURE;
58
+ static constexpr bool kRepeatable = false;
59
+ using ValueType = Timestamp;
60
+ using MementoType = Duration;
61
+ static absl::string_view key() { return "grpc-timeout"; }
62
+ static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error) {
63
+ auto timeout = ParseTimeout(value);
64
+ if (!timeout.has_value()) {
65
+ on_error("invalid value", value);
66
+ return Duration::Infinity();
90
67
  }
91
- grpc_slice_unref_internal(value);
92
- return timeout;
68
+ return *timeout;
93
69
  }
94
70
  static ValueType MementoToValue(MementoType timeout) {
95
- if (timeout == GRPC_MILLIS_INF_FUTURE) {
96
- return GRPC_MILLIS_INF_FUTURE;
71
+ if (timeout == Duration::Infinity()) {
72
+ return Timestamp::InfFuture();
97
73
  }
98
- return grpc_core::ExecCtx::Get()->Now() + timeout;
74
+ return ExecCtx::Get()->Now() + timeout;
99
75
  }
100
- static grpc_slice Encode(ValueType x) {
101
- char timeout[GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE];
102
- grpc_http2_encode_timeout(x, timeout);
103
- return grpc_slice_from_copied_string(timeout);
76
+ static Slice Encode(ValueType x) {
77
+ return Timeout::FromDuration(x - ExecCtx::Get()->Now()).Encode();
104
78
  }
105
- static MementoType DisplayValue(MementoType x) { return x; }
79
+ static std::string DisplayValue(MementoType x) { return x.ToString(); }
106
80
  };
107
81
 
108
82
  // TE metadata trait.
109
83
  struct TeMetadata {
84
+ static constexpr bool kRepeatable = false;
110
85
  // HTTP2 says that TE can either be empty or "trailers".
111
86
  // Empty means this trait is not included, "trailers" means kTrailers, and
112
87
  // kInvalid is used to remember an invalid value.
@@ -115,19 +90,20 @@ struct TeMetadata {
115
90
  kInvalid,
116
91
  };
117
92
  using MementoType = ValueType;
118
- static const char* key() { return "te"; }
119
- static MementoType ParseMemento(const grpc_slice& value) {
93
+ static absl::string_view key() { return "te"; }
94
+ static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error) {
120
95
  auto out = kInvalid;
121
- if (grpc_slice_eq(value, GRPC_MDSTR_TRAILERS)) {
96
+ if (value == "trailers") {
122
97
  out = kTrailers;
98
+ } else {
99
+ on_error("invalid value", value);
123
100
  }
124
- grpc_slice_unref_internal(value);
125
101
  return out;
126
102
  }
127
103
  static ValueType MementoToValue(MementoType te) { return te; }
128
- static grpc_slice Encode(ValueType x) {
104
+ static StaticSlice Encode(ValueType x) {
129
105
  GPR_ASSERT(x == kTrailers);
130
- return GRPC_MDSTR_TRAILERS;
106
+ return StaticSlice::FromStaticString("trailers");
131
107
  }
132
108
  static const char* DisplayValue(MementoType te) {
133
109
  switch (te) {
@@ -139,109 +115,952 @@ struct TeMetadata {
139
115
  }
140
116
  };
141
117
 
118
+ // content-type metadata trait.
119
+ struct ContentTypeMetadata {
120
+ static constexpr bool kRepeatable = false;
121
+ // gRPC says that content-type can be application/grpc[;something]
122
+ // Core has only ever verified the prefix.
123
+ // IF we want to start verifying more, we can expand this type.
124
+ enum ValueType {
125
+ kApplicationGrpc,
126
+ kEmpty,
127
+ kInvalid,
128
+ };
129
+ using MementoType = ValueType;
130
+ static absl::string_view key() { return "content-type"; }
131
+ static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error) {
132
+ auto out = kInvalid;
133
+ auto value_string = value.as_string_view();
134
+ if (value_string == "application/grpc") {
135
+ out = kApplicationGrpc;
136
+ } else if (absl::StartsWith(value_string, "application/grpc;")) {
137
+ out = kApplicationGrpc;
138
+ } else if (absl::StartsWith(value_string, "application/grpc+")) {
139
+ out = kApplicationGrpc;
140
+ } else if (value_string.empty()) {
141
+ out = kEmpty;
142
+ } else {
143
+ on_error("invalid value", value);
144
+ }
145
+ return out;
146
+ }
147
+ static ValueType MementoToValue(MementoType content_type) {
148
+ return content_type;
149
+ }
150
+ static StaticSlice Encode(ValueType x) {
151
+ switch (x) {
152
+ case kEmpty:
153
+ return StaticSlice::FromStaticString("");
154
+ case kApplicationGrpc:
155
+ return StaticSlice::FromStaticString("application/grpc");
156
+ case kInvalid:
157
+ return StaticSlice::FromStaticString("application/grpc+unknown");
158
+ }
159
+ GPR_UNREACHABLE_CODE(
160
+ return StaticSlice::FromStaticString("unrepresentable value"));
161
+ }
162
+ static const char* DisplayValue(MementoType content_type) {
163
+ switch (content_type) {
164
+ case ValueType::kApplicationGrpc:
165
+ return "application/grpc";
166
+ case ValueType::kEmpty:
167
+ return "";
168
+ default:
169
+ return "<discarded-invalid-value>";
170
+ }
171
+ }
172
+ };
173
+
174
+ // scheme metadata trait.
175
+ struct HttpSchemeMetadata {
176
+ static constexpr bool kRepeatable = false;
177
+ enum ValueType {
178
+ kHttp,
179
+ kHttps,
180
+ kInvalid,
181
+ };
182
+ using MementoType = ValueType;
183
+ static absl::string_view key() { return ":scheme"; }
184
+ static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error) {
185
+ return Parse(value.as_string_view(), on_error);
186
+ }
187
+ static ValueType Parse(absl::string_view value,
188
+ MetadataParseErrorFn on_error) {
189
+ if (value == "http") {
190
+ return kHttp;
191
+ } else if (value == "https") {
192
+ return kHttps;
193
+ }
194
+ on_error("invalid value", Slice::FromCopiedBuffer(value));
195
+ return kInvalid;
196
+ }
197
+ static ValueType MementoToValue(MementoType content_type) {
198
+ return content_type;
199
+ }
200
+ static StaticSlice Encode(ValueType x) {
201
+ switch (x) {
202
+ case kHttp:
203
+ return StaticSlice::FromStaticString("http");
204
+ case kHttps:
205
+ return StaticSlice::FromStaticString("https");
206
+ default:
207
+ abort();
208
+ }
209
+ }
210
+ static const char* DisplayValue(MementoType content_type) {
211
+ switch (content_type) {
212
+ case kHttp:
213
+ return "http";
214
+ case kHttps:
215
+ return "https";
216
+ default:
217
+ return "<discarded-invalid-value>";
218
+ }
219
+ }
220
+ };
221
+
222
+ // method metadata trait.
223
+ struct HttpMethodMetadata {
224
+ static constexpr bool kRepeatable = false;
225
+ enum ValueType {
226
+ kPost,
227
+ kPut,
228
+ kGet,
229
+ kInvalid,
230
+ };
231
+ using MementoType = ValueType;
232
+ static absl::string_view key() { return ":method"; }
233
+ static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error) {
234
+ auto out = kInvalid;
235
+ auto value_string = value.as_string_view();
236
+ if (value_string == "POST") {
237
+ out = kPost;
238
+ } else if (value_string == "PUT") {
239
+ out = kPut;
240
+ } else if (value_string == "GET") {
241
+ out = kGet;
242
+ } else {
243
+ on_error("invalid value", value);
244
+ }
245
+ return out;
246
+ }
247
+ static ValueType MementoToValue(MementoType content_type) {
248
+ return content_type;
249
+ }
250
+ static StaticSlice Encode(ValueType x) {
251
+ switch (x) {
252
+ case kPost:
253
+ return StaticSlice::FromStaticString("POST");
254
+ case kPut:
255
+ return StaticSlice::FromStaticString("PUT");
256
+ case kGet:
257
+ return StaticSlice::FromStaticString("GET");
258
+ default:
259
+ abort();
260
+ }
261
+ }
262
+ static const char* DisplayValue(MementoType content_type) {
263
+ switch (content_type) {
264
+ case kPost:
265
+ return "POST";
266
+ case kPut:
267
+ return "PUT";
268
+ case kGet:
269
+ return "GET";
270
+ default:
271
+ return "<discarded-invalid-value>";
272
+ }
273
+ }
274
+ };
275
+
276
+ // Base type for metadata pertaining to a single compression algorithm
277
+ // (e.g., "grpc-encoding").
278
+ struct CompressionAlgorithmBasedMetadata {
279
+ using ValueType = grpc_compression_algorithm;
280
+ using MementoType = ValueType;
281
+ static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error) {
282
+ auto algorithm = ParseCompressionAlgorithm(value.as_string_view());
283
+ if (!algorithm.has_value()) {
284
+ on_error("invalid value", value);
285
+ return GRPC_COMPRESS_NONE;
286
+ }
287
+ return *algorithm;
288
+ }
289
+ static ValueType MementoToValue(MementoType x) { return x; }
290
+ static Slice Encode(ValueType x) {
291
+ GPR_ASSERT(x != GRPC_COMPRESS_ALGORITHMS_COUNT);
292
+ return Slice::FromStaticString(CompressionAlgorithmAsString(x));
293
+ }
294
+ static const char* DisplayValue(MementoType x) {
295
+ if (const char* p = CompressionAlgorithmAsString(x)) {
296
+ return p;
297
+ } else {
298
+ return "<discarded-invalid-value>";
299
+ }
300
+ }
301
+ };
302
+
303
+ // grpc-encoding metadata trait.
304
+ struct GrpcEncodingMetadata : public CompressionAlgorithmBasedMetadata {
305
+ static constexpr bool kRepeatable = false;
306
+ static absl::string_view key() { return "grpc-encoding"; }
307
+ };
308
+
309
+ // grpc-internal-encoding-request metadata trait.
310
+ struct GrpcInternalEncodingRequest : public CompressionAlgorithmBasedMetadata {
311
+ static constexpr bool kRepeatable = false;
312
+ static absl::string_view key() { return "grpc-internal-encoding-request"; }
313
+ };
314
+
315
+ // grpc-accept-encoding metadata trait.
316
+ struct GrpcAcceptEncodingMetadata {
317
+ static constexpr bool kRepeatable = false;
318
+ static absl::string_view key() { return "grpc-accept-encoding"; }
319
+ using ValueType = CompressionAlgorithmSet;
320
+ using MementoType = ValueType;
321
+ static MementoType ParseMemento(Slice value, MetadataParseErrorFn) {
322
+ return CompressionAlgorithmSet::FromString(value.as_string_view());
323
+ }
324
+ static ValueType MementoToValue(MementoType x) { return x; }
325
+ static Slice Encode(ValueType x) { return x.ToSlice(); }
326
+ static std::string DisplayValue(MementoType x) { return x.ToString(); }
327
+ };
328
+
329
+ struct SimpleSliceBasedMetadata {
330
+ using ValueType = Slice;
331
+ using MementoType = Slice;
332
+ static MementoType ParseMemento(Slice value, MetadataParseErrorFn) {
333
+ return value.TakeOwned();
334
+ }
335
+ static ValueType MementoToValue(MementoType value) { return value; }
336
+ static Slice Encode(const ValueType& x) { return x.Ref(); }
337
+ static absl::string_view DisplayValue(const MementoType& value) {
338
+ return value.as_string_view();
339
+ }
340
+ };
341
+
342
+ // user-agent metadata trait.
343
+ struct UserAgentMetadata : public SimpleSliceBasedMetadata {
344
+ static constexpr bool kRepeatable = false;
345
+ static absl::string_view key() { return "user-agent"; }
346
+ };
347
+
348
+ // grpc-message metadata trait.
349
+ struct GrpcMessageMetadata : public SimpleSliceBasedMetadata {
350
+ static constexpr bool kRepeatable = false;
351
+ static absl::string_view key() { return "grpc-message"; }
352
+ };
353
+
354
+ // host metadata trait.
355
+ struct HostMetadata : public SimpleSliceBasedMetadata {
356
+ static constexpr bool kRepeatable = false;
357
+ static absl::string_view key() { return "host"; }
358
+ };
359
+
360
+ // x-endpoint-load-metrics-bin metadata trait.
361
+ struct XEndpointLoadMetricsBinMetadata : public SimpleSliceBasedMetadata {
362
+ static constexpr bool kRepeatable = false;
363
+ static absl::string_view key() { return "x-endpoint-load-metrics-bin"; }
364
+ };
365
+
366
+ // grpc-server-stats-bin metadata trait.
367
+ struct GrpcServerStatsBinMetadata : public SimpleSliceBasedMetadata {
368
+ static constexpr bool kRepeatable = false;
369
+ static absl::string_view key() { return "grpc-server-stats-bin"; }
370
+ };
371
+
372
+ // grpc-trace-bin metadata trait.
373
+ struct GrpcTraceBinMetadata : public SimpleSliceBasedMetadata {
374
+ static constexpr bool kRepeatable = false;
375
+ static absl::string_view key() { return "grpc-trace-bin"; }
376
+ };
377
+
378
+ // grpc-tags-bin metadata trait.
379
+ struct GrpcTagsBinMetadata : public SimpleSliceBasedMetadata {
380
+ static constexpr bool kRepeatable = false;
381
+ static absl::string_view key() { return "grpc-tags-bin"; }
382
+ };
383
+
384
+ // :authority metadata trait.
385
+ struct HttpAuthorityMetadata : public SimpleSliceBasedMetadata {
386
+ static constexpr bool kRepeatable = false;
387
+ static absl::string_view key() { return ":authority"; }
388
+ };
389
+
390
+ // :path metadata trait.
391
+ struct HttpPathMetadata : public SimpleSliceBasedMetadata {
392
+ static constexpr bool kRepeatable = false;
393
+ static absl::string_view key() { return ":path"; }
394
+ };
395
+
396
+ // We separate SimpleIntBasedMetadata into two pieces: one that does not depend
397
+ // on the invalid value, and one that does. This allows the compiler to easily
398
+ // see the functions that are shared, and helps reduce code bloat here.
399
+ template <typename Int>
400
+ struct SimpleIntBasedMetadataBase {
401
+ using ValueType = Int;
402
+ using MementoType = Int;
403
+ static ValueType MementoToValue(MementoType value) { return value; }
404
+ static Slice Encode(ValueType x) { return Slice::FromInt64(x); }
405
+ static Int DisplayValue(MementoType x) { return x; }
406
+ };
407
+
408
+ template <typename Int, Int kInvalidValue>
409
+ struct SimpleIntBasedMetadata : public SimpleIntBasedMetadataBase<Int> {
410
+ static constexpr Int invalid_value() { return kInvalidValue; }
411
+ static Int ParseMemento(Slice value, MetadataParseErrorFn on_error) {
412
+ Int out;
413
+ if (!absl::SimpleAtoi(value.as_string_view(), &out)) {
414
+ on_error("not an integer", value);
415
+ out = kInvalidValue;
416
+ }
417
+ return out;
418
+ }
419
+ };
420
+
421
+ // grpc-status metadata trait.
422
+ struct GrpcStatusMetadata
423
+ : public SimpleIntBasedMetadata<grpc_status_code, GRPC_STATUS_UNKNOWN> {
424
+ static constexpr bool kRepeatable = false;
425
+ static absl::string_view key() { return "grpc-status"; }
426
+ };
427
+
428
+ // grpc-previous-rpc-attempts metadata trait.
429
+ struct GrpcPreviousRpcAttemptsMetadata
430
+ : public SimpleIntBasedMetadata<uint32_t, 0> {
431
+ static constexpr bool kRepeatable = false;
432
+ static absl::string_view key() { return "grpc-previous-rpc-attempts"; }
433
+ };
434
+
435
+ // grpc-retry-pushback-ms metadata trait.
436
+ struct GrpcRetryPushbackMsMetadata {
437
+ static constexpr bool kRepeatable = false;
438
+ static absl::string_view key() { return "grpc-retry-pushback-ms"; }
439
+ using ValueType = Duration;
440
+ using MementoType = Duration;
441
+ static ValueType MementoToValue(MementoType x) { return x; }
442
+ static Slice Encode(Duration x) { return Slice::FromInt64(x.millis()); }
443
+ static int64_t DisplayValue(Duration x) { return x.millis(); }
444
+ static Duration ParseMemento(Slice value, MetadataParseErrorFn on_error) {
445
+ int64_t out;
446
+ if (!absl::SimpleAtoi(value.as_string_view(), &out)) {
447
+ on_error("not an integer", value);
448
+ return Duration::NegativeInfinity();
449
+ }
450
+ return Duration::Milliseconds(out);
451
+ }
452
+ };
453
+
454
+ // :status metadata trait.
455
+ // TODO(ctiller): consider moving to uint16_t
456
+ struct HttpStatusMetadata : public SimpleIntBasedMetadata<uint32_t, 0> {
457
+ static constexpr bool kRepeatable = false;
458
+ static absl::string_view key() { return ":status"; }
459
+ };
460
+
461
+ // "secret" metadata trait used to pass load balancing token between filters.
462
+ // This should not be exposed outside of gRPC core.
463
+ class GrpcLbClientStats;
464
+ struct GrpcLbClientStatsMetadata {
465
+ static constexpr bool kRepeatable = false;
466
+ static absl::string_view key() { return "grpclb_client_stats"; }
467
+ using ValueType = GrpcLbClientStats*;
468
+ using MementoType = ValueType;
469
+ static ValueType MementoToValue(MementoType value) { return value; }
470
+ static Slice Encode(ValueType) { abort(); }
471
+ static const char* DisplayValue(MementoType) { return "<internal-lb-stats>"; }
472
+ static MementoType ParseMemento(Slice, MetadataParseErrorFn) {
473
+ return nullptr;
474
+ }
475
+ };
476
+
477
+ // lb-token metadata
478
+ struct LbTokenMetadata : public SimpleSliceBasedMetadata {
479
+ static constexpr bool kRepeatable = false;
480
+ static absl::string_view key() { return "lb-token"; }
481
+ };
482
+
483
+ // lb-cost-bin metadata
484
+ struct LbCostBinMetadata {
485
+ static constexpr bool kRepeatable = true;
486
+ static absl::string_view key() { return "lb-cost-bin"; }
487
+ struct ValueType {
488
+ double cost;
489
+ std::string name;
490
+ };
491
+ using MementoType = ValueType;
492
+ static ValueType MementoToValue(MementoType value) { return value; }
493
+ static Slice Encode(const ValueType& x) {
494
+ auto slice =
495
+ MutableSlice::CreateUninitialized(sizeof(double) + x.name.length());
496
+ memcpy(slice.data(), &x.cost, sizeof(double));
497
+ memcpy(slice.data() + sizeof(double), x.name.data(), x.name.length());
498
+ return Slice(std::move(slice));
499
+ }
500
+ static std::string DisplayValue(MementoType x) {
501
+ return absl::StrCat(x.name, ":", x.cost);
502
+ }
503
+ static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error) {
504
+ if (value.length() < sizeof(double)) {
505
+ on_error("too short", value);
506
+ return {0, ""};
507
+ }
508
+ MementoType out;
509
+ memcpy(&out.cost, value.data(), sizeof(double));
510
+ out.name = std::string(
511
+ reinterpret_cast<const char*>(value.data()) + sizeof(double),
512
+ value.length() - sizeof(double));
513
+ return out;
514
+ }
515
+ };
516
+
517
+ // Annotation added by a transport to note whether a failed request was never
518
+ // placed on the wire, or never seen by a server.
519
+ struct GrpcStreamNetworkState {
520
+ static absl::string_view DebugKey() { return "GrpcStreamNetworkState"; }
521
+ static constexpr bool kRepeatable = false;
522
+ enum ValueType : uint8_t {
523
+ kNotSentOnWire,
524
+ kNotSeenByServer,
525
+ };
526
+ static std::string DisplayValue(ValueType x) {
527
+ switch (x) {
528
+ case kNotSentOnWire:
529
+ return "not sent on wire";
530
+ case kNotSeenByServer:
531
+ return "not seen by server";
532
+ }
533
+ }
534
+ };
535
+
536
+ // Annotation added by various systems to describe the reason for a failure.
537
+ struct GrpcStatusContext {
538
+ static absl::string_view DebugKey() { return "GrpcStatusContext"; }
539
+ static constexpr bool kRepeatable = true;
540
+ using ValueType = std::string;
541
+ static const std::string& DisplayValue(const std::string& x) { return x; }
542
+ };
543
+
142
544
  namespace metadata_detail {
143
545
 
144
- // Inner implementation of MetadataMap<Container>::Parse()
145
- // Recursive in terms of metadata trait, tries each known type in order by doing
146
- // a string comparison on key, and if that key is found parses it. If not found,
147
- // calls not_found to generate the result value.
148
- template <typename Container, typename... Traits>
149
- struct ParseHelper;
150
-
151
- template <typename Container, typename Trait, typename... Traits>
152
- struct ParseHelper<Container, Trait, Traits...> {
153
- template <typename NotFound>
154
- static ParsedMetadata<Container> Parse(absl::string_view key,
155
- const grpc_slice& value,
156
- NotFound not_found) {
546
+ // IsEncodable: Given a trait, determine if that trait is encodable, or is just
547
+ // a value attached to a MetadataMap.
548
+ // We use the presence of the key() static method to determine if a trait is
549
+ // encodable or not - encodable traits have string names, and non-encodable
550
+ // traits do not.
551
+ template <typename Trait, typename Ignored = void>
552
+ struct IsEncodableTrait {
553
+ static const bool value = false;
554
+ };
555
+
556
+ template <typename Trait>
557
+ struct IsEncodableTrait<Trait, absl::void_t<decltype(Trait::key())>> {
558
+ static const bool value = true;
559
+ };
560
+
561
+ // Helper type - maps a string name to a trait.
562
+ template <typename MustBeVoid, typename... Traits>
563
+ struct NameLookup;
564
+
565
+ template <typename Trait, typename... Traits>
566
+ struct NameLookup<absl::enable_if_t<IsEncodableTrait<Trait>::value, void>,
567
+ Trait, Traits...> {
568
+ // Call op->Found(Trait()) if op->name == Trait::key() for some Trait in
569
+ // Traits. If not found, call op->NotFound().
570
+ template <typename Op>
571
+ static auto Lookup(absl::string_view key, Op* op)
572
+ -> decltype(op->Found(Trait())) {
157
573
  if (key == Trait::key()) {
158
- return ParsedMetadata<Container>(
159
- Trait(), Trait::ParseMemento(value),
160
- ParsedMetadata<Container>::TransportSize(key.size(),
161
- GRPC_SLICE_LENGTH(value)));
574
+ return op->Found(Trait());
162
575
  }
163
- return ParseHelper<Container, Traits...>::Parse(key, value, not_found);
576
+ return NameLookup<void, Traits...>::Lookup(key, op);
577
+ }
578
+ };
579
+
580
+ template <typename Trait, typename... Traits>
581
+ struct NameLookup<absl::enable_if_t<!IsEncodableTrait<Trait>::value, void>,
582
+ Trait, Traits...> {
583
+ template <typename Op>
584
+ static auto Lookup(absl::string_view key, Op* op)
585
+ -> decltype(NameLookup<void, Traits...>::Lookup(key, op)) {
586
+ return NameLookup<void, Traits...>::Lookup(key, op);
587
+ }
588
+ };
589
+
590
+ template <>
591
+ struct NameLookup<void> {
592
+ template <typename Op>
593
+ static auto Lookup(absl::string_view key, Op* op)
594
+ -> decltype(op->NotFound(key)) {
595
+ return op->NotFound(key);
596
+ }
597
+ };
598
+
599
+ // Helper to take a slice to a memento to a value.
600
+ // By splitting this part out we can scale code size as the number of (memento,
601
+ // value) types, rather than as the number of traits.
602
+ template <typename ParseMementoFn, typename MementoToValueFn>
603
+ struct ParseValue {
604
+ template <ParseMementoFn parse_memento, MementoToValueFn memento_to_value>
605
+ static GPR_ATTRIBUTE_NOINLINE auto Parse(Slice* value,
606
+ MetadataParseErrorFn on_error)
607
+ -> decltype(memento_to_value(parse_memento(std::move(*value),
608
+ on_error))) {
609
+ return memento_to_value(parse_memento(std::move(*value), on_error));
610
+ }
611
+ };
612
+
613
+ // This is an "Op" type for NameLookup.
614
+ // Used for MetadataMap::Parse, its Found/NotFound methods turn a slice into a
615
+ // ParsedMetadata object.
616
+ template <typename Container>
617
+ class ParseHelper {
618
+ public:
619
+ ParseHelper(Slice value, MetadataParseErrorFn on_error, size_t transport_size)
620
+ : value_(std::move(value)),
621
+ on_error_(on_error),
622
+ transport_size_(transport_size) {}
623
+
624
+ template <typename Trait>
625
+ GPR_ATTRIBUTE_NOINLINE ParsedMetadata<Container> Found(Trait trait) {
626
+ return ParsedMetadata<Container>(
627
+ trait,
628
+ ParseValueToMemento<typename Trait::MementoType, Trait::ParseMemento>(),
629
+ transport_size_);
630
+ }
631
+
632
+ GPR_ATTRIBUTE_NOINLINE ParsedMetadata<Container> NotFound(
633
+ absl::string_view key) {
634
+ return ParsedMetadata<Container>(Slice::FromCopiedString(key),
635
+ std::move(value_));
164
636
  }
637
+
638
+ private:
639
+ template <typename T, T (*parse_memento)(Slice, MetadataParseErrorFn)>
640
+ GPR_ATTRIBUTE_NOINLINE T ParseValueToMemento() {
641
+ return parse_memento(std::move(value_), on_error_);
642
+ }
643
+
644
+ Slice value_;
645
+ MetadataParseErrorFn on_error_;
646
+ const size_t transport_size_;
165
647
  };
166
648
 
649
+ // This is an "Op" type for NameLookup.
650
+ // Used for MetadataMap::Append, its Found/NotFound methods turn a slice into a
651
+ // value and add it to a container.
167
652
  template <typename Container>
168
- struct ParseHelper<Container> {
169
- template <typename NotFound>
170
- static ParsedMetadata<Container> Parse(absl::string_view, const grpc_slice&,
171
- NotFound not_found) {
172
- return not_found();
653
+ class AppendHelper {
654
+ public:
655
+ AppendHelper(Container* container, Slice value, MetadataParseErrorFn on_error)
656
+ : container_(container), value_(std::move(value)), on_error_(on_error) {}
657
+
658
+ template <typename Trait>
659
+ GPR_ATTRIBUTE_NOINLINE void Found(Trait trait) {
660
+ container_->Set(
661
+ trait, ParseValue<decltype(Trait::ParseMemento),
662
+ decltype(Trait::MementoToValue)>::
663
+ template Parse<Trait::ParseMemento, Trait::MementoToValue>(
664
+ &value_, on_error_));
665
+ }
666
+
667
+ GPR_ATTRIBUTE_NOINLINE void NotFound(absl::string_view key) {
668
+ container_->AppendUnknown(key, std::move(value_));
173
669
  }
670
+
671
+ private:
672
+ Container* const container_;
673
+ Slice value_;
674
+ MetadataParseErrorFn on_error_;
174
675
  };
175
676
 
176
- // Inner implementation of MetadataMap<Container>::Append()
177
- // Recursive in terms of metadata trait, tries each known type in order by doing
178
- // a string comparison on key, and if that key is found sets it. If not found,
179
- // calls not_found to append generically.
180
- template <typename Container, typename... Traits>
181
- struct AppendHelper;
182
-
183
- template <typename Container, typename Trait, typename... Traits>
184
- struct AppendHelper<Container, Trait, Traits...> {
185
- template <typename NotFound>
186
- static void Append(Container* container, absl::string_view key,
187
- const grpc_slice& value, NotFound not_found) {
188
- if (key == Trait::key()) {
189
- container->Set(Trait(),
190
- Trait::MementoToValue(Trait::ParseMemento(value)));
191
- return;
192
- }
193
- AppendHelper<Container, Traits...>::Append(container, key, value,
194
- not_found);
677
+ // This is an "Op" type for NameLookup.
678
+ // Used for MetadataMap::Remove, its Found/NotFound methods remove a key from
679
+ // the container.
680
+ template <typename Container>
681
+ class RemoveHelper {
682
+ public:
683
+ explicit RemoveHelper(Container* container) : container_(container) {}
684
+
685
+ template <typename Trait>
686
+ GPR_ATTRIBUTE_NOINLINE void Found(Trait trait) {
687
+ container_->Remove(trait);
688
+ }
689
+
690
+ GPR_ATTRIBUTE_NOINLINE void NotFound(absl::string_view key) {
691
+ container_->RemoveUnknown(key);
195
692
  }
693
+
694
+ private:
695
+ Container* const container_;
196
696
  };
197
697
 
698
+ // This is an "Op" type for NameLookup.
699
+ // Used for MetadataMap::GetStringValue, its Found/NotFound methods generated a
700
+ // string value from the container.
198
701
  template <typename Container>
199
- struct AppendHelper<Container> {
200
- template <typename NotFound>
201
- static void Append(Container*, absl::string_view, const grpc_slice&,
202
- NotFound not_found) {
203
- not_found();
702
+ class GetStringValueHelper {
703
+ public:
704
+ explicit GetStringValueHelper(const Container* container,
705
+ std::string* backing)
706
+ : container_(container), backing_(backing) {}
707
+
708
+ template <typename Trait>
709
+ GPR_ATTRIBUTE_NOINLINE absl::enable_if_t<
710
+ Trait::kRepeatable == false &&
711
+ std::is_same<Slice, typename Trait::ValueType>::value,
712
+ absl::optional<absl::string_view>>
713
+ Found(Trait) {
714
+ const auto* value = container_->get_pointer(Trait());
715
+ if (value == nullptr) return absl::nullopt;
716
+ return value->as_string_view();
717
+ }
718
+
719
+ template <typename Trait>
720
+ GPR_ATTRIBUTE_NOINLINE absl::enable_if_t<
721
+ Trait::kRepeatable == true &&
722
+ !std::is_same<Slice, typename Trait::ValueType>::value,
723
+ absl::optional<absl::string_view>>
724
+ Found(Trait) {
725
+ const auto* value = container_->get_pointer(Trait());
726
+ if (value == nullptr) return absl::nullopt;
727
+ backing_->clear();
728
+ for (const auto& v : *value) {
729
+ if (!backing_->empty()) backing_->push_back(',');
730
+ auto new_segment = Trait::Encode(v);
731
+ backing_->append(new_segment.begin(), new_segment.end());
732
+ }
733
+ return *backing_;
734
+ }
735
+
736
+ template <typename Trait>
737
+ GPR_ATTRIBUTE_NOINLINE absl::enable_if_t<
738
+ Trait::kRepeatable == false &&
739
+ !std::is_same<Slice, typename Trait::ValueType>::value,
740
+ absl::optional<absl::string_view>>
741
+ Found(Trait) {
742
+ const auto* value = container_->get_pointer(Trait());
743
+ if (value == nullptr) return absl::nullopt;
744
+ *backing_ = std::string(Trait::Encode(*value).as_string_view());
745
+ return *backing_;
746
+ }
747
+
748
+ GPR_ATTRIBUTE_NOINLINE absl::optional<absl::string_view> NotFound(
749
+ absl::string_view key) {
750
+ return container_->GetStringValueUnknown(key, backing_);
751
+ }
752
+
753
+ private:
754
+ const Container* const container_;
755
+ std::string* backing_;
756
+ };
757
+
758
+ // Sink for key value logs
759
+ using LogFn = absl::FunctionRef<void(absl::string_view, absl::string_view)>;
760
+
761
+ template <typename T>
762
+ struct AdaptDisplayValueToLog {
763
+ static std::string ToString(const T& value) { return absl::StrCat(value); }
764
+ };
765
+
766
+ template <>
767
+ struct AdaptDisplayValueToLog<Slice> {
768
+ static std::string ToString(Slice value) {
769
+ return std::string(value.as_string_view());
770
+ }
771
+ };
772
+
773
+ template <>
774
+ struct AdaptDisplayValueToLog<StaticSlice> {
775
+ static absl::string_view ToString(StaticSlice value) {
776
+ return value.as_string_view();
777
+ }
778
+ };
779
+
780
+ template <typename T, typename U, typename V>
781
+ GPR_ATTRIBUTE_NOINLINE void LogKeyValueTo(absl::string_view key, const T& value,
782
+ V (*display_value)(U), LogFn log_fn) {
783
+ log_fn(key, AdaptDisplayValueToLog<V>::ToString(display_value(value)));
784
+ }
785
+
786
+ // Generate a strong type for metadata values per trait.
787
+ template <typename Which, typename Ignored = void>
788
+ struct Value;
789
+
790
+ template <typename Which>
791
+ struct Value<Which, absl::enable_if_t<Which::kRepeatable == false &&
792
+ IsEncodableTrait<Which>::value,
793
+ void>> {
794
+ Value() = default;
795
+ explicit Value(const typename Which::ValueType& value) : value(value) {}
796
+ explicit Value(typename Which::ValueType&& value)
797
+ : value(std::forward<typename Which::ValueType>(value)) {}
798
+ Value(const Value&) = delete;
799
+ Value& operator=(const Value&) = delete;
800
+ Value(Value&&) noexcept = default;
801
+ Value& operator=(Value&& other) noexcept {
802
+ value = std::move(other.value);
803
+ return *this;
804
+ }
805
+ template <typename Encoder>
806
+ void EncodeTo(Encoder* encoder) const {
807
+ encoder->Encode(Which(), value);
808
+ }
809
+ void LogTo(LogFn log_fn) const {
810
+ LogKeyValueTo(Which::key(), value, Which::Encode, log_fn);
811
+ }
812
+ using StorageType = typename Which::ValueType;
813
+ GPR_NO_UNIQUE_ADDRESS StorageType value;
814
+ };
815
+
816
+ template <typename Which>
817
+ struct Value<Which, absl::enable_if_t<Which::kRepeatable == false &&
818
+ !IsEncodableTrait<Which>::value,
819
+ void>> {
820
+ Value() = default;
821
+ explicit Value(const typename Which::ValueType& value) : value(value) {}
822
+ explicit Value(typename Which::ValueType&& value)
823
+ : value(std::forward<typename Which::ValueType>(value)) {}
824
+ Value(const Value&) = delete;
825
+ Value& operator=(const Value&) = delete;
826
+ Value(Value&&) noexcept = default;
827
+ Value& operator=(Value&& other) noexcept {
828
+ value = std::move(other.value);
829
+ return *this;
830
+ }
831
+ template <typename Encoder>
832
+ void EncodeTo(Encoder*) const {}
833
+ void LogTo(LogFn log_fn) const {
834
+ LogKeyValueTo(Which::DebugKey(), value, Which::DisplayValue, log_fn);
835
+ }
836
+ using StorageType = typename Which::ValueType;
837
+ GPR_NO_UNIQUE_ADDRESS StorageType value;
838
+ };
839
+
840
+ template <typename Which>
841
+ struct Value<Which, absl::enable_if_t<Which::kRepeatable == true &&
842
+ IsEncodableTrait<Which>::value,
843
+ void>> {
844
+ Value() = default;
845
+ explicit Value(const typename Which::ValueType& value) {
846
+ this->value.push_back(value);
847
+ }
848
+ explicit Value(typename Which::ValueType&& value) {
849
+ this->value.emplace_back(std::forward<typename Which::ValueType>(value));
850
+ }
851
+ Value(const Value&) = delete;
852
+ Value& operator=(const Value&) = delete;
853
+ Value(Value&& other) noexcept : value(std::move(other.value)) {}
854
+ Value& operator=(Value&& other) noexcept {
855
+ value = std::move(other.value);
856
+ return *this;
857
+ }
858
+ template <typename Encoder>
859
+ void EncodeTo(Encoder* encoder) const {
860
+ for (const auto& v : value) {
861
+ encoder->Encode(Which(), v);
862
+ }
863
+ }
864
+ void LogTo(LogFn log_fn) const {
865
+ for (const auto& v : value) {
866
+ LogKeyValueTo(Which::key(), v, Which::Encode, log_fn);
867
+ }
868
+ }
869
+ using StorageType = absl::InlinedVector<typename Which::ValueType, 1>;
870
+ StorageType value;
871
+ };
872
+
873
+ template <typename Which>
874
+ struct Value<Which, absl::enable_if_t<Which::kRepeatable == true &&
875
+ !IsEncodableTrait<Which>::value,
876
+ void>> {
877
+ Value() = default;
878
+ explicit Value(const typename Which::ValueType& value) {
879
+ this->value.push_back(value);
880
+ }
881
+ explicit Value(typename Which::ValueType&& value) {
882
+ this->value.emplace_back(std::forward<typename Which::ValueType>(value));
883
+ }
884
+ Value(const Value&) = delete;
885
+ Value& operator=(const Value&) = delete;
886
+ Value(Value&& other) noexcept : value(std::move(other.value)) {}
887
+ Value& operator=(Value&& other) noexcept {
888
+ value = std::move(other.value);
889
+ return *this;
890
+ }
891
+ template <typename Encoder>
892
+ void EncodeTo(Encoder*) const {}
893
+ void LogTo(LogFn log_fn) const {
894
+ for (const auto& v : value) {
895
+ LogKeyValueTo(Which::DebugKey(), v, Which::DisplayValue, log_fn);
896
+ }
897
+ }
898
+ using StorageType = absl::InlinedVector<typename Which::ValueType, 1>;
899
+ StorageType value;
900
+ };
901
+
902
+ // Encoder to copy some metadata
903
+ template <typename Output>
904
+ class CopySink {
905
+ public:
906
+ explicit CopySink(Output* dst) : dst_(dst) {}
907
+
908
+ template <class T, class V>
909
+ void Encode(T trait, V value) {
910
+ dst_->Set(trait, value);
911
+ }
912
+
913
+ template <class T>
914
+ void Encode(T trait, const Slice& value) {
915
+ dst_->Set(trait, std::move(value.AsOwned()));
916
+ }
917
+
918
+ void Encode(const Slice& key, const Slice& value) {
919
+ dst_->AppendUnknown(key.as_string_view(), value.Ref());
920
+ }
921
+
922
+ private:
923
+ Output* dst_;
924
+ };
925
+
926
+ // Callable for the ForEach in Encode() -- for each value, call the
927
+ // appropriate encoder method.
928
+ template <typename Encoder>
929
+ struct EncodeWrapper {
930
+ Encoder* encoder;
931
+ template <typename Which>
932
+ void operator()(const Value<Which>& which) {
933
+ which.EncodeTo(encoder);
934
+ }
935
+ };
936
+
937
+ // Callable for the ForEach in Log()
938
+ struct LogWrapper {
939
+ LogFn log_fn;
940
+ template <typename Which>
941
+ void operator()(const Value<Which>& which) {
942
+ which.LogTo(log_fn);
943
+ }
944
+ };
945
+
946
+ // Encoder to compute TransportSize
947
+ class TransportSizeEncoder {
948
+ public:
949
+ void Encode(const Slice& key, const Slice& value) {
950
+ size_ += key.length() + value.length() + 32;
204
951
  }
952
+
953
+ template <typename Which>
954
+ void Encode(Which, const typename Which::ValueType& value) {
955
+ Add(Which(), value);
956
+ }
957
+
958
+ void Encode(ContentTypeMetadata,
959
+ const typename ContentTypeMetadata::ValueType& value) {
960
+ if (value == ContentTypeMetadata::kInvalid) return;
961
+ Add(ContentTypeMetadata(), value);
962
+ }
963
+
964
+ size_t size() const { return size_; }
965
+
966
+ private:
967
+ template <typename Which>
968
+ void Add(Which, const typename Which::ValueType& value) {
969
+ size_ += Which::key().length() + Which::Encode(value).length() + 32;
970
+ }
971
+
972
+ uint32_t size_ = 0;
205
973
  };
206
974
 
207
975
  } // namespace metadata_detail
208
976
 
977
+ // Helper function for encoders
978
+ // Given a metadata trait, convert the value to a slice.
979
+ template <typename Which>
980
+ absl::enable_if_t<std::is_same<typename Which::ValueType, Slice>::value,
981
+ const Slice&>
982
+ MetadataValueAsSlice(const Slice& slice) {
983
+ return slice;
984
+ }
985
+
986
+ template <typename Which>
987
+ absl::enable_if_t<!std::is_same<typename Which::ValueType, Slice>::value, Slice>
988
+ MetadataValueAsSlice(typename Which::ValueType value) {
989
+ return Slice(Which::Encode(value));
990
+ }
991
+
209
992
  // MetadataMap encodes the mapping of metadata keys to metadata values.
210
- // Right now the API presented is the minimal one that will allow us to
211
- // substitute this type for grpc_metadata_batch in a relatively easy fashion. At
212
- // that point we'll start iterating this API into something that's ergonomic
213
- // again, whilst minimally holding the performance bar already set (and
214
- // hopefully improving some things).
215
- // In the meantime, we're not going to invest much time in ephemeral API
216
- // documentation, so if you must use one of these APIs and it's not obvious
217
- // how, reach out to ctiller.
218
993
  //
219
- // MetadataMap takes a list of traits. Each of these trait objects defines
220
- // one metadata field that is used by core, and so should have more specialized
221
- // handling than just using the generic APIs.
994
+ // MetadataMap takes a derived class and list of traits. Each of these trait
995
+ // objects defines one metadata field that is used by core, and so should have
996
+ // more specialized handling than just using the generic APIs.
997
+ //
998
+ // MetadataMap is the backing type for some derived type via the curiously
999
+ // recursive template pattern. This is because many types consumed by
1000
+ // MetadataMap require the container type to operate on, and many of those
1001
+ // types are instantiated one per trait. A naive implementation without the
1002
+ // Derived type would, for traits A,B,C, then instantiate for some
1003
+ // T<Container, Trait>:
1004
+ // - T<MetadataMap<A,B,C>, A>,
1005
+ // - T<MetadataMap<A,B,C>, B>,
1006
+ // - T<MetadataMap<A,B,C>, C>.
1007
+ // Since these types ultimately need to be recorded in the .dynstr segment
1008
+ // for dynamic linkers (if gRPC is linked as a static library) this would
1009
+ // create O(N^2) bytes of symbols even in stripped libraries. To avoid this
1010
+ // we use the derived type (e.g. grpc_metadata_batch right now) to capture
1011
+ // the container type, and we would write T<grpc_metadata_batch, A>, etc...
1012
+ // Note that now the container type uses a number of bytes that is independent
1013
+ // of the number of traits, and so we return to a linear symbol table growth
1014
+ // function.
1015
+ //
1016
+ // Each trait object has one of two possible signatures, depending on whether
1017
+ // that traits field is encodable or not.
1018
+ // Non-encodable traits are carried in a MetadataMap, but are never passed to
1019
+ // the application nor serialized to wire.
222
1020
  //
223
- // Each trait object has the following signature:
224
- // // Traits for the grpc-xyz metadata field:
1021
+ // Encodable traits have the following signature:
1022
+ // // Traits for the "grpc-xyz" metadata field:
225
1023
  // struct GrpcXyzMetadata {
1024
+ // // Can this metadata field be repeated?
1025
+ // static constexpr bool kRepeatable = ...;
226
1026
  // // The type that's stored on MetadataBatch
227
1027
  // using ValueType = ...;
228
1028
  // // The type that's stored in compression/decompression tables
229
1029
  // using MementoType = ...;
230
1030
  // // The string key for this metadata type (for transports that require it)
231
- // static constexpr char* key() { return "grpc-xyz"; }
1031
+ // static absl::string_view key() { return "grpc-xyz"; }
232
1032
  // // Parse a memento from a slice
233
1033
  // // Takes ownership of value
234
- // static MementoType ParseMemento(const grpc_slice& value) { ... }
1034
+ // // Calls fn in the case of an error that should be reported to the user
1035
+ // static MementoType ParseMemento(Slice value, MementoParseErrorFn fn) { ...
1036
+ // }
235
1037
  // // Convert a memento to a value
236
1038
  // static ValueType MementoToValue(MementoType memento) { ... }
237
1039
  // // Convert a value to its canonical text wire format (the format that
238
1040
  // // ParseMemento will accept!)
239
- // static grpc_slice Encode(ValueType value);
1041
+ // static Slice Encode(const ValueType& value);
240
1042
  // // Convert a value to something that can be passed to StrCat and displayed
241
1043
  // // for debugging
242
1044
  // static SomeStrCatableType DisplayValue(MementoType value) { ... }
243
1045
  // };
244
1046
  //
1047
+ // Non-encodable traits are determined by missing the key() method, and have the
1048
+ // following signature (and by convention omit the Metadata part of the type
1049
+ // name):
1050
+ // // Traits for the GrpcXyz field:
1051
+ // struct GrpcXyz {
1052
+ // // The string key that should be used for debug dumps - should not be a
1053
+ // // valid http2 key (ie all lower case)
1054
+ // static absl::string_view DebugKey() { return "GRPC_XYZ"; }
1055
+ // // Can this metadata field be repeated?
1056
+ // static constexpr bool kRepeatable = ...;
1057
+ // // The type that's stored on MetadataBatch
1058
+ // using ValueType = ...;
1059
+ // // Convert a value to something that can be passed to StrCat and displayed
1060
+ // // for debugging
1061
+ // static SomeStrCatableType DisplayValue(ValueType value) { ... }
1062
+ // };
1063
+ //
245
1064
  // About parsing and mementos:
246
1065
  //
247
1066
  // Many gRPC transports exchange metadata as key/value strings, but also allow
@@ -261,7 +1080,7 @@ struct AppendHelper<Container> {
261
1080
  // for grpc-timeout we make the memento the timeout expressed on the wire, but
262
1081
  // we make the value the timestamp of when the timeout will expire (i.e. the
263
1082
  // deadline).
264
- template <typename... Traits>
1083
+ template <class Derived, typename... Traits>
265
1084
  class MetadataMap {
266
1085
  public:
267
1086
  explicit MetadataMap(Arena* arena);
@@ -270,7 +1089,10 @@ class MetadataMap {
270
1089
  MetadataMap(const MetadataMap&) = delete;
271
1090
  MetadataMap& operator=(const MetadataMap&) = delete;
272
1091
  MetadataMap(MetadataMap&&) noexcept;
273
- MetadataMap& operator=(MetadataMap&&) noexcept;
1092
+ // We never create MetadataMap directly, instead we create Derived, but we
1093
+ // want to be able to move it without redeclaring this.
1094
+ // NOLINTNEXTLINE(misc-unconventional-assign-operator)
1095
+ Derived& operator=(MetadataMap&&) noexcept;
274
1096
 
275
1097
  // Encode this metadata map into some encoder.
276
1098
  // For each field that is set in the MetadataMap, call
@@ -287,17 +1109,36 @@ class MetadataMap {
287
1109
  // transitions.
288
1110
  template <typename Encoder>
289
1111
  void Encode(Encoder* encoder) const {
290
- for (auto* l = list_.head; l; l = l->next) {
291
- encoder->Encode(l->md);
1112
+ table_.ForEach(metadata_detail::EncodeWrapper<Encoder>{encoder});
1113
+ for (const auto& unk : unknown_) {
1114
+ encoder->Encode(unk.first, unk.second);
1115
+ }
1116
+ }
1117
+
1118
+ // Similar to Encode, but targeted at logging: for each metadatum,
1119
+ // call f(key, value) as absl::string_views.
1120
+ void Log(metadata_detail::LogFn log_fn) const {
1121
+ table_.ForEach(metadata_detail::LogWrapper{log_fn});
1122
+ for (const auto& unk : unknown_) {
1123
+ log_fn(unk.first.as_string_view(), unk.second.as_string_view());
292
1124
  }
293
- table_.ForEach(EncodeWrapper<Encoder>{encoder});
1125
+ }
1126
+
1127
+ std::string DebugString() const {
1128
+ std::string out;
1129
+ Log([&out](absl::string_view key, absl::string_view value) {
1130
+ if (!out.empty()) out.append(", ");
1131
+ absl::StrAppend(&out, absl::CEscape(key), ": ", absl::CEscape(value));
1132
+ });
1133
+ return out;
294
1134
  }
295
1135
 
296
1136
  // Get the pointer to the value of some known metadata.
297
1137
  // Returns nullptr if the metadata is not present.
298
1138
  // Causes a compilation error if Which is not an element of Traits.
299
1139
  template <typename Which>
300
- const typename Which::ValueType* get_pointer(Which) const {
1140
+ const typename metadata_detail::Value<Which>::StorageType* get_pointer(
1141
+ Which) const {
301
1142
  if (auto* p = table_.template get<Value<Which>>()) return &p->value;
302
1143
  return nullptr;
303
1144
  }
@@ -306,11 +1147,20 @@ class MetadataMap {
306
1147
  // Returns nullptr if the metadata is not present.
307
1148
  // Causes a compilation error if Which is not an element of Traits.
308
1149
  template <typename Which>
309
- typename Which::ValueType* get_pointer(Which) {
1150
+ typename metadata_detail::Value<Which>::StorageType* get_pointer(Which) {
310
1151
  if (auto* p = table_.template get<Value<Which>>()) return &p->value;
311
1152
  return nullptr;
312
1153
  }
313
1154
 
1155
+ // Get the pointer to the value of some known metadata.
1156
+ // Adds the default value for the metadata is not present.
1157
+ // Causes a compilation error if Which is not an element of Traits.
1158
+ template <typename Which>
1159
+ typename metadata_detail::Value<Which>::StorageType* GetOrCreatePointer(
1160
+ Which) {
1161
+ return &table_.template get_or_create<Value<Which>>()->value;
1162
+ }
1163
+
314
1164
  // Get the value of some known metadata.
315
1165
  // Returns nullopt if the metadata is not present.
316
1166
  // Causes a compilation error if Which is not an element of Traits.
@@ -323,9 +1173,14 @@ class MetadataMap {
323
1173
  // Set the value of some known metadata.
324
1174
  // Returns a pointer to the new value.
325
1175
  template <typename Which, typename... Args>
326
- typename Which::ValueType* Set(Which, Args&&... args) {
327
- return &table_.template set<Value<Which>>(std::forward<Args>(args)...)
328
- ->value;
1176
+ absl::enable_if_t<Which::kRepeatable == false, void> Set(Which,
1177
+ Args&&... args) {
1178
+ table_.template set<Value<Which>>(std::forward<Args>(args)...);
1179
+ }
1180
+ template <typename Which, typename... Args>
1181
+ absl::enable_if_t<Which::kRepeatable == true, void> Set(Which,
1182
+ Args&&... args) {
1183
+ GetOrCreatePointer(Which())->emplace_back(std::forward<Args>(args)...);
329
1184
  }
330
1185
 
331
1186
  // Remove a specific piece of known metadata.
@@ -334,722 +1189,202 @@ class MetadataMap {
334
1189
  table_.template clear<Value<Which>>();
335
1190
  }
336
1191
 
1192
+ // Remove some metadata by name
1193
+ void Remove(absl::string_view key) {
1194
+ metadata_detail::RemoveHelper<Derived> helper(static_cast<Derived*>(this));
1195
+ metadata_detail::NameLookup<void, Traits...>::Lookup(key, &helper);
1196
+ }
1197
+
1198
+ void Remove(const char* key) { Remove(absl::string_view(key)); }
1199
+
1200
+ // Retrieve some metadata by name
1201
+ absl::optional<absl::string_view> GetStringValue(absl::string_view name,
1202
+ std::string* buffer) const {
1203
+ metadata_detail::GetStringValueHelper<Derived> helper(
1204
+ static_cast<const Derived*>(this), buffer);
1205
+ return metadata_detail::NameLookup<void, Traits...>::Lookup(name, &helper);
1206
+ }
1207
+
337
1208
  // Extract a piece of known metadata.
338
1209
  // Returns nullopt if the metadata was not present, or the value if it was.
339
1210
  // The same as:
340
1211
  // auto value = m.get(T());
341
1212
  // m.Remove(T());
342
1213
  template <typename Which>
343
- absl::optional<typename Which::ValueType> Take(Which which) {
344
- auto value = get(which);
345
- Remove(which);
346
- return value;
1214
+ absl::enable_if_t<Which::kRepeatable == false,
1215
+ absl::optional<typename Which::ValueType>>
1216
+ Take(Which which) {
1217
+ if (auto* p = get_pointer(which)) {
1218
+ absl::optional<typename Which::ValueType> value(std::move(*p));
1219
+ Remove(which);
1220
+ return value;
1221
+ }
1222
+ return {};
1223
+ }
1224
+
1225
+ // Extract repeated known metadata.
1226
+ // Returns an empty vector if the metadata was not present.
1227
+ template <typename Which>
1228
+ absl::enable_if_t<Which::kRepeatable == true,
1229
+ typename metadata_detail::Value<Which>::StorageType>
1230
+ Take(Which which) {
1231
+ if (auto* p = get_pointer(which)) {
1232
+ typename Value<Which>::StorageType value = std::move(*p);
1233
+ Remove(which);
1234
+ return value;
1235
+ }
1236
+ return {};
347
1237
  }
348
1238
 
349
1239
  // Parse metadata from a key/value pair, and return an object representing
350
1240
  // that result.
351
1241
  // TODO(ctiller): key should probably be an absl::string_view.
352
1242
  // Once we don't care about interning anymore, make that change!
353
- template <class KeySlice, class ValueSlice>
354
- static ParsedMetadata<MetadataMap> Parse(const KeySlice& key,
355
- const ValueSlice& value) {
356
- bool parsed = true;
357
- auto out = metadata_detail::ParseHelper<MetadataMap, Traits...>::Parse(
358
- StringViewFromSlice(key), value, [&] {
359
- parsed = false;
360
- return ParsedMetadata<MetadataMap>(
361
- grpc_mdelem_from_slices(key, value));
362
- });
363
- if (parsed) {
364
- grpc_slice_unref_internal(key);
365
- }
366
- return out;
1243
+ static ParsedMetadata<Derived> Parse(absl::string_view key, Slice value,
1244
+ uint32_t transport_size,
1245
+ MetadataParseErrorFn on_error) {
1246
+ metadata_detail::ParseHelper<Derived> helper(value.TakeOwned(), on_error,
1247
+ transport_size);
1248
+ return metadata_detail::NameLookup<void, Traits...>::Lookup(key, &helper);
367
1249
  }
368
1250
 
369
1251
  // Set a value from a parsed metadata object.
370
- GRPC_MUST_USE_RESULT grpc_error_handle
371
- Set(const ParsedMetadata<MetadataMap>& m) {
372
- return m.SetOnContainer(this);
1252
+ void Set(const ParsedMetadata<Derived>& m) {
1253
+ m.SetOnContainer(static_cast<Derived*>(this));
373
1254
  }
374
1255
 
375
1256
  // Append a key/value pair - takes ownership of value
376
- void Append(absl::string_view key, const grpc_slice& value) {
377
- metadata_detail::AppendHelper<MetadataMap, Traits...>::Append(
378
- this, key, value, [&] {
379
- GPR_ASSERT(GRPC_ERROR_NONE ==
380
- Append(grpc_mdelem_from_slices(
381
- grpc_slice_intern(grpc_slice_from_static_buffer(
382
- key.data(), key.length())),
383
- value)));
384
- });
385
- }
386
-
387
- //
388
- // All APIs below this point are subject to change.
389
- //
390
-
391
- template <typename F>
392
- void ForEach(F f) const {
393
- for (auto* l = list_.head; l; l = l->next) {
394
- f(l->md);
395
- }
396
- }
397
-
398
- template <typename F>
399
- grpc_error_handle Filter(F f, const char* composite_error_string) {
400
- grpc_linked_mdelem* l = list_.head;
401
- grpc_error_handle error = GRPC_ERROR_NONE;
402
- auto add_error = [&](grpc_error_handle new_error) {
403
- if (new_error == GRPC_ERROR_NONE) return;
404
- if (error == GRPC_ERROR_NONE) {
405
- error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(composite_error_string);
406
- }
407
- error = grpc_error_add_child(error, new_error);
408
- };
409
- while (l) {
410
- grpc_linked_mdelem* next = l->next;
411
- grpc_filtered_mdelem new_mdelem = f(l->md);
412
- add_error(new_mdelem.error);
413
- if (GRPC_MDISNULL(new_mdelem.md)) {
414
- Remove(l);
415
- } else if (new_mdelem.md.payload != l->md.payload) {
416
- add_error(Substitute(l, new_mdelem.md));
417
- }
418
- l = next;
419
- }
420
- return error;
1257
+ void Append(absl::string_view key, Slice value,
1258
+ MetadataParseErrorFn on_error) {
1259
+ metadata_detail::AppendHelper<Derived> helper(static_cast<Derived*>(this),
1260
+ value.TakeOwned(), on_error);
1261
+ metadata_detail::NameLookup<void, Traits...>::Lookup(key, &helper);
421
1262
  }
422
1263
 
423
- GRPC_MUST_USE_RESULT grpc_error_handle Append(grpc_mdelem md) {
424
- return AddTail(elem_storage_.EmplaceBack(), md);
425
- }
426
-
427
- GRPC_MUST_USE_RESULT grpc_error_handle ReplaceOrAppend(grpc_slice key,
428
- grpc_slice value) {
429
- if (ReplaceIfExists(key, value)) return GRPC_ERROR_NONE;
430
- return Append(grpc_mdelem_from_slices(key, value));
431
- }
432
-
433
- // Set key to value if it exists and return true, otherwise return false.
434
- // If this function returns true, it takes ownership of key and value.
435
- // If this function returns false, it does not take ownership of key nor
436
- // value.
437
- bool ReplaceIfExists(grpc_slice key, grpc_slice value);
438
-
439
1264
  void Clear();
440
- bool empty() const { return count() == 0; }
441
-
442
- size_t count() const { return list_.count + table_.count(); }
443
- size_t non_deadline_count() const { return list_.count; }
444
- size_t default_count() const { return list_.default_count; }
445
-
446
1265
  size_t TransportSize() const;
447
-
448
- void Remove(grpc_linked_mdelem* storage);
449
- void Remove(grpc_metadata_batch_callouts_index idx);
450
-
451
- absl::optional<grpc_slice> Remove(grpc_slice key);
452
-
453
- grpc_error_handle Substitute(grpc_linked_mdelem* storage,
454
- grpc_mdelem new_mdelem);
455
-
456
- absl::optional<absl::string_view> GetValue(
457
- absl::string_view target_key, std::string* concatenated_value) const;
458
-
459
- grpc_error_handle LinkHead(grpc_linked_mdelem* storage) GRPC_MUST_USE_RESULT;
460
- grpc_error_handle LinkHead(grpc_linked_mdelem* storage,
461
- grpc_metadata_batch_callouts_index idx)
462
- GRPC_MUST_USE_RESULT;
463
- grpc_error_handle LinkTail(grpc_linked_mdelem* storage) GRPC_MUST_USE_RESULT;
464
- grpc_error_handle LinkTail(grpc_linked_mdelem* storage,
465
- grpc_metadata_batch_callouts_index idx)
466
- GRPC_MUST_USE_RESULT;
467
-
468
- grpc_error_handle AddHead(grpc_linked_mdelem* storage) GRPC_MUST_USE_RESULT;
469
- grpc_error_handle AddHead(grpc_linked_mdelem* storage,
470
- grpc_mdelem elem_to_add) GRPC_MUST_USE_RESULT;
471
- grpc_error_handle AddTail(grpc_linked_mdelem* storage) GRPC_MUST_USE_RESULT;
472
- grpc_error_handle AddTail(grpc_linked_mdelem* storage,
473
- grpc_mdelem elem_to_add) GRPC_MUST_USE_RESULT;
474
-
475
- void CopyFrom(MetadataMap* src, grpc_linked_mdelem* storage);
476
-
477
- #ifndef NDEBUG
478
- void AssertOk();
479
- #else
480
- void AssertOk() {}
481
- #endif
482
-
483
- // TODO(ctiller): the following explicit deadline handling methods are
484
- // deprecated in terms of the traits based APIs.
485
- grpc_millis deadline() const {
486
- return get(GrpcTimeoutMetadata()).value_or(GRPC_MILLIS_INF_FUTURE);
487
- };
488
-
489
- const grpc_metadata_batch_callouts* legacy_index() const { return &idx_; }
1266
+ Derived Copy() const;
1267
+ bool empty() const { return table_.empty() && unknown_.empty(); }
1268
+ size_t count() const { return table_.count() + unknown_.size(); }
490
1269
 
491
1270
  private:
492
- // Generate a strong type for metadata values per trait.
1271
+ friend class metadata_detail::AppendHelper<Derived>;
1272
+ friend class metadata_detail::GetStringValueHelper<Derived>;
1273
+ friend class metadata_detail::RemoveHelper<Derived>;
1274
+ friend class metadata_detail::CopySink<Derived>;
1275
+ friend class ParsedMetadata<Derived>;
1276
+
493
1277
  template <typename Which>
494
- struct Value {
495
- Value() = default;
496
- explicit Value(const typename Which::ValueType& value) : value(value) {}
497
- Value(const Value&) = default;
498
- Value& operator=(const Value&) = default;
499
- Value(Value&&) noexcept = default;
500
- Value& operator=(Value&&) noexcept = default;
501
- GPR_NO_UNIQUE_ADDRESS typename Which::ValueType value;
502
- };
503
- // Callable for the ForEach in Encode() -- for each value, call the
504
- // appropriate encoder method.
505
- template <typename Encoder>
506
- struct EncodeWrapper {
507
- Encoder* encoder;
508
- template <typename Which>
509
- void operator()(const Value<Which>& which) {
510
- encoder->Encode(Which(), which.value);
511
- }
512
- };
1278
+ using Value = metadata_detail::Value<Which>;
513
1279
 
514
- void AssertValidCallouts();
515
- grpc_error_handle LinkCallout(grpc_linked_mdelem* storage,
516
- grpc_metadata_batch_callouts_index idx)
517
- GRPC_MUST_USE_RESULT;
518
- grpc_error_handle MaybeLinkCallout(grpc_linked_mdelem* storage)
519
- GRPC_MUST_USE_RESULT;
520
- void MaybeUnlinkCallout(grpc_linked_mdelem* storage);
521
-
522
- static void assert_valid_list(grpc_mdelem_list* list) {
523
- #ifndef NDEBUG
524
- grpc_linked_mdelem* l;
525
-
526
- GPR_ASSERT((list->head == nullptr) == (list->tail == nullptr));
527
- if (!list->head) return;
528
- GPR_ASSERT(list->head->prev == nullptr);
529
- GPR_ASSERT(list->tail->next == nullptr);
530
- GPR_ASSERT((list->head == list->tail) == (list->head->next == nullptr));
531
-
532
- size_t verified_count = 0;
533
- for (l = list->head; l; l = l->next) {
534
- GPR_ASSERT(!GRPC_MDISNULL(l->md));
535
- GPR_ASSERT((l->prev == nullptr) == (l == list->head));
536
- GPR_ASSERT((l->next == nullptr) == (l == list->tail));
537
- if (l->next) GPR_ASSERT(l->next->prev == l);
538
- if (l->prev) GPR_ASSERT(l->prev->next == l);
539
- verified_count++;
540
- }
541
- GPR_ASSERT(list->count == verified_count);
542
- #else
543
- // Avoid unused-parameter warning for debug-only parameter
544
- (void)list;
545
- #endif /* NDEBUG */
546
- }
547
-
548
- static grpc_error_handle GPR_ATTRIBUTE_NOINLINE
549
- error_with_md(grpc_mdelem md) {
550
- return grpc_attach_md_to_error(
551
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Unallowed duplicate metadata"),
552
- md);
553
- }
554
-
555
- static void link_head(grpc_mdelem_list* list, grpc_linked_mdelem* storage) {
556
- assert_valid_list(list);
557
- GPR_DEBUG_ASSERT(!GRPC_MDISNULL(storage->md));
558
- storage->prev = nullptr;
559
- storage->next = list->head;
560
- storage->reserved = nullptr;
561
- if (list->head != nullptr) {
562
- list->head->prev = storage;
563
- } else {
564
- list->tail = storage;
565
- }
566
- list->head = storage;
567
- list->count++;
568
- assert_valid_list(list);
569
- }
570
-
571
- static void link_tail(grpc_mdelem_list* list, grpc_linked_mdelem* storage) {
572
- assert_valid_list(list);
573
- GPR_DEBUG_ASSERT(!GRPC_MDISNULL(storage->md));
574
- storage->prev = list->tail;
575
- storage->next = nullptr;
576
- storage->reserved = nullptr;
577
- if (list->tail != nullptr) {
578
- list->tail->next = storage;
579
- } else {
580
- list->head = storage;
581
- }
582
- list->tail = storage;
583
- list->count++;
584
- assert_valid_list(list);
1280
+ void AppendUnknown(absl::string_view key, Slice value) {
1281
+ unknown_.EmplaceBack(Slice::FromCopiedString(key), value.Ref());
585
1282
  }
586
1283
 
587
- static void unlink_storage(grpc_mdelem_list* list,
588
- grpc_linked_mdelem* storage) {
589
- assert_valid_list(list);
590
- if (storage->prev != nullptr) {
591
- storage->prev->next = storage->next;
592
- } else {
593
- list->head = storage->next;
594
- }
595
- if (storage->next != nullptr) {
596
- storage->next->prev = storage->prev;
597
- } else {
598
- list->tail = storage->prev;
1284
+ void RemoveUnknown(absl::string_view key) {
1285
+ unknown_.SetEnd(std::remove_if(unknown_.begin(), unknown_.end(),
1286
+ [key](const std::pair<Slice, Slice>& p) {
1287
+ return p.first.as_string_view() == key;
1288
+ }));
1289
+ }
1290
+
1291
+ absl::optional<absl::string_view> GetStringValueUnknown(
1292
+ absl::string_view key, std::string* backing) const {
1293
+ absl::optional<absl::string_view> out;
1294
+ for (const auto& p : unknown_) {
1295
+ if (p.first.as_string_view() == key) {
1296
+ if (!out.has_value()) {
1297
+ out = p.second.as_string_view();
1298
+ } else {
1299
+ out = *backing = absl::StrCat(*out, ",", p.second.as_string_view());
1300
+ }
1301
+ }
599
1302
  }
600
- list->count--;
601
- assert_valid_list(list);
1303
+ return out;
602
1304
  }
603
1305
 
604
1306
  // Table of known metadata types.
605
1307
  Table<Value<Traits>...> table_;
606
- /** Metadata elements in this batch */
607
- grpc_mdelem_list list_;
608
- grpc_metadata_batch_callouts idx_;
609
1308
  // Backing store for added metadata.
610
- ChunkedVector<grpc_linked_mdelem, 10> elem_storage_;
1309
+ ChunkedVector<std::pair<Slice, Slice>, 10> unknown_;
611
1310
  };
612
1311
 
613
- template <typename... Traits>
614
- void MetadataMap<Traits...>::AssertValidCallouts() {
615
- #ifndef NDEBUG
616
- for (grpc_linked_mdelem* l = list_.head; l != nullptr; l = l->next) {
617
- grpc_slice key_interned = grpc_slice_intern(GRPC_MDKEY(l->md));
618
- grpc_metadata_batch_callouts_index callout_idx =
619
- GRPC_BATCH_INDEX_OF(key_interned);
620
- if (callout_idx != GRPC_BATCH_CALLOUTS_COUNT) {
621
- GPR_ASSERT(idx_.array[callout_idx] == l);
622
- }
623
- grpc_slice_unref_internal(key_interned);
624
- }
625
- #endif
626
- }
627
-
628
- #ifndef NDEBUG
629
- template <typename... Traits>
630
- void MetadataMap<Traits...>::AssertOk() {
631
- assert_valid_list(&list_);
1312
+ // Ok/not-ok check for metadata maps that contain GrpcStatusMetadata, so that
1313
+ // they can be used as result types for TrySeq.
1314
+ template <typename Derived, typename... Args>
1315
+ inline bool IsStatusOk(const MetadataMap<Derived, Args...>& m) {
1316
+ return m.get(GrpcStatusMetadata()).value_or(GRPC_STATUS_UNKNOWN) ==
1317
+ GRPC_STATUS_OK;
632
1318
  }
633
- #endif /* NDEBUG */
634
1319
 
635
- template <typename... Traits>
636
- MetadataMap<Traits...>::MetadataMap(Arena* arena) : elem_storage_(arena) {
637
- memset(&list_, 0, sizeof(list_));
638
- memset(&idx_, 0, sizeof(idx_));
639
- }
1320
+ template <typename Derived, typename... Traits>
1321
+ MetadataMap<Derived, Traits...>::MetadataMap(Arena* arena) : unknown_(arena) {}
640
1322
 
641
- template <typename... Traits>
642
- MetadataMap<Traits...>::MetadataMap(MetadataMap&& other) noexcept
643
- : table_(std::move(other.table_)) {
644
- list_ = other.list_;
645
- idx_ = other.idx_;
646
- memset(&other.list_, 0, sizeof(list_));
647
- memset(&other.idx_, 0, sizeof(idx_));
648
- }
1323
+ template <typename Derived, typename... Traits>
1324
+ MetadataMap<Derived, Traits...>::MetadataMap(MetadataMap&& other) noexcept
1325
+ : table_(std::move(other.table_)), unknown_(std::move(other.unknown_)) {}
649
1326
 
650
- template <typename... Traits>
651
- MetadataMap<Traits...>& MetadataMap<Traits...>::operator=(
1327
+ // We never create MetadataMap directly, instead we create Derived, but we want
1328
+ // to be able to move it without redeclaring this.
1329
+ // NOLINTNEXTLINE(misc-unconventional-assign-operator)
1330
+ template <typename Derived, typename... Traits>
1331
+ Derived& MetadataMap<Derived, Traits...>::operator=(
652
1332
  MetadataMap&& other) noexcept {
653
- Clear();
654
1333
  table_ = std::move(other.table_);
655
- list_ = other.list_;
656
- idx_ = other.idx_;
657
- memset(&other.list_, 0, sizeof(list_));
658
- memset(&other.idx_, 0, sizeof(idx_));
659
- return *this;
660
- }
661
-
662
- template <typename... Traits>
663
- MetadataMap<Traits...>::~MetadataMap() {
664
- AssertValidCallouts();
665
- for (auto* l = list_.head; l; l = l->next) {
666
- GRPC_MDELEM_UNREF(l->md);
667
- }
668
- }
669
-
670
- template <typename... Traits>
671
- absl::optional<grpc_slice> MetadataMap<Traits...>::Remove(grpc_slice key) {
672
- for (auto* l = list_.head; l; l = l->next) {
673
- if (grpc_slice_eq(GRPC_MDKEY(l->md), key)) {
674
- auto out = grpc_slice_ref_internal(GRPC_MDVALUE(l->md));
675
- Remove(l);
676
- return out;
677
- }
678
- }
679
- return {};
680
- }
681
-
682
- template <typename... Traits>
683
- grpc_error_handle MetadataMap<Traits...>::LinkCallout(
684
- grpc_linked_mdelem* storage, grpc_metadata_batch_callouts_index idx) {
685
- AssertValidCallouts();
686
- GPR_DEBUG_ASSERT(idx >= 0 && idx < GRPC_BATCH_CALLOUTS_COUNT);
687
- if (GPR_LIKELY(idx_.array[idx] == nullptr)) {
688
- ++list_.default_count;
689
- idx_.array[idx] = storage;
690
- AssertValidCallouts();
691
- return GRPC_ERROR_NONE;
692
- }
693
- AssertValidCallouts();
694
- return error_with_md(storage->md);
695
- }
696
-
697
- template <typename... Traits>
698
- grpc_error_handle MetadataMap<Traits...>::MaybeLinkCallout(
699
- grpc_linked_mdelem* storage) {
700
- grpc_metadata_batch_callouts_index idx =
701
- GRPC_BATCH_INDEX_OF(GRPC_MDKEY(storage->md));
702
- if (idx == GRPC_BATCH_CALLOUTS_COUNT) {
703
- return GRPC_ERROR_NONE;
704
- }
705
- return LinkCallout(storage, idx);
706
- }
707
-
708
- template <typename... Traits>
709
- void MetadataMap<Traits...>::MaybeUnlinkCallout(grpc_linked_mdelem* storage) {
710
- grpc_metadata_batch_callouts_index idx =
711
- GRPC_BATCH_INDEX_OF(GRPC_MDKEY(storage->md));
712
- if (idx == GRPC_BATCH_CALLOUTS_COUNT) {
713
- return;
714
- }
715
- --list_.default_count;
716
- GPR_DEBUG_ASSERT(idx_.array[idx] != nullptr);
717
- idx_.array[idx] = nullptr;
718
- }
719
-
720
- template <typename... Traits>
721
- grpc_error_handle MetadataMap<Traits...>::AddHead(grpc_linked_mdelem* storage,
722
- grpc_mdelem elem_to_add) {
723
- GPR_DEBUG_ASSERT(!GRPC_MDISNULL(elem_to_add));
724
- storage->md = elem_to_add;
725
- return LinkHead(storage);
726
- }
727
-
728
- template <typename... Traits>
729
- grpc_error_handle MetadataMap<Traits...>::LinkHead(
730
- grpc_linked_mdelem* storage) {
731
- AssertValidCallouts();
732
- grpc_error_handle err = MaybeLinkCallout(storage);
733
- if (err != GRPC_ERROR_NONE) {
734
- AssertValidCallouts();
735
- return err;
736
- }
737
- link_head(&list_, storage);
738
- AssertValidCallouts();
739
- return GRPC_ERROR_NONE;
740
- }
741
-
742
- // TODO(arjunroy): Need to revisit this and see what guarantees exist between
743
- // C-core and the internal-metadata subsystem. E.g. can we ensure a particular
744
- // metadata is never added twice, even in the presence of user supplied data?
745
- template <typename... Traits>
746
- grpc_error_handle MetadataMap<Traits...>::LinkHead(
747
- grpc_linked_mdelem* storage, grpc_metadata_batch_callouts_index idx) {
748
- GPR_DEBUG_ASSERT(GRPC_BATCH_INDEX_OF(GRPC_MDKEY(storage->md)) == idx);
749
- AssertValidCallouts();
750
- grpc_error_handle err = LinkCallout(storage, idx);
751
- if (GPR_UNLIKELY(err != GRPC_ERROR_NONE)) {
752
- AssertValidCallouts();
753
- return err;
754
- }
755
- link_head(&list_, storage);
756
- AssertValidCallouts();
757
- return GRPC_ERROR_NONE;
758
- }
759
-
760
- template <typename... Traits>
761
- grpc_error_handle MetadataMap<Traits...>::AddTail(grpc_linked_mdelem* storage,
762
- grpc_mdelem elem_to_add) {
763
- GPR_DEBUG_ASSERT(!GRPC_MDISNULL(elem_to_add));
764
- storage->md = elem_to_add;
765
- return LinkTail(storage);
766
- }
767
-
768
- template <typename... Traits>
769
- grpc_error_handle MetadataMap<Traits...>::LinkTail(
770
- grpc_linked_mdelem* storage) {
771
- AssertValidCallouts();
772
- grpc_error_handle err = MaybeLinkCallout(storage);
773
- if (err != GRPC_ERROR_NONE) {
774
- AssertValidCallouts();
775
- return err;
776
- }
777
- link_tail(&list_, storage);
778
- AssertValidCallouts();
779
- return GRPC_ERROR_NONE;
1334
+ unknown_ = std::move(other.unknown_);
1335
+ return static_cast<Derived&>(*this);
780
1336
  }
781
1337
 
782
- template <typename... Traits>
783
- grpc_error_handle MetadataMap<Traits...>::LinkTail(
784
- grpc_linked_mdelem* storage, grpc_metadata_batch_callouts_index idx) {
785
- GPR_DEBUG_ASSERT(GRPC_BATCH_INDEX_OF(GRPC_MDKEY(storage->md)) == idx);
786
- AssertValidCallouts();
787
- grpc_error_handle err = LinkCallout(storage, idx);
788
- if (GPR_UNLIKELY(err != GRPC_ERROR_NONE)) {
789
- AssertValidCallouts();
790
- return err;
791
- }
792
- link_tail(&list_, storage);
793
- AssertValidCallouts();
794
- return GRPC_ERROR_NONE;
795
- }
796
-
797
- template <typename... Traits>
798
- void MetadataMap<Traits...>::Remove(grpc_linked_mdelem* storage) {
799
- AssertValidCallouts();
800
- MaybeUnlinkCallout(storage);
801
- unlink_storage(&list_, storage);
802
- GRPC_MDELEM_UNREF(storage->md);
803
- AssertValidCallouts();
804
- }
1338
+ template <typename Derived, typename... Traits>
1339
+ MetadataMap<Derived, Traits...>::~MetadataMap() = default;
805
1340
 
806
- template <typename... Traits>
807
- void MetadataMap<Traits...>::Remove(grpc_metadata_batch_callouts_index idx) {
808
- AssertValidCallouts();
809
- if (idx_.array[idx] == nullptr) return;
810
- --list_.default_count;
811
- unlink_storage(&list_, idx_.array[idx]);
812
- GRPC_MDELEM_UNREF(idx_.array[idx]->md);
813
- idx_.array[idx] = nullptr;
814
- AssertValidCallouts();
1341
+ template <typename Derived, typename... Traits>
1342
+ void MetadataMap<Derived, Traits...>::Clear() {
1343
+ table_.ClearAll();
1344
+ unknown_.Clear();
815
1345
  }
816
1346
 
817
- template <typename... Traits>
818
- absl::optional<absl::string_view> MetadataMap<Traits...>::GetValue(
819
- absl::string_view target_key, std::string* concatenated_value) const {
820
- // Find all values for the specified key.
821
- absl::InlinedVector<absl::string_view, 1> values;
822
- for (grpc_linked_mdelem* md = list_.head; md != nullptr; md = md->next) {
823
- absl::string_view key = grpc_core::StringViewFromSlice(GRPC_MDKEY(md->md));
824
- absl::string_view value =
825
- grpc_core::StringViewFromSlice(GRPC_MDVALUE(md->md));
826
- if (target_key == key) values.push_back(value);
827
- }
828
- // If none found, no match.
829
- if (values.empty()) return absl::nullopt;
830
- // If exactly one found, return it as-is.
831
- if (values.size() == 1) return values.front();
832
- // If more than one found, concatenate the values, using
833
- // *concatenated_values as a temporary holding place for the
834
- // concatenated string.
835
- *concatenated_value = absl::StrJoin(values, ",");
836
- return *concatenated_value;
837
- }
838
-
839
- template <typename... Traits>
840
- grpc_error_handle MetadataMap<Traits...>::Substitute(
841
- grpc_linked_mdelem* storage, grpc_mdelem new_mdelem) {
842
- AssertValidCallouts();
843
- grpc_error_handle error = GRPC_ERROR_NONE;
844
- grpc_mdelem old_mdelem = storage->md;
845
- if (!grpc_slice_eq(GRPC_MDKEY(new_mdelem), GRPC_MDKEY(old_mdelem))) {
846
- MaybeUnlinkCallout(storage);
847
- storage->md = new_mdelem;
848
- error = MaybeLinkCallout(storage);
849
- if (error != GRPC_ERROR_NONE) {
850
- unlink_storage(&list_, storage);
851
- GRPC_MDELEM_UNREF(storage->md);
852
- }
853
- } else {
854
- storage->md = new_mdelem;
855
- }
856
- GRPC_MDELEM_UNREF(old_mdelem);
857
- AssertValidCallouts();
858
- return error;
1347
+ template <typename Derived, typename... Traits>
1348
+ size_t MetadataMap<Derived, Traits...>::TransportSize() const {
1349
+ metadata_detail::TransportSizeEncoder enc;
1350
+ Encode(&enc);
1351
+ return enc.size();
859
1352
  }
860
1353
 
861
- template <typename... Traits>
862
- void MetadataMap<Traits...>::Clear() {
863
- // TODO(ctiller): implement this without deconstructing/reconstructing once
864
- // linked_mdelem is no longer a thing.
865
- auto* arena = elem_storage_.arena();
866
- this->~MetadataMap();
867
- new (this) MetadataMap(arena);
868
- }
869
-
870
- template <typename... Traits>
871
- size_t MetadataMap<Traits...>::TransportSize() const {
872
- size_t size = 0;
873
- for (grpc_linked_mdelem* elem = list_.head; elem != nullptr;
874
- elem = elem->next) {
875
- size += GRPC_MDELEM_LENGTH(elem->md);
876
- }
877
- return size;
878
- }
879
-
880
- template <typename... Traits>
881
- bool MetadataMap<Traits...>::ReplaceIfExists(grpc_slice key, grpc_slice value) {
882
- AssertValidCallouts();
883
- for (grpc_linked_mdelem* l = list_.head; l != nullptr; l = l->next) {
884
- if (grpc_slice_eq(GRPC_MDKEY(l->md), key)) {
885
- auto new_mdelem = grpc_mdelem_from_slices(key, value);
886
- GRPC_MDELEM_UNREF(l->md);
887
- l->md = new_mdelem;
888
- AssertValidCallouts();
889
- return true;
890
- }
891
- }
892
- AssertValidCallouts();
893
- return false;
1354
+ template <typename Derived, typename... Traits>
1355
+ Derived MetadataMap<Derived, Traits...>::Copy() const {
1356
+ Derived out(unknown_.arena());
1357
+ metadata_detail::CopySink<Derived> sink(&out);
1358
+ Encode(&sink);
1359
+ return out;
894
1360
  }
895
1361
 
896
1362
  } // namespace grpc_core
897
1363
 
898
- using grpc_metadata_batch =
899
- grpc_core::MetadataMap<grpc_core::GrpcTimeoutMetadata,
900
- grpc_core::TeMetadata>;
901
-
902
- inline void grpc_metadata_batch_clear(grpc_metadata_batch* batch) {
903
- batch->Clear();
904
- }
905
- inline bool grpc_metadata_batch_is_empty(grpc_metadata_batch* batch) {
906
- return batch->empty();
907
- }
908
-
909
- /* Returns the transport size of the batch. */
910
- inline size_t grpc_metadata_batch_size(grpc_metadata_batch* batch) {
911
- return batch->TransportSize();
912
- }
913
-
914
- /** Remove \a storage from the batch, unreffing the mdelem contained */
915
- inline void grpc_metadata_batch_remove(grpc_metadata_batch* batch,
916
- grpc_linked_mdelem* storage) {
917
- batch->Remove(storage);
918
- }
919
- inline void grpc_metadata_batch_remove(grpc_metadata_batch* batch,
920
- grpc_metadata_batch_callouts_index idx) {
921
- batch->Remove(idx);
922
- }
923
-
924
- /** Substitute a new mdelem for an old value */
925
- inline grpc_error_handle grpc_metadata_batch_substitute(
926
- grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
927
- grpc_mdelem new_mdelem) {
928
- return batch->Substitute(storage, new_mdelem);
929
- }
930
-
931
- void grpc_metadata_batch_set_value(grpc_linked_mdelem* storage,
932
- const grpc_slice& value);
933
-
934
- /** Returns metadata value(s) for the specified key.
935
- If the key is not present in the batch, returns absl::nullopt.
936
- If the key is present exactly once in the batch, returns a string_view of
937
- that value.
938
- If the key is present more than once in the batch, constructs a
939
- comma-concatenated string of all values in concatenated_value and returns a
940
- string_view of that string. */
941
- inline absl::optional<absl::string_view> grpc_metadata_batch_get_value(
942
- grpc_metadata_batch* batch, absl::string_view target_key,
943
- std::string* concatenated_value) {
944
- return batch->GetValue(target_key, concatenated_value);
945
- }
946
-
947
- /** Add \a storage to the beginning of \a batch. storage->md is
948
- assumed to be valid.
949
- \a storage is owned by the caller and must survive for the
950
- lifetime of batch. This usually means it should be around
951
- for the lifetime of the call. */
952
- inline GRPC_MUST_USE_RESULT grpc_error_handle grpc_metadata_batch_link_head(
953
- grpc_metadata_batch* batch, grpc_linked_mdelem* storage) {
954
- return batch->LinkHead(storage);
955
- }
956
-
957
- inline GRPC_MUST_USE_RESULT grpc_error_handle grpc_metadata_batch_link_head(
958
- grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
959
- grpc_metadata_batch_callouts_index idx) {
960
- return batch->LinkHead(storage, idx);
961
- }
962
-
963
- /** Add \a storage to the end of \a batch. storage->md is
964
- assumed to be valid.
965
- \a storage is owned by the caller and must survive for the
966
- lifetime of batch. This usually means it should be around
967
- for the lifetime of the call. */
968
- inline GRPC_MUST_USE_RESULT grpc_error_handle grpc_metadata_batch_link_tail(
969
- grpc_metadata_batch* batch, grpc_linked_mdelem* storage) {
970
- return batch->LinkTail(storage);
971
- }
972
-
973
- inline GRPC_MUST_USE_RESULT grpc_error_handle grpc_metadata_batch_link_tail(
974
- grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
975
- grpc_metadata_batch_callouts_index idx) {
976
- return batch->LinkTail(storage, idx);
977
- }
978
-
979
- /** Add \a elem_to_add as the first element in \a batch, using
980
- \a storage as backing storage for the linked list element.
981
- \a storage is owned by the caller and must survive for the
982
- lifetime of batch. This usually means it should be around
983
- for the lifetime of the call.
984
- Takes ownership of \a elem_to_add */
985
- inline grpc_error_handle grpc_metadata_batch_add_head(
986
- grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
987
- grpc_mdelem elem_to_add) {
988
- return batch->AddHead(storage, elem_to_add);
989
- }
990
-
991
- // TODO(arjunroy, roth): Remove redundant methods.
992
- // add/link_head/tail are almost identical.
993
- inline grpc_error_handle GRPC_MUST_USE_RESULT grpc_metadata_batch_add_head(
994
- grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
995
- grpc_metadata_batch_callouts_index idx) {
996
- return grpc_metadata_batch_link_head(batch, storage, idx);
997
- }
998
-
999
- inline grpc_error_handle GRPC_MUST_USE_RESULT grpc_metadata_batch_add_head(
1000
- grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
1001
- grpc_mdelem elem_to_add, grpc_metadata_batch_callouts_index idx) {
1002
- GPR_DEBUG_ASSERT(!GRPC_MDISNULL(elem_to_add));
1003
- storage->md = elem_to_add;
1004
- return grpc_metadata_batch_add_head(batch, storage, idx);
1005
- }
1006
-
1007
- /** Add \a elem_to_add as the last element in \a batch, using
1008
- \a storage as backing storage for the linked list element.
1009
- \a storage is owned by the caller and must survive for the
1010
- lifetime of batch. This usually means it should be around
1011
- for the lifetime of the call.
1012
- Takes ownership of \a elem_to_add */
1013
- inline GRPC_MUST_USE_RESULT grpc_error_handle grpc_metadata_batch_add_tail(
1014
- grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
1015
- grpc_mdelem elem_to_add) {
1016
- return batch->AddTail(storage, elem_to_add);
1017
- }
1018
-
1019
- inline grpc_error_handle GRPC_MUST_USE_RESULT grpc_metadata_batch_add_tail(
1020
- grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
1021
- grpc_metadata_batch_callouts_index idx) {
1022
- return grpc_metadata_batch_link_tail(batch, storage, idx);
1023
- }
1024
-
1025
- inline grpc_error_handle GRPC_MUST_USE_RESULT grpc_metadata_batch_add_tail(
1026
- grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
1027
- grpc_mdelem elem_to_add, grpc_metadata_batch_callouts_index idx) {
1028
- GPR_DEBUG_ASSERT(!GRPC_MDISNULL(elem_to_add));
1029
- storage->md = elem_to_add;
1030
- return grpc_metadata_batch_add_tail(batch, storage, idx);
1031
- }
1032
-
1033
- typedef grpc_filtered_mdelem (*grpc_metadata_batch_filter_func)(
1034
- void* user_data, grpc_mdelem elem);
1035
- inline GRPC_MUST_USE_RESULT grpc_error_handle grpc_metadata_batch_filter(
1036
- grpc_metadata_batch* batch, grpc_metadata_batch_filter_func func,
1037
- void* user_data, const char* composite_error_string) {
1038
- return batch->Filter([=](grpc_mdelem elem) { return func(user_data, elem); },
1039
- composite_error_string);
1040
- }
1041
-
1042
- inline void grpc_metadata_batch_assert_ok(grpc_metadata_batch* batch) {
1043
- batch->AssertOk();
1044
- }
1045
-
1046
- /// Copies \a src to \a dst.
1047
- ///
1048
- /// For each mdelem in \a src, if the mdelem is of storage types
1049
- /// GRPC_MDELEM_STORAGE_INTERNED or GRPC_MDELEM_STORAGE_ALLOCATED,
1050
- /// refs the original mdelem for the copy. Otherwise, makes a new
1051
- /// mdelem that will hold its own refs to the key and value slices.
1052
- void grpc_metadata_batch_copy(const grpc_metadata_batch* src,
1053
- grpc_metadata_batch* dst);
1364
+ struct grpc_metadata_batch;
1365
+
1366
+ using grpc_metadata_batch_base = grpc_core::MetadataMap<
1367
+ grpc_metadata_batch,
1368
+ // Colon prefixed headers first
1369
+ grpc_core::HttpPathMetadata, grpc_core::HttpAuthorityMetadata,
1370
+ grpc_core::HttpMethodMetadata, grpc_core::HttpStatusMetadata,
1371
+ grpc_core::HttpSchemeMetadata,
1372
+ // Non-colon prefixed headers begin here
1373
+ grpc_core::ContentTypeMetadata, grpc_core::TeMetadata,
1374
+ grpc_core::GrpcEncodingMetadata, grpc_core::GrpcInternalEncodingRequest,
1375
+ grpc_core::GrpcAcceptEncodingMetadata, grpc_core::GrpcStatusMetadata,
1376
+ grpc_core::GrpcTimeoutMetadata, grpc_core::GrpcPreviousRpcAttemptsMetadata,
1377
+ grpc_core::GrpcRetryPushbackMsMetadata, grpc_core::UserAgentMetadata,
1378
+ grpc_core::GrpcMessageMetadata, grpc_core::HostMetadata,
1379
+ grpc_core::XEndpointLoadMetricsBinMetadata,
1380
+ grpc_core::GrpcServerStatsBinMetadata, grpc_core::GrpcTraceBinMetadata,
1381
+ grpc_core::GrpcTagsBinMetadata, grpc_core::GrpcLbClientStatsMetadata,
1382
+ grpc_core::LbCostBinMetadata, grpc_core::LbTokenMetadata,
1383
+ // Non-encodable things
1384
+ grpc_core::GrpcStreamNetworkState, grpc_core::GrpcStatusContext>;
1385
+
1386
+ struct grpc_metadata_batch : public grpc_metadata_batch_base {
1387
+ using grpc_metadata_batch_base::grpc_metadata_batch_base;
1388
+ };
1054
1389
 
1055
1390
  #endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H */