Class FileMappingManager
java.lang.Object
org.apache.flink.state.forst.fs.filemapping.FileMappingManager
A manager to manage file mapping of forst file system, including misc file mapping (remote file
-> local file) and linked mapping (remote file -> remote file). Note, the key/value of mapping
table must be a file path, directories are maintained by file system itself, directories wouldn't
be the key/value of mapping table.
-
Constructor Summary
ConstructorsConstructorDescriptionFileMappingManager(org.apache.flink.core.fs.FileSystem fileSystem, String remoteBase, String localBase) -
Method Summary
Modifier and TypeMethodDescriptioncreateNewFile(org.apache.flink.core.fs.Path filePath, boolean overwrite, FileBasedCache cache) Create a new file in the mapping table.booleandeleteFileOrDirectory(org.apache.flink.core.fs.Path file, boolean recursive) Delete a file or directory from mapping table and file system, the directory deletion may be deferred.voidgiveUpOwnership(org.apache.flink.core.fs.Path path, org.apache.flink.runtime.state.StreamStateHandle stateHandle) intAdd a mapping 'dst -> src' to the mapping table.listByPrefix(String path) mappingEntry(String path) registerReusedRestoredFile(String key, org.apache.flink.runtime.state.StreamStateHandle stateHandle, org.apache.flink.core.fs.Path dbFilePath, FileBasedCache cache) Register a file restored from checkpoints to the mapping table.booleanrenameFile(String src, String dst) 1.
-
Constructor Details
-
FileMappingManager
-
-
Method Details
-
createNewFile
public MappingEntry createNewFile(org.apache.flink.core.fs.Path filePath, boolean overwrite, FileBasedCache cache) Create a new file in the mapping table. -
registerReusedRestoredFile
public MappingEntry registerReusedRestoredFile(String key, org.apache.flink.runtime.state.StreamStateHandle stateHandle, org.apache.flink.core.fs.Path dbFilePath, FileBasedCache cache) Register a file restored from checkpoints to the mapping table. -
link
Add a mapping 'dst -> src' to the mapping table. -
listByPrefix
-
renameFile
1. If src can match any key, we only `mark rename`, no physical file would be renamed. 2. If src is a directory, all files under src will be renamed, including linked files and local files, the directory also would be renamed in file system physically.- Parameters:
src- the source pathdst- the destination path- Returns:
- always return true except for IOException
- Throws:
IOException
-
deleteFileOrDirectory
public boolean deleteFileOrDirectory(org.apache.flink.core.fs.Path file, boolean recursive) throws IOException Delete a file or directory from mapping table and file system, the directory deletion may be deferred.- Parameters:
file- to be deletedrecursive- whether to delete recursively- Returns:
- true if the file or directory is deleted successfully, false otherwise.
- Throws:
IOException- if an error occurs during deletion
-
mappingEntry
-
giveUpOwnership
public void giveUpOwnership(org.apache.flink.core.fs.Path path, org.apache.flink.runtime.state.StreamStateHandle stateHandle)
-