001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase.master.cleaner;
019
020import org.apache.yetus.audience.InterfaceAudience;
021import org.apache.hadoop.conf.Configurable;
022import org.apache.hadoop.fs.FileStatus;
023import org.apache.hadoop.hbase.Stoppable;
024
025import java.util.Map;
026
027/**
028 * General interface for cleaning files from a folder (generally an archive or
029 * backup folder). These are chained via the {@link CleanerChore} to determine
030 * if a given file should be deleted.
031 */
032@InterfaceAudience.Private
033public interface FileCleanerDelegate extends Configurable, Stoppable {
034
035  /**
036   * Determines which of the given files are safe to delete
037   * @param files files to check for deletion
038   * @return files that are ok to delete according to this cleaner
039   */
040  Iterable<FileStatus> getDeletableFiles(Iterable<FileStatus> files);
041
042
043  /**
044   * this method is used to pass some instance into subclass
045   * */
046  void init(Map<String, Object> params);
047
048  /**
049   * Used to do some initialize work before every period clean
050   */
051  default void preClean() {
052  }
053}