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.ipc;
21
22 import org.apache.hadoop.hbase.HMsg;
23 import org.apache.hadoop.hbase.HRegionInfo;
24 import org.apache.hadoop.hbase.HServerInfo;
25 import org.apache.hadoop.io.MapWritable;
26
27 import java.io.IOException;
28
29 /**
30 * HRegionServers interact with the HMasterRegionInterface to report on local
31 * goings-on and to obtain data-handling instructions from the HMaster.
32 * <p>Changes here need to be reflected in HbaseObjectWritable HbaseRPC#Invoker.
33 *
34 * <p>NOTE: if you change the interface, you must change the RPC version
35 * number in HBaseRPCProtocolVersion
36 *
37 */
38 public interface HMasterRegionInterface extends HBaseRPCProtocolVersion {
39
40 /**
41 * Called when a region server first starts
42 * @param info server info
43 * @throws IOException e
44 * @return Configuration for the regionserver to use: e.g. filesystem,
45 * hbase rootdir, etc.
46 */
47 public MapWritable regionServerStartup(HServerInfo info) throws IOException;
48
49 /**
50 * Called to renew lease, tell master what the region server is doing and to
51 * receive new instructions from the master
52 *
53 * @param info server's address and start code
54 * @param msgs things the region server wants to tell the master
55 * @param mostLoadedRegions Array of HRegionInfos that should contain the
56 * reporting server's most loaded regions. These are candidates for being
57 * rebalanced.
58 * @return instructions from the master to the region server
59 * @throws IOException e
60 */
61 public HMsg[] regionServerReport(HServerInfo info, HMsg msgs[],
62 HRegionInfo mostLoadedRegions[])
63 throws IOException;
64 }