type Store … type KeyFunc … type KeyError … // Error gives a human-readable description of the error. func (k KeyError) Error() string { … } // Unwrap implements errors.Unwrap func (k KeyError) Unwrap() error { … } type ExplicitKey … // MetaNamespaceKeyFunc is a convenient default KeyFunc which knows how to make // keys for API objects which implement meta.Interface. // The key uses the format <namespace>/<name> unless <namespace> is empty, then // it's just <name>. // // Clients that want a structured alternative can use ObjectToName or MetaObjectToName. // Note: this would not be a client that wants a key for a Store because those are // necessarily strings. // // TODO maybe some day?: change Store to be keyed differently func MetaNamespaceKeyFunc(obj interface{ … } // ObjectToName returns the structured name for the given object, // if indeed it can be viewed as a metav1.Object. func ObjectToName(obj interface{ … } // MetaObjectToName returns the structured name for the given object func MetaObjectToName(obj metav1.Object) ObjectName { … } // SplitMetaNamespaceKey returns the namespace and name that // MetaNamespaceKeyFunc encoded into key. // // TODO: replace key-as-string with a key-as-struct so that this // packing/unpacking won't be necessary. func SplitMetaNamespaceKey(key string) (namespace, name string, err error) { … } type cache … var _ … // Add inserts an item into the cache. func (c *cache) Add(obj interface{ … } // Update sets an item in the cache to its updated state. func (c *cache) Update(obj interface{ … } // Delete removes an item from the cache. func (c *cache) Delete(obj interface{ … } // List returns a list of all the items. // List is completely threadsafe as long as you treat all items as immutable. func (c *cache) List() []interface{ … } // ListKeys returns a list of all the keys of the objects currently // in the cache. func (c *cache) ListKeys() []string { … } // GetIndexers returns the indexers of cache func (c *cache) GetIndexers() Indexers { … } // Index returns a list of items that match on the index function // Index is thread-safe so long as you treat all items as immutable func (c *cache) Index(indexName string, obj interface{ … } // 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) { … } // ListIndexFuncValues returns the list of generated values of an Index func func (c *cache) ListIndexFuncValues(indexName string) []string { … } // 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{ … } func (c *cache) AddIndexers(newIndexers Indexers) error { … } // Get returns the requested item, or sets exists=false. // Get is completely threadsafe as long as you treat all items as immutable. func (c *cache) Get(obj interface{ … } // GetByKey returns the request item, or exists=false. // GetByKey is completely threadsafe as long as you treat all items as immutable. func (c *cache) GetByKey(key string) (item interface{ … } // Replace will delete the contents of 'c', using instead the given list. // 'c' takes ownership of the list, you should not reference the list again // after calling this function. func (c *cache) Replace(list []interface{ … } // Resync is meaningless for one of these func (c *cache) Resync() error { … } // NewStore returns a Store implemented simply with a map and a lock. func NewStore(keyFunc KeyFunc) Store { … } // NewIndexer returns an Indexer implemented simply with a map and a lock. func NewIndexer(keyFunc KeyFunc, indexers Indexers) Indexer { … }