Interface TransientBlobService

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
BlobServer, TransientBlobCache

public interface TransientBlobService extends Closeable
A service to retrieve transient binary large objects (BLOBs) which are deleted on the BlobServer when they are retrieved.

These may include per-job BLOBs like files in the DistributedCache, for example.

Note: None of these BLOBs is highly available (HA). This case is covered by BLOBs in the PermanentBlobService.

TODO: change API to not rely on local files but return InputStream objects

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    deleteFromCache(org.apache.flink.api.common.JobID jobId, TransientBlobKey key)
    Deletes the file associated with the provided job ID and blob key from the local cache.
    boolean
    Deletes the (job-unrelated) file associated with the provided blob key from the local cache.
    getFile(org.apache.flink.api.common.JobID jobId, TransientBlobKey key)
    Returns the path to a local copy of the file associated with the provided job ID and blob key.
    Returns the path to a local copy of the (job-unrelated) file associated with the provided blob key.
    putTransient(byte[] value)
    Uploads the (job-unrelated) data of the given byte array to the BLOB server.
    Uploads the (job-unrelated) data from the given input stream to the BLOB server.
    putTransient(org.apache.flink.api.common.JobID jobId, byte[] value)
    Uploads the data of the given byte array for the given job to the BLOB server.
    putTransient(org.apache.flink.api.common.JobID jobId, InputStream inputStream)
    Uploads the data from the given input stream for the given job to the BLOB server.

    Methods inherited from interface java.io.Closeable

    close
  • Method Details

    • getFile

      File getFile(TransientBlobKey key) throws IOException
      Returns the path to a local copy of the (job-unrelated) file associated with the provided blob key.
      Parameters:
      key - blob key associated with the requested file
      Returns:
      The path to the file.
      Throws:
      FileNotFoundException - when the path does not exist;
      IOException - if any other error occurs when retrieving the file
    • getFile

      File getFile(org.apache.flink.api.common.JobID jobId, TransientBlobKey key) throws IOException
      Returns the path to a local copy of the file associated with the provided job ID and blob key.
      Parameters:
      jobId - ID of the job this blob belongs to
      key - blob key associated with the requested file
      Returns:
      The path to the file.
      Throws:
      FileNotFoundException - when the path does not exist;
      IOException - if any other error occurs when retrieving the file
    • putTransient

      TransientBlobKey putTransient(byte[] value) throws IOException
      Uploads the (job-unrelated) data of the given byte array to the BLOB server.
      Parameters:
      value - the buffer to upload
      Returns:
      the computed BLOB key identifying the BLOB on the server
      Throws:
      IOException - thrown if an I/O error occurs while uploading the data to the BLOB server
    • putTransient

      TransientBlobKey putTransient(org.apache.flink.api.common.JobID jobId, byte[] value) throws IOException
      Uploads the data of the given byte array for the given job to the BLOB server.
      Parameters:
      jobId - the ID of the job the BLOB belongs to
      value - the buffer to upload
      Returns:
      the computed BLOB key identifying the BLOB on the server
      Throws:
      IOException - thrown if an I/O error occurs while uploading the data to the BLOB server
    • putTransient

      TransientBlobKey putTransient(InputStream inputStream) throws IOException
      Uploads the (job-unrelated) data from the given input stream to the BLOB server.
      Parameters:
      inputStream - the input stream to read the data from
      Returns:
      the computed BLOB key identifying the BLOB on the server
      Throws:
      IOException - thrown if an I/O error occurs while reading the data from the input stream or uploading the data to the BLOB server
    • putTransient

      TransientBlobKey putTransient(org.apache.flink.api.common.JobID jobId, InputStream inputStream) throws IOException
      Uploads the data from the given input stream for the given job to the BLOB server.
      Parameters:
      jobId - ID of the job this blob belongs to
      inputStream - the input stream to read the data from
      Returns:
      the computed BLOB key identifying the BLOB on the server
      Throws:
      IOException - thrown if an I/O error occurs while reading the data from the input stream or uploading the data to the BLOB server
    • deleteFromCache

      boolean deleteFromCache(TransientBlobKey key)
      Deletes the (job-unrelated) file associated with the provided blob key from the local cache.
      Parameters:
      key - associated with the file to be deleted
      Returns:
      true if the given blob is successfully deleted or non-existing; false otherwise
    • deleteFromCache

      boolean deleteFromCache(org.apache.flink.api.common.JobID jobId, TransientBlobKey key)
      Deletes the file associated with the provided job ID and blob key from the local cache.
      Parameters:
      jobId - ID of the job this blob belongs to
      key - associated with the file to be deleted
      Returns:
      true if the given blob is successfully deleted or non-existing; false otherwise