Sega76 commented on a change in pull request #9422: URL: https://github.com/apache/ignite/pull/9422#discussion_r715508916
########## File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java ########## @@ -2468,4 +2515,67 @@ public IgniteSnapshotFutureImpl(IgniteInternalFuture<Void> fut) { return new IgniteException("Snapshot has not been created", U.convertException(e)); } } + + /** Get the snapshot view of a cluster. */ + @GridInternal + private static class SnapshotViewTask extends VisorMultiNodeTask<String, Set<SnapshotView>, List<SnapshotView>> { + /** */ + private static final long serialVersionUID = 0L; + + /** {@inheritDoc} */ + @Override protected SnapshotViewJob job(String arg) { + return new SnapshotViewJob(arg, debug); + } + + /** */ + private static class SnapshotViewJob extends VisorJob<String, List<SnapshotView>> { + /** */ + private static final long serialVersionUID = 0L; + + /** + * Create job without specified argument. + * + * @param arg Job argument. + * @param debug Flag indicating whether debug information should be printed into node log. + */ + protected SnapshotViewJob(@Nullable String arg, boolean debug) { + super(arg, debug); + } + + /** {@inheritDoc} */ + @Override protected List<SnapshotView> run(@Nullable String snapName) { + IgniteSnapshotManager snapMngr = (IgniteSnapshotManager)ignite.snapshot(); + + List<SnapshotMetadata> metas; + + if (snapName != null) + metas = snapMngr.readSnapshotMetadatas(snapName); + else + metas = snapMngr.localSnapshotNames().stream() + .map(snapMngr::readSnapshotMetadatas) + .flatMap(Collection::stream) + .collect(Collectors.toList()); + + return metas.stream().map(meta -> { + Collection<String> cacheGrps = F.viewReadOnly(snapMngr.snapshotCacheDirectories(meta.snapshotName(), meta.folderName()), + FilePageStoreManager::cacheGroupName); + + return new SnapshotView(meta.snapshotName(), + meta.consistentId(), + String.valueOf(meta.baselineNodes()), + String.valueOf(cacheGrps)); + }).collect(Collectors.toList()); + } + } + + /** {@inheritDoc} */ + @Override protected Set<SnapshotView> reduce0(List<ComputeJobResult> results) + throws IgniteException { + return results.stream() + .map(ComputeJobResult::getData) Review comment: fixed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org