-
Notifications
You must be signed in to change notification settings - Fork 4k
xds: Add composite filter #12646
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
Open
AgraVator
wants to merge
12
commits into
grpc:master
Choose a base branch
from
AgraVator:xds-composite-filter
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
xds: Add composite filter #12646
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
603d4fe
revert unintended changes
AgraVator cd6c611
add support for keep_matching
AgraVator 64e7c1c
fix warnings
AgraVator 10c8d1e
fix: suggested comments
AgraVator 0648217
revert the typedStruct type
AgraVator 1d4d18e
fix: suggested changes
AgraVator 4d2f442
Merge branch 'master' into xds-composite-filter
AgraVator af9a9ce
fix: test
AgraVator be05900
fix: skip filter
AgraVator dc297fe
fix: suggested changes
AgraVator 96c1fb1
Merge upstream/master into xds-composite-filter
AgraVator 3d98fb9
fix: add recursion depth
AgraVator File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,13 +91,39 @@ public static Matchers.StringMatcher parseStringMatcher( | |
| Pattern.compile(proto.getSafeRegex().getRegex())); | ||
| case CONTAINS: | ||
| return Matchers.StringMatcher.forContains(proto.getContains()); | ||
| case CUSTOM: | ||
| throw new IllegalArgumentException("custom string matcher is not supported"); | ||
| case MATCHPATTERN_NOT_SET: | ||
| default: | ||
| throw new IllegalArgumentException( | ||
| "Unknown StringMatcher match pattern: " + proto.getMatchPatternCase()); | ||
| } | ||
| } | ||
|
|
||
| /** Translate StringMatcher xDS proto to internal StringMatcher. */ | ||
| public static Matchers.StringMatcher parseStringMatcher( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The stringMatcher parsing logic should not be in this PR. It will be covered by A106. You then need to just modify add the |
||
| com.github.xds.type.matcher.v3.StringMatcher proto) { | ||
| switch (proto.getMatchPatternCase()) { | ||
| case EXACT: | ||
| return Matchers.StringMatcher.forExact(proto.getExact(), proto.getIgnoreCase()); | ||
| case PREFIX: | ||
| return Matchers.StringMatcher.forPrefix(proto.getPrefix(), proto.getIgnoreCase()); | ||
| case SUFFIX: | ||
| return Matchers.StringMatcher.forSuffix(proto.getSuffix(), proto.getIgnoreCase()); | ||
| case SAFE_REGEX: | ||
| return Matchers.StringMatcher.forSafeRegEx( | ||
| Pattern.compile(proto.getSafeRegex().getRegex())); | ||
| case CONTAINS: | ||
| return Matchers.StringMatcher.forContains(proto.getContains()); | ||
| case CUSTOM: | ||
| throw new IllegalArgumentException("custom string matcher is not supported"); | ||
| case MATCHPATTERN_NOT_SET: | ||
| default: | ||
| throw new IllegalArgumentException( | ||
| "Unknown StringMatcher match pattern: " + proto.getMatchPatternCase()); | ||
| } | ||
| } | ||
|
|
||
| /** Translates envoy proto FractionalPercent to internal FractionMatcher. */ | ||
| public static Matchers.FractionMatcher parseFractionMatcher( | ||
| io.envoyproxy.envoy.type.v3.FractionalPercent proto) { | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go/java-practices/null#collection
Is there a semantic difference between a null
filterMetadataand emptyfilterMetadata?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the current implementation, a null filterMetadata represents the absence of metadata (as per the proto not having it set), while an empty map would represent present but empty metadata. I followed the existing pattern in the codebase for optional maps. However, I agree that using non-null empty collections is generally preferred in Java to avoid null checks. We can consider a refactor to use empty maps consistently in a separate cleanup PR to keep this PR focused on the core feature ?