mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Merge pull request #27786 from deads2k/last-sync
Automatic merge from submit-queue add lastsyncresourceversion to sharedinformer Indexer consumers can use the `LastSyncResourceVersion` to know if its possible that any change has happened since they last checked. @derekwaynecarr you used this downstream.
This commit is contained in:
commit
cc91e7943a
@ -44,6 +44,7 @@ type SharedInformer interface {
|
|||||||
GetController() ControllerInterface
|
GetController() ControllerInterface
|
||||||
Run(stopCh <-chan struct{})
|
Run(stopCh <-chan struct{})
|
||||||
HasSynced() bool
|
HasSynced() bool
|
||||||
|
LastSyncResourceVersion() string
|
||||||
}
|
}
|
||||||
|
|
||||||
type SharedIndexInformer interface {
|
type SharedIndexInformer interface {
|
||||||
@ -161,6 +162,16 @@ func (s *sharedIndexInformer) HasSynced() bool {
|
|||||||
return s.controller.HasSynced()
|
return s.controller.HasSynced()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *sharedIndexInformer) LastSyncResourceVersion() string {
|
||||||
|
s.startedLock.Lock()
|
||||||
|
defer s.startedLock.Unlock()
|
||||||
|
|
||||||
|
if s.controller == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return s.controller.reflector.LastSyncResourceVersion()
|
||||||
|
}
|
||||||
|
|
||||||
func (s *sharedIndexInformer) GetStore() cache.Store {
|
func (s *sharedIndexInformer) GetStore() cache.Store {
|
||||||
return s.indexer
|
return s.indexer
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user