mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
Merge pull request #130752 from serathius/watchcache-simplify-delagate
Simplify shouldDelegateList
This commit is contained in:
commit
2e9bb32ee8
@ -249,14 +249,12 @@ func shouldDelegateList(opts storage.ListOptions) bool {
|
|||||||
case metav1.ResourceVersionMatchExact:
|
case metav1.ResourceVersionMatchExact:
|
||||||
return true
|
return true
|
||||||
case metav1.ResourceVersionMatchNotOlderThan:
|
case metav1.ResourceVersionMatchNotOlderThan:
|
||||||
|
return false
|
||||||
case "":
|
case "":
|
||||||
// Legacy exact match
|
// Legacy exact match
|
||||||
if opts.Predicate.Limit > 0 && len(opts.ResourceVersion) > 0 && opts.ResourceVersion != "0" {
|
if opts.Predicate.Limit > 0 && len(opts.ResourceVersion) > 0 && opts.ResourceVersion != "0" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
// Continue
|
// Continue
|
||||||
if len(opts.Predicate.Continue) > 0 {
|
if len(opts.Predicate.Continue) > 0 {
|
||||||
return true
|
return true
|
||||||
@ -268,6 +266,9 @@ func shouldDelegateList(opts storage.ListOptions) bool {
|
|||||||
return !consistentListFromCacheEnabled || !requestWatchProgressSupported
|
return !consistentListFromCacheEnabled || !requestWatchProgressSupported
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
default:
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CacheDelegator) GuaranteedUpdate(ctx context.Context, key string, destination runtime.Object, ignoreNotFound bool, preconditions *storage.Preconditions, tryUpdate storage.UpdateFunc, cachedExistingObject runtime.Object) error {
|
func (c *CacheDelegator) GuaranteedUpdate(ctx context.Context, key string, destination runtime.Object, ignoreNotFound bool, preconditions *storage.Preconditions, tryUpdate storage.UpdateFunc, cachedExistingObject runtime.Object) error {
|
||||||
|
@ -169,14 +169,12 @@ func shouldListFromStorage(query url.Values, opts *metav1.ListOptions) bool {
|
|||||||
case metav1.ResourceVersionMatchExact:
|
case metav1.ResourceVersionMatchExact:
|
||||||
return true
|
return true
|
||||||
case metav1.ResourceVersionMatchNotOlderThan:
|
case metav1.ResourceVersionMatchNotOlderThan:
|
||||||
|
return false
|
||||||
case "":
|
case "":
|
||||||
// Legacy exact match
|
// Legacy exact match
|
||||||
if opts.Limit > 0 && len(opts.ResourceVersion) > 0 && opts.ResourceVersion != "0" {
|
if opts.Limit > 0 && len(opts.ResourceVersion) > 0 && opts.ResourceVersion != "0" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
// Continue
|
// Continue
|
||||||
if len(opts.Continue) > 0 {
|
if len(opts.Continue) > 0 {
|
||||||
return true
|
return true
|
||||||
@ -188,4 +186,7 @@ func shouldListFromStorage(query url.Values, opts *metav1.ListOptions) bool {
|
|||||||
return !consistentListFromCacheEnabled || !requestWatchProgressSupported
|
return !consistentListFromCacheEnabled || !requestWatchProgressSupported
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
default:
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user