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 toSharedStateRegistryto track the life cycle of the directory.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.state.StateObject
StateObject.StateObjectLocation, StateObject.StateObjectSizeStatsCollector
-
-
Constructor Summary
Constructors Constructor Description DirectoryStreamStateHandle(org.apache.flink.core.fs.Path directory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<byte[]>asBytesIfInMemory()SharedStateRegistryKeycreateStateRegistryKey()voiddiscardState()Discards the state referred to and solemnly owned by this handle, to free up resources in the persistent storage.booleanequals(Object o)org.apache.flink.core.fs.PathgetDirectory()longgetStateSize()This handle usually used to track the life cycle of the directory, therefore a fake size is provided.PhysicalStateHandleIDgetStreamStateHandleID()inthashCode()static DirectoryStreamStateHandleof(org.apache.flink.core.fs.Path directory)org.apache.flink.core.fs.FSDataInputStreamopenInputStream()Returns anFSDataInputStreamthat can be used to read back the data that was previously written to the stream.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.flink.runtime.state.StateObject
collectSizeStats
-
Methods inherited from interface org.apache.flink.runtime.state.StreamStateHandle
maybeGetPath
-
-
-
-
Method Detail
-
openInputStream
public org.apache.flink.core.fs.FSDataInputStream openInputStream()
Description copied from interface:StreamStateHandleReturns anFSDataInputStreamthat can be used to read back the data that was previously written to the stream.- Specified by:
openInputStreamin interfaceStreamStateHandle
-
asBytesIfInMemory
public Optional<byte[]> asBytesIfInMemory()
- Specified by:
asBytesIfInMemoryin interfaceStreamStateHandle- Returns:
- Content of this handle as bytes array if it is already in memory.
-
getStreamStateHandleID
public PhysicalStateHandleID getStreamStateHandleID()
- Specified by:
getStreamStateHandleIDin interfaceStreamStateHandle- Returns:
- a unique identifier of this handle.
-
createStateRegistryKey
public SharedStateRegistryKey createStateRegistryKey()
-
getDirectory
public org.apache.flink.core.fs.Path getDirectory()
-
discardState
public void discardState() throws ExceptionDescription copied from interface:StateObjectDiscards 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:
discardStatein interfaceStateObject- 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:
getStateSizein interfaceStateObject- Returns:
- Size of the state in bytes.
-
of
public static DirectoryStreamStateHandle of(@Nonnull org.apache.flink.core.fs.Path directory)
-
-