grpc 1.60.0 → 1.61.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (277) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +208 -165
  3. data/include/grpc/event_engine/event_engine.h +59 -12
  4. data/include/grpc/event_engine/internal/memory_allocator_impl.h +6 -0
  5. data/include/grpc/event_engine/internal/slice_cast.h +12 -0
  6. data/include/grpc/event_engine/memory_allocator.h +3 -1
  7. data/include/grpc/event_engine/slice.h +5 -0
  8. data/include/grpc/grpc_security.h +22 -1
  9. data/include/grpc/impl/call.h +29 -0
  10. data/include/grpc/impl/channel_arg_names.h +12 -1
  11. data/include/grpc/impl/slice_type.h +1 -1
  12. data/include/grpc/module.modulemap +1 -0
  13. data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +54 -7
  14. data/src/core/ext/filters/backend_metrics/backend_metric_filter.h +20 -6
  15. data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +10 -13
  16. data/src/core/ext/filters/channel_idle/channel_idle_filter.h +18 -10
  17. data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +326 -0
  18. data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.h +143 -0
  19. data/src/core/ext/filters/client_channel/backend_metric.cc +2 -2
  20. data/src/core/ext/filters/client_channel/client_channel.cc +32 -6
  21. data/src/core/ext/filters/client_channel/client_channel_internal.h +2 -0
  22. data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +1 -1
  23. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +54 -21
  24. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +3 -2
  25. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +2 -1
  26. data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.cc +12 -15
  27. data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.h +8 -5
  28. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +139 -92
  29. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +9 -4
  30. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +9 -4
  31. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +10 -11
  32. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +94 -93
  33. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +5 -3
  34. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +12 -15
  35. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +38 -16
  36. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +25 -28
  37. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +10 -10
  38. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +37 -35
  39. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +11 -9
  40. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +504 -461
  41. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +232 -122
  42. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +8 -6
  43. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +642 -251
  44. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.h +2 -6
  45. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +7 -8
  46. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +2 -1
  47. data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +3 -1
  48. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +2 -2
  49. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +2 -2
  50. data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +6 -8
  51. data/src/core/ext/filters/client_channel/resolver/xds/xds_dependency_manager.cc +1031 -0
  52. data/src/core/ext/filters/client_channel/resolver/xds/xds_dependency_manager.h +277 -0
  53. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +128 -270
  54. data/src/core/ext/filters/client_channel/resolver/xds/{xds_resolver.h → xds_resolver_attributes.h} +5 -4
  55. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver_trace.cc +25 -0
  56. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver_trace.h +30 -0
  57. data/src/core/ext/filters/client_channel/retry_filter.cc +1 -0
  58. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +35 -17
  59. data/src/core/ext/filters/deadline/deadline_filter.cc +12 -0
  60. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +17 -13
  61. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +13 -4
  62. data/src/core/ext/filters/http/client/http_client_filter.cc +23 -32
  63. data/src/core/ext/filters/http/client/http_client_filter.h +10 -5
  64. data/src/core/ext/filters/http/client_authority_filter.cc +14 -14
  65. data/src/core/ext/filters/http/client_authority_filter.h +12 -4
  66. data/src/core/ext/filters/http/http_filters_plugin.cc +42 -20
  67. data/src/core/ext/filters/http/message_compress/compression_filter.cc +55 -80
  68. data/src/core/ext/filters/http/message_compress/compression_filter.h +54 -12
  69. data/src/core/ext/filters/http/message_compress/legacy_compression_filter.cc +325 -0
  70. data/src/core/ext/filters/http/message_compress/legacy_compression_filter.h +139 -0
  71. data/src/core/ext/filters/http/server/http_server_filter.cc +41 -41
  72. data/src/core/ext/filters/http/server/http_server_filter.h +11 -4
  73. data/src/core/ext/filters/message_size/message_size_filter.cc +56 -76
  74. data/src/core/ext/filters/message_size/message_size_filter.h +35 -23
  75. data/src/core/ext/filters/rbac/rbac_filter.cc +15 -11
  76. data/src/core/ext/filters/rbac/rbac_filter.h +11 -4
  77. data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +25 -13
  78. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +47 -50
  79. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +21 -4
  80. data/src/core/ext/transport/chttp2/alpn/alpn.cc +1 -1
  81. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -2
  82. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +11 -2
  83. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +67 -145
  84. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -3
  85. data/src/core/ext/transport/chttp2/transport/flow_control.cc +21 -82
  86. data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -8
  87. data/src/core/ext/transport/chttp2/transport/frame.cc +506 -0
  88. data/src/core/ext/transport/chttp2/transport/frame.h +214 -0
  89. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +1 -1
  90. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +33 -79
  91. data/src/core/ext/transport/chttp2/transport/frame_settings.h +4 -7
  92. data/src/core/ext/transport/chttp2/transport/http2_settings.cc +122 -32
  93. data/src/core/ext/transport/chttp2/transport/http2_settings.h +142 -37
  94. data/src/core/ext/transport/chttp2/transport/internal.h +1 -22
  95. data/src/core/ext/transport/chttp2/transport/parsing.cc +23 -37
  96. data/src/core/ext/transport/chttp2/transport/writing.cc +26 -58
  97. data/src/core/ext/transport/inproc/inproc_transport.cc +172 -13
  98. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb.h +712 -0
  99. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.c +151 -0
  100. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.h +33 -0
  101. data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.c +133 -0
  102. data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.h +50 -0
  103. data/src/core/ext/xds/certificate_provider_store.cc +2 -1
  104. data/src/core/ext/xds/certificate_provider_store.h +0 -5
  105. data/src/core/ext/xds/xds_api.cc +31 -18
  106. data/src/core/ext/xds/xds_api.h +2 -2
  107. data/src/core/ext/xds/xds_bootstrap.h +3 -0
  108. data/src/core/ext/xds/xds_certificate_provider.cc +88 -287
  109. data/src/core/ext/xds/xds_certificate_provider.h +44 -111
  110. data/src/core/ext/xds/xds_client.cc +420 -414
  111. data/src/core/ext/xds/xds_client.h +31 -22
  112. data/src/core/ext/xds/xds_client_grpc.cc +3 -1
  113. data/src/core/ext/xds/xds_cluster.cc +104 -11
  114. data/src/core/ext/xds/xds_cluster.h +9 -1
  115. data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +9 -5
  116. data/src/core/ext/xds/xds_common_types.cc +14 -10
  117. data/src/core/ext/xds/xds_endpoint.cc +9 -4
  118. data/src/core/ext/xds/xds_endpoint.h +5 -1
  119. data/src/core/ext/xds/xds_health_status.cc +12 -2
  120. data/src/core/ext/xds/xds_health_status.h +4 -2
  121. data/src/core/ext/xds/xds_http_rbac_filter.cc +5 -3
  122. data/src/core/ext/xds/xds_listener.cc +14 -8
  123. data/src/core/ext/xds/xds_resource_type_impl.h +6 -4
  124. data/src/core/ext/xds/xds_route_config.cc +34 -22
  125. data/src/core/ext/xds/xds_route_config.h +1 -0
  126. data/src/core/ext/xds/xds_server_config_fetcher.cc +61 -57
  127. data/src/core/ext/xds/xds_transport.h +3 -0
  128. data/src/core/ext/xds/xds_transport_grpc.cc +47 -50
  129. data/src/core/ext/xds/xds_transport_grpc.h +4 -0
  130. data/src/core/lib/channel/call_tracer.cc +12 -0
  131. data/src/core/lib/channel/call_tracer.h +17 -3
  132. data/src/core/lib/channel/channel_args.cc +24 -14
  133. data/src/core/lib/channel/channel_args.h +74 -13
  134. data/src/core/lib/channel/channel_stack.cc +27 -0
  135. data/src/core/lib/channel/channel_stack.h +10 -10
  136. data/src/core/lib/channel/connected_channel.cc +64 -18
  137. data/src/core/lib/channel/promise_based_filter.h +1041 -1
  138. data/src/core/lib/channel/server_call_tracer_filter.cc +43 -35
  139. data/src/core/lib/compression/compression_internal.cc +0 -3
  140. data/src/core/lib/event_engine/ares_resolver.cc +35 -14
  141. data/src/core/lib/event_engine/ares_resolver.h +9 -10
  142. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +8 -1
  143. data/src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.cc +132 -0
  144. data/src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.h +61 -0
  145. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +52 -36
  146. data/src/core/lib/event_engine/posix_engine/posix_engine.h +4 -9
  147. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +11 -3
  148. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +9 -2
  149. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +7 -0
  150. data/src/core/lib/event_engine/posix_engine/timer_manager.cc +17 -27
  151. data/src/core/lib/event_engine/posix_engine/timer_manager.h +0 -3
  152. data/src/core/lib/event_engine/ref_counted_dns_resolver_interface.h +55 -0
  153. data/src/core/lib/event_engine/windows/native_windows_dns_resolver.cc +114 -0
  154. data/src/core/lib/event_engine/windows/native_windows_dns_resolver.h +51 -0
  155. data/src/core/lib/event_engine/windows/windows_engine.cc +7 -7
  156. data/src/core/lib/experiments/config.cc +13 -0
  157. data/src/core/lib/experiments/config.h +3 -0
  158. data/src/core/lib/experiments/experiments.cc +245 -366
  159. data/src/core/lib/experiments/experiments.h +50 -156
  160. data/src/core/lib/gprpp/debug_location.h +13 -0
  161. data/src/core/lib/gprpp/dual_ref_counted.h +36 -7
  162. data/src/core/lib/gprpp/orphanable.h +27 -0
  163. data/src/core/lib/gprpp/ref_counted.h +63 -22
  164. data/src/core/lib/gprpp/ref_counted_ptr.h +70 -27
  165. data/src/core/lib/gprpp/ref_counted_string.h +13 -0
  166. data/src/core/lib/gprpp/status_helper.cc +1 -2
  167. data/src/core/lib/iomgr/combiner.cc +15 -51
  168. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +31 -0
  169. data/src/core/lib/iomgr/event_engine_shims/endpoint.h +16 -0
  170. data/src/core/lib/iomgr/tcp_client_posix.cc +4 -3
  171. data/src/core/lib/load_balancing/lb_policy.h +1 -1
  172. data/src/core/lib/promise/activity.cc +17 -2
  173. data/src/core/lib/promise/activity.h +5 -4
  174. data/src/core/lib/promise/all_ok.h +80 -0
  175. data/src/core/lib/promise/detail/join_state.h +2077 -0
  176. data/src/core/lib/promise/detail/promise_factory.h +1 -0
  177. data/src/core/lib/promise/detail/promise_like.h +8 -1
  178. data/src/core/lib/promise/detail/seq_state.h +3458 -150
  179. data/src/core/lib/promise/detail/status.h +42 -5
  180. data/src/core/lib/promise/for_each.h +13 -1
  181. data/src/core/lib/promise/if.h +4 -0
  182. data/src/core/lib/promise/latch.h +6 -3
  183. data/src/core/lib/promise/party.cc +33 -31
  184. data/src/core/lib/promise/party.h +142 -6
  185. data/src/core/lib/promise/poll.h +39 -13
  186. data/src/core/lib/promise/promise.h +4 -0
  187. data/src/core/lib/promise/seq.h +107 -7
  188. data/src/core/lib/promise/status_flag.h +196 -0
  189. data/src/core/lib/promise/try_join.h +132 -0
  190. data/src/core/lib/promise/try_seq.h +132 -10
  191. data/src/core/lib/resolver/endpoint_addresses.cc +0 -1
  192. data/src/core/lib/resolver/endpoint_addresses.h +48 -0
  193. data/src/core/lib/resource_quota/arena.h +2 -2
  194. data/src/core/lib/resource_quota/memory_quota.cc +57 -8
  195. data/src/core/lib/resource_quota/memory_quota.h +6 -0
  196. data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +14 -11
  197. data/src/core/lib/security/authorization/grpc_server_authz_filter.h +14 -5
  198. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +4 -0
  199. data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +4 -0
  200. data/src/core/lib/security/credentials/external/external_account_credentials.cc +28 -20
  201. data/src/core/lib/security/credentials/external/external_account_credentials.h +4 -0
  202. data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +4 -0
  203. data/src/core/lib/security/credentials/external/file_external_account_credentials.h +4 -0
  204. data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +4 -0
  205. data/src/core/lib/security/credentials/external/url_external_account_credentials.h +4 -0
  206. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +2 -1
  207. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +0 -3
  208. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +12 -0
  209. data/src/core/lib/security/credentials/tls/grpc_tls_crl_provider.cc +22 -5
  210. data/src/core/lib/security/credentials/tls/grpc_tls_crl_provider.h +1 -5
  211. data/src/core/lib/security/credentials/tls/tls_credentials.cc +16 -0
  212. data/src/core/lib/security/credentials/xds/xds_credentials.cc +21 -28
  213. data/src/core/lib/security/credentials/xds/xds_credentials.h +2 -4
  214. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +4 -3
  215. data/src/core/lib/security/transport/auth_filters.h +71 -4
  216. data/src/core/lib/security/transport/client_auth_filter.cc +2 -4
  217. data/src/core/lib/security/transport/legacy_server_auth_filter.cc +244 -0
  218. data/src/core/lib/security/transport/server_auth_filter.cc +70 -90
  219. data/src/core/lib/slice/slice_buffer.h +3 -0
  220. data/src/core/lib/surface/builtins.cc +1 -1
  221. data/src/core/lib/surface/call.cc +683 -196
  222. data/src/core/lib/surface/call.h +26 -13
  223. data/src/core/lib/surface/call_trace.cc +42 -1
  224. data/src/core/lib/surface/channel.cc +0 -1
  225. data/src/core/lib/surface/channel.h +0 -6
  226. data/src/core/lib/surface/channel_init.h +26 -0
  227. data/src/core/lib/surface/init.cc +14 -8
  228. data/src/core/lib/surface/server.cc +256 -237
  229. data/src/core/lib/surface/server.h +26 -54
  230. data/src/core/lib/surface/version.cc +2 -2
  231. data/src/core/lib/surface/wait_for_cq_end_op.h +94 -0
  232. data/src/core/lib/transport/call_final_info.cc +38 -0
  233. data/src/core/lib/transport/call_final_info.h +54 -0
  234. data/src/core/lib/transport/connectivity_state.cc +3 -2
  235. data/src/core/lib/transport/connectivity_state.h +4 -0
  236. data/src/core/lib/transport/metadata_batch.h +4 -4
  237. data/src/core/lib/transport/transport.cc +70 -19
  238. data/src/core/lib/transport/transport.h +395 -25
  239. data/src/core/plugin_registry/grpc_plugin_registry.cc +3 -0
  240. data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +0 -3
  241. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
  242. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +1 -1
  243. data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +1 -1
  244. data/src/core/tsi/ssl_transport_security.cc +65 -43
  245. data/src/ruby/ext/grpc/rb_channel_args.c +3 -1
  246. data/src/ruby/ext/grpc/rb_grpc.c +0 -1
  247. data/src/ruby/ext/grpc/rb_grpc.h +0 -2
  248. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
  249. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
  250. data/src/ruby/lib/grpc/version.rb +1 -1
  251. data/third_party/upb/upb/reflection/def_pool.h +2 -2
  252. data/third_party/zlib/adler32.c +5 -27
  253. data/third_party/zlib/compress.c +5 -16
  254. data/third_party/zlib/crc32.c +86 -162
  255. data/third_party/zlib/deflate.c +233 -336
  256. data/third_party/zlib/deflate.h +8 -8
  257. data/third_party/zlib/gzguts.h +11 -12
  258. data/third_party/zlib/infback.c +7 -23
  259. data/third_party/zlib/inffast.c +1 -4
  260. data/third_party/zlib/inffast.h +1 -1
  261. data/third_party/zlib/inflate.c +30 -99
  262. data/third_party/zlib/inftrees.c +6 -11
  263. data/third_party/zlib/inftrees.h +3 -3
  264. data/third_party/zlib/trees.c +224 -302
  265. data/third_party/zlib/uncompr.c +4 -12
  266. data/third_party/zlib/zconf.h +6 -2
  267. data/third_party/zlib/zlib.h +191 -188
  268. data/third_party/zlib/zutil.c +16 -44
  269. data/third_party/zlib/zutil.h +10 -10
  270. metadata +35 -13
  271. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +0 -1173
  272. data/src/core/lib/event_engine/memory_allocator.cc +0 -74
  273. data/src/core/lib/transport/pid_controller.cc +0 -51
  274. data/src/core/lib/transport/pid_controller.h +0 -116
  275. data/third_party/upb/upb/collections/array.h +0 -17
  276. data/third_party/upb/upb/collections/map.h +0 -17
  277. data/third_party/upb/upb/upb.hpp +0 -18
