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 com.google.protobuf.Service;
22  
23  import java.io.IOException;
24  import java.util.Map;
25  import java.util.Set;
26  import java.util.concurrent.ConcurrentMap;
27  
28  import org.apache.hadoop.hbase.classification.InterfaceAudience;
29  import org.apache.hadoop.fs.FileSystem;
30  import org.apache.hadoop.hbase.HRegionInfo;
31  import org.apache.hadoop.hbase.TableName;
32  import org.apache.hadoop.hbase.executor.ExecutorService;
33  import org.apache.hadoop.hbase.ipc.RpcServerInterface;
34  import org.apache.hadoop.hbase.master.TableLockManager;
35  import org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode;
36  import org.apache.hadoop.hbase.regionserver.wal.HLog;
37  import org.apache.hadoop.hbase.quotas.RegionServerQuotaManager;
38  import org.apache.zookeeper.KeeperException;
39  
40  /**
41   * Services provided by {@link HRegionServer}
42   */
43  @InterfaceAudience.Private
44  public interface RegionServerServices
45      extends OnlineRegions, FavoredNodesForRegion {
46    /**
47     * @return True if this regionserver is stopping.
48     */
49    boolean isStopping();
50  
51    /** @return the HLog for a particular region. Pass null for getting the
52     * default (common) WAL */
53    HLog getWAL(HRegionInfo regionInfo) throws IOException;
54  
55    /**
56     * @return Implementation of {@link CompactionRequestor} or null.
57     */
58    CompactionRequestor getCompactionRequester();
59  
60    /**
61     * @return Implementation of {@link FlushRequester} or null.
62     */
63    FlushRequester getFlushRequester();
64  
65    /**
66     * @return the RegionServerAccounting for this Region Server
67     */
68    RegionServerAccounting getRegionServerAccounting();
69  
70    /**
71     * @return RegionServer's instance of {@link TableLockManager}
72     */
73    TableLockManager getTableLockManager();
74  
75    /**
76     * @return RegionServer's instance of {@link RegionServerQuotaManager}
77     */
78    RegionServerQuotaManager getRegionServerQuotaManager();
79  
80    /**
81     * Tasks to perform after region open to complete deploy of region on
82     * regionserver
83     *
84     * @param r Region to open.
85     * @throws KeeperException
86     * @throws IOException
87     */
88    void postOpenDeployTasks(final HRegion r)
89    throws KeeperException, IOException;
90  
91    /**
92     * Notify master that a handler requests to change a region state
93     */
94    boolean reportRegionStateTransition(TransitionCode code, long openSeqNum, HRegionInfo... hris);
95  
96    /**
97     * Notify master that a handler requests to change a region state
98     */
99    boolean reportRegionStateTransition(TransitionCode code, HRegionInfo... hris);
100 
101   /**
102    * Returns a reference to the region server's RPC server
103    */
104   RpcServerInterface getRpcServer();
105 
106   /**
107    * Get the regions that are currently being opened or closed in the RS
108    * @return map of regions in transition in this RS
109    */
110   ConcurrentMap<byte[], Boolean> getRegionsInTransitionInRS();
111 
112   /**
113    * @return Return the FileSystem object used by the regionserver
114    */
115   FileSystem getFileSystem();
116 
117   /**
118    * @return The RegionServer's "Leases" service
119    */
120   Leases getLeases();
121 
122   /**
123    * @return hbase executor service
124    */
125   ExecutorService getExecutorService();
126 
127   /**
128    * @return set of recovering regions on the hosting region server
129    */
130   Map<String, HRegion> getRecoveringRegions();
131 
132   /**
133    * Only required for "old" log replay; if it's removed, remove this.
134    * @return The RegionServer's NonceManager
135    */
136   public ServerNonceManager getNonceManager();
137 
138   /**
139    * @return all the online tables in this RS
140    */
141   Set<TableName> getOnlineTables();
142   
143      
144   /**
145    * Registers a new protocol buffer {@link Service} subclass as a coprocessor endpoint to be
146    * available for handling
147    * @param instance the {@code Service} subclass instance to expose as a coprocessor endpoint
148    * @return {@code true} if the registration was successful, {@code false}
149    */
150   boolean registerService(Service service);
151 
152 }