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    /**
45     * @return Implementation of {@link CompactionRequestor} or null.
46     */
47    public CompactionRequestor getCompactionRequester();
48  
49    /**
50     * @return Implementation of {@link FlushRequester} or null.
51     */
52    public FlushRequester getFlushRequester();
53  
54    /**
55     * @return the RegionServerAccounting for this Region Server
56     */
57    public RegionServerAccounting getRegionServerAccounting();
58  
59    /**
60     * Tasks to perform after region open to complete deploy of region on
61     * regionserver
62     * 
63     * @param r Region to open.
64     * @param ct Instance of {@link CatalogTracker}
65     * @param daughter True if this is daughter of a split
66     * @throws KeeperException
67     * @throws IOException
68     */
69    public void postOpenDeployTasks(final HRegion r, final CatalogTracker ct,
70        final boolean daughter)
71    throws KeeperException, IOException;
72  
73    /**
74     * Returns a reference to the region server's RPC server
75     */
76    public RpcServer getRpcServer();
77  
78    /**
79     * Remove passed <code>hri</code> from the internal list of regions in transition on this
80     * regionserver.
81     * @param hri Region to remove.
82     * @return True if removed
83     */
84    public boolean removeFromRegionsInTransition(HRegionInfo hri);
85    /**
86     * @param hri
87     * @return True if the internal list of regions in transition includes the
88     *         passed <code>hri</code>.
89     */
90    public boolean containsKeyInRegionsInTransition(HRegionInfo hri);
91  
92    /**
93     * @return Return the FileSystem object used by the regionserver
94     */
95    public FileSystem getFileSystem();
96  
97    /**
98     * @return The RegionServer's "Leases" service
99     */
100   public Leases getLeases();
101 }