diff --git a/src/core/lib/channel/promise_based_filter.h b/src/core/lib/channel/promise_based_filter.h index cef590ef4ef..bb642bc7f21 100644 --- a/src/core/lib/channel/promise_based_filter.h +++ b/src/core/lib/channel/promise_based_filter.h @@ -74,6 +74,12 @@ namespace grpc_core { +// HACK: If a filter has this type as a base class it will be skipped in +// v3 filter stacks. This is a temporary measure to allow the v3 filter stack +// to be bought up whilst some tests inadvertently rely on hard to convert +// filters. +class HackyHackyHackySkipInV3FilterStacks {}; + class ChannelFilter { public: class Args { @@ -1906,9 +1912,11 @@ struct ChannelFilterWithFlagsMethods { // ChannelArgs channel_args, ChannelFilter::Args filter_args); // }; template -absl::enable_if_t::value && - !std::is_base_of, F>::value, - grpc_channel_filter> +absl::enable_if_t< + std::is_base_of::value && + !std::is_base_of, F>::value && + !std::is_base_of::value, + grpc_channel_filter> MakePromiseBasedFilter(const char* name) { using CallData = promise_filter_detail::CallData; @@ -1946,6 +1954,52 @@ MakePromiseBasedFilter(const char* name) { }; } +template +absl::enable_if_t< + std::is_base_of::value, + grpc_channel_filter> +MakePromiseBasedFilter(const char* name) { + using CallData = promise_filter_detail::CallData; + + return grpc_channel_filter{ + // start_transport_stream_op_batch + promise_filter_detail::BaseCallDataMethods::StartTransportStreamOpBatch, + // make_call_promise + promise_filter_detail::ChannelFilterMethods::MakeCallPromise, + [](grpc_channel_element* elem, CallSpineInterface*) { + GRPC_LOG_EVERY_N_SEC( + 1, GPR_ERROR, + "gRPC V3 call stack in use, with a filter ('%s') that is not V3.", + elem->filter->name); + }, + // start_transport_op + promise_filter_detail::ChannelFilterMethods::StartTransportOp, + // sizeof_call_data + sizeof(CallData), + // init_call_elem + promise_filter_detail::CallDataFilterWithFlagsMethods< + CallData, kFlags>::InitCallElem, + // set_pollset_or_pollset_set + promise_filter_detail::BaseCallDataMethods::SetPollsetOrPollsetSet, + // destroy_call_elem + promise_filter_detail::CallDataFilterWithFlagsMethods< + CallData, kFlags>::DestroyCallElem, + // sizeof_channel_data + sizeof(F), + // init_channel_elem + promise_filter_detail::ChannelFilterWithFlagsMethods< + F, kFlags>::InitChannelElem, + // post_init_channel_elem + promise_filter_detail::ChannelFilterMethods::PostInitChannelElem, + // destroy_channel_elem + promise_filter_detail::ChannelFilterMethods::DestroyChannelElem, + // get_channel_info + promise_filter_detail::ChannelFilterMethods::GetChannelInfo, + // name + name, + }; +} + template absl::enable_if_t, F>::value, grpc_channel_filter>