001/**
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *     http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019package org.apache.hadoop.hbase.regionserver;
020
021import java.io.IOException;
022import java.util.List;
023
024import org.apache.hadoop.hbase.HBaseInterfaceAudience;
025import org.apache.hadoop.hbase.TableName;
026import org.apache.yetus.audience.InterfaceAudience;
027import org.apache.yetus.audience.InterfaceStability;
028
029/**
030 * Provides read-only access to the Regions presently online on the
031 * current RegionServer
032 */
033@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
034@InterfaceStability.Evolving
035public interface OnlineRegions {
036
037  /**
038   * Return {@link Region} instance.
039   * Only works if caller is in same context, in same JVM. Region is not
040   * serializable.
041   * @param encodedRegionName
042   * @return Region for the passed encoded <code>encodedRegionName</code> or
043   * null if named region is not member of the online regions.
044   */
045  Region getRegion(String encodedRegionName);
046
047   /**
048    * Get all online regions of a table in this RS.
049    * @param tableName
050    * @return List of Region
051    * @throws java.io.IOException
052    */
053   List<? extends Region> getRegions(TableName tableName) throws IOException;
054
055   /**
056    * Get all online regions in this RS.
057    * @return List of online Region
058    */
059   List<? extends Region> getRegions();
060}