Package org.apache.flink.runtime.blob
Class FileSystemBlobStore
- java.lang.Object
-
- org.apache.flink.runtime.blob.FileSystemBlobStore
-
- All Implemented Interfaces:
Closeable,AutoCloseable,BlobStore,BlobStoreService,BlobView
public class FileSystemBlobStore extends Object implements BlobStoreService
Blob store backed byFileSystem.This is used in addition to the local blob storage for high availability.
-
-
Field Summary
Fields Modifier and Type Field Description static StringBLOB_PATH_NAMEThe name of the blob path.
-
Constructor Summary
Constructors Constructor Description FileSystemBlobStore(org.apache.flink.core.fs.FileSystem fileSystem, String storagePath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanupAllData()Cleans up the store.voidclose()booleandelete(org.apache.flink.api.common.JobID jobId, BlobKey blobKey)Tries to delete a blob from storage.booleandeleteAll(org.apache.flink.api.common.JobID jobId)Tries to delete all blobs for the given job from storage.booleanget(org.apache.flink.api.common.JobID jobId, BlobKey blobKey, File localFile)Copies a blob to a local file.booleanput(File localFile, org.apache.flink.api.common.JobID jobId, BlobKey blobKey)Copies the local file to the blob store.
-
-
-
Field Detail
-
BLOB_PATH_NAME
public static final String BLOB_PATH_NAME
The name of the blob path.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FileSystemBlobStore
public FileSystemBlobStore(org.apache.flink.core.fs.FileSystem fileSystem, String storagePath) throws IOException- Throws:
IOException
-
-
Method Detail
-
put
public boolean put(File localFile, org.apache.flink.api.common.JobID jobId, BlobKey blobKey) throws IOException
Description copied from interface:BlobStoreCopies the local file to the blob store.- Specified by:
putin interfaceBlobStore- Parameters:
localFile- The file to copyjobId- ID of the job this blob belongs to (or null if job-unrelated)blobKey- The ID for the file in the blob store- Returns:
- whether the file was copied (true) or not (false)
- Throws:
IOException- If the copy fails
-
get
public boolean get(org.apache.flink.api.common.JobID jobId, BlobKey blobKey, File localFile) throws IOExceptionDescription copied from interface:BlobViewCopies a blob to a local file.- Specified by:
getin interfaceBlobView- Parameters:
jobId- ID of the job this blob belongs to (or null if job-unrelated)blobKey- The blob IDlocalFile- The local file to copy to- Returns:
- whether the file was copied (true) or not (false)
- Throws:
IOException- If the copy fails
-
delete
public boolean delete(org.apache.flink.api.common.JobID jobId, BlobKey blobKey)Description copied from interface:BlobStoreTries to delete a blob from storage.NOTE: This also tries to delete any created directories if empty.
-
deleteAll
public boolean deleteAll(org.apache.flink.api.common.JobID jobId)
Description copied from interface:BlobStoreTries to delete all blobs for the given job from storage.NOTE: This also tries to delete any created directories if empty.
-
cleanupAllData
public void cleanupAllData()
Description copied from interface:BlobStoreServiceCleans up the store. This entails the deletion of all blobs.- Specified by:
cleanupAllDatain interfaceBlobStoreService
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-