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 * @param serverCurrentTime The current time of the region server in ms 44 * @throws IOException e 45 * @return Configuration for the regionserver to use: e.g. filesystem, 46 * hbase rootdir, etc. 47 */ 48 public MapWritable regionServerStartup(HServerInfo info, 49 long serverCurrentTime) throws IOException; 50 51 /** 52 * Called to renew lease, tell master what the region server is doing and to 53 * receive new instructions from the master 54 * 55 * @param info server's address and start code 56 * @param msgs things the region server wants to tell the master 57 * @param mostLoadedRegions Array of HRegionInfos that should contain the 58 * reporting server's most loaded regions. These are candidates for being 59 * rebalanced. 60 * @return instructions from the master to the region server 61 * @throws IOException e 62 */ 63 public HMsg[] regionServerReport(HServerInfo info, HMsg msgs[], 64 HRegionInfo mostLoadedRegions[]) 65 throws IOException; 66 }