steffenvan commented on code in PR #1560: URL: https://github.com/apache/jackrabbit-oak/pull/1560#discussion_r1657127391
########## 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: could you rewrite what this could sort based on? Imo: `sorted on the basis of particular key in the metadata map` isn't super clear. And an example would be very helpful. -- 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: oak-dev-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org