1 /** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 package org.apache.hadoop.hbase.regionserver; 20 21 import java.io.IOException; 22 import java.util.List; 23 24 import org.apache.hadoop.hbase.classification.InterfaceAudience; 25 import org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest; 26 import org.apache.hadoop.hbase.security.User; 27 import org.apache.hadoop.hbase.util.Pair; 28 29 @InterfaceAudience.Private 30 public interface CompactionRequestor { 31 /** 32 * @param r Region to compact 33 * @param why Why compaction was requested -- used in debug messages 34 * @return The created {@link CompactionRequest CompactionRequests} or an empty list if no 35 * compactions were started 36 * @throws IOException 37 */ 38 List<CompactionRequest> requestCompaction(final Region r, final String why) 39 throws IOException; 40 41 /** 42 * @param r Region to compact 43 * @param why Why compaction was requested -- used in debug messages 44 * @param requests custom compaction requests. Each compaction must specify the store on which it 45 * is acting. Can be <tt>null</tt> in which case a compaction will be attempted on all 46 * stores for the region. 47 * @return The created {@link CompactionRequest CompactionRequests} or an empty list if no 48 * compactions were started 49 * @throws IOException 50 */ 51 List<CompactionRequest> requestCompaction( 52 final Region r, final String why, List<Pair<CompactionRequest, Store>> requests 53 ) 54 throws IOException; 55 56 /** 57 * @param r Region to compact 58 * @param s Store within region to compact 59 * @param why Why compaction was requested -- used in debug messages 60 * @param request custom compaction request for the {@link Region} and {@link Store}. Custom 61 * request must be <tt>null</tt> or be constructed with matching region and store. 62 * @return The created {@link CompactionRequest} or <tt>null</tt> if no compaction was started. 63 * @throws IOException 64 */ 65 CompactionRequest requestCompaction( 66 final Region r, final Store s, final String why, CompactionRequest request 67 ) throws IOException; 68 69 /** 70 * @param r Region to compact 71 * @param why Why compaction was requested -- used in debug messages 72 * @param pri Priority of this compaction. minHeap. <=0 is critical 73 * @param requests custom compaction requests. Each compaction must specify the store on which it 74 * is acting. Can be <tt>null</tt> in which case a compaction will be attempted on all 75 * stores for the region. 76 * @param user the effective user 77 * @return The created {@link CompactionRequest CompactionRequests} or an empty list if no 78 * compactions were started. 79 * @throws IOException 80 */ 81 List<CompactionRequest> requestCompaction( 82 final Region r, final String why, int pri, List<Pair<CompactionRequest, Store>> requests, 83 User user) throws IOException; 84 85 /** 86 * @param r Region to compact 87 * @param s Store within region to compact 88 * @param why Why compaction was requested -- used in debug messages 89 * @param pri Priority of this compaction. minHeap. <=0 is critical 90 * @param request custom compaction request to run. {@link Store} and {@link Region} for the 91 * request must match the region and store specified here. 92 * @param user 93 * @return The created {@link CompactionRequest} or <tt>null</tt> if no compaction was started 94 * @throws IOException 95 */ 96 CompactionRequest requestCompaction( 97 final Region r, final Store s, final String why, int pri, CompactionRequest request, User user 98 ) throws IOException; 99 }