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