@Test public void toBlobName() { Path absolute = underTest.getContentDir().resolve(DIRECT_PATH_ROOT).resolve("some/direct/path/file.txt.properties"); assertThat(underTest.toBlobName(absolute), is("some/direct/path/file.txt")); }
@VisibleForTesting @Nullable String toBlobName(final Path path) { try { String pathStr = contentDir.resolve(DIRECT_PATH_ROOT) .relativize(path) .toString().replace(File.separatorChar, '/'); return removeEnd(pathStr, BLOB_ATTRIBUTE_SUFFIX); } catch (Exception ex) { log.debug("Attempting to create blob name from path {}, but caught Exception", path, ex); return null; } }
FileBlobStore extends BlobStoreSupport<FileAttributesLocation> { @VisibleForTesting @Nullable String toBlobName(final Path path) { try { String pathStr = contentDir.resolve(DIRECT_PATH_ROOT) .relativize(path) .toString().replace(File.separatorChar, '/'); return removeEnd(pathStr, BLOB_ATTRIBUTE_SUFFIX); } catch (Exception ex) { log.debug("Attempting to create blob name from path {}, but caught Exception", path, ex); return null; } } }
FileBlobStore extends BlobStoreSupport<FileAttributesLocation> { @VisibleForTesting @Nullable String toBlobName(final Path path) { try { String pathStr = contentDir.resolve(DIRECT_PATH_ROOT) .relativize(path) .toString().replace(File.separatorChar, '/'); return removeEnd(pathStr, BLOB_ATTRIBUTE_SUFFIX); } catch (Exception ex) { log.debug("Attempting to create blob name from path {}, but caught Exception", path, ex); 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> { @VisibleForTesting @Nullable String toBlobName(final Path path) { try { String pathStr = contentDir.resolve(DIRECT_PATH_ROOT) .relativize(path) .toString().replace(File.separatorChar, '/'); return removeEnd(pathStr, BLOB_ATTRIBUTE_SUFFIX); } catch (Exception ex) { log.debug("Attempting to create blob name from path {}, but caught Exception", path, ex); 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> { @VisibleForTesting @Nullable String toBlobName(final Path path) { try { String pathStr = contentDir.resolve(DIRECT_PATH_ROOT) .relativize(path) .toString().replace(File.separatorChar, '/'); return removeEnd(pathStr, BLOB_ATTRIBUTE_SUFFIX); } catch (Exception ex) { log.debug("Attempting to create blob name from path {}, but caught Exception", path, ex); 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; }