chungen0126 commented on code in PR #3784:
URL: https://github.com/apache/ozone/pull/3784#discussion_r1018759710


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -1125,6 +1125,69 @@ public List<RepeatedOmKeyInfo> listTrash(String 
volumeName, String bucketName,
     return deletedKeys;
   }
 
+  @Override
+  public List<SnapshotInfo> listSnapshot(String volumeName, String bucketName)
+      throws IOException {
+    if (Strings.isNullOrEmpty(volumeName)) {
+      throw new OMException("Volume name is required.",
+          ResultCodes.VOLUME_NOT_FOUND);
+    }
+
+    if (Strings.isNullOrEmpty(bucketName)) {
+      throw new OMException("Bucket name is required.",
+          ResultCodes.BUCKET_NOT_FOUND);
+    }
+
+    List<SnapshotInfo> snapshotInfos = new ArrayList<>();
+    TreeMap<String, SnapshotInfo> snapshotInfoMap = new TreeMap<>();
+
+    snapshotInfoMap.putAll(getSnapshotFromCache());
+    snapshotInfoMap.putAll(getSnapshotFromDB());
+
+    for (Map.Entry<String, SnapshotInfo> cacheKey : snapshotInfoMap
+        .entrySet()) {
+      snapshotInfos.add(cacheKey.getValue());
+    }
+
+    return snapshotInfos;
+  }
+
+  private TreeMap<String, SnapshotInfo> getSnapshotFromCache() {
+    TreeMap<String, SnapshotInfo> result = new TreeMap<>();

Review Comment:
   done.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to