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

Separate matchers as a bucket filter #3229

Merged
merged 4 commits into from
Aug 21, 2024
Merged

Separate matchers as a bucket filter #3229

merged 4 commits into from
Aug 21, 2024

Conversation

emcfarlane
Copy link
Contributor

@emcfarlane emcfarlane commented Aug 12, 2024

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.

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.
Copy link
Contributor

github-actions bot commented Aug 12, 2024

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedAug 21, 2024, 7:59 PM

// 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)
Copy link
Contributor Author

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 Matchers 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.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed, Matchers no longer implement Mappers.

//
// 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 {
Copy link
Contributor Author

@emcfarlane emcfarlane Aug 12, 2024

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?

@emcfarlane emcfarlane changed the title Separate matchers to new storage filter Separate matchers as a bucket filter Aug 12, 2024
@emcfarlane emcfarlane merged commit bc5ed90 into main Aug 21, 2024
16 checks passed
@emcfarlane emcfarlane deleted the ed/splitMapper branch August 21, 2024 19:58
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