Package org.apache.blur.thrift.generated

Examples of org.apache.blur.thrift.generated.RowMutation


        BlurThriftHelper.newColumn("a", "b"));
    RecordMutation rm2 = BlurThriftHelper.newRecordMutation("test-family", "record-2",
        BlurThriftHelper.newColumn("c", "d"));
    RecordMutation rm3 = BlurThriftHelper.newRecordMutation("test-family-2", "record-1",
        BlurThriftHelper.newColumn("e", "f"));
    RowMutation row = BlurThriftHelper.newRowMutation("test-table", "row-123", rm1, rm2, rm3);
    Record r = BlurThriftHelper.newRecord("test-family", "record-2", BlurThriftHelper.newColumn("g", "h"));
    Record r2 = BlurThriftHelper.newRecord("test-family", "record-99", BlurThriftHelper.newColumn("g", "h"));

    assertEquals("should find record-2", rm2, BlurThriftHelper.findRecordMutation(row, r));
    assertNull("should not find record-99", BlurThriftHelper.findRecordMutation(row, r2));
View Full Code Here


      }
    }
  }

  private static RowMutation getRowMutation(int rowid, String table, boolean wal, int numberRecordsPerRow, int numberOfColumns, int numberOfFamilies, int numberOfWords) {
    RowMutation mutation = new RowMutation();
    mutation.setTable(table);
    mutation.setRowId(Integer.toString(rowid));
    mutation.setWal(wal);
    mutation.setRowMutationType(RowMutationType.REPLACE_ROW);
    for (int j = 0; j < numberRecordsPerRow; j++) {
      mutation.addToRecordMutations(getRecordMutation(numberOfColumns, numberOfFamilies, numberOfWords));
    }
    return mutation;
  }
View Full Code Here

        recordCount = 0;
        totalTime = 0;
        calls = 0;
      }

      RowMutation mutation = new RowMutation();
      mutation.setTable(table);
      String rowId = getRowId();
      mutation.setRowId(rowId);
      mutation.setWal(wal);
      mutation.setRowMutationType(RowMutationType.REPLACE_ROW);
      for (int j = 0; j < numberRecordsPerRow; j++) {
        mutation.addToRecordMutations(getRecordMutation(numberOfColumns, numberOfFamilies, numberOfWords));
      }
      batch.add(mutation);
      if (batch.size() >= batchSize) {
        long sm = System.nanoTime();
        client.mutateBatch(batch);
View Full Code Here

    return newRowMutation(RowMutationType.REPLACE_ROW, table, rowId, mutations);
  }

  public static RowMutation newRowMutation(RowMutationType type, String table, String rowId,
      RecordMutation... mutations) {
    RowMutation mutation = new RowMutation();
    mutation.setRowId(rowId);
    mutation.setTable(table);
    mutation.setRowMutationType(type);
    for (RecordMutation recordMutation : mutations) {
      mutation.addToRecordMutations(recordMutation);
    }
    return mutation;
  }
View Full Code Here

    final Map<String, BlurIndex> indexes = _indexServer.getIndexes(table);

    Map<String, List<RowMutation>> mutationsByShard = new HashMap<String, List<RowMutation>>();

    for (int i = 0; i < mutations.size(); i++) {
      RowMutation mutation = mutations.get(i);
      String shard = MutationHelper.getShardName(table, mutation.rowId, getNumberOfShards(table), _blurPartitioner);
      List<RowMutation> list = mutationsByShard.get(shard);
      if (list == null) {
        list = new ArrayList<RowMutation>();
        mutationsByShard.put(shard, list);
View Full Code Here

  private void executeMutates(String table, String shard, Map<String, BlurIndex> indexes, List<RowMutation> mutations)
      throws BlurException, IOException {
    long s = System.nanoTime();
    boolean waitToBeVisible = false;
    for (int i = 0; i < mutations.size(); i++) {
      RowMutation mutation = mutations.get(i);
      if (mutation.waitToBeVisible) {
        waitToBeVisible = true;
      }
      BlurIndex blurIndex = indexes.get(shard);
      if (blurIndex == null) {
View Full Code Here

      existingRow.records = new ArrayList<Record>();
    }
    Row newRow = new Row().setId(existingRow.id);

    // Create a local copy of the mutation we can modify
    RowMutation mutationCopy = mutation.deepCopy();

    // Match existing records against record mutations. Once a record
    // mutation has been processed, remove it from our local copy.
    for (Record existingRecord : existingRow.records) {
      RecordMutation recordMutation = findRecordMutation(mutationCopy, existingRecord);
View Full Code Here

  private static void delete(Iface client, String tableName) throws BlurException, TException {
    client.removeTable(tableName, true);
  }

  private static void loadTable(Iface client, String tableName) throws BlurException, TException {
    RowMutation mutation = new RowMutation();
    mutation.table = tableName;
    mutation.waitToBeVisible = true;
    mutation.rowId = "test";
    mutation.addToRecordMutations(newRecordMutation("test", "test", newColumn("test", "test")));
    mutation.rowMutationType = RowMutationType.REPLACE_ROW;
    client.mutate(mutation);
  }
View Full Code Here

      count++;
    }
  }

  private static RowMutation getRowMutation(String table, boolean wal, int numberRecordsPerRow, int numberOfColumns, int numberOfFamilies, int numberOfWords) {
    RowMutation mutation = new RowMutation();
    mutation.setTable(table);
    String rowId = getRowId();
    mutation.setRowId(rowId);
    mutation.setWal(wal);
    mutation.setRowMutationType(RowMutationType.REPLACE_ROW);
    for (int j = 0; j < numberRecordsPerRow; j++) {
      mutation.addToRecordMutations(getRecordMutation(numberOfColumns, numberOfFamilies, numberOfWords));
    }
    return mutation;
  }
View Full Code Here

    Record record = new Record();
    record.setRecordId(Integer.toString(i));
    record.setFamily("test");
    record.addToColumns(new Column("test", Integer.toString(i)));
    row.addToRecords(record);
    RowMutation rowMutation = BlurUtil.toRowMutation(table, row);
    rowMutation.setWal(false);
    client.mutate(rowMutation);
  }
View Full Code Here

TOP

Related Classes of org.apache.blur.thrift.generated.RowMutation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.