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:
k8s-merge-robot 2016-06-28 06:28:40 -07:00 committed by GitHub
commit cc91e7943a

View File

@ -44,6 +44,7 @@ type SharedInformer interface {
GetController() ControllerInterface
Run(stopCh <-chan struct{})
HasSynced() bool
LastSyncResourceVersion() string
}
type SharedIndexInformer interface {
@ -161,6 +162,16 @@ func (s *sharedIndexInformer) HasSynced() bool {
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 {
return s.indexer
}