Java 类org.apache.hadoop.hbase.protobuf.generated.MasterProtos.CreateTableResponse 实例源码

项目:ditb    文件:MasterRpcServices.java   
@Override
public CreateTableResponse createTable(RpcController controller, CreateTableRequest req)
throws ServiceException {
  HTableDescriptor hTableDescriptor = HTableDescriptor.convert(req.getTableSchema());
  byte [][] splitKeys = ProtobufUtil.getSplitKeysArray(req);
  try {
    long procId =
        master.createTable(hTableDescriptor, splitKeys, req.getNonceGroup(), req.getNonce());
    return CreateTableResponse.newBuilder().setProcId(procId).build();
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
}
项目:ditb    文件:HBaseAdmin.java   
/**
 * Creates a new table but does not block and wait for it to come online.
 * You can use Future.get(long, TimeUnit) to wait on the operation to complete.
 * It may throw ExecutionException if there was an error while executing the operation
 * or TimeoutException in case the wait timeout was not long enough to allow the
 * operation to complete.
 *
 * @param desc table descriptor for table
 * @param splitKeys keys to check if the table has been created with all split keys
 * @throws IllegalArgumentException Bad table name, if the split keys
 *    are repeated and if the split key has empty byte array.
 * @throws IOException if a remote or network exception occurs
 * @return the result of the async creation. You can use Future.get(long, TimeUnit)
 *    to wait on the operation to complete.
 */
// TODO: This should be called Async but it will break binary compatibility
private Future<Void> createTableAsyncV2(final HTableDescriptor desc, final byte[][] splitKeys)
    throws IOException {
  if (desc.getTableName() == null) {
    throw new IllegalArgumentException("TableName cannot be null");
  }
  if (splitKeys != null && splitKeys.length > 0) {
    Arrays.sort(splitKeys, Bytes.BYTES_COMPARATOR);
    // Verify there are no duplicate split keys
    byte[] lastKey = null;
    for (byte[] splitKey : splitKeys) {
      if (Bytes.compareTo(splitKey, HConstants.EMPTY_BYTE_ARRAY) == 0) {
        throw new IllegalArgumentException(
            "Empty split key must not be passed in the split keys.");
      }
      if (lastKey != null && Bytes.equals(splitKey, lastKey)) {
        throw new IllegalArgumentException("All split keys must be unique, " +
          "found duplicate: " + Bytes.toStringBinary(splitKey) +
          ", " + Bytes.toStringBinary(lastKey));
      }
      lastKey = splitKey;
    }
  }

  CreateTableResponse response = executeCallable(
    new MasterCallable<CreateTableResponse>(getConnection()) {
      @Override
      public CreateTableResponse call(int callTimeout) throws ServiceException {
        PayloadCarryingRpcController controller = rpcControllerFactory.newController();
        controller.setCallTimeout(callTimeout);
        controller.setPriority(desc.getTableName());
        CreateTableRequest request = RequestConverter.buildCreateTableRequest(
          desc, splitKeys, ng.getNonceGroup(), ng.newNonce());
        return master.createTable(controller, request);
      }
    });
  return new CreateTableFuture(this, desc, splitKeys, response);
}
项目:pbase    文件:MasterRpcServices.java   
@Override
public CreateTableResponse createTable(RpcController controller, CreateTableRequest req)
throws ServiceException {
  HTableDescriptor hTableDescriptor = HTableDescriptor.convert(req.getTableSchema());
  byte [][] splitKeys = ProtobufUtil.getSplitKeysArray(req);
  try {
    master.createTable(hTableDescriptor, splitKeys);
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
  return CreateTableResponse.newBuilder().build();
}
项目:HIndex    文件:HMaster.java   
@Override
public CreateTableResponse createTable(RpcController controller, CreateTableRequest req)
throws ServiceException {
  HTableDescriptor hTableDescriptor = HTableDescriptor.convert(req.getTableSchema());
  byte [][] splitKeys = ProtobufUtil.getSplitKeysArray(req);
  try {
    createTable(hTableDescriptor,splitKeys);
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
  return CreateTableResponse.newBuilder().build();
}
项目:PyroDB    文件:MasterRpcServices.java   
@Override
public CreateTableResponse createTable(RpcController controller, CreateTableRequest req)
throws ServiceException {
  HTableDescriptor hTableDescriptor = HTableDescriptor.convert(req.getTableSchema());
  byte [][] splitKeys = ProtobufUtil.getSplitKeysArray(req);
  // Shen Li: add parameter replicaNum
  int replicaNum = req.getReplicaNum();
  try {
    master.createTable(hTableDescriptor, splitKeys, replicaNum);
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
  return CreateTableResponse.newBuilder().build();
}
项目:c5    文件:HMaster.java   
@Override
public CreateTableResponse createTable(RpcController controller, CreateTableRequest req)
throws ServiceException {
  HTableDescriptor hTableDescriptor = HTableDescriptor.convert(req.getTableSchema());
  byte [][] splitKeys = ProtobufUtil.getSplitKeysArray(req);
  try {
    createTable(hTableDescriptor,splitKeys);
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
  return CreateTableResponse.newBuilder().build();
}
项目:ditb    文件:HBaseAdmin.java   
public CreateTableFuture(final HBaseAdmin admin, final HTableDescriptor desc,
    final byte[][] splitKeys, final CreateTableResponse response) {
  super(admin, (response != null && response.hasProcId()) ? response.getProcId() : null);
  this.splitKeys = splitKeys;
  this.desc = desc;
}