Type Parameters:
V - value type
All Superinterfaces:
Iterable<Map.Entry<IndexKey,V>>
All Known Subinterfaces:
ModifiableIndex<V>, UpdatableIndex<V>

public interface Index<V> extends Iterable<Map.Entry<IndexKey,V>>
General interface for all store indexes.

Indexes provide lexicographically ordered access to the index keys/elements via the iterator functions. Reverse iterator functions provide reverse lexicographically ordered access.

Instances of this interface are generally not thread-safe when modified, read-only accesses are generally thread-safe.

See Also:
  • Method Details

    • empty

      static <V> Index<V> empty()
      Retrieves a read-only, empty index.
    • prefetchIfNecessary

      void prefetchIfNecessary(Iterable<IndexKey> keys)
      Prefetch this index and/or index splits that are needed to satisfy operations against the given keys.
    • contains

      boolean contains(IndexKey key)
      Check whether the index contains the given key and whether its value is not null.
    • get

      @Nullable V get(@Nonnull IndexKey key)
      Retrieve the value for a key.
      Parameters:
      key - key to retrieve the value for
      Returns:
      value or null, if the key does not exist
    • iterator

      @Nonnull default Iterator<Map.Entry<IndexKey,V>> iterator()
      Specified by:
      iterator in interface Iterable<V>
      See Also:
    • iterator

      @Nonnull Iterator<Map.Entry<IndexKey,V>> iterator(@Nullable IndexKey lower, @Nullable IndexKey higher, boolean prefetch)
      Iterate over the elements in this index, with optional lower/higher or prefix restrictions.

      Prefix queries: lower and higher must be equal and not null, only elements that start with the given key value will be returned.

      Start at queries: Start at lower (inclusive)

      End at queries: End at higher (inclusive if exact match) restrictions

      Range queries: lower (inclusive) and higher (inclusive if exact match) restrictions

      Parameters:
      lower - optional lower bound for the range, see description above..
      higher - optional higher bound for the range, see description above..
      prefetch - Enables eager prefetch of all potentially required indexes. Set to false, when using result paging.
      Returns:
      iterator over the elements in this index, lexicographically ordered.
      See Also:
    • reverseIterator

      @Nonnull default Iterator<Map.Entry<IndexKey,V>> reverseIterator()
      See Also:
    • reverseIterator

      @Nonnull Iterator<Map.Entry<IndexKey,V>> reverseIterator(@Nullable IndexKey lower, @Nullable IndexKey higher, boolean prefetch)
      Iterate in reverse order over the elements in this index, with optional lower/higher or prefix restrictions.

      Prefix queries (NOT SUPPORTED, YET?): lower and higher must be equal and not null, only elements that start with the given key value will be returned.

      Start at queries: Start at higher (inclusive)

      End at queries: End at lower (inclusive if exact match) restrictions

      Range queries: higher (inclusive) and lower (inclusive if exact match) restrictions

      Parameters:
      lower - optional lower bound for the range, see description above..
      higher - optional higher bound for the range, see description above..
      prefetch - Enables eager prefetch of all potentially required indexes. Set to false, when using result paging.
      Returns:
      iterator over the elements in this index, reverse-lexicographically ordered.
      See Also: