[promises] Add an API to access new style filters - #35200
Conversation
The code in promise_based_filter allows http_client_filter to use the v3 APIs for filters. The implementation of the mapping from v3 -> v2.1 is as yet incomplete, but sufficient for this sample. The long term aim will be to convert all filters to this API, and then transition the runtime from the current promise based stack to a new stack that uses these interception points natively. PiperOrigin-RevId: 586188548
Automated fix for refs/heads/cg-http-cli
Automated fix for refs/heads/cg-http-svr
Automated fix for refs/heads/cg-channel-filter-api
Automated fix for refs/heads/cg-channel-filter-api
…hannel-filter-api
markdroth
left a comment
There was a problem hiding this comment.
Looks good modulo comments!
| virtual Pipe<MessageHandle>& client_to_server_messages() = 0; | ||
| virtual Pipe<MessageHandle>& server_to_client_messages() = 0; | ||
| virtual Pipe<ServerMetadataHandle>& server_trailing_metadata() = 0; | ||
| GRPC_MUST_USE_RESULT virtual absl::nullopt_t Cancel( |
There was a problem hiding this comment.
As discussed, please add a comment explaining why GRPC_MUST_USE_RESULT is being used with absl::nullopt_t, and maybe a TODO to find a more elegant way to accomplish the same thing.
|
|
||
| // TODO(ctiller): eventually drop this when we don't need to reference into | ||
| // legacy promise calls anymore | ||
| class CallSpineInterface { |
There was a problem hiding this comment.
Please add a comment explaining the purpose of this class and its relationship to CallInitiator, CallHandler, top-level calls, client_channel calls, and server calls. Also its importance for cancellation.
| template <typename Derived> | ||
| class ImplementChannelFilter : public ChannelFilter { | ||
| public: | ||
| void InitCall(CallSpineInterface* call_spine) { |
There was a problem hiding this comment.
Please add a comment explaining that this is doing v3->v2 conversion (ability to run a v3 filter in a v2 stack), and that it transitively works for v3->v1 because we have v2->v1 already implemented.
Will be used during this transition time to run 5-pipe style filters somewhat more natively. Once everything is getting closer to 5-pipes, we'll drop this method and have the channel stack understand how to create an interception-map that can be reused per-call, instead of creating the interception-map every time a call is created. Closes #35200 COPYBARA_INTEGRATE_REVIEW=#35200 from ctiller:cg-channel-filter-api 2fc11dd PiperOrigin-RevId: 587940947
Will be used during this transition time to run 5-pipe style filters somewhat more natively. Once everything is getting closer to 5-pipes, we'll drop this method and have the channel stack understand how to create an interception-map that can be reused per-call, instead of creating the interception-map every time a call is created. Closes grpc#35200 COPYBARA_INTEGRATE_REVIEW=grpc#35200 from ctiller:cg-channel-filter-api 2fc11dd PiperOrigin-RevId: 587940947
Will be used during this transition time to run 5-pipe style filters somewhat more natively. Once everything is getting closer to 5-pipes, we'll drop this method and have the channel stack understand how to create an interception-map that can be reused per-call, instead of creating the interception-map every time a call is created.