@Override public RSGroupInfo getRSGroupInfoOfTable(TableName tableName) throws IOException { RSGroupAdminProtos.GetRSGroupInfoOfTableRequest request = RSGroupAdminProtos.GetRSGroupInfoOfTableRequest.newBuilder() .setTableName(ProtobufUtil.toProtoTableName(tableName)) .build(); try { GetRSGroupInfoOfTableResponse resp = proxy.getRSGroupInfoOfTable(null, request); if (resp.hasRSGroupInfo()) { return RSGroupSerDe.toGroupInfo(resp.getRSGroupInfo()); } return null; } catch (ServiceException e) { throw ProtobufUtil.handleRemoteException(e); } }
@Override public RSGroupInfo getRSGroupInfo(String groupName) throws IOException { try { RSGroupAdminProtos.GetRSGroupInfoResponse resp = proxy.getRSGroupInfo( null, RSGroupAdminProtos.GetRSGroupInfoRequest.newBuilder() .setRSGroupName(groupName) .build()); if (resp.hasRSGroupInfo()) { return RSGroupSerDe.toGroupInfo(resp.getRSGroupInfo()); } return null; } catch (ServiceException e) { throw ProtobufUtil.handleRemoteException(e); } }
@Override public List<RSGroupInfo> listRSGroups() throws IOException { try { List<RSGroupProtos.RSGroupInfo> resp = proxy .listRSGroupInfos( null, RSGroupAdminProtos.ListRSGroupInfosRequest.newBuilder().build()) .getRSGroupInfoList(); List<RSGroupInfo> result = new ArrayList<RSGroupInfo>(resp.size()); for (RSGroupProtos.RSGroupInfo entry : resp) { result.add(RSGroupSerDe.toGroupInfo(entry)); } return result; } catch (ServiceException e) { throw ProtobufUtil.handleRemoteException(e); } }
@Override public RSGroupInfo getRSGroupOfServer(HostAndPort hostPort) throws IOException { RSGroupAdminProtos.GetRSGroupInfoOfServerRequest request = RSGroupAdminProtos.GetRSGroupInfoOfServerRequest.newBuilder() .setServer( HBaseProtos.ServerName.newBuilder() .setHostName(hostPort.getHostText()) .setPort(hostPort.getPort()) .build()) .build(); try { GetRSGroupInfoOfServerResponse resp = proxy.getRSGroupInfoOfServer(null, request); if (resp.hasRSGroupInfo()) { return RSGroupSerDe.toGroupInfo(resp.getRSGroupInfo()); } return null; } catch (ServiceException e) { throw ProtobufUtil.handleRemoteException(e); } }