public class FileStateHandle extends Object implements StreamStateHandle
StreamStateHandle for state that was written to a file stream. The written data is
identified by the file path. The state can be read again by calling openInputStream().StateObject.StateObjectLocation, StateObject.StateObjectSizeStatsCollector| Constructor and Description |
|---|
FileStateHandle(org.apache.flink.core.fs.Path filePath,
long stateSize)
Creates a new file state for the given file path.
|
| Modifier and Type | Method and Description |
|---|---|
Optional<byte[]> |
asBytesIfInMemory() |
void |
collectSizeStats(StateObject.StateObjectSizeStatsCollector collector)
Collects statistics about state size and location from the state object.
|
void |
discardState()
Discard the state by deleting the file that stores the state.
|
boolean |
equals(Object o) |
org.apache.flink.core.fs.Path |
getFilePath()
Gets the path where this handle's state is stored.
|
long |
getStateSize()
Returns the file size in bytes.
|
PhysicalStateHandleID |
getStreamStateHandleID() |
int |
hashCode() |
org.apache.flink.core.fs.FSDataInputStream |
openInputStream()
Returns an
FSDataInputStream that can be used to read back the data that was
previously written to the stream. |
String |
toString() |
public FileStateHandle(org.apache.flink.core.fs.Path filePath,
long stateSize)
filePath - The path to the file that stores the state.public org.apache.flink.core.fs.Path getFilePath()
public org.apache.flink.core.fs.FSDataInputStream openInputStream()
throws IOException
StreamStateHandleFSDataInputStream that can be used to read back the data that was
previously written to the stream.openInputStream in interface StreamStateHandleIOExceptionpublic Optional<byte[]> asBytesIfInMemory()
asBytesIfInMemory in interface StreamStateHandlepublic PhysicalStateHandleID getStreamStateHandleID()
getStreamStateHandleID in interface StreamStateHandlepublic void discardState()
throws Exception
discardState in interface StateObjectException - Thrown, if the file deletion (not the directory deletion) fails.public long getStateSize()
getStateSize in interface StateObjectpublic void collectSizeStats(StateObject.StateObjectSizeStatsCollector collector)
StateObjectcollectSizeStats in interface StateObjectcollector - the statistics collector.Copyright © 2014–2025 The Apache Software Foundation. All rights reserved.