public final class BlobCache extends Object implements BlobService
When requesting BLOBs through the getURL(org.apache.flink.runtime.blob.BlobKey)
methods, the
BLOB cache will first attempt to serve the file from its local cache. Only if
the local cache does not contain the desired BLOB, the BLOB cache will try to
download it from a distributed file system (if available) or the BLOB
server.
Constructor and Description |
---|
BlobCache(InetSocketAddress serverAddress,
Configuration blobClientConfig,
BlobView blobView)
Instantiates a new BLOB cache.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
BlobClient |
createClient() |
void |
delete(BlobKey key)
Deletes the file associated with the given key from the BLOB cache.
|
void |
deleteGlobal(BlobKey key)
Deletes the file associated with the given key from the BLOB cache and
BLOB server.
|
int |
getPort()
Returns the port of the blob service.
|
File |
getStorageDir() |
URL |
getURL(BlobKey requiredBlob)
Returns the URL for the BLOB with the given key.
|
public BlobCache(InetSocketAddress serverAddress, Configuration blobClientConfig, BlobView blobView) throws IOException
serverAddress
- address of the BlobServer
to use for fetching files fromblobClientConfig
- global configurationblobView
- (distributed) blob store file system to retrieve files from firstIOException
- thrown if the (local or distributed) file storage cannot be created or is not usablepublic URL getURL(BlobKey requiredBlob) throws IOException
getURL
in interface BlobService
requiredBlob
- The key of the desired BLOB.IOException
- Thrown if an I/O error occurs while downloading the BLOBs from the BLOB server.public void delete(BlobKey key) throws IOException
delete
in interface BlobService
key
- referring to the file to be deletedIOException
public void deleteGlobal(BlobKey key) throws IOException
key
- referring to the file to be deletedIOException
- thrown if an I/O error occurs while transferring the request to
the BLOB server or if the BLOB server cannot delete the filepublic int getPort()
BlobService
getPort
in interface BlobService
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public BlobClient createClient() throws IOException
createClient
in interface BlobService
IOException
public File getStorageDir()
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.