@Override public boolean metadataRecordExists(String name) { return delegate instanceof SharedDataStore && ((SharedDataStore) delegate).metadataRecordExists(name); }
@Override public boolean metadataRecordExists(String name) { return delegate instanceof SharedDataStore && ((SharedDataStore) delegate).metadataRecordExists(name); }
/** * Adds the marked references to the blob store root. Default NOOP * * @param blobStore the blob store * @param fs the fs * @param repoId the repo id * @param uniqueSuffix the unique session suffix * @throws DataStoreException the data store exception * @throws IOException Signals that an I/O exception has occurred. */ @Override void addMarked(GarbageCollectableBlobStore blobStore, GarbageCollectorFileState fs, String repoId, String uniqueSuffix) throws DataStoreException, IOException { boolean exists = ((SharedDataStore) blobStore) .metadataRecordExists(SharedStoreRecordType.REFERENCES.getNameFromId(repoId)); if (exists) { LOG.info("References for repository id {} already exists. Creating a duplicate one. " + "Please check for inadvertent sharing of repository id by different repositories", repoId); } ((SharedDataStore) blobStore).addMetadataRecord(fs.getMarkedRefs(), SharedStoreRecordType.REFERENCES .getNameFromIdPrefix(repoId, uniqueSuffix)); }
/** * Adds the marked references to the blob store root. Default NOOP * * @param blobStore the blob store * @param fs the fs * @param repoId the repo id * @param uniqueSuffix the unique session suffix * @throws DataStoreException the data store exception * @throws IOException Signals that an I/O exception has occurred. */ @Override void addMarked(GarbageCollectableBlobStore blobStore, GarbageCollectorFileState fs, String repoId, String uniqueSuffix) throws DataStoreException, IOException { boolean exists = ((SharedDataStore) blobStore) .metadataRecordExists(SharedStoreRecordType.REFERENCES.getNameFromId(repoId)); if (exists) { LOG.info("References for repository id {} already exists. Creating a duplicate one. " + "Please check for inadvertent sharing of repository id by different repositories", repoId); } ((SharedDataStore) blobStore).addMetadataRecord(fs.getMarkedRefs(), SharedStoreRecordType.REFERENCES .getNameFromIdPrefix(repoId, uniqueSuffix)); }
@Test public void testBackendMetadataRecordExists() throws DataStoreException { SharedDataStore fds = dataStore; fds.addMetadataRecord(randomStream(0, 10), "name"); for (String name : Lists.newArrayList("invalid", "", null)) { if (Strings.isNullOrEmpty(name)) { try { fds.metadataRecordExists(name); } catch (IllegalArgumentException e) { } } else { assertFalse(fds.metadataRecordExists(name)); } } assertTrue(fds.metadataRecordExists("name")); } }