Пример #1
0
  /** Helper function to create an empty table. */
  private void createEmptyTable(String instanceName, String tableId) {
    Table.Builder tableBuilder = Table.newBuilder();
    Map<String, ColumnFamily> columnFamilies = tableBuilder.getMutableColumnFamilies();
    columnFamilies.put(COLUMN_FAMILY_NAME, ColumnFamily.newBuilder().build());

    CreateTableRequest.Builder createTableRequestBuilder =
        CreateTableRequest.newBuilder()
            .setParent(instanceName)
            .setTableId(tableId)
            .setTable(tableBuilder.build());
    tableAdminClient.createTable(createTableRequestBuilder.build());
  }
Пример #2
0
 /** Helper function to delete a table. */
 private void deleteTable(String tableName) {
   DeleteTableRequest.Builder deleteTableRequestBuilder =
       DeleteTableRequest.newBuilder().setName(tableName);
   tableAdminClient.deleteTable(deleteTableRequestBuilder.build());
 }
Пример #3
0
 /** Helper function to get a table. */
 private Table getTable(String tableName) {
   GetTableRequest.Builder getTableRequestBuilder =
       GetTableRequest.newBuilder().setName(tableName);
   return tableAdminClient.getTable(getTableRequestBuilder.build());
 }