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 java.io.IOException;
23  
24  import org.apache.hadoop.fs.FileSystem;
25  import org.apache.hadoop.hbase.HRegionInfo;
26  import org.apache.hadoop.hbase.catalog.CatalogTracker;
27  import org.apache.hadoop.hbase.ipc.RpcServer;
28  import org.apache.hadoop.hbase.regionserver.wal.HLog;
29  import org.apache.zookeeper.KeeperException;
30  
31  /**
32   * Services provided by {@link HRegionServer}
33   */
34  public interface RegionServerServices extends OnlineRegions {
35    /**
36     * @return True if this regionserver is stopping.
37     */
38    public boolean isStopping();
39  
40    /** @return the HLog for a particular region. Pass null for getting the
41     * default (common) WAL */
42    public HLog getWAL(HRegionInfo regionInfo) throws IOException;
43  
44    /** @return get the default (common) WAL for the server*/
45    public HLog getWAL() throws IOException;
46  
47    /**
48     * @return Implementation of {@link CompactionRequestor} or null.
49     */
50    public CompactionRequestor getCompactionRequester();
51  
52    /**
53     * @return Implementation of {@link FlushRequester} or null.
54     */
55    public FlushRequester getFlushRequester();
56  
57    /**
58     * @return the RegionServerAccounting for this Region Server
59     */
60    public RegionServerAccounting getRegionServerAccounting();
61  
62    /**
63     * Tasks to perform after region open to complete deploy of region on
64     * regionserver
65     * 
66     * @param r Region to open.
67     * @param ct Instance of {@link CatalogTracker}
68     * @param daughter True if this is daughter of a split
69     * @throws KeeperException
70     * @throws IOException
71     */
72    public void postOpenDeployTasks(final HRegion r, final CatalogTracker ct,
73        final boolean daughter)
74    throws KeeperException, IOException;
75  
76    /**
77     * Returns a reference to the region server's RPC server
78     */
79    public RpcServer getRpcServer();
80  
81    /**
82     * Remove passed <code>hri</code> from the internal list of regions in transition on this
83     * regionserver.
84     * @param hri Region to remove.
85     * @return True if removed
86     */
87    public boolean removeFromRegionsInTransition(HRegionInfo hri);
88    /**
89     * @param hri
90     * @return True if the internal list of regions in transition includes the
91     *         passed <code>hri</code>.
92     */
93    public boolean containsKeyInRegionsInTransition(HRegionInfo hri);
94  
95    /**
96     * @return Return the FileSystem object used by the regionserver
97     */
98    public FileSystem getFileSystem();
99  
100   /**
101    * @return The RegionServer's "Leases" service
102    */
103   public Leases getLeases();
104 }