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 String
BLOB_PATH_NAME
The name of the blob path.
-
Constructor Summary
Constructors Constructor Description FileSystemBlobStore(FileSystem fileSystem, String storagePath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanupAllData()
Cleans up the store.void
close()
boolean
delete(JobID jobId, BlobKey blobKey)
Tries to delete a blob from storage.boolean
deleteAll(JobID jobId)
Tries to delete all blobs for the given job from storage.boolean
get(JobID jobId, BlobKey blobKey, File localFile)
Copies a blob to a local file.boolean
put(File localFile, 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(FileSystem fileSystem, String storagePath) throws IOException
- Throws:
IOException
-
-
Method Detail
-
put
public boolean put(File localFile, JobID jobId, BlobKey blobKey) throws IOException
Description copied from interface:BlobStore
Copies the local file to the blob store.- Specified by:
put
in 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(JobID jobId, BlobKey blobKey, File localFile) throws IOException
Description copied from interface:BlobView
Copies a blob to a local file.- Specified by:
get
in 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(JobID jobId, BlobKey blobKey)
Description copied from interface:BlobStore
Tries to delete a blob from storage.NOTE: This also tries to delete any created directories if empty.
-
deleteAll
public boolean deleteAll(JobID jobId)
Description copied from interface:BlobStore
Tries 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:BlobStoreService
Cleans up the store. This entails the deletion of all blobs.- Specified by:
cleanupAllData
in interfaceBlobStoreService
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-