@@ -14,8 +14,8 @@
14
14
  // limitations under the License.
15
15
  //
16
16
 
17
- #ifndef GRPC_SRC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_XDS_XDS_RESOLVER_H
18
- #define GRPC_SRC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_XDS_XDS_RESOLVER_H
17
+ #ifndef GRPC_SRC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_XDS_XDS_RESOLVER_ATTRIBUTES_H
18
+ #define GRPC_SRC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_XDS_XDS_RESOLVER_ATTRIBUTES_H
19
19
 
20
20
  #include <grpc/support/port_platform.h>
21
21
 
@@ -49,13 +49,14 @@ class XdsRouteStateAttribute
49
49
  : public ServiceConfigCallData::CallAttributeInterface {
50
50
  public:
51
51
  static UniqueTypeName TypeName() {
52
- static UniqueTypeName::Factory factory("xds_cluster_lb_data");
52
+ static UniqueTypeName::Factory factory("xds_route_state");
53
53
  return factory.Create();
54
54
  }
55
55
 
56
56
  virtual bool HasClusterForRoute(absl::string_view cluster_name) const = 0;
57
57
  UniqueTypeName type() const override { return TypeName(); }
58
58
  };
59
+
59
60
  } // namespace grpc_core
60
61
 
61
- #endif // GRPC_SRC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_XDS_XDS_RESOLVER_H
62
+ #endif // GRPC_SRC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_XDS_XDS_RESOLVER_ATTRIBUTES_H
@@ -0,0 +1,25 @@
1
+ //
2
+ // Copyright 2019 gRPC authors.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
16
+
17
+ #include <grpc/support/port_platform.h>
18
+
19
+ #include "src/core/ext/filters/client_channel/resolver/xds/xds_resolver_trace.h"
20
+
21
+ namespace grpc_core {
22
+
23
+ TraceFlag grpc_xds_resolver_trace(false, "xds_resolver");
24
+
25
+ } // namespace grpc_core
@@ -0,0 +1,30 @@
1
+ //
2
+ // Copyright 2019 gRPC authors.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
16
+
17
+ #ifndef GRPC_SRC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_XDS_XDS_RESOLVER_TRACE_H
18
+ #define GRPC_SRC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_XDS_XDS_RESOLVER_TRACE_H
19
+
20
+ #include <grpc/support/port_platform.h>
21
+
22
+ #include "src/core/lib/debug/trace.h"
23
+
24
+ namespace grpc_core {
25
+
26
+ extern TraceFlag grpc_xds_resolver_trace;
27
+
28
+ } // namespace grpc_core
29
+
30
+ #endif // GRPC_SRC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_XDS_XDS_RESOLVER_TRACE_H
@@ -143,6 +143,7 @@ const RetryMethodConfig* RetryFilter::GetRetryPolicy(
143
143
  const grpc_channel_filter RetryFilter::kVtable = {
144
144
  RetryFilter::LegacyCallData::StartTransportStreamOpBatch,
145
145
  nullptr,
146
+ /* init_call: */ nullptr,
146
147
  RetryFilter::StartTransportOp,
147
148
  sizeof(RetryFilter::LegacyCallData),
148
149
  RetryFilter::LegacyCallData::Init,
@@ -54,8 +54,11 @@ namespace grpc_core {
54
54
 
55
55
  namespace {
56
56
 
57
- class ServiceConfigChannelArgFilter : public ChannelFilter {
57
+ class ServiceConfigChannelArgFilter
58
+ : public ImplementChannelFilter<ServiceConfigChannelArgFilter> {
58
59
  public:
60
+ static const grpc_channel_filter kFilter;
61
+
59
62
  static absl::StatusOr<ServiceConfigChannelArgFilter> Create(
60
63
  const ChannelArgs& args, ChannelFilter::Args) {
61
64
  return ServiceConfigChannelArgFilter(args);
@@ -74,31 +77,46 @@ class ServiceConfigChannelArgFilter : public ChannelFilter {
74
77
  }
75
78
  }
76
79
 
77
- // Construct a promise for one call.
78
- ArenaPromise<ServerMetadataHandle> MakeCallPromise(
79
- CallArgs call_args, NextPromiseFactory next_promise_factory) override;
80
+ class Call {
81
+ public:
82
+ void OnClientInitialMetadata(ClientMetadata& md,
83
+ ServiceConfigChannelArgFilter* filter);
84
+ static const NoInterceptor OnServerInitialMetadata;
85
+ static const NoInterceptor OnServerTrailingMetadata;
86
+ static const NoInterceptor OnClientToServerMessage;
87
+ static const NoInterceptor OnServerToClientMessage;
88
+ static const NoInterceptor OnFinalize;
89
+ };
80
90
 
81
91
  private:
82
92
  RefCountedPtr<ServiceConfig> service_config_;
83
93
  };
84
94
 
85
- ArenaPromise<ServerMetadataHandle>
86
- ServiceConfigChannelArgFilter::MakeCallPromise(
87
- CallArgs call_args, NextPromiseFactory next_promise_factory) {
95
+ const NoInterceptor
96
+ ServiceConfigChannelArgFilter::Call::OnServerInitialMetadata;
97
+ const NoInterceptor
98
+ ServiceConfigChannelArgFilter::Call::OnServerTrailingMetadata;
99
+ const NoInterceptor
100
+ ServiceConfigChannelArgFilter::Call::OnClientToServerMessage;
101
+ const NoInterceptor
102
+ ServiceConfigChannelArgFilter::Call::OnServerToClientMessage;
103
+ const NoInterceptor ServiceConfigChannelArgFilter::Call::OnFinalize;
104
+
105
+ void ServiceConfigChannelArgFilter::Call::OnClientInitialMetadata(
106
+ ClientMetadata& md, ServiceConfigChannelArgFilter* filter) {
88
107
  const ServiceConfigParser::ParsedConfigVector* method_configs = nullptr;
89
- if (service_config_ != nullptr) {
90
- method_configs = service_config_->GetMethodParsedConfigVector(
91
- call_args.client_initial_metadata->get_pointer(HttpPathMetadata())
92
- ->c_slice());
108
+ if (filter->service_config_ != nullptr) {
109
+ method_configs = filter->service_config_->GetMethodParsedConfigVector(
110
+ md.get_pointer(HttpPathMetadata())->c_slice());
93
111
  }
94
112
  auto* arena = GetContext<Arena>();
95
113
  auto* service_config_call_data = arena->New<ServiceConfigCallData>(
96
114
  arena, GetContext<grpc_call_context_element>());
97
- service_config_call_data->SetServiceConfig(service_config_, method_configs);
98
- return next_promise_factory(std::move(call_args));
115
+ service_config_call_data->SetServiceConfig(filter->service_config_,
116
+ method_configs);
99
117
  }
100
118
 
101
- const grpc_channel_filter kServiceConfigChannelArgFilter =
119
+ const grpc_channel_filter ServiceConfigChannelArgFilter::kFilter =
102
120
  MakePromiseBasedFilter<ServiceConfigChannelArgFilter,
103
121
  FilterEndpoint::kClient>(
104
122
  "service_config_channel_arg");
@@ -108,11 +126,11 @@ const grpc_channel_filter kServiceConfigChannelArgFilter =
108
126
  void RegisterServiceConfigChannelArgFilter(
109
127
  CoreConfiguration::Builder* builder) {
110
128
  builder->channel_init()
111
- ->RegisterFilter(GRPC_CLIENT_DIRECT_CHANNEL,
112
- &kServiceConfigChannelArgFilter)
129
+ ->RegisterFilter<ServiceConfigChannelArgFilter>(
130
+ GRPC_CLIENT_DIRECT_CHANNEL)
113
131
  .ExcludeFromMinimalStack()
114
132
  .IfHasChannelArg(GRPC_ARG_SERVICE_CONFIG)
115
- .Before({&ClientMessageSizeFilter::kFilter});
133
+ .Before<ClientMessageSizeFilter>();
116
134
  }
117
135
 
118
136
  } // namespace grpc_core
@@ -343,6 +343,7 @@ const grpc_channel_filter grpc_client_deadline_filter = {
343
343
  grpc_core::NextPromiseFactory next_promise_factory) {
344
344
  return next_promise_factory(std::move(call_args));
345
345
  },
346
+ /* init_call: */ nullptr,
346
347
  grpc_channel_next_op,
347
348
  sizeof(grpc_deadline_state),
348
349
  deadline_init_call_elem,
@@ -368,6 +369,17 @@ const grpc_channel_filter grpc_server_deadline_filter = {
368
369
  }
369
370
  return next_promise_factory(std::move(call_args));
370
371
  },
372
+ [](grpc_channel_element*, grpc_core::CallSpineInterface* spine) {
373
+ spine->client_initial_metadata().receiver.InterceptAndMap(
374
+ [](grpc_core::ClientMetadataHandle md) {
375
+ auto deadline = md->get(grpc_core::GrpcTimeoutMetadata());
376
+ if (deadline.has_value()) {
377
+ grpc_core::GetContext<grpc_core::CallContext>()->UpdateDeadline(
378
+ *deadline);
379
+ }
380
+ return md;
381
+ });
382
+ },
371
383
  grpc_channel_next_op,
372
384
  sizeof(server_call_data),
373
385
  deadline_init_call_elem,
@@ -54,6 +54,11 @@
54
54
  namespace grpc_core {
55
55
 
56
56
  TraceFlag grpc_fault_injection_filter_trace(false, "fault_injection_filter");
57
+ const NoInterceptor FaultInjectionFilter::Call::OnServerInitialMetadata;
58
+ const NoInterceptor FaultInjectionFilter::Call::OnServerTrailingMetadata;
59
+ const NoInterceptor FaultInjectionFilter::Call::OnClientToServerMessage;
60
+ const NoInterceptor FaultInjectionFilter::Call::OnServerToClientMessage;
61
+ const NoInterceptor FaultInjectionFilter::Call::OnFinalize;
57
62
 
58
63
  namespace {
59
64
 
@@ -144,23 +149,22 @@ FaultInjectionFilter::FaultInjectionFilter(ChannelFilter::Args filter_args)
144
149
  mu_(new Mutex) {}
145
150
 
146
151
  // Construct a promise for one call.
147
- ArenaPromise<ServerMetadataHandle> FaultInjectionFilter::MakeCallPromise(
148
- CallArgs call_args, NextPromiseFactory next_promise_factory) {
149
- auto decision = MakeInjectionDecision(call_args.client_initial_metadata);
152
+ ArenaPromise<absl::Status> FaultInjectionFilter::Call::OnClientInitialMetadata(
153
+ ClientMetadata& md, FaultInjectionFilter* filter) {
154
+ auto decision = filter->MakeInjectionDecision(md);
150
155
  if (GRPC_TRACE_FLAG_ENABLED(grpc_fault_injection_filter_trace)) {
151
156
  gpr_log(GPR_INFO, "chand=%p: Fault injection triggered %s", this,
152
157
  decision.ToString().c_str());
153
158
  }
154
159
  auto delay = decision.DelayUntil();
155
- return TrySeq(
156
- Sleep(delay),
157
- [decision = std::move(decision)]() { return decision.MaybeAbort(); },
158
- next_promise_factory(std::move(call_args)));
160
+ return TrySeq(Sleep(delay), [decision = std::move(decision)]() {
161
+ return decision.MaybeAbort();
162
+ });
159
163
  }
160
164
 
161
165
  FaultInjectionFilter::InjectionDecision
162
166
  FaultInjectionFilter::MakeInjectionDecision(
163
- const ClientMetadataHandle& initial_metadata) {
167
+ const ClientMetadata& initial_metadata) {
164
168
  // Fetch the fault injection policy from the service config, based on the
165
169
  // relative index for which policy should this CallData use.
166
170
  auto* service_config_call_data = static_cast<ServiceConfigCallData*>(
@@ -188,15 +192,15 @@ FaultInjectionFilter::MakeInjectionDecision(
188
192
  !fi_policy->delay_percentage_header.empty()) {
189
193
  std::string buffer;
190
194
  if (!fi_policy->abort_code_header.empty() && abort_code == GRPC_STATUS_OK) {
191
- auto value = initial_metadata->GetStringValue(
192
- fi_policy->abort_code_header, &buffer);
195
+ auto value = initial_metadata.GetStringValue(fi_policy->abort_code_header,
196
+ &buffer);
193
197
  if (value.has_value()) {
194
198
  grpc_status_code_from_int(
195
199
  AsInt<int>(*value).value_or(GRPC_STATUS_UNKNOWN), &abort_code);
196
200
  }
197
201
  }
198
202
  if (!fi_policy->abort_percentage_header.empty()) {
199
- auto value = initial_metadata->GetStringValue(
203
+ auto value = initial_metadata.GetStringValue(
200
204
  fi_policy->abort_percentage_header, &buffer);
201
205
  if (value.has_value()) {
202
206
  abort_percentage_numerator = std::min(
@@ -205,14 +209,14 @@ FaultInjectionFilter::MakeInjectionDecision(
205
209
  }
206
210
  if (!fi_policy->delay_header.empty() && delay == Duration::Zero()) {
207
211
  auto value =
208
- initial_metadata->GetStringValue(fi_policy->delay_header, &buffer);
212
+ initial_metadata.GetStringValue(fi_policy->delay_header, &buffer);
209
213
  if (value.has_value()) {
210
214
  delay = Duration::Milliseconds(
211
215
  std::max(AsInt<int64_t>(*value).value_or(0), int64_t{0}));
212
216
  }
213
217
  }
214
218
  if (!fi_policy->delay_percentage_header.empty()) {
215
- auto value = initial_metadata->GetStringValue(
219
+ auto value = initial_metadata.GetStringValue(
216
220
  fi_policy->delay_percentage_header, &buffer);
217
221
  if (value.has_value()) {
218
222
  delay_percentage_numerator = std::min(
@@ -40,7 +40,8 @@ namespace grpc_core {
40
40
  // of the ordinary channel stack. The fault injection filter fetches fault
41
41
  // injection policy from the method config of service config returned by the
42
42
  // resolver, and enforces the fault injection policy.
43
- class FaultInjectionFilter : public ChannelFilter {
43
+ class FaultInjectionFilter
44
+ : public ImplementChannelFilter<FaultInjectionFilter> {
44
45
  public:
45
46
  static const grpc_channel_filter kFilter;
46
47
 
@@ -48,15 +49,23 @@ class FaultInjectionFilter : public ChannelFilter {
48
49
  const ChannelArgs& args, ChannelFilter::Args filter_args);
49
50
 
50
51
  // Construct a promise for one call.
51
- ArenaPromise<ServerMetadataHandle> MakeCallPromise(
52
- CallArgs call_args, NextPromiseFactory next_promise_factory) override;
52
+ class Call {
53
+ public:
54
+ ArenaPromise<absl::Status> OnClientInitialMetadata(
55
+ ClientMetadata& md, FaultInjectionFilter* filter);
56
+ static const NoInterceptor OnServerInitialMetadata;
57
+ static const NoInterceptor OnServerTrailingMetadata;
58
+ static const NoInterceptor OnClientToServerMessage;
59
+ static const NoInterceptor OnServerToClientMessage;
60
+ static const NoInterceptor OnFinalize;
61
+ };
53
62
 
54
63
  private:
55
64
  explicit FaultInjectionFilter(ChannelFilter::Args filter_args);
56
65
 
57
66
  class InjectionDecision;
58
67
  InjectionDecision MakeInjectionDecision(
59
- const ClientMetadataHandle& initial_metadata);
68
+ const ClientMetadata& initial_metadata);
60
69
 
61
70
  // The relative index of instances of the same filter.
62
71
  size_t index_;
@@ -51,6 +51,10 @@
51
51
 
52
52
  namespace grpc_core {
53
53
 
54
+ const NoInterceptor HttpClientFilter::Call::OnServerToClientMessage;
55
+ const NoInterceptor HttpClientFilter::Call::OnClientToServerMessage;
56
+ const NoInterceptor HttpClientFilter::Call::OnFinalize;
57
+
54
58
  const grpc_channel_filter HttpClientFilter::kFilter =
55
59
  MakePromiseBasedFilter<HttpClientFilter, FilterEndpoint::kClient,
56
60
  kFilterExaminesServerInitialMetadata>("http-client");
@@ -105,40 +109,27 @@ Slice UserAgentFromArgs(const ChannelArgs& args,
105
109
  }
106
110
  } // namespace
107
111
 
108
- ArenaPromise<ServerMetadataHandle> HttpClientFilter::MakeCallPromise(
109
- CallArgs call_args, NextPromiseFactory next_promise_factory) {
110
- auto& md = call_args.client_initial_metadata;
111
- if (test_only_use_put_requests_) {
112
- md->Set(HttpMethodMetadata(), HttpMethodMetadata::kPut);
112
+ void HttpClientFilter::Call::OnClientInitialMetadata(ClientMetadata& md,
113
+ HttpClientFilter* filter) {
114
+ if (filter->test_only_use_put_requests_) {
115
+ md.Set(HttpMethodMetadata(), HttpMethodMetadata::kPut);
113
116
  } else {
114
- md->Set(HttpMethodMetadata(), HttpMethodMetadata::kPost);
117
+ md.Set(HttpMethodMetadata(), HttpMethodMetadata::kPost);
115
118
  }
116
- md->Set(HttpSchemeMetadata(), scheme_);
117
- md->Set(TeMetadata(), TeMetadata::kTrailers);
118
- md->Set(ContentTypeMetadata(), ContentTypeMetadata::kApplicationGrpc);
119
- md->Set(UserAgentMetadata(), user_agent_.Ref());
120
-
121
- auto* initial_metadata_err =
122
- GetContext<Arena>()->New<Latch<ServerMetadataHandle>>();
123
-
124
- call_args.server_initial_metadata->InterceptAndMap(
125
- [initial_metadata_err](
126
- ServerMetadataHandle md) -> absl::optional<ServerMetadataHandle> {
127
- auto r = CheckServerMetadata(md.get());
128
- if (!r.ok()) {
129
- initial_metadata_err->Set(ServerMetadataFromStatus(r));
130
- return absl::nullopt;
131
- }
132
- return std::move(md);
133
- });
134
-
135
- return Race(initial_metadata_err->Wait(),
136
- Map(next_promise_factory(std::move(call_args)),
137
- [](ServerMetadataHandle md) -> ServerMetadataHandle {
138
- auto r = CheckServerMetadata(md.get());
139
- if (!r.ok()) return ServerMetadataFromStatus(r);
140
- return md;
141
- }));
119
+ md.Set(HttpSchemeMetadata(), filter->scheme_);
120
+ md.Set(TeMetadata(), TeMetadata::kTrailers);
121
+ md.Set(ContentTypeMetadata(), ContentTypeMetadata::kApplicationGrpc);
122
+ md.Set(UserAgentMetadata(), filter->user_agent_.Ref());
123
+ }
124
+
125
+ absl::Status HttpClientFilter::Call::OnServerInitialMetadata(
126
+ ServerMetadata& md) {
127
+ return CheckServerMetadata(&md);
128
+ }
129
+
130
+ absl::Status HttpClientFilter::Call::OnServerTrailingMetadata(
131
+ ServerMetadata& md) {
132
+ return CheckServerMetadata(&md);
142
133
  }
143
134
 
144
135
  HttpClientFilter::HttpClientFilter(HttpSchemeMetadata::ValueType scheme,
@@ -25,23 +25,28 @@
25
25
  #include "src/core/lib/channel/channel_args.h"
26
26
  #include "src/core/lib/channel/channel_fwd.h"
27
27
  #include "src/core/lib/channel/promise_based_filter.h"
28
- #include "src/core/lib/promise/arena_promise.h"
29
28
  #include "src/core/lib/slice/slice.h"
30
29
  #include "src/core/lib/transport/metadata_batch.h"
31
30
  #include "src/core/lib/transport/transport.h"
32
31
 
33
32
  namespace grpc_core {
34
33
 
35
- class HttpClientFilter : public ChannelFilter {
34
+ class HttpClientFilter : public ImplementChannelFilter<HttpClientFilter> {
36
35
  public:
37
36
  static const grpc_channel_filter kFilter;
38
37
 
39
38
  static absl::StatusOr<HttpClientFilter> Create(
40
39
  const ChannelArgs& args, ChannelFilter::Args filter_args);
41
40
 
42
- // Construct a promise for one call.
43
- ArenaPromise<ServerMetadataHandle> MakeCallPromise(
44
- CallArgs call_args, NextPromiseFactory next_promise_factory) override;
41
+ class Call {
42
+ public:
43
+ void OnClientInitialMetadata(ClientMetadata& md, HttpClientFilter* filter);
44
+ absl::Status OnServerInitialMetadata(ServerMetadata& md);
45
+ absl::Status OnServerTrailingMetadata(ServerMetadata& md);
46
+ static const NoInterceptor OnClientToServerMessage;
47
+ static const NoInterceptor OnServerToClientMessage;
48
+ static const NoInterceptor OnFinalize;
49
+ };
45
50
 
46
51
  private:
47
52
  HttpClientFilter(HttpSchemeMetadata::ValueType scheme, Slice user_agent,
@@ -37,6 +37,12 @@
37
37
 
38
38
  namespace grpc_core {
39
39
 
40
+ const NoInterceptor ClientAuthorityFilter::Call::OnServerInitialMetadata;
41
+ const NoInterceptor ClientAuthorityFilter::Call::OnServerTrailingMetadata;
42
+ const NoInterceptor ClientAuthorityFilter::Call::OnClientToServerMessage;
43
+ const NoInterceptor ClientAuthorityFilter::Call::OnServerToClientMessage;
44
+ const NoInterceptor ClientAuthorityFilter::Call::OnFinalize;
45
+
40
46
  absl::StatusOr<ClientAuthorityFilter> ClientAuthorityFilter::Create(
41
47
  const ChannelArgs& args, ChannelFilter::Args) {
42
48
  absl::optional<absl::string_view> default_authority =
@@ -49,17 +55,12 @@ absl::StatusOr<ClientAuthorityFilter> ClientAuthorityFilter::Create(
49
55
  return ClientAuthorityFilter(Slice::FromCopiedString(*default_authority));
50
56
  }
51
57
 
52
- ArenaPromise<ServerMetadataHandle> ClientAuthorityFilter::MakeCallPromise(
53
- CallArgs call_args, NextPromiseFactory next_promise_factory) {
58
+ void ClientAuthorityFilter::Call::OnClientInitialMetadata(
59
+ ClientMetadata& md, ClientAuthorityFilter* filter) {
54
60
  // If no authority is set, set the default authority.
55
- if (call_args.client_initial_metadata->get_pointer(HttpAuthorityMetadata()) ==
56
- nullptr) {
57
- call_args.client_initial_metadata->Set(HttpAuthorityMetadata(),
58
- default_authority_.Ref());
61
+ if (md.get_pointer(HttpAuthorityMetadata()) == nullptr) {
62
+ md.Set(HttpAuthorityMetadata(), filter->default_authority_.Ref());
59
63
  }
60
- // We have no asynchronous work, so we can just ask the next promise to run,
61
- // passing down initial_metadata.
62
- return next_promise_factory(std::move(call_args));
63
64
  }
64
65
 
65
66
  const grpc_channel_filter ClientAuthorityFilter::kFilter =
@@ -75,14 +76,13 @@ bool NeedsClientAuthorityFilter(const ChannelArgs& args) {
75
76
 
76
77
  void RegisterClientAuthorityFilter(CoreConfiguration::Builder* builder) {
77
78
  builder->channel_init()
78
- ->RegisterFilter(GRPC_CLIENT_SUBCHANNEL, &ClientAuthorityFilter::kFilter)
79
+ ->RegisterFilter<ClientAuthorityFilter>(GRPC_CLIENT_SUBCHANNEL)
79
80
  .If(NeedsClientAuthorityFilter)
80
- .Before({&ClientAuthFilter::kFilter});
81
+ .Before<ClientAuthFilter>();
81
82
  builder->channel_init()
82
- ->RegisterFilter(GRPC_CLIENT_DIRECT_CHANNEL,
83
- &ClientAuthorityFilter::kFilter)
83
+ ->RegisterFilter<ClientAuthorityFilter>(GRPC_CLIENT_DIRECT_CHANNEL)
84
84
  .If(NeedsClientAuthorityFilter)
85
- .Before({&ClientAuthFilter::kFilter});
85
+ .Before<ClientAuthFilter>();
86
86
  }
87
87
 
88
88
  } // namespace grpc_core
@@ -34,16 +34,24 @@
34
34
 
35
35
  namespace grpc_core {
36
36
 
37
- class ClientAuthorityFilter final : public ChannelFilter {
37
+ class ClientAuthorityFilter final
38
+ : public ImplementChannelFilter<ClientAuthorityFilter> {
38
39
  public:
39
40
  static const grpc_channel_filter kFilter;
40
41
 
41
42
  static absl::StatusOr<ClientAuthorityFilter> Create(const ChannelArgs& args,
42
43
  ChannelFilter::Args);
43
44
 
44
- // Construct a promise for one call.
45
- ArenaPromise<ServerMetadataHandle> MakeCallPromise(
46
- CallArgs call_args, NextPromiseFactory next_promise_factory) override;
45
+ class Call {
46
+ public:
47
+ void OnClientInitialMetadata(ClientMetadata& md,
48
+ ClientAuthorityFilter* filter);
49
+ static const NoInterceptor OnServerInitialMetadata;
50
+ static const NoInterceptor OnServerTrailingMetadata;
51
+ static const NoInterceptor OnClientToServerMessage;
52
+ static const NoInterceptor OnServerToClientMessage;
53
+ static const NoInterceptor OnFinalize;
54
+ };
47
55
 
48
56
  private:
49
57
  explicit ClientAuthorityFilter(Slice default_authority)
@@ -22,10 +22,12 @@
22
22
 
23
23
  #include "src/core/ext/filters/http/client/http_client_filter.h"
24
24
  #include "src/core/ext/filters/http/message_compress/compression_filter.h"
25
+ #include "src/core/ext/filters/http/message_compress/legacy_compression_filter.h"
25
26
  #include "src/core/ext/filters/http/server/http_server_filter.h"
26
27
  #include "src/core/ext/filters/message_size/message_size_filter.h"
27
28
  #include "src/core/lib/channel/channel_args.h"
28
29
  #include "src/core/lib/config/core_configuration.h"
30
+ #include "src/core/lib/experiments/experiments.h"
29
31
  #include "src/core/lib/surface/channel_stack_type.h"
30
32
  #include "src/core/lib/transport/transport.h"
31
33
 
@@ -38,31 +40,51 @@ bool IsBuildingHttpLikeTransport(const ChannelArgs& args) {
38
40
  } // namespace
39
41
 
40
42
  void RegisterHttpFilters(CoreConfiguration::Builder* builder) {
43
+ if (IsV3CompressionFilterEnabled()) {
44
+ builder->channel_init()
45
+ ->RegisterFilter<ClientCompressionFilter>(GRPC_CLIENT_SUBCHANNEL)
46
+ .If(IsBuildingHttpLikeTransport)
47
+ .After<HttpClientFilter>()
48
+ .After<ClientMessageSizeFilter>();
49
+ builder->channel_init()
50
+ ->RegisterFilter<ClientCompressionFilter>(GRPC_CLIENT_DIRECT_CHANNEL)
51
+ .If(IsBuildingHttpLikeTransport)
52
+ .After<HttpClientFilter>()
53
+ .After<ClientMessageSizeFilter>();
54
+ builder->channel_init()
55
+ ->RegisterFilter<ServerCompressionFilter>(GRPC_SERVER_CHANNEL)
56
+ .If(IsBuildingHttpLikeTransport)
57
+ .After<HttpServerFilter>()
58
+ .After<ServerMessageSizeFilter>();
59
+ } else {
60
+ builder->channel_init()
61
+ ->RegisterFilter<LegacyClientCompressionFilter>(GRPC_CLIENT_SUBCHANNEL)
62
+ .If(IsBuildingHttpLikeTransport)
63
+ .After<HttpClientFilter>()
64
+ .After<ClientMessageSizeFilter>();
65
+ builder->channel_init()
66
+ ->RegisterFilter<LegacyClientCompressionFilter>(
67
+ GRPC_CLIENT_DIRECT_CHANNEL)
68
+ .If(IsBuildingHttpLikeTransport)
69
+ .After<HttpClientFilter>()
70
+ .After<ClientMessageSizeFilter>();
71
+ builder->channel_init()
72
+ ->RegisterFilter<LegacyServerCompressionFilter>(GRPC_SERVER_CHANNEL)
73
+ .If(IsBuildingHttpLikeTransport)
74
+ .After<HttpServerFilter>()
75
+ .After<ServerMessageSizeFilter>();
76
+ }
41
77
  builder->channel_init()
42
- ->RegisterFilter(GRPC_CLIENT_SUBCHANNEL,
43
- &ClientCompressionFilter::kFilter)
78
+ ->RegisterFilter<HttpClientFilter>(GRPC_CLIENT_SUBCHANNEL)
44
79
  .If(IsBuildingHttpLikeTransport)
45
- .After({&HttpClientFilter::kFilter, &ClientMessageSizeFilter::kFilter});
80
+ .After<ClientMessageSizeFilter>();
46
81
  builder->channel_init()
47
- ->RegisterFilter(GRPC_CLIENT_DIRECT_CHANNEL,
48
- &ClientCompressionFilter::kFilter)
82
+ ->RegisterFilter<HttpClientFilter>(GRPC_CLIENT_DIRECT_CHANNEL)
49
83
  .If(IsBuildingHttpLikeTransport)
50
- .After({&HttpClientFilter::kFilter, &ClientMessageSizeFilter::kFilter});
84
+ .After<ClientMessageSizeFilter>();
51
85
  builder->channel_init()
52
- ->RegisterFilter(GRPC_SERVER_CHANNEL, &ServerCompressionFilter::kFilter)
86
+ ->RegisterFilter<HttpServerFilter>(GRPC_SERVER_CHANNEL)
53
87
  .If(IsBuildingHttpLikeTransport)
54
- .After({&HttpServerFilter::kFilter, &ServerMessageSizeFilter::kFilter});
55
- builder->channel_init()
56
- ->RegisterFilter(GRPC_CLIENT_SUBCHANNEL, &HttpClientFilter::kFilter)
57
- .If(IsBuildingHttpLikeTransport)
58
- .After({&ClientMessageSizeFilter::kFilter});
59
- builder->channel_init()
60
- ->RegisterFilter(GRPC_CLIENT_DIRECT_CHANNEL, &HttpClientFilter::kFilter)
61
- .If(IsBuildingHttpLikeTransport)
62
- .After({&ClientMessageSizeFilter::kFilter});
63
- builder->channel_init()
64
- ->RegisterFilter(GRPC_SERVER_CHANNEL, &HttpServerFilter::kFilter)
65
- .If(IsBuildingHttpLikeTransport)
66
- .After({&ServerMessageSizeFilter::kFilter});
88
+ .After<ServerMessageSizeFilter>();
67
89
  }
68
90
  } // namespace grpc_core