Class ReducedStateItemStore<V extends HasMetadata>

  • All Implemented Interfaces:
    ItemStore<V>

    public class ReducedStateItemStore<V extends 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.
    • 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.KeyState should match the keyFunction provided to the informer.

        Parameters:
        keyState - information about the key fields/function
        typeClass - the expected type
        valueFields - the additional fields to save