@Test public void getBlobAttributes() throws Exception { Path propertiesPath = fullPath.resolve("e27f83a9-dc18-4818-b4ca-ae8a9cb813c7.properties"); write(propertiesPath, VALID_BLOB_STORE_PROPERTIES); assertNotNull(underTest.getBlobAttributes(new BlobId("e27f83a9-dc18-4818-b4ca-ae8a9cb813c7"))); }
@Nullable @Override public BlobAttributes getBlobAttributes(final BlobId blobId) { Path blobPath = attributePath(blobId); try { FileBlobAttributes blobAttributes = new FileBlobAttributes(blobPath); if (!blobAttributes.load()) { log.warn("Attempt to access non-existent blob {} ({})", blobId, attributePath(blobId)); return null; } else { return blobAttributes; } } catch (Exception e) { log.error("Unable to load BlobAttributes for blob id: {}, path: {}, exception: {}", blobId, blobPath, e.getMessage(), log.isDebugEnabled() ? e : null); return null; } }
FileBlobStore extends BlobStoreSupport<FileAttributesLocation> { @Nullable @Override public BlobAttributes getBlobAttributes(final BlobId blobId) { Path blobPath = attributePath(blobId); try { FileBlobAttributes blobAttributes = new FileBlobAttributes(blobPath); if (!blobAttributes.load()) { log.warn("Attempt to access non-existent blob {} ({})", blobId, attributePath(blobId)); return null; } else { return blobAttributes; } } catch (Exception e) { log.error("Unable to load BlobAttributes for blob id: {}, path: {}, exception: {}", blobId, blobPath, e.getMessage(), log.isDebugEnabled() ? e : null); return null; } } }
FileBlobStore extends BlobStoreSupport<FileAttributesLocation> { @Nullable @Override public BlobAttributes getBlobAttributes(final BlobId blobId) { Path blobPath = attributePath(blobId); try { FileBlobAttributes blobAttributes = new FileBlobAttributes(blobPath); if (!blobAttributes.load()) { log.warn("Attempt to access non-existent blob {} ({})", blobId, attributePath(blobId)); return null; } else { return blobAttributes; } } catch (Exception e) { log.error("Unable to load BlobAttributes for blob id: {}, path: {}, exception: {}", blobId, blobPath, e.getMessage(), log.isDebugEnabled() ? e : null); return null; } } @Inject  FileBlobStore(final BlobIdLocationResolver blobIdLocationResolver,
                       final FileOperations fileOperations,
                       final ApplicationDirectories applicationDirectories,
                       final FileBlobStoreMetricsStore metricsStore,
                       final NodeAccess nodeAccess,
                       final DryRunPrefix dryRunPrefix); @VisibleForTesting  FileBlobStore(final Path contentDir, //NOSONAR
                       final BlobIdLocationResolver blobIdLocationResolver,
                       final FileOperations fileOperations,
                       final FileBlobStoreMetricsStore metricsStore,
                       final BlobStoreConfiguration configuration,
                       final ApplicationDirectories directories,
                       final NodeAccess nodeAccess,
                       final DryRunPrefix dryRunPrefix); }
FileBlobStore extends BlobStoreSupport<FileAttributesLocation> { @Nullable @Override public BlobAttributes getBlobAttributes(final BlobId blobId) { Path blobPath = attributePath(blobId); try { FileBlobAttributes blobAttributes = new FileBlobAttributes(blobPath); if (!blobAttributes.load()) { log.warn("Attempt to access non-existent blob {} ({})", blobId, attributePath(blobId)); return null; } else { return blobAttributes; } } catch (Exception e) { log.error("Unable to load BlobAttributes for blob id: {}, path: {}, exception: {}", blobId, blobPath, e.getMessage(), log.isDebugEnabled() ? e : null); return null; } } @Inject  FileBlobStore(final BlobIdLocationResolver blobIdLocationResolver,
                       final FileOperations fileOperations,
                       final ApplicationDirectories applicationDirectories,
                       final FileBlobStoreMetricsStore metricsStore,
                       final NodeAccess nodeAccess,
                       final DryRunPrefix dryRunPrefix); @VisibleForTesting  FileBlobStore(final Path contentDir, //NOSONAR
                       final BlobIdLocationResolver blobIdLocationResolver,
                       final FileOperations fileOperations,
                       final FileBlobStoreMetricsStore metricsStore,
                       final BlobStoreConfiguration configuration,
                       final ApplicationDirectories directories,
                       final NodeAccess nodeAccess,
                       final DryRunPrefix dryRunPrefix); @Override @Guarded(by = STARTED) Blob create(final Path sourceFile, final Map<String, String> headers, final long size, final HashCode sha1); @Override @Guarded(by = STARTED) @Timed Blob copy(final BlobId blobId, final Map<String, String> headers); @Nullable @Override @Guarded(by = STARTED) Blob get(final BlobId blobId); @Nullable @Override @Guarded(by = STARTED) @Timed Blob get(final BlobId blobId, final boolean includeDeleted); @Override @Guarded(by = STARTED) BlobStoreMetrics getMetrics(); @Override boolean isStorageAvailable(); @Override boolean exists(final BlobId blobId); @Override @Guarded(by = {NEW, STOPPED, FAILED, SHUTDOWN}) void remove(); @Override Stream<BlobId> getBlobIdStream(); @Override Stream<BlobId> getDirectPathBlobIdStream(final String prefix); @VisibleForTesting Path getContentDir(); @Nullable @Override BlobAttributes getBlobAttributes(final BlobId blobId); @Override BlobAttributes getBlobAttributes(final FileAttributesLocation attributesFilePath); @Override void setBlobAttributes(BlobId blobId, BlobAttributes blobAttributes); }
