Class DirectoryStreamStateHandle

java.lang.Object
org.apache.flink.runtime.state.filemerging.DirectoryStreamStateHandle
All Implemented Interfaces:
Serializable, StateObject, StreamStateHandle

public class DirectoryStreamStateHandle extends Object implements StreamStateHandle
This state handle represents a directory, usually used to be registered to SharedStateRegistry to track the life cycle of the directory.
See Also:
  • Constructor Details

    • DirectoryStreamStateHandle

      public DirectoryStreamStateHandle(@Nonnull org.apache.flink.core.fs.Path directory)
  • Method Details

    • openInputStream

      public org.apache.flink.core.fs.FSDataInputStream openInputStream()
      Description copied from interface: StreamStateHandle
      Returns an FSDataInputStream that can be used to read back the data that was previously written to the stream.
      Specified by:
      openInputStream in interface StreamStateHandle
    • asBytesIfInMemory

      public Optional<byte[]> asBytesIfInMemory()
      Specified by:
      asBytesIfInMemory in interface StreamStateHandle
      Returns:
      Content of this handle as bytes array if it is already in memory.
    • getStreamStateHandleID

      public PhysicalStateHandleID getStreamStateHandleID()
      Specified by:
      getStreamStateHandleID in interface StreamStateHandle
      Returns:
      a unique identifier of this handle.
    • createStateRegistryKey

      public SharedStateRegistryKey createStateRegistryKey()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getDirectory

      public org.apache.flink.core.fs.Path getDirectory()
    • discardState

      public void discardState() throws Exception
      Description copied from interface: StateObject
      Discards the state referred to and solemnly owned by this handle, to free up resources in the persistent storage. This method is called when the state represented by this object will not be used anymore.
      Specified by:
      discardState in interface StateObject
      Throws:
      Exception
    • getStateSize

      public long getStateSize()
      This handle usually used to track the life cycle of the directory, therefore a fake size is provided.
      Specified by:
      getStateSize in interface StateObject
      Returns:
      Size of the state in bytes.
    • of

      public static DirectoryStreamStateHandle of(@Nonnull org.apache.flink.core.fs.Path directory)