diff --git a/go.mod b/go.mod index b3c82dec..0a4575d1 100644 --- a/go.mod +++ b/go.mod @@ -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 ) diff --git a/go.sum b/go.sum index 3cce31df..b6a7460f 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/tools/cache/index.go b/tools/cache/index.go index 1d6aae56..c6af49d8 100644 --- a/tools/cache/index.go +++ b/tools/cache/index.go @@ -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 diff --git a/tools/cache/store.go b/tools/cache/store.go index 24ffabab..5308ea74 100644 --- a/tools/cache/store.go +++ b/tools/cache/store.go @@ -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 { diff --git a/tools/cache/thread_safe_store.go b/tools/cache/thread_safe_store.go index 6d58c0d6..1182ea14 100644 --- a/tools/cache/thread_safe_store.go +++ b/tools/cache/thread_safe_store.go @@ -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