1 /** 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 package org.apache.hadoop.hbase.master.cleaner; 19 20 import org.apache.hadoop.classification.InterfaceAudience; 21 import org.apache.hadoop.fs.Path; 22 import org.apache.hadoop.hbase.BaseConfigurable; 23 24 /** 25 * Base class for the log cleaning function inside the master. By default, two 26 * cleaners: <code>TimeToLiveLogCleaner</code> and 27 * <code>ReplicationLogCleaner</code> are called in order. So if other effects 28 * are needed, implement your own LogCleanerDelegate and add it to the 29 * configuration "hbase.master.logcleaner.plugins", which is a comma-separated 30 * list of fully qualified class names. LogsCleaner will add it to the chain. 31 * <p> 32 * HBase ships with LogsCleaner as the default implementation. 33 * <p> 34 * This interface extends Configurable, so setConf needs to be called once 35 * before using the cleaner. Since LogCleanerDelegates are created in 36 * LogsCleaner by reflection. Classes that implements this interface should 37 * provide a default constructor. 38 */ 39 @InterfaceAudience.Private 40 public abstract class BaseLogCleanerDelegate extends BaseConfigurable implements FileCleanerDelegate { 41 42 @Override 43 public boolean isFileDeletable(Path file) { 44 return isLogDeletable(file); 45 } 46 47 /** 48 * Should the master delete the log or keep it? 49 * <p> 50 * Implementing classes should override {@link #isFileDeletable(Path)} instead. 51 * @param filePath full path to log. 52 * @return true if the log is deletable, false (default) if not 53 */ 54 @Deprecated 55 public boolean isLogDeletable(Path filePath) { 56 return false; 57 } 58 }