-
Notifications
You must be signed in to change notification settings - Fork 280
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
Separate matchers as a bucket filter #3229
Conversation
Adds a new read bucket called Filter that works exclusively on Matchers. This allows for using Matchers to constrain the bucket walk path. Buckets that use Matchers as Mappers have been split as a Mapper and Filter bucket. The method MapPrefix on Mappers has been removed. Matchers no longer implement Mappers.
The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).
|
// The path is expected to be normalized and validated. | ||
// The returned path is expected to be normalized and validated. | ||
// If the path cannot be mapped, this returns false. | ||
MapPrefix(prefix string) (string, bool) |
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.
MapPrefix
can be removed and replaced with calls to MapPath
now that Matcher
s won't restrict the mappers.
@@ -82,123 +85,47 @@ func MatchNot(matcher Matcher) Matcher { | |||
|
|||
// We limit or/and/not to Matchers as composite logic must assume | |||
// the input path is not modified, so that we can always return it | |||
// | |||
// We might want to just remove Matcher implementing Mapper for simplification, | |||
// and just have a Matches function, then handle chaining them separately. |
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.
Removed, Matcher
s no longer implement Mapper
s.
// | ||
// If the Matchers are empty, the original ReadBucket is returned. | ||
// If there is more than one Matcher, the Matchers are anded together. | ||
func FilterReadBucket(readBucket ReadBucket, matchers ...Matcher) ReadBucket { |
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.
Chose FilterReadBucket
over MatchReadBucket
, the naming of filter with the filter funcs being called matchers I think is still clear. We could also rename Matchers to FIlters?
Adds a new read bucket Filter that works exclusively on Matchers. This allows for further optimizations by using the Matchers to constrain the bucket walk path (see #3230). Buckets that use Matchers as Mappers have been split as a Mapper and Filter bucket. The method MapPrefix on Mappers has been removed. Matchers no longer implement Mappers.