nit0906 commented on code in PR #1560:
URL: https://github.com/apache/jackrabbit-oak/pull/1560#discussion_r1669660919


##########
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUtils.java:
##########
@@ -281,4 +287,35 @@ public static String getCaller(@Nullable String[] 
ignoredJavaPackages) {
         // if every element is ignored, we assume it's an internal request
         return "(internal)";
     }
+
+    /**
+     * Returns a Map consisting of checkpoints and checkpointInfoMap filtered 
based on a given predicate
+     * which can utilise checkpoint info map for filtering
+     * @param store
+     * @param predicate predicate used for filtering of checkpoints
+     * @return Map<String, Map<String,String>> filteredCheckpoint Map
+     */
+    public static Map<String, Map<String,String>> 
getFilteredCheckpoints(NodeStore store, Predicate<Map.Entry<String, 
Map<String,String>>> predicate) {
+        return StreamSupport.stream(store.checkpoints().spliterator(), false)
+                .collect(Collectors.toMap(str -> str,
+                        store::checkpointInfo))
+                .entrySet()
+                .stream()
+                .filter(predicate)
+                .collect(Collectors.toMap(Map.Entry::getKey, 
Map.Entry::getValue));
+    }
+
+    /**
+     * Returns a map with checkpoint name as key and checkpoint metadata map 
as value, sorted on the basis of particular key in the metadata map.

Review Comment:
   >sorted on the basis of particular key in the metadata map.
   
   every checkpoint has an associated metadata map and this sort can be based 
on any of the keys of the metadata map. 
   
   Added an example to try and make it more clear.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to