rdblue commented on code in PR #5669:
URL: https://github.com/apache/iceberg/pull/5669#discussion_r990826055


##########
core/src/main/java/org/apache/iceberg/FileCleanupStrategy.java:
##########
@@ -0,0 +1,86 @@
+/*
+ * 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.iceberg;
+
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.function.Consumer;
+import org.apache.iceberg.avro.Avro;
+import org.apache.iceberg.exceptions.NotFoundException;
+import org.apache.iceberg.io.CloseableIterable;
+import org.apache.iceberg.io.FileIO;
+import org.apache.iceberg.util.Tasks;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("checkstyle:VisibilityModifier")
+abstract class FileCleanupStrategy {
+  private static final Logger LOG = 
LoggerFactory.getLogger(FileCleanupStrategy.class);
+
+  protected final FileIO fileIO;
+  protected final ExecutorService planExecutorService;
+  private final Consumer<String> deleteFunc;
+  private final ExecutorService deleteExecutorService;
+
+  protected FileCleanupStrategy(
+      FileIO fileIO,
+      ExecutorService deleteExecutorService,
+      ExecutorService planExecutorService,
+      Consumer<String> deleteFunc) {
+    this.fileIO = fileIO;
+    this.deleteExecutorService = deleteExecutorService;
+    this.planExecutorService = planExecutorService;
+    this.deleteFunc = deleteFunc;
+  }
+
+  public abstract void cleanFiles(TableMetadata beforeExpiration, 
TableMetadata afterExpiration);
+
+  protected static final Schema MANIFEST_PROJECTION =
+      ManifestFile.schema()
+          .select(
+              "manifest_path", "manifest_length", "added_snapshot_id", 
"deleted_data_files_count");
+
+  protected CloseableIterable<ManifestFile> readManifestFiles(Snapshot 
snapshot) {
+    if (snapshot.manifestListLocation() != null) {
+      return readManifestFiles(snapshot.manifestListLocation());
+    } else {
+      return CloseableIterable.withNoopClose(snapshot.allManifests(fileIO));
+    }
+  }
+
+  private CloseableIterable<ManifestFile> readManifestFiles(String 
manifestListLocation) {

Review Comment:
   This could be embedded in `readManifestFiles(Snapshot)` since it is private?



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