@@ -76,14 +76,13 @@ type OperatorCacheProvider interface {
76
76
}
77
77
78
78
type Cache struct {
79
- logger logrus.StdLogger
80
- sp SourceProvider
81
- catsrcLister v1alpha1.CatalogSourceLister
82
- snapshots map [SourceKey ]* snapshotHeader
83
- ttl time.Duration
84
- sem chan struct {}
85
- m sync.RWMutex
86
- globalFilters []Predicate
79
+ logger logrus.StdLogger
80
+ sp SourceProvider
81
+ catsrcLister v1alpha1.CatalogSourceLister
82
+ snapshots map [SourceKey ]* snapshotHeader
83
+ ttl time.Duration
84
+ sem chan struct {}
85
+ m sync.RWMutex
87
86
}
88
87
89
88
type catalogSourcePriority int
@@ -104,12 +103,6 @@ func WithCatalogSourceLister(catalogSourceLister v1alpha1.CatalogSourceLister) O
104
103
}
105
104
}
106
105
107
- func WithGlobalFilters (globalFilters ... Predicate ) Option {
108
- return func (c * Cache ) {
109
- c .globalFilters = globalFilters
110
- }
111
- }
112
-
113
106
func New (sp SourceProvider , options ... Option ) * Cache {
114
107
const (
115
108
MaxConcurrentSnapshotUpdates = 4
@@ -121,12 +114,11 @@ func New(sp SourceProvider, options ...Option) *Cache {
121
114
logger .SetOutput (io .Discard )
122
115
return logger
123
116
}(),
124
- sp : sp ,
125
- catsrcLister : operatorlister .NewLister ().OperatorsV1alpha1 ().CatalogSourceLister (),
126
- snapshots : make (map [SourceKey ]* snapshotHeader ),
127
- ttl : 5 * time .Minute ,
128
- sem : make (chan struct {}, MaxConcurrentSnapshotUpdates ),
129
- globalFilters : make ([]Predicate , 0 ),
117
+ sp : sp ,
118
+ catsrcLister : operatorlister .NewLister ().OperatorsV1alpha1 ().CatalogSourceLister (),
119
+ snapshots : make (map [SourceKey ]* snapshotHeader ),
120
+ ttl : 5 * time .Minute ,
121
+ sem : make (chan struct {}, MaxConcurrentSnapshotUpdates ),
130
122
}
131
123
132
124
for _ , opt := range options {
@@ -137,9 +129,8 @@ func New(sp SourceProvider, options ...Option) *Cache {
137
129
}
138
130
139
131
type NamespacedOperatorCache struct {
140
- existing * SourceKey
141
- snapshots map [SourceKey ]* snapshotHeader
142
- globalFilters []Predicate
132
+ existing * SourceKey
133
+ snapshots map [SourceKey ]* snapshotHeader
143
134
}
144
135
145
136
func (c * NamespacedOperatorCache ) Error () error {
@@ -174,8 +165,7 @@ func (c *Cache) Namespaced(namespaces ...string) MultiCatalogOperatorFinder {
174
165
sources := c .sp .Sources (namespaces ... )
175
166
176
167
result := NamespacedOperatorCache {
177
- snapshots : make (map [SourceKey ]* snapshotHeader ),
178
- globalFilters : c .globalFilters ,
168
+ snapshots : make (map [SourceKey ]* snapshotHeader ),
179
169
}
180
170
181
171
var misses []SourceKey
@@ -277,10 +267,6 @@ func (c *NamespacedOperatorCache) FindPreferred(preferred *SourceKey, preferredN
277
267
preferred = nil
278
268
}
279
269
280
- if c .globalFilters != nil {
281
- p = append (p , c .globalFilters ... )
282
- }
283
-
284
270
sorted := newSortableSnapshots (c .existing , preferred , preferredNamespace , c .snapshots )
285
271
sort .Sort (sorted )
286
272
for _ , snapshot := range sorted .snapshots {
0 commit comments