xtern commented on a change in pull request #9422:
URL: https://github.com/apache/ignite/pull/9422#discussion_r712074057



##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java
##########
@@ -1750,6 +1768,53 @@ static void copy(FileIOFactory factory, File from, File 
to, long length) {
         return new 
IgniteFutureImpl<>(cctx.kernalContext().task().execute(taskCls, snpName));
     }
 
+    /**
+     * Snapshots view supplier.
+     *
+     * @param filter Filter.
+     */
+    private Iterable<SnapshotView> snapshotViewSupplier(Map<String, Object> 
filter) {
+        List<String> snapshotNames = localSnapshotNames();
+
+        String snapshotName = 
(String)filter.get(SnapshotViewWalker.SNAPSHOT_NAME_FILTER);
+        String nodeConsistentId = 
(String)filter.get(SnapshotViewWalker.NODE_CONSISTENT_ID_FILTER);
+
+        return F.flat(F.iterator(snapshotNames, snpName -> {
+                if (snapshotName != null && !snapshotName.equals(snpName))
+                    return Collections.emptyList();
+
+                return F.flat(F.iterator(readSnapshotMetadatas(snpName), meta 
-> {
+                        if (nodeConsistentId != null && 
!nodeConsistentId.equals(toStringSafe(meta.consistentId())))
+                            return Collections.emptyList();
+
+                        return F.iterator(getCacheGroupsName(meta), cacheGrp 
-> new SnapshotView(
+                            meta.snapshotName(),
+                            meta.consistentId(),
+                            cacheGrp,
+                            meta.partitions().get(CU.cacheId(cacheGrp))
+                        ), true);
+                    }, true));
+            }, true));
+    }
+
+    /** */
+    private List<String> getCacheGroupsName(SnapshotMetadata meta) {
+        Path path = 
Paths.get(snapshotLocalDir(meta.snapshotName()).toString(), "db", 
meta.folderName());
+
+        List<String> res = new ArrayList<>();
+
+        try (DirectoryStream<Path> ds = Files.newDirectoryStream(path,
+            pth -> pth.getFileName().toString().startsWith(CACHE_DIR_PREFIX))) 
{

Review comment:
       And what about shared cache groups (CACHE_GRP_DIR_PREFIX)?




-- 
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


Reply via email to