Merge pull request #109632 from weilaaa/recorrect_byindex_input_param

correct input params of ByIndex

Kubernetes-commit: e2fe430da77da01aa5b4c9bd787d46062f1500a0
This commit is contained in:
Kubernetes Publisher
2022-06-22 09:29:43 -07:00
5 changed files with 16 additions and 11 deletions

4
go.mod
View File

@@ -25,7 +25,7 @@ require (
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8
google.golang.org/protobuf v1.27.1
k8s.io/api v0.0.0-20220614194929-edebc6706dde
k8s.io/apimachinery v0.0.0-20220614194717-c5be38573c73
k8s.io/apimachinery v0.0.0-20220616034651-eda93e06cb1f
k8s.io/klog/v2 v2.60.1
k8s.io/kube-openapi v0.0.0-20220603121420-31174f50af60
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
@@ -64,5 +64,5 @@ require (
replace (
k8s.io/api => k8s.io/api v0.0.0-20220614194929-edebc6706dde
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20220614194717-c5be38573c73
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20220616034651-eda93e06cb1f
)

4
go.sum
View File

@@ -515,8 +515,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
k8s.io/api v0.0.0-20220614194929-edebc6706dde h1:uI3Bauw5zHxpzCFMum9XlALU5iK37yEiAZgKdVUQHGA=
k8s.io/api v0.0.0-20220614194929-edebc6706dde/go.mod h1:GLhFhgtyTRwgH456jroUFHnl0QFlRJ7RFJ41U7TgOZc=
k8s.io/apimachinery v0.0.0-20220614194717-c5be38573c73 h1:EBei3PXKAoJZbqTqFYcQVh/wJcgXA/X1w7m8tBDyi3s=
k8s.io/apimachinery v0.0.0-20220614194717-c5be38573c73/go.mod h1:iknpugsBdD8jeaGNZyi85Q334Mj3GFqi1SEHEEB/KQM=
k8s.io/apimachinery v0.0.0-20220616034651-eda93e06cb1f h1:XSjJx9SuLxYZcRoMVZBMbkv25AYGPXfoAIHTeeUA+RY=
k8s.io/apimachinery v0.0.0-20220616034651-eda93e06cb1f/go.mod h1:iknpugsBdD8jeaGNZyi85Q334Mj3GFqi1SEHEEB/KQM=
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=

View File

@@ -47,7 +47,7 @@ type Indexer interface {
// ByIndex returns the stored objects whose set of indexed values
// for the named index includes the given indexed value
ByIndex(indexName, indexedValue string) ([]interface{}, error)
// GetIndexer return the indexers
// GetIndexers return the indexers
GetIndexers() Indexers
// AddIndexers adds more indexers to this store. If you call this after you already have data

13
tools/cache/store.go vendored
View File

@@ -199,8 +199,11 @@ func (c *cache) Index(indexName string, obj interface{}) ([]interface{}, error)
return c.cacheStorage.Index(indexName, obj)
}
func (c *cache) IndexKeys(indexName, indexKey string) ([]string, error) {
return c.cacheStorage.IndexKeys(indexName, indexKey)
// IndexKeys returns the storage keys of the stored objects whose set of
// indexed values for the named index includes the given indexed value.
// The returned keys are suitable to pass to GetByKey().
func (c *cache) IndexKeys(indexName, indexedValue string) ([]string, error) {
return c.cacheStorage.IndexKeys(indexName, indexedValue)
}
// ListIndexFuncValues returns the list of generated values of an Index func
@@ -208,8 +211,10 @@ func (c *cache) ListIndexFuncValues(indexName string) []string {
return c.cacheStorage.ListIndexFuncValues(indexName)
}
func (c *cache) ByIndex(indexName, indexKey string) ([]interface{}, error) {
return c.cacheStorage.ByIndex(indexName, indexKey)
// ByIndex returns the stored objects whose set of indexed values
// for the named index includes the given indexed value.
func (c *cache) ByIndex(indexName, indexedValue string) ([]interface{}, error) {
return c.cacheStorage.ByIndex(indexName, indexedValue)
}
func (c *cache) AddIndexers(newIndexers Indexers) error {

View File

@@ -47,9 +47,9 @@ type ThreadSafeStore interface {
ListKeys() []string
Replace(map[string]interface{}, string)
Index(indexName string, obj interface{}) ([]interface{}, error)
IndexKeys(indexName, indexKey string) ([]string, error)
IndexKeys(indexName, indexedValue string) ([]string, error)
ListIndexFuncValues(name string) []string
ByIndex(indexName, indexKey string) ([]interface{}, error)
ByIndex(indexName, indexedValue string) ([]interface{}, error)
GetIndexers() Indexers
// AddIndexers adds more indexers to this store. If you call this after you already have data