Interface StateManager


  • @Experimental
    public interface StateManager
    This is responsibility for managing runtime information related to state of process function.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <K> K getCurrentKey()
      Get the key of current record.
      <IN,​ACC,​OUT>
      Optional<org.apache.flink.api.common.state.AggregatingState<IN,​OUT>>
      getState​(org.apache.flink.api.common.state.AggregatingStateDeclaration<IN,​ACC,​OUT> stateDeclaration)
      Get the specific aggregating state.
      <K,​V>
      Optional<org.apache.flink.api.common.state.BroadcastState<K,​V>>
      getState​(org.apache.flink.api.common.state.BroadcastStateDeclaration<K,​V> stateDeclaration)
      Get the specific broadcast state.
      <T> Optional<org.apache.flink.api.common.state.ListState<T>> getState​(org.apache.flink.api.common.state.ListStateDeclaration<T> stateDeclaration)
      Get the specific list state.
      <K,​V>
      Optional<org.apache.flink.api.common.state.MapState<K,​V>>
      getState​(org.apache.flink.api.common.state.MapStateDeclaration<K,​V> stateDeclaration)
      Get the specific map state.
      <T> Optional<org.apache.flink.api.common.state.ReducingState<T>> getState​(org.apache.flink.api.common.state.ReducingStateDeclaration<T> stateDeclaration)
      Get the specific reducing state.
      <T> Optional<org.apache.flink.api.common.state.ValueState<T>> getState​(org.apache.flink.api.common.state.ValueStateDeclaration<T> stateDeclaration)
      Get the specific value state.
    • Method Detail

      • getCurrentKey

        <K> K getCurrentKey()
                     throws UnsupportedOperationException
        Get the key of current record.
        Returns:
        The key of current processed record.
        Throws:
        UnsupportedOperationException - if the key can not be extracted for this function, for instance, get the key from a non-keyed partition stream.
      • getState

        <T> Optional<org.apache.flink.api.common.state.ListState<T>> getState​(org.apache.flink.api.common.state.ListStateDeclaration<T> stateDeclaration)
                                                                       throws Exception
        Get the specific list state.
        Parameters:
        stateDeclaration - of this state.
        Returns:
        the list state corresponds to the state declaration.
        Throws:
        Exception
      • getState

        <T> Optional<org.apache.flink.api.common.state.ValueState<T>> getState​(org.apache.flink.api.common.state.ValueStateDeclaration<T> stateDeclaration)
                                                                        throws Exception
        Get the specific value state.
        Parameters:
        stateDeclaration - of this state.
        Returns:
        the value state corresponds to the state declaration.
        Throws:
        Exception
      • getState

        <K,​V> Optional<org.apache.flink.api.common.state.MapState<K,​V>> getState​(org.apache.flink.api.common.state.MapStateDeclaration<K,​V> stateDeclaration)
                                                                                      throws Exception
        Get the specific map state.
        Parameters:
        stateDeclaration - of this state.
        Returns:
        the map state corresponds to the state declaration.
        Throws:
        Exception
      • getState

        <T> Optional<org.apache.flink.api.common.state.ReducingState<T>> getState​(org.apache.flink.api.common.state.ReducingStateDeclaration<T> stateDeclaration)
                                                                           throws Exception
        Get the specific reducing state.
        Parameters:
        stateDeclaration - of this state.
        Returns:
        the reducing state corresponds to the state declaration.
        Throws:
        Exception
      • getState

        <IN,​ACC,​OUT> Optional<org.apache.flink.api.common.state.AggregatingState<IN,​OUT>> getState​(org.apache.flink.api.common.state.AggregatingStateDeclaration<IN,​ACC,​OUT> stateDeclaration)
                                                                                                              throws Exception
        Get the specific aggregating state.
        Parameters:
        stateDeclaration - of this state.
        Returns:
        the aggregating state corresponds to the state declaration.
        Throws:
        Exception
      • getState

        <K,​V> Optional<org.apache.flink.api.common.state.BroadcastState<K,​V>> getState​(org.apache.flink.api.common.state.BroadcastStateDeclaration<K,​V> stateDeclaration)
                                                                                            throws Exception
        Get the specific broadcast state.
        Parameters:
        stateDeclaration - of this state.
        Returns:
        the broadcast state corresponds to the state declaration.
        Throws:
        Exception