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.classification.InterfaceStability; 26 import org.apache.hadoop.hbase.HBaseInterfaceAudience; 27 import org.apache.hadoop.hbase.TableName; 28 import org.apache.hadoop.hbase.Server; 29 import org.apache.hadoop.hbase.ServerName; 30 31 /** 32 * Interface to Map of online regions. In the Map, the key is the region's 33 * encoded name and the value is an {@link Region} instance. 34 */ 35 @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) 36 @InterfaceStability.Evolving 37 public interface OnlineRegions extends Server { 38 /** 39 * Add to online regions. 40 * @param r 41 */ 42 void addToOnlineRegions(final Region r); 43 44 /** 45 * This method removes Region corresponding to hri from the Map of onlineRegions. 46 * 47 * @param r Region to remove. 48 * @param destination Destination, if any, null otherwise. 49 * @return True if we removed a region from online list. 50 */ 51 boolean removeFromOnlineRegions(final Region r, ServerName destination); 52 53 /** 54 * Return {@link Region} instance. 55 * Only works if caller is in same context, in same JVM. Region is not 56 * serializable. 57 * @param encodedRegionName 58 * @return Region for the passed encoded <code>encodedRegionName</code> or 59 * null if named region is not member of the online regions. 60 */ 61 Region getFromOnlineRegions(String encodedRegionName); 62 63 /** 64 * Get all online regions of a table in this RS. 65 * @param tableName 66 * @return List of Region 67 * @throws java.io.IOException 68 */ 69 List<Region> getOnlineRegions(TableName tableName) throws IOException; 70 }