2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 package org
.apache
.hadoop
.hbase
.rsgroup
;
20 import java
.io
.IOException
;
21 import java
.util
.List
;
23 import org
.apache
.hadoop
.hbase
.TableName
;
24 import org
.apache
.hadoop
.hbase
.master
.MasterServices
;
25 import org
.apache
.hadoop
.hbase
.net
.Address
;
26 import org
.apache
.yetus
.audience
.InterfaceAudience
;
29 * Interface used to manage RSGroupInfo storage. An implementation has the option to support offline
30 * mode. See {@code RSGroupBasedLoadBalancer}.
32 @InterfaceAudience.Private
33 public interface RSGroupInfoManager
{
38 * Add given RSGroupInfo to existing list of group infos.
40 void addRSGroup(RSGroupInfo rsGroupInfo
) throws IOException
;
43 * Remove a region server group.
45 void removeRSGroup(String groupName
) throws IOException
;
48 * Move servers to a new group.
50 void moveServers(Set
<Address
> servers
, String targetGroupName
) throws IOException
;
53 * Gets the group info of server.
55 RSGroupInfo
getRSGroupOfServer(Address serverHostPort
) throws IOException
;
58 * Gets {@code RSGroupInfo} for the given group name.
60 RSGroupInfo
getRSGroup(String groupName
) throws IOException
;
63 * List the existing {@code RSGroupInfo}s.
65 List
<RSGroupInfo
> listRSGroups() throws IOException
;
68 * Whether the manager is able to fully return group metadata
69 * @return whether the manager is in online mode
74 * Remove decommissioned servers from rsgroup
75 * @param servers set of servers to remove
77 void removeServers(Set
<Address
> servers
) throws IOException
;
80 * Get {@code RSGroupInfo} for the given table.
82 RSGroupInfo
getRSGroupForTable(TableName tableName
) throws IOException
;
84 static RSGroupInfoManager
create(MasterServices master
) throws IOException
{
85 if (RSGroupUtil
.isRSGroupEnabled(master
.getConfiguration())) {
86 return RSGroupInfoManagerImpl
.getInstance(master
);
88 return new DisabledRSGroupInfoManager(master
.getServerManager());
93 * Balance a region server group.
95 boolean balanceRSGroup(String groupName
) throws IOException
;
98 * Set group for tables.
100 void setRSGroup(Set
<TableName
> tables
, String groupName
) throws IOException
;
103 * Determine {@code RSGroupInfo} for the given table.
104 * @param tableName table name
105 * @return rsgroup name
107 String
determineRSGroupInfoForTable(TableName tableName
);