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.hbase.classification.InterfaceAudience;
21 import org.apache.hadoop.fs.FileStatus;
22
23 /**
24 * Base class for the log cleaning function inside the master. By default, two
25 * cleaners: <code>TimeToLiveLogCleaner</code> and
26 * <code>ReplicationLogCleaner</code> are called in order. So if other effects
27 * are needed, implement your own LogCleanerDelegate and add it to the
28 * configuration "hbase.master.logcleaner.plugins", which is a comma-separated
29 * list of fully qualified class names. LogsCleaner will add it to the chain.
30 * <p>
31 * HBase ships with LogsCleaner as the default implementation.
32 * <p>
33 * This interface extends Configurable, so setConf needs to be called once
34 * before using the cleaner. Since LogCleanerDelegates are created in
35 * LogsCleaner by reflection. Classes that implements this interface should
36 * provide a default constructor.
37 */
38 @InterfaceAudience.Private
39 public abstract class BaseLogCleanerDelegate extends BaseFileCleanerDelegate {
40
41 @Override
42 public boolean isFileDeletable(FileStatus fStat) {
43 return isLogDeletable(fStat);
44 }
45
46 /**
47 * Should the master delete the log or keep it?
48 * <p>
49 * Implementing classes should override {@link #isFileDeletable(FileStatus)} instead.
50 * @param fStat file status of the file
51 * @return true if the log is deletable, false (default) if not
52 */
53 @Deprecated
54 public boolean isLogDeletable(FileStatus fStat) {
55 return false;
56 }
57 }