swamirishi commented on code in PR #4823:
URL: https://github.com/apache/ozone/pull/4823#discussion_r1236181237


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/FSODirectoryPathResolver.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.ozone.om.snapshot;
+
+import com.google.common.collect.Sets;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.hadoop.hdds.utils.db.Table;
+import org.apache.hadoop.hdds.utils.db.TableIterator;
+import org.apache.hadoop.ozone.om.helpers.OmDirectoryInfo;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Queue;
+import java.util.Set;
+
+import static org.apache.hadoop.ozone.OzoneConsts.OM_KEY_PREFIX;
+
+/**
+ * Class to resolve absolute paths for FSO DirectoryInfo Objects.
+ */
+public class FSODirectoryPathResolver implements ObjectPathResolver {
+
+  private final String prefix;
+  private final long bucketId;
+  private final Table<String, OmDirectoryInfo> dirInfoTable;
+
+  public FSODirectoryPathResolver(String prefix, long bucketId,
+      Table<String, OmDirectoryInfo> dirInfoTable) {
+    this.prefix = prefix;
+    this.dirInfoTable = dirInfoTable;
+    this.bucketId = bucketId;
+  }
+
+  private void addToPathMap(Pair<Long, Path> objectIDPath,
+                            Set<Long> dirObjIds, Map<Long, Path> pathMap) {
+    if (dirObjIds.contains(objectIDPath.getKey())) {
+      pathMap.put(objectIDPath.getKey(), objectIDPath.getValue());
+      dirObjIds.remove(objectIDPath.getKey());
+    }
+  }
+
+  /**
+   * Assuming all dirObjIds belong to a bucket this function resolves absolute
+   * path for a given FSO bucket.
+   * @param dirObjIds
+   * @return Map of Path corresponding to provided directory object IDs
+   */
+  @SuppressFBWarnings("DMI_HARDCODED_ABSOLUTE_FILENAME")

Review Comment:
   it still throws the warning even if we move to a constant.



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