View Javadoc

1   /**
2    * Copyright 2010 The Apache Software Foundation
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  package org.apache.hadoop.hbase.regionserver;
21  
22  import org.apache.hadoop.hbase.Server;
23  
24  import java.io.IOException;
25  import java.util.List;
26  
27  /**
28   * Interface to Map of online regions.  In the  Map, the key is the region's
29   * encoded name and the value is an {@link HRegion} instance.
30   */
31  interface OnlineRegions extends Server {
32    /**
33     * Add to online regions.
34     * @param r
35     */
36    public void addToOnlineRegions(final HRegion r);
37  
38    /**
39     * This method removes HRegion corresponding to hri from the Map of onlineRegions.
40     *
41     * @param encodedRegionName
42     * @return True if we removed a region from online list.
43     */
44    public boolean removeFromOnlineRegions(String encodedRegionName);
45  
46    /**
47     * Return {@link HRegion} instance.
48     * Only works if caller is in same context, in same JVM. HRegion is not
49     * serializable.
50     * @param encodedRegionName
51     * @return HRegion for the passed encoded <code>encodedRegionName</code> or
52     * null if named region is not member of the online regions.
53     */
54    public HRegion getFromOnlineRegions(String encodedRegionName);
55  
56     /**
57      * Get all online regions of a table in this RS.
58      * @param tableName
59      * @return List of HRegion
60      * @throws java.io.IOException
61      */
62     public List<HRegion> getOnlineRegions(byte[] tableName) throws IOException;
63  }