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


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/filter/ReclaimableFilter.java:
##########
@@ -0,0 +1,234 @@
+/*
+ * 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
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.filter;
+
+import com.google.common.collect.Lists;
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import org.apache.hadoop.hdds.utils.IOUtils;
+import org.apache.hadoop.hdds.utils.db.Table;
+import org.apache.hadoop.ozone.om.KeyManager;
+import org.apache.hadoop.ozone.om.OmSnapshot;
+import org.apache.hadoop.ozone.om.OmSnapshotManager;
+import org.apache.hadoop.ozone.om.OzoneManager;
+import org.apache.hadoop.ozone.om.SnapshotChainManager;
+import org.apache.hadoop.ozone.om.helpers.OmBucketInfo;
+import org.apache.hadoop.ozone.om.helpers.SnapshotInfo;
+import org.apache.hadoop.ozone.om.lock.IOzoneManagerLock;
+import org.apache.hadoop.ozone.om.lock.OzoneManagerLock;
+import org.apache.hadoop.ozone.om.snapshot.MultiSnapshotLocks;
+import org.apache.hadoop.ozone.om.snapshot.ReferenceCounted;
+import org.apache.hadoop.ozone.om.snapshot.SnapshotUtils;
+import org.apache.hadoop.ozone.util.CheckedFunction;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class is responsible for opening last N snapshot given a snapshot 
metadata manager or AOS metadata manager by
+ * acquiring a lock.
+ */
+public abstract class ReclaimableFilter<V> implements 
CheckedFunction<Table.KeyValue<String, V>,
+    Boolean, IOException>, Closeable {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(ReclaimableFilter.class);
+
+  private final OzoneManager ozoneManager;
+  private final SnapshotInfo currentSnapshotInfo;
+  private final OmSnapshotManager omSnapshotManager;
+  private final SnapshotChainManager snapshotChainManager;
+
+  private final List<SnapshotInfo> previousSnapshotInfos;
+  private final List<ReferenceCounted<OmSnapshot>> previousOmSnapshots;
+  private final MultiSnapshotLocks snapshotIdLocks;
+  private Long volumeId;
+  private OmBucketInfo bucketInfo;
+  private final KeyManager keyManager;
+  private final int numberOfPreviousSnapshotsFromChain;
+
+  /**
+   * Filter to return deleted keys/directories which are reclaimable based on 
their presence in previous snapshot in
+   * the snapshot chain.
+   *
+   * @param ozoneManager : Ozone Manager instance
+   * @param omSnapshotManager : OmSnapshot Manager of OM instance.
+   * @param snapshotChainManager : snapshot chain manager of OM instance.
+   * @param currentSnapshotInfo : If null the deleted keys in Active Metadata 
manager needs to be processed, hence the
+   *                             latest snapshot in the snapshot chain 
corresponding to bucket key needs to be
+   *                             processed.
+   * @param keyManager : KeyManager corresponding to snapshot or Active 
Metadata Manager.
+   * @param lock : Lock for Active OM.
+   * @param numberOfPreviousSnapshotsFromChain : number of previous snapshots 
to be initialized.
+   */
+  public ReclaimableFilter(OzoneManager ozoneManager, OmSnapshotManager 
omSnapshotManager,
+                           SnapshotChainManager snapshotChainManager,

Review Comment:
   Move SnapshotChainManager inside OmSnapshotManager



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