Interface Store<T>

  • Type Parameters:
    T - resource
    All Known Subinterfaces:
    Cache<T>, Indexer<T>

    public interface Store<T>
    Store is a generic object storage interface. Reflector knows how to watch a server and update a store. A generic store is provided, which allows Reflector to be used as a local caching system, and an Least Recently Used store, which allows Reflector to work like a queue of items yet to be processed. It makes no assumptions about the stored object identity; it is the responsibility of a Store implementation to provide a mechanism to correctly key objects and to define the contract for obtaining objects by some arbitrary key type. This is ported from official go client: https://github.com/kubernetes/client-go/blob/master/tools/cache/store.go
    Refactored to only expose read methods
    • Method Detail

      • list

        List<T> list()
        Returns a list of all the items.
        Returns:
        list of all items
      • listKeys

        List<String> listKeys()
        returns a list of all keys of the object currently in the store.
        Returns:
        list of all keys
      • get

        T get​(T object)
        Returns the requested item.
        Parameters:
        object - object
        Returns:
        requested item if exists.
      • getByKey

        T getByKey​(String key)
        Returns the request item with specific key.
        Parameters:
        key - specific key
        Returns:
        the requested item
      • getKey

        String getKey​(T object)
        Use the key function to extract the object's key.
        Parameters:
        object - object
        Returns:
        the key