java.lang.Object
org.apache.beam.runners.flink.translation.wrappers.streaming.state.FlinkStateInternals<K>
All Implemented Interfaces:
org.apache.beam.runners.core.StateInternals

public class FlinkStateInternals<K> extends Object implements org.apache.beam.runners.core.StateInternals
StateInternals that uses a Flink KeyedStateBackend to manage state.

Note: In the Flink streaming runner the key is always encoded using an Coder and stored in a FlinkKey.

  • Constructor Details

    • FlinkStateInternals

      public FlinkStateInternals(org.apache.flink.runtime.state.KeyedStateBackend<FlinkKey> flinkStateBackend, Coder<K> keyCoder, Coder<? extends BoundedWindow> windowCoder, org.apache.beam.runners.core.construction.SerializablePipelineOptions pipelineOptions) throws Exception
      Throws:
      Exception
  • Method Details

    • minWatermarkHoldMs

      public Long minWatermarkHoldMs()
      Returns the minimum over all watermark holds.
    • getKey

      public K getKey()
      Specified by:
      getKey in interface org.apache.beam.runners.core.StateInternals
    • state

      public <T extends State> T state(org.apache.beam.runners.core.StateNamespace namespace, org.apache.beam.runners.core.StateTag<T> address, StateContext<?> context)
      Specified by:
      state in interface org.apache.beam.runners.core.StateInternals
    • clearGlobalState

      public void clearGlobalState()
      Allows to clear all state for the global watermark when the maximum watermark arrives. We do not clean up the global window state via timers which would lead to an unbounded number of keys and cleanup timers. Instead, the cleanup code below should be run when we finally receive the max watermark.
    • addWatermarkHoldUsage

      public void addWatermarkHoldUsage(Instant watermarkHold)
    • removeWatermarkHoldUsage

      public void removeWatermarkHoldUsage(Instant watermarkHold)