Class ReducedStateItemStore<V extends io.fabric8.kubernetes.api.model.HasMetadata>

  • 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.
    • 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
    • Method Detail

      • put

        public V put​(String key,
                     V obj)
        Specified by:
        put in interface ItemStore<V extends io.fabric8.kubernetes.api.model.HasMetadata>
      • remove

        public V remove​(String key)
        Specified by:
        remove in interface ItemStore<V extends io.fabric8.kubernetes.api.model.HasMetadata>
      • keySet

        public Stream<String> keySet()
        Specified by:
        keySet in interface ItemStore<V extends io.fabric8.kubernetes.api.model.HasMetadata>
      • values

        public Stream<V> values()
        Specified by:
        values in interface ItemStore<V extends io.fabric8.kubernetes.api.model.HasMetadata>
      • get

        public V get​(String key)
        Specified by:
        get in interface ItemStore<V extends io.fabric8.kubernetes.api.model.HasMetadata>
      • getResourceVersion

        public String getResourceVersion​(String key)
      • size

        public int size()
        Specified by:
        size in interface ItemStore<V extends io.fabric8.kubernetes.api.model.HasMetadata>
      • getKey

        public String getKey​(V obj)
        Specified by:
        getKey in interface ItemStore<V extends io.fabric8.kubernetes.api.model.HasMetadata>
      • isFullState

        public boolean isFullState()
        Description copied from interface: ItemStore
        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.
        If false, then the initial add events must be processed as they occur - meaning that the store state may not be complete.
        Specified by:
        isFullState in interface ItemStore<V extends io.fabric8.kubernetes.api.model.HasMetadata>
        Returns: