Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure every instance of StreamFilter and PassThroughFilter to contain only one copy of StreamFilterBase. #35341

Merged
merged 2 commits into from
Aug 1, 2024

Conversation

wu-bin
Copy link
Contributor

@wu-bin wu-bin commented Jul 22, 2024

Change Stream(Decode|Encode)Filter to inherit from StreamFilterBase virtually.
Move the default implementation of PassThrough(Decoder|Encode)Filter::onDestroy into StreamFilterBase.

Commit Message: Ensure every instance of StreamFilter and PassThroughFilter to contain only one copy of Stream(Decode|Encode)Filter and StreamFilterBase.
Additional Description:
Risk Level: Medium
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

virtually.
Change PassThrough(Decoder|Encode)Filter to inherit from Stream(Decoder|Encode)Filter
virtually.

This ensures every instance of StreamFilter and PassThroughFilter
contains only one copy of Stream(Decode|Encode)Filter and
StreamFilterBase.

Signed-off-by: Bin Wu <[email protected]>
@wu-bin wu-bin changed the title Ensure every instance of StreamFilter and PassThroughFilter to contain only one copy of Stream(Decode|Encode)Filter and StreamFilterBase. Ensure every instance of StreamFilter and PassThroughFilter to contain only one copy of StreamFilterBase. Jul 22, 2024
Copy link
Contributor

@yanavlasov yanavlasov left a comment

Choose a reason for hiding this comment

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

/wait-any

@@ -857,7 +857,7 @@ class StreamFilterBase {
* onDestroy() invoked. Filters that cross-register as access log handlers receive log() before
* onDestroy().
*/
virtual void onDestroy() PURE;
virtual void onDestroy() {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you keep this method pure virtual if you add override onDestroy in the PassThroughFilter? Or is it causing more build errors than that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks Yan, but I think if we do that, an existing class will not compile if

  • It derives directly from PassThroughDecoderFilter or PassThroughEncoderFilter, and
  • It doesn't override onDestroy, i.e. it relies on the empty implementation in PassThroughDecoderFilter or PassThroughEncoderFilter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

/assign @yanavlasov

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you try it? Can you post the compiler error, please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed, I change to have 3 onDestroy implementations in PassThroughDecoderFilter, PassThroughEncoderFilter, and PassThroughFilter. PTAL.

@yanavlasov
Copy link
Contributor

/wait-any

implementations in PassThroughDecoderFilter, PassThroughEncoderFilter
and PassThroughFilter.

Signed-off-by: Bin Wu <[email protected]>
@yanavlasov yanavlasov enabled auto-merge (squash) August 1, 2024 14:15
@yanavlasov yanavlasov merged commit 0fa9e60 into envoyproxy:main Aug 1, 2024
50 of 51 checks passed
martinduke pushed a commit to martinduke/envoy that referenced this pull request Aug 8, 2024
…n only one copy of StreamFilterBase. (envoyproxy#35341)

Change Stream(Decode|Encode)Filter to inherit from StreamFilterBase
virtually.
Move the default implementation of
PassThrough(Decoder|Encode)Filter::onDestroy into StreamFilterBase.

---------

Signed-off-by: Bin Wu <[email protected]>
Signed-off-by: Martin Duke <[email protected]>
asingh-g pushed a commit to asingh-g/envoy that referenced this pull request Aug 20, 2024
…n only one copy of StreamFilterBase. (envoyproxy#35341)

Change Stream(Decode|Encode)Filter to inherit from StreamFilterBase
virtually.
Move the default implementation of
PassThrough(Decoder|Encode)Filter::onDestroy into StreamFilterBase.

---------

Signed-off-by: Bin Wu <[email protected]>
Signed-off-by: asingh-g <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants