Class ReducedStateItemStore<V extends io.fabric8.kubernetes.api.model.HasMetadata>
- java.lang.Object
-
- io.fabric8.kubernetes.client.informers.cache.ReducedStateItemStore<V>
-
- All Implemented Interfaces:
ItemStore<V>
public class ReducedStateItemStore<V extends io.fabric8.kubernetes.api.model.HasMetadata> extends Object implements ItemStore<V>
By default an informer stores every item that exists in memory. If that is too much memory for your application, you may instead reduce what is actually stored by using this item store.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classReducedStateItemStore.KeyState
-
Field Summary
Fields Modifier and Type Field Description static ReducedStateItemStore.KeyStateNAME_KEY_STATEstatic ReducedStateItemStore.KeyStateUID_KEY_STATE
-
Constructor Summary
Constructors Constructor Description ReducedStateItemStore(ReducedStateItemStore.KeyState keyState, Class<V> typeClass, KubernetesSerialization serialization, String... valueFields)Create a state store with only the fields specified.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Vget(String key)StringgetKey(V obj)StringgetResourceVersion(String key)booleanisFullState()Used to determine if initial add events can be deferred until the entire list operation has completed - when using a limit it may take several batches to complete.Stream<String>keySet()Vput(String key, V obj)Vremove(String key)intsize()Stream<V>values()
-
-
-
Field Detail
-
NAME_KEY_STATE
public static final ReducedStateItemStore.KeyState NAME_KEY_STATE
-
UID_KEY_STATE
public static final ReducedStateItemStore.KeyState UID_KEY_STATE
-
-
Constructor Detail
-
ReducedStateItemStore
public ReducedStateItemStore(ReducedStateItemStore.KeyState keyState, Class<V> typeClass, KubernetesSerialization serialization, String... valueFields)
Create a state store with only the fields specified.metadata.resourceVersion - will automatically be saved as will the necessary key fields.
If you are using custom indexers, then the fields used by those indexes must be added to the valueFields - otherwise the indexer won't be able to delete the index entries when the item is removed.
For example in level event handling systems all you may need beyond the key is the ownerReferences. You would use withValueFields("metadata.ownerReferences") for that.
NOTE: If you use this feature, you should only use the informer cache/store for basic existence checks and maintain your own cache of full resource objects.
Only simple names are allowed in field paths - '.' is reserved as the separator.
Whatever is provided as the
ReducedStateItemStore.KeyStateshould match the keyFunction provided to the informer.- Parameters:
keyState- information about the key fields/functiontypeClass- the expected typevalueFields- the additional fields to save
-
-
Method Detail
-
size
public int size()
-
isFullState
public boolean isFullState()
Description copied from interface:ItemStoreUsed to determine if initial add events can be deferred until the entire list operation has completed - when using a limit it may take several batches to complete.
If false, then the initial add events must be processed as they occur - meaning that the store state may not be complete.- Specified by:
isFullStatein interfaceItemStore<V extends io.fabric8.kubernetes.api.model.HasMetadata>- Returns:
-
-