Class AbstractValueState<K,​N,​V>

    • Method Detail

      • asyncValue

        public final StateFuture<V> asyncValue()
        Description copied from interface: ValueState
        Returns the current value for the state asynchronously. When the state is not partitioned the returned value is the same for all inputs in a given operator instance. If state partitioning is applied, the value returned depends on the current operator input, as the operator maintains an independent state for each partition. When no value was previously set using ValueState.asyncUpdate(Object), the future will return null asynchronously.
        Specified by:
        asyncValue in interface ValueState<K>
        Returns:
        The StateFuture that will return the value corresponding to the current input.
      • asyncUpdate

        public final StateFuture<Void> asyncUpdate​(V value)
        Description copied from interface: ValueState
        Updates the operator state accessible by ValueState.asyncValue() to the given value asynchronously. The next time ValueState.asyncValue() is called (for the same state partition) the returned state will represent the updated value. When a partitioned state is updated with null, the state for the current key will be removed.
        Specified by:
        asyncUpdate in interface ValueState<K>
        Parameters:
        value - The new value for the state.
        Returns:
        The StateFuture that will trigger the callback when update finishes.
      • value

        public V value()
        Description copied from interface: ValueState
        Returns the current value for the state. When the state is not partitioned the returned value is the same for all inputs in a given operator instance. If state partitioning is applied, the value returned depends on the current operator input, as the operator maintains an independent state for each partition.

        If you didn't specify a default value when creating the ValueStateDescriptor this will return null when no value was previously set using ValueState.update(Object).

        Specified by:
        value in interface ValueState<K>
        Returns:
        The state value corresponding to the current input.
      • update

        public void update​(V value)
        Description copied from interface: ValueState
        Updates the operator state accessible by ValueState.value() to the given value. The next time ValueState.value() is called (for the same state partition) the returned state will represent the updated value. When a partitioned state is updated with null, the state for the current key will be removed and the default value is returned on the next access.
        Specified by:
        update in interface ValueState<K>
        Parameters:
        value - The new value for the state.