@@ -91,6 +91,10 @@ type watchCacheInterval struct {
91
91
// lock on each invocation of Next().
92
92
buffer * watchCacheIntervalBuffer
93
93
94
+ // resourceVersion is the resourceVersion from which
95
+ // the interval was constructed.
96
+ resourceVersion uint64
97
+
94
98
// lock effectively protects access to the underlying source
95
99
// of events through - indexer and indexValidator.
96
100
//
@@ -103,14 +107,15 @@ type attrFunc func(runtime.Object) (labels.Set, fields.Set, error)
103
107
type indexerFunc func (int ) * watchCacheEvent
104
108
type indexValidator func (int ) bool
105
109
106
- func newCacheInterval (startIndex , endIndex int , indexer indexerFunc , indexValidator indexValidator , locker sync.Locker ) * watchCacheInterval {
110
+ func newCacheInterval (startIndex , endIndex int , indexer indexerFunc , indexValidator indexValidator , resourceVersion uint64 , locker sync.Locker ) * watchCacheInterval {
107
111
return & watchCacheInterval {
108
- startIndex : startIndex ,
109
- endIndex : endIndex ,
110
- indexer : indexer ,
111
- indexValidator : indexValidator ,
112
- buffer : & watchCacheIntervalBuffer {buffer : make ([]* watchCacheEvent , bufferSize )},
113
- lock : locker ,
112
+ startIndex : startIndex ,
113
+ endIndex : endIndex ,
114
+ indexer : indexer ,
115
+ indexValidator : indexValidator ,
116
+ buffer : & watchCacheIntervalBuffer {buffer : make ([]* watchCacheEvent , bufferSize )},
117
+ resourceVersion : resourceVersion ,
118
+ lock : locker ,
114
119
}
115
120
}
116
121
@@ -172,8 +177,9 @@ func newCacheIntervalFromStore(resourceVersion uint64, store storeIndexer, getAt
172
177
ci := & watchCacheInterval {
173
178
startIndex : 0 ,
174
179
// Simulate that we already have all the events we're looking for.
175
- endIndex : 0 ,
176
- buffer : buffer ,
180
+ endIndex : 0 ,
181
+ buffer : buffer ,
182
+ resourceVersion : resourceVersion ,
177
183
}
178
184
179
185
return ci , nil
0 commit comments