public final class BlobClient extends Object implements Closeable
Constructor and Description |
---|
BlobClient(InetSocketAddress serverAddress,
Configuration clientConfig)
Instantiates a new BLOB client.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
delete(BlobKey key)
Deletes the BLOB identified by the given BLOB key from the BLOB server.
|
void |
delete(JobID jobId,
String key)
Deletes the BLOB identified by the given job ID and key from the BLOB server.
|
void |
deleteAll(JobID jobId)
Deletes all BLOBs belonging to the job with the given ID from the BLOB server
|
InputStream |
get(BlobKey blobKey)
Downloads the BLOB identified by the given BLOB key from the BLOB server.
|
InputStream |
get(JobID jobID,
String key)
Downloads the BLOB identified by the given job ID and key from the BLOB server.
|
boolean |
isClosed() |
BlobKey |
put(byte[] value)
Uploads the data of the given byte array to the BLOB server in a content-addressable manner.
|
BlobKey |
put(byte[] value,
int offset,
int len)
Uploads data from the given byte array to the BLOB server in a content-addressable manner.
|
BlobKey |
put(InputStream inputStream)
Uploads the data from the given input stream to the BLOB server in a content-addressable manner.
|
void |
put(JobID jobId,
String key,
byte[] value)
Uploads the data of the given byte array to the BLOB server and stores it under the given job ID and key.
|
void |
put(JobID jobId,
String key,
byte[] value,
int offset,
int len)
Uploads data from the given byte array to the BLOB server and stores it under the given job ID and key.
|
void |
put(JobID jobId,
String key,
InputStream inputStream)
Uploads data from the given input stream to the BLOB server and stores it under the given job ID and key.
|
static List<BlobKey> |
uploadJarFiles(ActorGateway jobManager,
scala.concurrent.duration.FiniteDuration askTimeout,
Configuration clientConfig,
List<Path> jars)
Retrieves the
BlobServer address from the JobManager and uploads
the JAR files to it. |
static List<BlobKey> |
uploadJarFiles(InetSocketAddress serverAddress,
Configuration clientConfig,
List<Path> jars)
Uploads the JAR files to a
BlobServer at the given address. |
public BlobClient(InetSocketAddress serverAddress, Configuration clientConfig) throws IOException
serverAddress
- the network address of the BLOB serverclientConfig
- additional configuration like SSL parameters required to connect to the blob serverIOException
- thrown if the connection to the BLOB server could not be establishedpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public boolean isClosed()
public InputStream get(JobID jobID, String key) throws IOException
FileNotFoundException
is thrown.jobID
- the job ID identifying the BLOB to downloadkey
- the key identifying the BLOB to downloadIOException
- thrown if an I/O error occurs during the downloadpublic InputStream get(BlobKey blobKey) throws IOException
FileNotFoundException
is thrown.blobKey
- the BLOB key identifying the BLOB to downloadIOException
- thrown if an I/O error occurs during the downloadpublic BlobKey put(byte[] value) throws IOException
value
- the buffer to uploadIOException
- thrown if an I/O error occurs while uploading the data to the BLOB serverpublic BlobKey put(byte[] value, int offset, int len) throws IOException
value
- the buffer to upload data fromoffset
- the read offset within the bufferlen
- the number of bytes to upload from the bufferIOException
- thrown if an I/O error occurs while uploading the data to the BLOB serverpublic void put(JobID jobId, String key, byte[] value) throws IOException
jobId
- the job ID to identify the uploaded datakey
- the key to identify the uploaded datavalue
- the buffer to uploadIOException
- thrown if an I/O error occurs while uploading the data to the BLOB serverpublic void put(JobID jobId, String key, byte[] value, int offset, int len) throws IOException
jobId
- the job ID to identify the uploaded datakey
- the key to identify the uploaded datavalue
- the buffer to upload data fromoffset
- the read offset within the bufferlen
- the number of bytes to upload from the bufferIOException
- thrown if an I/O error occurs while uploading the data to the BLOB serverpublic void put(JobID jobId, String key, InputStream inputStream) throws IOException
jobId
- the job ID to identify the uploaded datakey
- the key to identify the uploaded datainputStream
- the input stream to read the data fromIOException
- thrown if an I/O error occurs while reading the data from the input stream or uploading the data to the
BLOB serverpublic BlobKey put(InputStream inputStream) throws IOException
inputStream
- the input stream to read the data fromIOException
- thrown if an I/O error occurs while reading the data from the input stream or uploading the data to the
BLOB serverpublic void delete(BlobKey key) throws IOException
key
- the key to identify the BLOBIOException
- thrown if an I/O error occurs while transferring the request to
the BLOB server or if the BLOB server cannot delete the filepublic void delete(JobID jobId, String key) throws IOException
jobId
- the job ID to identify the BLOBkey
- the key to identify the BLOBIOException
- thrown if an I/O error occurs while transferring the request to the BLOB serverpublic void deleteAll(JobID jobId) throws IOException
jobId
- the job ID to identify the BLOBs to be deletedIOException
- thrown if an I/O error occurs while transferring the request to the BLOB serverpublic static List<BlobKey> uploadJarFiles(ActorGateway jobManager, scala.concurrent.duration.FiniteDuration askTimeout, Configuration clientConfig, List<Path> jars) throws IOException
BlobServer
address from the JobManager and uploads
the JAR files to it.jobManager
- Server address of the BlobServer
askTimeout
- Ask timeout for blob server address retrievalclientConfig
- Any additional configuration for the blob clientjars
- List of JAR files to uploadIOException
- Thrown if the address retrieval or upload failspublic static List<BlobKey> uploadJarFiles(InetSocketAddress serverAddress, Configuration clientConfig, List<Path> jars) throws IOException
BlobServer
at the given address.serverAddress
- Server address of the BlobServer
clientConfig
- Any additional configuration for the blob clientjars
- List of JAR files to uploadIOException
- Thrown if the upload failsCopyright © 2014–2018 The Apache Software Foundation. All rights reserved.