Modifier and Type | Field and Description |
---|---|
static String |
NAMESPACE_INDEX |
Constructor and Description |
---|
Cache() |
Cache(String indexName,
Function<T,List<String>> indexFunc,
Function<T,String> keyFunc) |
Modifier and Type | Method and Description |
---|---|
void |
add(T obj)
Add objects
|
void |
addIndexers(Map<String,Function<T,List<String>>> indexersNew)
Add additional indexers to the store.
|
void |
addIndexFunc(String indexName,
Function<T,List<String>> indexFunc)
Add index func.
|
List<T> |
byIndex(String indexName,
String indexKey)
By index list
|
void |
delete(T obj)
Delete the object.
|
static <T> String |
deletionHandlingMetaNamespaceKeyFunc(T object)
Checks for DeletedFinalStateUnknown objects before calling metaNamespaceKeyFunc
|
T |
get(T obj)
Get object
|
T |
getByKey(String key)
Gets get by key.
|
Map<String,Function<T,List<String>>> |
getIndexers()
Returns the indexers registered with the cache.
|
List<T> |
index(String indexName,
Object obj)
Get objects
|
List<String> |
indexKeys(String indexName,
String indexKey)
Index keys list
|
void |
isPopulated(boolean isPopulated)
Updates the status of cache in case of any API error from Kubernetes server
|
List<T> |
list()
List all objects in the cache.
|
List<String> |
listKeys()
List keys
|
static List<String> |
metaNamespaceIndexFunc(Object obj)
It is a default index function that indexes based on an object's namespace
|
static String |
metaNamespaceKeyFunc(Object obj)
It's is a convenient default KeyFunc which know show to make keys for API
objects which implement HasMetadata interface.
|
static String |
namespaceKeyFunc(String objectNamespace,
String objectName)
Default index function that indexes based on an object's namespace and name.
|
void |
replace(List<T> list,
String resourceVersion)
Replace the content in the cache completely.
|
void |
resync()
Resync
|
void |
update(T obj)
Update the object.
|
void |
updateIndices(T oldObj,
T newObj,
String key)
UpdateIndices modifies the objects location in the managed indexes, if there is
an update, you must provide an oldObj
|
public static final String NAMESPACE_INDEX
public void add(T obj)
public Map<String,Function<T,List<String>>> getIndexers()
getIndexers
in interface Indexer<T>
public void addIndexers(Map<String,Function<T,List<String>>> indexersNew)
Indexer
addIndexers
in interface Indexer<T>
indexersNew
- indexers to addpublic void update(T obj)
public void delete(T obj)
public void replace(List<T> list, String resourceVersion)
public void isPopulated(boolean isPopulated)
Store
isPopulated
in interface Store<T>
isPopulated
- boolean value indicating whether cache is populated or notpublic void updateIndices(T oldObj, T newObj, String key)
oldObj
- old objectnewObj
- new objectkey
- the keypublic void addIndexFunc(String indexName, Function<T,List<String>> indexFunc)
indexName
- the index nameindexFunc
- the index funcpublic static <T> String deletionHandlingMetaNamespaceKeyFunc(T object)
T
- object typeobject
- the specific objectpublic static String metaNamespaceKeyFunc(Object obj)
obj
- specific objectpublic static String namespaceKeyFunc(String objectNamespace, String objectName)
metaNamespaceKeyFunc(java.lang.Object)
Copyright © 2015–2022 Red Hat. All rights reserved.