* With the removal of the incompatible snapshots list in RepositoryData the get snapshots and get all snapshots methods are equivalent so I removed one of them
This commit is contained in:
parent
068286ca4b
commit
9b4f50b40a
|
@ -94,7 +94,7 @@ public class TransportGetSnapshotsAction extends TransportMasterNodeAction<GetSn
|
|||
final RepositoryData repositoryData;
|
||||
if (isCurrentSnapshotsOnly(request.snapshots()) == false) {
|
||||
repositoryData = snapshotsService.getRepositoryData(repository);
|
||||
for (SnapshotId snapshotId : repositoryData.getAllSnapshotIds()) {
|
||||
for (SnapshotId snapshotId : repositoryData.getSnapshotIds()) {
|
||||
allSnapshotIds.put(snapshotId.getName(), snapshotId);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -194,7 +194,7 @@ public class TransportSnapshotsStatusAction extends TransportMasterNodeAction<Sn
|
|||
if (Strings.hasText(repositoryName) && request.snapshots() != null && request.snapshots().length > 0) {
|
||||
final Set<String> requestedSnapshotNames = Sets.newHashSet(request.snapshots());
|
||||
final RepositoryData repositoryData = snapshotsService.getRepositoryData(repositoryName);
|
||||
final Map<String, SnapshotId> matchedSnapshotIds = repositoryData.getAllSnapshotIds().stream()
|
||||
final Map<String, SnapshotId> matchedSnapshotIds = repositoryData.getSnapshotIds().stream()
|
||||
.filter(s -> requestedSnapshotNames.contains(s.getName()))
|
||||
.collect(Collectors.toMap(SnapshotId::getName, Function.identity()));
|
||||
for (final String snapshotName : request.snapshots()) {
|
||||
|
|
|
@ -107,13 +107,6 @@ public final class RepositoryData {
|
|||
return Collections.unmodifiableCollection(snapshotIds.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable collection of all the snapshot ids in the repository.
|
||||
*/
|
||||
public Collection<SnapshotId> getAllSnapshotIds() {
|
||||
return new ArrayList<>(snapshotIds.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link SnapshotState} for the given snapshot. Returns {@code null} if
|
||||
* there is no state for the snapshot.
|
||||
|
|
|
@ -388,7 +388,7 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
|
|||
final String snapshotName = snapshotId.getName();
|
||||
// check if the snapshot name already exists in the repository
|
||||
final RepositoryData repositoryData = getRepositoryData();
|
||||
if (repositoryData.getAllSnapshotIds().stream().anyMatch(s -> s.getName().equals(snapshotName))) {
|
||||
if (repositoryData.getSnapshotIds().stream().anyMatch(s -> s.getName().equals(snapshotName))) {
|
||||
throw new InvalidSnapshotNameException(metadata.name(), snapshotId.getName(), "snapshot with the same name already exists");
|
||||
}
|
||||
|
||||
|
@ -460,7 +460,7 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
|
|||
|
||||
private void cleanupStaleRootFiles(Set<String> rootBlobNames, RepositoryData repositoryData) {
|
||||
final Set<String> allSnapshotIds =
|
||||
repositoryData.getAllSnapshotIds().stream().map(SnapshotId::getUUID).collect(Collectors.toSet());
|
||||
repositoryData.getSnapshotIds().stream().map(SnapshotId::getUUID).collect(Collectors.toSet());
|
||||
final List<String> blobsToDelete = rootBlobNames.stream().filter(
|
||||
blob -> {
|
||||
if (FsBlobContainer.isTempBlobName(blob)) {
|
||||
|
|
Loading…
Reference in New Issue