Skip to content

[promises] Add an API to access new style filters - #35200

Closed
ctiller wants to merge 60 commits into
grpc:masterfrom
ctiller:cg-channel-filter-api
Closed

[promises] Add an API to access new style filters#35200
ctiller wants to merge 60 commits into
grpc:masterfrom
ctiller:cg-channel-filter-api

Conversation

@ctiller

@ctiller ctiller commented Dec 2, 2023

Copy link
Copy Markdown
Member

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.

ctiller and others added 30 commits November 30, 2023 20:01
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-channel-filter-api
Automated fix for refs/heads/cg-channel-filter-api

@markdroth markdroth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


// TODO(ctiller): eventually drop this when we don't need to reference into
// legacy promise calls anymore
class CallSpineInterface {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

template <typename Derived>
class ImplementChannelFilter : public ChannelFilter {
public:
void InitCall(CallSpineInterface* call_spine) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@ctiller ctiller closed this Dec 5, 2023
@ctiller
ctiller deleted the cg-channel-filter-api branch December 5, 2023 06:11
copybara-service Bot pushed a commit that referenced this pull request Dec 5, 2023
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
paulosjca pushed a commit to paulosjca/grpc that referenced this pull request Dec 8, 2023
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants