View Javadoc

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.Map;
23  import java.util.concurrent.ConcurrentMap;
24  
25  import org.apache.hadoop.classification.InterfaceAudience;
26  import org.apache.hadoop.fs.FileSystem;
27  import org.apache.hadoop.hbase.HRegionInfo;
28  import org.apache.hadoop.hbase.catalog.CatalogTracker;
29  import org.apache.hadoop.hbase.executor.ExecutorService;
30  import org.apache.hadoop.hbase.ipc.RpcServerInterface;
31  import org.apache.hadoop.hbase.master.TableLockManager;
32  import org.apache.hadoop.hbase.regionserver.wal.HLog;
33  import org.apache.zookeeper.KeeperException;
34  
35  /**
36   * Services provided by {@link HRegionServer}
37   */
38  @InterfaceAudience.Private
39  public interface RegionServerServices extends OnlineRegions, FavoredNodesForRegion {
40    /**
41     * @return True if this regionserver is stopping.
42     */
43    boolean isStopping();
44  
45    /** @return the HLog for a particular region. Pass null for getting the
46     * default (common) WAL */
47    HLog getWAL(HRegionInfo regionInfo) throws IOException;
48  
49    /**
50     * @return Implementation of {@link CompactionRequestor} or null.
51     */
52    CompactionRequestor getCompactionRequester();
53  
54    /**
55     * @return Implementation of {@link FlushRequester} or null.
56     */
57    FlushRequester getFlushRequester();
58  
59    /**
60     * @return the RegionServerAccounting for this Region Server
61     */
62    RegionServerAccounting getRegionServerAccounting();
63  
64    /**
65     * @return RegionServer's instance of {@link TableLockManager}
66     */
67    TableLockManager getTableLockManager();
68  
69    /**
70     * Tasks to perform after region open to complete deploy of region on
71     * regionserver
72     *
73     * @param r Region to open.
74     * @param ct Instance of {@link CatalogTracker}
75     * @throws KeeperException
76     * @throws IOException
77     */
78    void postOpenDeployTasks(final HRegion r, final CatalogTracker ct)
79    throws KeeperException, IOException;
80  
81    /**
82     * Returns a reference to the region server's RPC server
83     */
84    RpcServerInterface getRpcServer();
85  
86    /**
87     * Get the regions that are currently being opened or closed in the RS
88     * @return map of regions in transition in this RS
89     */
90    ConcurrentMap<byte[], Boolean> getRegionsInTransitionInRS();
91  
92    /**
93     * @return Return the FileSystem object used by the regionserver
94     */
95    FileSystem getFileSystem();
96  
97    /**
98     * @return The RegionServer's "Leases" service
99     */
100   Leases getLeases();
101 
102   /**
103    * @return hbase executor service
104    */
105   ExecutorService getExecutorService();
106 
107   /**
108    * @return The RegionServer's CatalogTracker
109    */
110   CatalogTracker getCatalogTracker();
111 
112   /**
113    * @return set of recovering regions on the hosting region server
114    */
115   Map<String, HRegion> getRecoveringRegions();
116 }