Interface ReadOnlyBroadcastState<K,​V>

  • Type Parameters:
    K - The key type of the elements in the ReadOnlyBroadcastState.
    V - The value type of the elements in the ReadOnlyBroadcastState.
    All Superinterfaces:
    State
    All Known Subinterfaces:
    BroadcastState<K,​V>

    @PublicEvolving
    public interface ReadOnlyBroadcastState<K,​V>
    extends State
    A read-only view of the BroadcastState.

    Although read-only, the user code should not modify the value returned by the get(Object) or the entries of the immutable iterator returned by the immutableEntries(), as this can lead to inconsistent states. The reason for this is that we do not create extra copies of the elements for performance reasons.

    • Method Detail

      • get

        V get​(K key)
        throws Exception
        Returns the current value associated with the given key.

        The user code must not modify the value returned, as this can lead to inconsistent states.

        Parameters:
        key - The key of the mapping
        Returns:
        The value of the mapping with the given key
        Throws:
        Exception - Thrown if the system cannot access the state.
      • contains

        boolean contains​(K key)
                  throws Exception
        Returns whether there exists the given mapping.
        Parameters:
        key - The key of the mapping
        Returns:
        True if there exists a mapping whose key equals to the given key
        Throws:
        Exception - Thrown if the system cannot access the state.
      • immutableEntries

        Iterable<Map.Entry<K,​V>> immutableEntries()
                                                 throws Exception
        Returns an immutable Iterable over the entries in the state.

        The user code must not modify the entries of the returned immutable iterator, as this can lead to inconsistent states.

        Throws:
        Exception