Examples of PutRequest


Examples of org.hbase.async.PutRequest

  }

  @Test
  public void compareFilters() throws Exception {
    client.setFlushInterval(FAST_FLUSH);
    final PutRequest put1 = new PutRequest(table, "cf1", family, "a", "v1");
    final PutRequest put2 = new PutRequest(table, "cf2", family, "b", "v2");
    final PutRequest put3 = new PutRequest(
        Bytes.UTF8(table),
        Bytes.UTF8("cf3"),
        Bytes.UTF8(family),
        Bytes.UTF8("c"),
        Bytes.UTF8("v3"),
        42);
    final PutRequest put4 = new PutRequest(
        Bytes.UTF8(table),
        Bytes.UTF8("cf3"),
        Bytes.UTF8(family),
        Bytes.UTF8("dep"),
        Bytes.UTF8("v4"),
View Full Code Here

Examples of org.hbase.async.PutRequest

    //   - a qualifier in between "qb" (inclusive) and "qd4" (exclusive).
    final ArrayList<ScanFilter> filters = new ArrayList<ScanFilter>(2);
    filters.add(new ColumnRangeFilter("qb", true, "qd4", false));
    filters.add(new KeyRegexpFilter("fl[12]$"));
    // Filtered out as we're looking due to qualifier being out of range:
    final PutRequest put1 = new PutRequest(table, "fl1", family, "qa1", "v1");
    // Kept by the filter:
    final PutRequest put2 = new PutRequest(table, "fl1", family, "qb2", "v2");
    // Filtered out because the row key doesn't match the regexp:
    final PutRequest put3 = new PutRequest(table, "fl1a", family, "qb3", "v3");
    // Kept by the filter:
    final PutRequest put4 = new PutRequest(table, "fl2", family, "qc4", "v4");
    // Filtered out because the qualifier is on the exclusive upper bound:
    final PutRequest put5 = new PutRequest(table, "fl2", family, "qd5", "v5");
    // Filtered out because the qualifier is past the upper bound:
    final PutRequest put6 = new PutRequest(table, "fl2", family, "qd6", "v6");
    Deferred.group(Deferred.group(client.put(put1), client.put(put2),
                                  client.put(put3)),
                   Deferred.group(client.put(put4), client.put(put5),
                                  client.put(put6))).join();
    final Scanner scanner = client.newScanner(table);
View Full Code Here

Examples of org.hbase.async.PutRequest

  public void timestampsFilter() throws Exception {
    client.setFlushInterval(FAST_FLUSH);
    final byte[] tableBytes = Bytes.UTF8(table);
    final byte[] familyBytes = Bytes.UTF8(family);
    final byte[] qualifier = Bytes.UTF8("q");
    final PutRequest put1 =
      new PutRequest(tableBytes, Bytes.UTF8("tf1"), familyBytes, qualifier, Bytes.UTF8("v1"), 1L);
    final PutRequest put2 =
      new PutRequest(tableBytes, Bytes.UTF8("tf2"), familyBytes, qualifier, Bytes.UTF8("v2"), 2L);
    final PutRequest put3 =
      new PutRequest(tableBytes, Bytes.UTF8("tf3"), familyBytes, qualifier, Bytes.UTF8("v3"), 3L);
    Deferred.group(client.put(put1), client.put(put2), client.put(put3)).join();
    final Scanner scanner = client.newScanner(table);
    scanner.setFamily(family);
    scanner.setStartKey(Bytes.UTF8("tf"));
    scanner.setStopKey(Bytes.UTF8("tf4"));
View Full Code Here

Examples of org.hbase.async.PutRequest

  /** Regression test for issue #2. */
  @Test
  public void regression2() throws Exception {
    try {
      final PutRequest put1 = new PutRequest(table, "k1", family, "q", "val1");
      final PutRequest put2 = new PutRequest(table, "k2", family, "q", "val2");
      LOG.info("Before calling put()");
      client.put(put1);
      client.put(put2);
      LOG.info("After calling put()");
    } finally {
View Full Code Here

Examples of org.hbase.async.PutRequest

    final String table2 = args[0] + "2";
    final String family = args[1];
    createOrTruncateTable(client, table1, family);
    createOrTruncateTable(client, table2, family);
    for (int i = 0; i < 2; i++) {
      final PutRequest put;
      final String key = 'k' + String.valueOf(i);
      if (i % 2 == 0) {
        put = new PutRequest(table1, key, family, "q", "v");
      } else {
        put = new PutRequest(table2, key, family, "q", "v");
      }
      final DeleteRequest delete = new DeleteRequest(put.table(), put.key());
      client.delete(delete);
      client.put(put);
    }
    client.flush().joinUninterruptibly();
  }
View Full Code Here

Examples of org.hbase.async.PutRequest

    key[1] = '4';
    key[2] = '0';
    key[key.length - 1] = '*';
    final byte[] family = TestIntegration.family.getBytes();
    final byte[] qual = { 'q' };
    final PutRequest put = new PutRequest(table, key, family, qual,
                                          new byte[0] /* empty */);
    final GetRequest get = new GetRequest(table, key);
    client.put(put).join();
    final ArrayList<KeyValue> kvs = client.get(get).join();
    assertSizeIs(1, kvs);
View Full Code Here

Examples of org.hbase.async.PutRequest

      if (args[1].charAt(0) == 'l') {  // locked version of the command
        final RowLockRequest rlr = new RowLockRequest(args[2], args[3]);
        lock = client.lockRow(rlr).joinUninterruptibly();
        LOG.info("Acquired explicit row lock: " + lock);
      }
      final PutRequest put = lock == null
        ? new PutRequest(args[2], args[3], args[4], args[5], args[6])
        : new PutRequest(args[2], args[3], args[4], args[5], args[6], lock);
      args = null;
      try {
        final Object result = client.put(put).joinUninterruptibly();
        LOG.info("Put result=" + result);
      } catch (Exception e) {
View Full Code Here

Examples of org.hbase.async.PutRequest

        }
       
        // reset the change map so we don't keep writing
        initializeChangedMap();
       
        final PutRequest put = new PutRequest(tsdb.treeTable(),
            Tree.idToBytes(tree_id), TREE_FAMILY, TREE_QUALIFIER,
            stored_tree.toStorageJson());
        return tsdb.getClient().compareAndSet(put, original_tree);
      }
View Full Code Here

Examples of org.hbase.async.PutRequest

   
    // compile the object for storage, this will toss exceptions if we are
    // missing anything important
    final byte[] storage_data = toStorageJson();

    final PutRequest put = new PutRequest(tsdb.treeTable(), row, Tree.TREE_FAMILY(),
        BRANCH_QUALIFIER, storage_data);
    put.setBufferable(true);
    storage_results.add(tsdb.getClient().compareAndSet(put, new byte[0]));
   
    // store leaves if told to and put the storage calls in our deferred group
    if (store_leaves && leaves != null && !leaves.isEmpty()) {
      for (final Leaf leaf : leaves.values()) {
View Full Code Here

Examples of org.hbase.async.PutRequest

          Annotation.this.syncNote(stored_note, overwrite);
        }
       
        final byte[] tsuid_byte = tsuid != null && !tsuid.isEmpty() ?
            UniqueId.stringToUid(tsuid) : null;
        final PutRequest put = new PutRequest(tsdb.dataTable(),
            getRowKey(start_time, tsuid_byte), FAMILY,
            getQualifier(start_time),
            Annotation.this.getStorageJSON());
        return tsdb.getClient().compareAndSet(put, original_note);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.