mirror of
https://github.com/minio/minio.git
synced 2025-11-26 12:36:13 -05: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:
@@ -16,23 +16,12 @@
|
||||
|
||||
package event
|
||||
|
||||
import "fmt"
|
||||
|
||||
// TargetIDSet - Set representation of TargetIDs.
|
||||
type TargetIDSet map[TargetID]struct{}
|
||||
|
||||
// ToSlice - returns TargetID slice from TargetIDSet.
|
||||
func (set TargetIDSet) ToSlice() []TargetID {
|
||||
keys := make([]TargetID, 0, len(set))
|
||||
for k := range set {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
return keys
|
||||
}
|
||||
|
||||
// String - returns string representation.
|
||||
func (set TargetIDSet) String() string {
|
||||
return fmt.Sprintf("%v", set.ToSlice())
|
||||
// IsEmpty returns true if the set is empty.
|
||||
func (set TargetIDSet) IsEmpty() bool {
|
||||
return len(set) != 0
|
||||
}
|
||||
|
||||
// Clone - returns copy of this set.
|
||||
|
||||
Reference in New Issue
Block a user