FileBlobStore extends BlobStoreSupport<FileAttributesLocation> { @Nullable @Override public BlobAttributes getBlobAttributes(final BlobId blobId) { Path blobPath = attributePath(blobId); try { FileBlobAttributes blobAttributes = new FileBlobAttributes(blobPath); if (!blobAttributes.load()) { log.warn("Attempt to access non-existent blob {} ({})", blobId, attributePath(blobId)); return null; } else { return blobAttributes; } } catch (Exception e) { log.error("Unable to load BlobAttributes for blob id: {}, path: {}, exception: {}", blobId, blobPath, e.getMessage(), log.isDebugEnabled() ? e : null); return null; } } @Inject  FileBlobStore(final BlobIdLocationResolver blobIdLocationResolver,
                       final FileOperations fileOperations,
                       final ApplicationDirectories applicationDirectories,
                       final FileBlobStoreMetricsStore metricsStore,
                       final NodeAccess nodeAccess,
                       final DryRunPrefix dryRunPrefix); @VisibleForTesting  FileBlobStore(final Path contentDir, //NOSONAR
                       final BlobIdLocationResolver blobIdLocationResolver,
                       final FileOperations fileOperations,
                       final FileBlobStoreMetricsStore metricsStore,
                       final BlobStoreConfiguration configuration,
                       final ApplicationDirectories directories,
                       final NodeAccess nodeAccess,
                       final DryRunPrefix dryRunPrefix); @Override @Guarded(by = STARTED) Blob create(final Path sourceFile, final Map<String, String> headers, final long size, final HashCode sha1); @Override @Guarded(by = STARTED) @Timed Blob copy(final BlobId blobId, final Map<String, String> headers); @Nullable @Override @Guarded(by = STARTED) Blob get(final BlobId blobId); @Nullable @Override @Guarded(by = STARTED) @Timed Blob get(final BlobId blobId, final boolean includeDeleted); @Override @Guarded(by = STARTED) BlobStoreMetrics getMetrics(); @Override boolean isStorageAvailable(); @Override boolean exists(final BlobId blobId); @Override @Guarded(by = {NEW, STOPPED, FAILED, SHUTDOWN}) void remove(); @Override Stream<BlobId> getBlobIdStream(); @Override Stream<BlobId> getDirectPathBlobIdStream(final String prefix); @VisibleForTesting Path getContentDir(); @Nullable @Override BlobAttributes getBlobAttributes(final BlobId blobId); @Override BlobAttributes getBlobAttributes(final FileAttributesLocation attributesFilePath); @Override void setBlobAttributes(BlobId blobId, BlobAttributes blobAttributes); static final String BASEDIR; static final String TYPE; static final String BLOB_CONTENT_SUFFIX; @VisibleForTesting
  static final String CONFIG_KEY; @VisibleForTesting
  static final String PATH_KEY; @VisibleForTesting
  static final String METADATA_FILENAME; @VisibleForTesting
  static final String TYPE_KEY; @VisibleForTesting
  static final String TYPE_V1; @VisibleForTesting
  static final String REBUILD_DELETED_BLOB_INDEX_KEY; @VisibleForTesting
  static final String DELETIONS_FILENAME; }