/** * Identifies if the instance is writable. The writable state is a configuration option and not representative of the * underlying storage implementation. To communicate the underlying implementations status see * {@link #isStorageAvailable()} * * @return {@code true} if the blob store is writable * @since 3.15 */ default boolean isWritable() { return getBlobStoreConfiguration().isWritable(); }
@Override public DateTime getModifiedDate() { return blob.getMetrics().getCreationTime(); } });
@Override public long getSize() { return blob.getMetrics().getContentSize(); }
/** * The blob reference this instance is pointing to. */ @Nonnull public BlobRef getBlobRef() { return new BlobRef( nodeAccess.getId(), blobStore.getBlobStoreConfiguration().getName(), getBlob().getId().asUniqueString()); }
@Override @Timed public boolean test(final BlobStore blobStore, final BlobId blobId, final String blobName) { BlobRef blobRef = new BlobRef(ANY_NODE, blobStore.getBlobStoreConfiguration().getName(), blobId.asUniqueString()); try (ODatabaseDocumentTx tx = txSupplier.get()) { tx.begin(); List<ODocument> results = tx.command(assetBlobRefQuery).execute(blobName, blobRef.toString()); return !results.isEmpty(); } } }
@Override public void close() { try { blobStore.deleteHard(blob.getId()); } catch (BlobStoreException e) { log.debug("Unable to delete blob {} in blob store {}", blob.getId(), blobStore.getBlobStoreConfiguration().getName(), e); } }
private void delete(final BlobStore blobStore) { detect(blobStore, blobId -> { log.info("Deleting orphaned blob {} from blobstore {}", blobId, blobStore.getBlobStoreConfiguration().getName()); blobStore.deleteHard(new BlobId(blobId)); }); }
@Override public InputStream get() { return blob.getInputStream(); } }
@Override public long blobStoreUsageCount(final String blobStoreName) { long count = 0; for (BlobStore otherBlobStore : stores.values()) { BlobStoreConfiguration otherBlobStoreConfig = otherBlobStore.getBlobStoreConfiguration(); BlobStoreDescriptor otherBlobStoreDescriptor = blobStoreDescriptors.get(otherBlobStoreConfig.getType()); if (otherBlobStoreDescriptor.configHasDependencyOn(otherBlobStoreConfig, blobStoreName)) { count += 1; } } return count; }
/** * Get the SHA1 from the {@link BlobAttributes} */ protected String getBlobSha1(final BlobAttributes blobAttributes) { BlobMetrics metrics = blobAttributes.getMetrics(); checkArgument(metrics != null, "Blob attributes are missing metrics"); String blobSha1 = metrics.getSha1Hash(); checkArgument(blobSha1 != null, "Blob metrics are missing SHA1 hash code"); return blobSha1; }
@Override public BlobStore blobStore() { return blobStoreManager.get(config.blobStoreName); } }
@Override protected void doStop() throws Exception { blobStore.stop(); entityType = null; }
@Override protected BlobStoreConfiguration newEntity() { return new BlobStoreConfiguration(); }
@Override public InputStream openInputStream() throws IOException { return blob.getInputStream(); }
/** * The blob size in bytes. */ public long getSize() { return getBlob().getMetrics().getContentSize(); }
@Override public InputStream getInputStream() { return blob.getInputStream(); }