-
Notifications
You must be signed in to change notification settings - Fork 12
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
filter remove all #145
filter remove all #145
Conversation
/// Removes all types from the mapping of denied types | ||
/// | ||
pub fun removeAllTypes() { | ||
for type in self.deniedTypes.keys { |
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.
Should we instead make deniedTypes
a var and just set it to an empty array?
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.
will that be backward compatible change
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.
also the events might be nice to have?
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.
we can probably have an event that says types cleared to make it more efficient. and lemme check if it's a backward compatible change, my gut says no
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.
will that be backward compatible change
I believe changing let
to var
is an an upgradable change yes
also the events might be nice to have?
👍 Sure, totally fine to add events. That might require some discussion so if you need some way to remove types right now for testing purposes, I'd split them up.
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.
is it worth it to do the let/var change if we want to iterate through every key to emit each event?
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.
Will it be helpful for each removed type to be included in its own event or could we emit an array of removed types? If the latter, I think we could use the same event for both removal operations and just emit the dict keys
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.
Emitting an array is what I was thinking, yeah. It depends on what kinds of events you're thinking about @rrrkren. Is there any high-level thought on that yet that we can use to think through this?
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.
this is what we are doing right now to reset filters:
let filterDetails = filter.getDetails() as! {String:AnyStruct}
for allowedType in filterDetails["allowedTypes"]! as! [Type]{
filter.removeType(allowedType)
}
I'd prefer to keep this PR as is if possible since it's just a sugared iterate remove all and doesn't require downstream event aggregations to change. Happy to discuss further on the single filter reset event as a follow up.
Checking in on this PR. @rrrkren any updates? If we need to have a quick call to get a plan together for it give me a shout! Happy to do so |
Approved, but looks like we have a failing test to fix: |
var filePath = "" | ||
switch kind { | ||
case FilterKindAllowList: | ||
filePath = "filter/allow/remove_all_types.cdc" |
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.
Looks like the file needs to be renamed - remoe_all_types.cdc
-> remove_all_types.cdc
. Small typo is causing this test case to fail
|
added method
removeAllTypes()
forAllowListFilter
andDenyListFilter