/** * Returns a file handle to the file associated with the given blob key on the blob * server. * * <p><strong>This is only called from the {@link BlobServerConnection}</strong> * * @param key identifying the file * @return file handle to the file */ File getStorageLocation(BlobKey key) { return BlobUtils.getStorageLocation(storageDir, key); }
/** * Returns a file handle to the file identified by the given jobID and key. * * <p><strong>This is only called from the {@link BlobServerConnection}</strong> * * @param jobID to which the file is associated * @param key to identify the file within the job context * @return file handle to the file */ File getStorageLocation(JobID jobID, String key) { return BlobUtils.getStorageLocation(storageDir, jobID, key); }
/** * Deletes the file associated with the given key from the BLOB cache. * @param key referring to the file to be deleted */ public void delete(BlobKey key) throws IOException{ final File localFile = BlobUtils.getStorageLocation(storageDir, key); if (localFile.exists() && !localFile.delete()) { LOG.warn("Failed to delete locally cached BLOB " + key + " at " + localFile.getAbsolutePath()); } }
/** * Returns a file handle to the file associated with the given blob key on the blob * server. * * <p><strong>This is only called from {@link BlobServerConnection} or unit tests.</strong> * * @param jobId ID of the job this blob belongs to (or <tt>null</tt> if job-unrelated) * @param key identifying the file * @return file handle to the file * * @throws IOException * if creating the directory fails */ @VisibleForTesting public File getStorageLocation(@Nullable JobID jobId, BlobKey key) throws IOException { return BlobUtils.getStorageLocation(storageDir, jobId, key); }
/** * Returns a file handle to the file associated with the given blob key on the blob * server. * * <p><strong>This is only called from {@link BlobServerConnection} or unit tests.</strong> * * @param jobId ID of the job this blob belongs to (or <tt>null</tt> if job-unrelated) * @param key identifying the file * @return file handle to the file * * @throws IOException * if creating the directory fails */ @VisibleForTesting public File getStorageLocation(@Nullable JobID jobId, BlobKey key) throws IOException { return BlobUtils.getStorageLocation(storageDir, jobId, key); }
/** * Returns a file handle to the file associated with the given blob key on the blob * server. * * <p><strong>This is only called from {@link BlobServerConnection} or unit tests.</strong> * * @param jobId ID of the job this blob belongs to (or <tt>null</tt> if job-unrelated) * @param key identifying the file * @return file handle to the file * * @throws IOException * if creating the directory fails */ @VisibleForTesting public File getStorageLocation(@Nullable JobID jobId, BlobKey key) throws IOException { return BlobUtils.getStorageLocation(storageDir, jobId, key); }
/** * Returns a file handle to the file associated with the given blob key on the blob * server. * * @param jobId * ID of the job this blob belongs to (or <tt>null</tt> if job-unrelated) * @param key * identifying the file * * @return file handle to the file * * @throws IOException * if creating the directory fails */ @VisibleForTesting public File getStorageLocation(@Nullable JobID jobId, BlobKey key) throws IOException { return BlobUtils.getStorageLocation(storageDir, jobId, key); }
/** * Returns a file handle to the file associated with the given blob key on the blob * server. * * @param jobId * ID of the job this blob belongs to (or <tt>null</tt> if job-unrelated) * @param key * identifying the file * * @return file handle to the file * * @throws IOException * if creating the directory fails */ @VisibleForTesting public File getStorageLocation(@Nullable JobID jobId, BlobKey key) throws IOException { return BlobUtils.getStorageLocation(storageDir, jobId, key); }
/** * Returns a file handle to the file associated with the given blob key on the blob * server. * * @param jobId * ID of the job this blob belongs to (or <tt>null</tt> if job-unrelated) * @param key * identifying the file * * @return file handle to the file * * @throws IOException * if creating the directory fails */ @VisibleForTesting public File getStorageLocation(@Nullable JobID jobId, BlobKey key) throws IOException { return BlobUtils.getStorageLocation(storageDir, jobId, key); }
/** * This method deletes the file associated to the blob key if it exists in the local storage * of the blob server. * * @param key associated with the file to be deleted * @throws IOException */ @Override public void delete(BlobKey key) throws IOException { final File localFile = BlobUtils.getStorageLocation(storageDir, key); readWriteLock.writeLock().lock(); try { if (localFile.exists()) { if (!localFile.delete()) { LOG.warn("Failed to delete locally BLOB " + key + " at " + localFile.getAbsolutePath()); } } blobStore.delete(key); } finally { readWriteLock.writeLock().unlock(); } }
/** * Retrieves the local path of a file associated with a job and a blob key. * * <p>The blob server looks the blob key up in its local storage. If the file exists, it is * returned. If the file does not exist, it is retrieved from the HA blob store (if available) * or a {@link FileNotFoundException} is thrown. * * @param jobId * ID of the job this blob belongs to (or <tt>null</tt> if job-unrelated) * @param blobKey * blob key associated with the requested file * * @return file referring to the local storage location of the BLOB * * @throws IOException * Thrown if the file retrieval failed. */ private File getFileInternal(@Nullable JobID jobId, BlobKey blobKey) throws IOException { checkArgument(blobKey != null, "BLOB key cannot be null."); final File localFile = BlobUtils.getStorageLocation(storageDir, jobId, blobKey); readWriteLock.readLock().lock(); try { getFileInternal(jobId, blobKey, localFile); return localFile; } finally { readWriteLock.readLock().unlock(); } }
/** * Retrieves the local path of a file associated with a job and a blob key. * * <p>The blob server looks the blob key up in its local storage. If the file exists, it is * returned. If the file does not exist, it is retrieved from the HA blob store (if available) * or a {@link FileNotFoundException} is thrown. * * @param jobId * ID of the job this blob belongs to (or <tt>null</tt> if job-unrelated) * @param blobKey * blob key associated with the requested file * * @return file referring to the local storage location of the BLOB * * @throws IOException * Thrown if the file retrieval failed. */ private File getFileInternal(@Nullable JobID jobId, BlobKey blobKey) throws IOException { checkArgument(blobKey != null, "BLOB key cannot be null."); final File localFile = BlobUtils.getStorageLocation(storageDir, jobId, blobKey); readWriteLock.readLock().lock(); try { getFileInternal(jobId, blobKey, localFile); return localFile; } finally { readWriteLock.readLock().unlock(); } }
/** * Retrieves the local path of a file associated with a job and a blob key. * * <p>The blob server looks the blob key up in its local storage. If the file exists, it is * returned. If the file does not exist, it is retrieved from the HA blob store (if available) * or a {@link FileNotFoundException} is thrown. * * @param jobId * ID of the job this blob belongs to (or <tt>null</tt> if job-unrelated) * @param blobKey * blob key associated with the requested file * * @return file referring to the local storage location of the BLOB * * @throws IOException * Thrown if the file retrieval failed. */ private File getFileInternal(@Nullable JobID jobId, BlobKey blobKey) throws IOException { checkArgument(blobKey != null, "BLOB key cannot be null."); final File localFile = BlobUtils.getStorageLocation(storageDir, jobId, blobKey); readWriteLock.readLock().lock(); try { getFileInternal(jobId, blobKey, localFile); return localFile; } finally { readWriteLock.readLock().unlock(); } }
checkArgument(requiredBlob != null, "BLOB key cannot be null."); final File localFile = BlobUtils.getStorageLocation(storageDir, requiredBlob);
/** * Returns a file handle to the file associated with the given blob key on the blob * server. * * @param jobId * ID of the job this blob belongs to (or <tt>null</tt> if job-unrelated) * @param key * identifying the file * * @return file handle to the file * * @throws IOException * if creating the directory fails */ @VisibleForTesting public File getStorageLocation(JobID jobId, BlobKey key) throws IOException { checkNotNull(jobId); return BlobUtils.getStorageLocation(storageDir, jobId, key); }
/** * Returns a file handle to the file associated with the given blob key on the blob * server. * * @param jobId * ID of the job this blob belongs to (or <tt>null</tt> if job-unrelated) * @param key * identifying the file * * @return file handle to the file * * @throws IOException * if creating the directory fails */ @VisibleForTesting public File getStorageLocation(JobID jobId, BlobKey key) throws IOException { checkNotNull(jobId); return BlobUtils.getStorageLocation(storageDir, jobId, key); }
/** * Returns a file handle to the file associated with the given blob key on the blob * server. * * @param jobId * ID of the job this blob belongs to (or <tt>null</tt> if job-unrelated) * @param key * identifying the file * * @return file handle to the file * * @throws IOException * if creating the directory fails */ @VisibleForTesting public File getStorageLocation(JobID jobId, BlobKey key) throws IOException { checkNotNull(jobId); return BlobUtils.getStorageLocation(storageDir, jobId, key); }
File storageFile = BlobUtils.getStorageLocation(storageDir, jobId, blobKey);
File storageFile = BlobUtils.getStorageLocation(storageDir, jobId, blobKey);
File storageFile = BlobUtils.getStorageLocation(storageDir, jobId, blobKey);