mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 20:20:25 +03:00
optimize Listen bucket notification implementation (#9444)
this commit avoids lots of tiny allocations, repeated channel creates which are performed when filtering the incoming events, unescaping a key just for matching. also remove deprecated code which is not needed anymore, avoids unexpected data structure transformations from the map to slice.
This commit is contained in:
@@ -53,6 +53,16 @@ func (rules Rules) Add(pattern string, targetID TargetID) {
|
||||
rules[pattern] = NewTargetIDSet(targetID).Union(rules[pattern])
|
||||
}
|
||||
|
||||
// MatchSimple - returns true one of the matching object name in rules.
|
||||
func (rules Rules) MatchSimple(objectName string) bool {
|
||||
for pattern := range rules {
|
||||
if wildcard.MatchSimple(pattern, objectName) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Match - returns TargetIDSet matching object name in rules.
|
||||
func (rules Rules) Match(objectName string) TargetIDSet {
|
||||
targetIDs := NewTargetIDSet()
|
||||
|
||||
Reference in New Issue
Block a user