private long listBlobsToGetLatestIndexId() throws IOException { Map<String, BlobMetaData> blobs = blobContainer().listBlobsByPrefix(INDEX_FILE_PREFIX); long latest = RepositoryData.EMPTY_REPO_GEN; if (blobs.isEmpty()) { // no snapshot index blobs have been written yet return latest; } for (final BlobMetaData blobMetaData : blobs.values()) { final String blobName = blobMetaData.name(); try { final long curr = Long.parseLong(blobName.substring(INDEX_FILE_PREFIX.length())); latest = Math.max(latest, curr); } catch (NumberFormatException nfe) { // the index- blob wasn't of the format index-N where N is a number, // no idea what this blob is but it doesn't belong in the repository! logger.debug("[{}] Unknown blob in the repository: {}", metadata.name(), blobName); } } return latest; }
private long listBlobsToGetLatestIndexId() throws IOException { Map<String, BlobMetaData> blobs = snapshotsBlobContainer.listBlobsByPrefix(INDEX_FILE_PREFIX); long latest = RepositoryData.EMPTY_REPO_GEN; if (blobs.isEmpty()) { // no snapshot index blobs have been written yet return latest; } for (final BlobMetaData blobMetaData : blobs.values()) { final String blobName = blobMetaData.name(); try { final long curr = Long.parseLong(blobName.substring(INDEX_FILE_PREFIX.length())); latest = Math.max(latest, curr); } catch (NumberFormatException nfe) { // the index- blob wasn't of the format index-N where N is a number, // no idea what this blob is but it doesn't belong in the repository! logger.debug("[{}] Unknown blob in the repository: {}", metadata.name(), blobName); } } return latest; }
private long listBlobsToGetLatestIndexId() throws IOException { Map<String, BlobMetaData> blobs = blobContainer().listBlobsByPrefix(INDEX_FILE_PREFIX); long latest = RepositoryData.EMPTY_REPO_GEN; if (blobs.isEmpty()) { // no snapshot index blobs have been written yet return latest; } for (final BlobMetaData blobMetaData : blobs.values()) { final String blobName = blobMetaData.name(); try { final long curr = Long.parseLong(blobName.substring(INDEX_FILE_PREFIX.length())); latest = Math.max(latest, curr); } catch (NumberFormatException nfe) { // the index- blob wasn't of the format index-N where N is a number, // no idea what this blob is but it doesn't belong in the repository! logger.debug("[{}] Unknown blob in the repository: {}", metadata.name(), blobName); } } return latest; }
private long listBlobsToGetLatestIndexId() throws IOException { Map<String, BlobMetaData> blobs = blobContainer().listBlobsByPrefix(INDEX_FILE_PREFIX); long latest = RepositoryData.EMPTY_REPO_GEN; if (blobs.isEmpty()) { // no snapshot index blobs have been written yet return latest; } for (final BlobMetaData blobMetaData : blobs.values()) { final String blobName = blobMetaData.name(); try { final long curr = Long.parseLong(blobName.substring(INDEX_FILE_PREFIX.length())); latest = Math.max(latest, curr); } catch (NumberFormatException nfe) { // the index- blob wasn't of the format index-N where N is a number, // no idea what this blob is but it doesn't belong in the repository! logger.debug("[{}] Unknown blob in the repository: {}", metadata.name(), blobName); } } return latest; }
Map<String, BlobMetaData> blobs; try { blobs = snapshotsBlobContainer.listBlobsByPrefix(COMMON_SNAPSHOT_PREFIX); } catch (UnsupportedOperationException ex) {
assertThat(container.listBlobsByPrefix("foo-").size(), equalTo(numberOfFooBlobs)); assertThat(container.listBlobsByPrefix("bar-").size(), equalTo(numberOfBarBlobs)); assertThat(container.listBlobsByPrefix("baz-").size(), equalTo(0)); assertThat(container.listBlobsByPrefix(name).size(), equalTo(0)); blobs = container.listBlobsByPrefix(newName); assertThat(blobs.size(), equalTo(1)); assertThat(blobs.get(newName).length(), equalTo(generatedBlobs.get(name)));