Allow tracking resource version for reflector store

Kubernetes-commit: 4af1328bb8a3b3eb2289bbbe624480548dd39cdc
This commit is contained in:
wojtekt
2020-08-31 15:58:16 +02:00
committed by Kubernetes Publisher
parent 206f761e8e
commit 866e6a7e3c
2 changed files with 68 additions and 0 deletions

View File

@@ -101,6 +101,15 @@ type Reflector struct {
watchErrorHandler WatchErrorHandler
}
// ResourceVersionUpdater is an interface that allows store implementation to
// track the current resource version of the reflector. This is especially
// important if storage bookmarks are enabled.
type ResourceVersionUpdater interface {
// UpdateResourceVersion is called each time current resource version of the reflector
// is updated.
UpdateResourceVersion(resourceVersion string)
}
// The WatchErrorHandler is called whenever ListAndWatch drops the
// connection with an error. After calling this handler, the informer
// will backoff and retry.
@@ -507,6 +516,9 @@ loop:
}
*resourceVersion = newResourceVersion
r.setLastSyncResourceVersion(newResourceVersion)
if rvu, ok := r.store.(ResourceVersionUpdater); ok {
rvu.UpdateResourceVersion(newResourceVersion)
}
eventCount++
}
}