Search in sources :

Example 1 with GetTableNamesResponse

use of org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.GetTableNamesResponse in project hbase by apache.

the class MasterRpcServices method getTableNames.

/**
   * Get list of userspace table names
   * @param controller Unused (set to null).
   * @param req GetTableNamesRequest
   * @return GetTableNamesResponse
   * @throws ServiceException
   */
@Override
public GetTableNamesResponse getTableNames(RpcController controller, GetTableNamesRequest req) throws ServiceException {
    try {
        master.checkServiceStarted();
        final String regex = req.hasRegex() ? req.getRegex() : null;
        final String namespace = req.hasNamespace() ? req.getNamespace() : null;
        List<TableName> tableNames = master.listTableNames(namespace, regex, req.getIncludeSysTables());
        GetTableNamesResponse.Builder builder = GetTableNamesResponse.newBuilder();
        if (tableNames != null && tableNames.size() > 0) {
            // Add the table names to the response
            for (TableName table : tableNames) {
                builder.addTableNames(ProtobufUtil.toProtoTableName(table));
            }
        }
        return builder.build();
    } catch (IOException e) {
        throw new ServiceException(e);
    }
}
Also used : TableName(org.apache.hadoop.hbase.TableName) GetTableNamesResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.GetTableNamesResponse) ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException)

Aggregations

IOException (java.io.IOException)1 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1 TableName (org.apache.hadoop.hbase.TableName)1 ServiceException (org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException)1 GetTableNamesResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.GetTableNamesResponse)1