@Nullable @Override public URI getDownloadURI(@NotNull Blob blob, @NotNull BlobDownloadOptions downloadOptions) { if (delegate instanceof DataRecordAccessProvider) { String blobId = blob.getContentIdentity(); if (blobId != null) { return ((DataRecordAccessProvider) delegate).getDownloadURI( new DataIdentifier(extractBlobId(blobId)), DataRecordDownloadOptions.fromBlobDownloadOptions(downloadOptions) ); } } return null; }
@Nullable @Override public URI getDownloadURI(@NotNull Blob blob, @NotNull BlobDownloadOptions downloadOptions) { if (delegate instanceof DataRecordAccessProvider) { String blobId = blob.getContentIdentity(); if (blobId != null) { return ((DataRecordAccessProvider) delegate).getDownloadURI( new DataIdentifier(extractBlobId(blobId)), DataRecordDownloadOptions.fromBlobDownloadOptions(downloadOptions) ); } } return null; }
@Override public String getReference(@NotNull String encodedBlobId) { checkNotNull(encodedBlobId); String blobId = extractBlobId(encodedBlobId); //Reference are not created for in memory record if (InMemoryDataRecord.isInstance(blobId)) { return null; } DataRecord record; try { record = delegate.getRecordIfStored(new DataIdentifier(blobId)); if (record != null) { return record.getReference(); } else { log.debug("No blob found for id [{}]", blobId); } } catch (DataStoreException e) { log.warn("Unable to access the blobId for [{}]", blobId, e); } return null; }
@Override public String getReference(@NotNull String encodedBlobId) { checkNotNull(encodedBlobId); String blobId = extractBlobId(encodedBlobId); //Reference are not created for in memory record if (InMemoryDataRecord.isInstance(blobId)) { return null; } DataRecord record; try { record = delegate.getRecordIfStored(new DataIdentifier(blobId)); if (record != null) { return record.getReference(); } else { log.debug("No blob found for id [{}]", blobId); } } catch (DataStoreException e) { log.warn("Unable to access the blobId for [{}]", blobId, e); } return null; }
@Override public String getReference(@Nonnull String encodedBlobId) { checkNotNull(encodedBlobId); String blobId = extractBlobId(encodedBlobId); //Reference are not created for in memory record if (InMemoryDataRecord.isInstance(blobId)) { return null; } DataRecord record; try { record = delegate.getRecordIfStored(new DataIdentifier(blobId)); if (record != null) { return record.getReference(); } else { log.debug("No blob found for id [{}]", blobId); } } catch (DataStoreException e) { log.warn("Unable to access the blobId for [{}]", blobId, e); } return null; }
@Override public long countDeleteChunks(List<String> chunkIds, long maxLastModifiedTime) throws Exception { int count = 0; if (delegate instanceof MultiDataStoreAware) { List<String> deleted = Lists.newArrayListWithExpectedSize(512); for (String chunkId : chunkIds) { String blobId = extractBlobId(chunkId); DataIdentifier identifier = new DataIdentifier(blobId); DataRecord dataRecord = getRecordForId(identifier); boolean success = (maxLastModifiedTime <= 0) || dataRecord.getLastModified() <= maxLastModifiedTime; log.trace("Deleting blob [{}] with last modified date [{}] : [{}]", blobId, dataRecord.getLastModified(), success); if (success) { ((MultiDataStoreAware) delegate).deleteRecord(identifier); deleted.add(blobId); count++; if (count % 512 == 0) { log.info("Deleted blobs {}", deleted); deleted.clear(); } } } if (!deleted.isEmpty()) { log.info("Deleted blobs {}", deleted); } } return count; }
@Override public long countDeleteChunks(List<String> chunkIds, long maxLastModifiedTime) throws Exception { int count = 0; if (delegate instanceof MultiDataStoreAware) { List<String> deleted = Lists.newArrayListWithExpectedSize(512); for (String chunkId : chunkIds) { String blobId = extractBlobId(chunkId); DataIdentifier identifier = new DataIdentifier(blobId); DataRecord dataRecord = getRecordForId(identifier); boolean success = (maxLastModifiedTime <= 0) || dataRecord.getLastModified() <= maxLastModifiedTime; log.trace("Deleting blob [{}] with last modified date [{}] : [{}]", blobId, dataRecord.getLastModified(), success); if (success) { ((MultiDataStoreAware) delegate).deleteRecord(identifier); deleted.add(blobId); count++; if (count % 512 == 0) { log.info("Deleted blobs {}", deleted); deleted.clear(); } } } if (!deleted.isEmpty()) { log.info("Deleted blobs {}", deleted); } } return count; }
@Override public long countDeleteChunks(List<String> chunkIds, long maxLastModifiedTime) throws Exception { int count = 0; if (delegate instanceof MultiDataStoreAware) { List<String> deleted = Lists.newArrayListWithExpectedSize(512); for (String chunkId : chunkIds) { String blobId = extractBlobId(chunkId); DataIdentifier identifier = new DataIdentifier(blobId); DataRecord dataRecord = getRecordForId(identifier); boolean success = (maxLastModifiedTime <= 0) || dataRecord.getLastModified() <= maxLastModifiedTime; log.trace("Deleting blob [{}] with last modified date [{}] : [{}]", blobId, dataRecord.getLastModified(), success); if (success) { ((MultiDataStoreAware) delegate).deleteRecord(identifier); deleted.add(blobId); count++; if (count % 512 == 0) { log.info("Deleted blobs {}", deleted); deleted.clear(); } } } if (!deleted.isEmpty()) { log.info("Deleted blobs {}", deleted); } } return count; }