Interface KeyValueTableMap<KeyT,​ValueT>

  • Type Parameters:
    KeyT - Table Key Type.
    ValueT - Table Value Type.
    All Superinterfaces:
    java.util.Map<KeyT,​ValueT>

    public interface KeyValueTableMap<KeyT,​ValueT>
    extends java.util.Map<KeyT,​ValueT>
    Map implementation for a KeyValueTable's Key Family.

    All methods inherited from Map respect the contracts defined in that interface, except as noted below.

    Performance considerations:

    • The Map interface defines synchronous operations, however KeyValueTable defines async operations. All method implementations defined in this interface or inherited from Map invoke CompletableFuture.join() on any KeyValueTable methods invoked. This means that two threads are used to fulfill these calls: one from the Executor passed in to the KeyValueTable factory, and one on which this request is executing.
    • The following operations result in a single call to the wrapped KeyValueTable:
      • Map.containsKey(java.lang.Object).
      • Map.get(java.lang.Object), Map.getOrDefault(java.lang.Object, V).
      • putDirect(KeyT, ValueT), Map.putAll(java.util.Map<? extends K, ? extends V>), Map.putIfAbsent(K, V).
      • removeDirect(KeyT).
      • Map.isEmpty() (Invokes KeyValueTable.keyIterator(java.lang.String, int, io.pravega.client.tables.IteratorState) and requests a single item).
      • Map.keySet(): Set.removeAll(java.util.Collection<?>), Set.contains(java.lang.Object), Set.containsAll(java.util.Collection<?>), Set.isEmpty().
      • Map.entrySet(): Set.contains(java.lang.Object), Set.containsAll(java.util.Collection<?>), Set.isEmpty(), Set.add(E), Set.addAll(java.util.Collection<? extends E>).
    • The following operations result up to two calls to the wrapped KeyValueTable:
      • Map.put(K, V) (refer to {putDirect(KeyT, ValueT) if the old value is not needed).
      • Map.replace(K, V, V).
      • Map.remove(java.lang.Object) (refer to removeDirect(KeyT) if the old value is not needed).
      • Map.computeIfPresent(K, java.util.function.BiFunction<? super K, ? super V, ? extends V>), Map.compute(K, java.util.function.BiFunction<? super K, ? super V, ? extends V>)}, Map.computeIfAbsent(K, java.util.function.Function<? super K, ? extends V>).
      • Map.keySet()Set.remove(java.lang.Object).
      • Map.entrySet(): Set.removeAll(java.util.Collection<?>), Set.isEmpty().
    • The following operations may result in iterating through all the Keys using KeyValueTable.keyIterator(java.lang.String, int, io.pravega.client.tables.IteratorState):
    • The following operations may result in iterating through all the Entries using KeyValueTable.entryIterator(java.lang.String, int, io.pravega.client.tables.IteratorState):
      • Map.containsValue(java.lang.Object).
      • Map.replaceAll(java.util.function.BiFunction<? super K, ? super V, ? extends V>) (which makes multiple calls to KeyValueTable.putAll(java.lang.String, java.lang.Iterable<java.util.Map.Entry<KeyT, ValueT>>) as well).
      • Map.entrySet()Set.iterator() (Iterates as Iterator.hasNext() or Iterator.next() are invoked. Calls to Iterator.remove() will result in a single call to KeyValueTable).
      • Map.entrySet(): Collection.removeIf(java.util.function.Predicate<? super E>), Set.retainAll(java.util.Collection<?>)
      • All operations on Map.values().
    • Invocations of Collection.stream()}, Collection.spliterator() or Collection.toArray() on Map.keySet(), Map.entrySet() or Map.values() will invoke those collections' iterators (see above).

    If getKeyFamily() is null), the following operations are not supported and will throw throw UnsupportedOperationException).

    • Map.containsValue(java.lang.Object).
    • Map.putAll(java.util.Map<? extends K, ? extends V>).
    • Map.replaceAll(java.util.function.BiFunction<? super K, ? super V, ? extends V>).
    • Map.keySet().
    • Map.values().
    • Map.entrySet().
    • Map.size().
    • Map.isEmpty().
    • Map.clear().
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String getKeyFamily()
      Gets the Key Family over which this KeyValueTableMap applies.
      void putDirect​(KeyT key, ValueT value)
      Same as Map.put(K, V), but does not attempt to retrieve the existing value.
      void removeDirect​(KeyT key)
      Same as Map.remove(java.lang.Object), but does not attempt to retrieve the existing value.
      • Methods inherited from interface java.util.Map

        clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
    • Method Detail

      • getKeyFamily

        java.lang.String getKeyFamily()
        Gets the Key Family over which this KeyValueTableMap applies.
        Returns:
        The Key Family, or null if operating over Keys with no Key Family.
      • putDirect

        void putDirect​(@NonNull
                       KeyT key,
                       @NonNull
                       ValueT value)
        Same as Map.put(K, V), but does not attempt to retrieve the existing value. Results in a single call to the wrapped KeyValueTable.
        Parameters:
        key - The Key to insert or update.
        value - The value to associate with the key.
      • removeDirect

        void removeDirect​(@NonNull
                          KeyT key)
        Same as Map.remove(java.lang.Object), but does not attempt to retrieve the existing value. Results in a single call to the wrapped KeyValueTable.
        Parameters:
        key - The key to remove.