Package org.hbase.async

Examples of org.hbase.async.GetRequest


    bufferIncrement(table, key, family, qual, -1);
    // This one would cause an underflow, so will be sent as a separate RPC.
    // Overflow would happen because the max value is -1L << 48.
    bufferIncrement(table, key, family, qual, big);
    client.flush().joinUninterruptibly();
    final GetRequest get = new GetRequest(table, key)
      .family(family).qualifier(qual);
    final ArrayList<KeyValue> kvs = client.get(get).join();
    assertSizeIs(1, kvs);
    assertEquals(big - 1 + big, Bytes.getLong(kvs.get(0).value()));
    // Check we sent the right number of RPCs.
View Full Code Here


    assertEquals(42, n);
    bufferIncrement(table, key, family, qual, 1);
    bufferIncrement(table, key, family, qual, 2);
    bufferIncrement(table, key, family, qual, -3);
    client.flush().joinUninterruptibly();
    final GetRequest get = new GetRequest(table, key)
      .family(family).qualifier(qual);
    final ArrayList<KeyValue> kvs = client.get(get).join();
    assertSizeIs(1, kvs);
    assertEquals(42, Bytes.getLong(kvs.get(0).value()));
    // The sum was 0, but must have sent the increment anyway.
View Full Code Here

  }

  /** Helper method to create a get request.  */
  private static GetRequest mkGet(final byte[] table, final byte[] key,
                                  final byte[] family, final byte[] qual) {
    return new GetRequest(table, key).family(family).qualifier(qual);
  }
View Full Code Here

    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);
    KeyValue kv = kvs.get(0);
    assertEq("q", kv.qualifier());
View Full Code Here

    final int iterations = 100000;
    for (int i = 0; i < iterations; i++) {
      bufferIncrement(table, key, family, qual, 1);
    }
    client.flush().joinUninterruptibly();
    final GetRequest get = new GetRequest(table, key)
      .family(family).qualifier(qual);
    final ArrayList<KeyValue> kvs = client.get(get).join();
    assertSizeIs(1, kvs);
    assertEquals(iterations, Bytes.getLong(kvs.get(0).value()));
  }
View Full Code Here

  }

  private static final class get implements Cmd {
    public void execute(final HBaseClient client, String[] args) throws Exception {
      ensureArguments(args, 4, 64);
      final GetRequest get = new GetRequest(args[2], args[3]);
      if (args.length > 4) {
        get.family(args[4]);
      }
      if (args.length > 5) {
        if (args.length == 6) {
          get.qualifier(args[5]);
        } else {
          final byte[][] qualifiers = new byte[args.length - 5][];
          for (int i = 5; i < args.length; i++) {
            qualifiers[i - 5] = args[i].getBytes();
          }
          get.qualifiers(qualifiers);
        }
      }
      RowLock lock = null;
      if (args[1].charAt(0) == 'l') {  // locked version of the command
        final RowLockRequest rlr = new RowLockRequest(args[2], args[3]);
View Full Code Here

   * @throws JSONException if the object could not be deserialized
   */
  public static Deferred<Branch> fetchBranchOnly(final TSDB tsdb,
      final byte[] branch_id) {
   
    final GetRequest get = new GetRequest(tsdb.treeTable(), branch_id);
    get.family(Tree.TREE_FAMILY());
    get.qualifier(BRANCH_QUALIFIER);
   
    /**
     * Called after the get returns with or without data. If we have data, we'll
     * parse the branch and return it.
     */
 
View Full Code Here

  private static int findAndPrintRow(final HBaseClient client,
                                     final byte[] table,
                                     final byte[] key,
                                     final byte[] family,
                                     boolean formard) {
    final GetRequest get = new GetRequest(table, key);
    get.family(family);
    ArrayList<KeyValue> row;
    try {
      row = client.get(get).joinUninterruptibly();
    } catch (HBaseException e) {
      LOG.error("Get failed: " + get, e);
View Full Code Here

   * @return The max metric ID as an integer value
   */
  private static long getMaxMetricID(final TSDB tsdb) {
    // first up, we need the max metric ID so we can split up the data table
    // amongst threads.
    final GetRequest get = new GetRequest(tsdb.uidTable(), new byte[] { 0 });
    get.family("id".getBytes(CHARSET));
    get.qualifier("metrics".getBytes(CHARSET));
    ArrayList<KeyValue> row;
    try {
      row = tsdb.getClient().get(get).joinUninterruptibly();
      if (row == null || row.isEmpty()) {
        throw new IllegalStateException("No data in the metric max UID cell");
View Full Code Here

        return Deferred.fromResult(note);
      }
     
    }

    final GetRequest get = new GetRequest(tsdb.dataTable(),
        getRowKey(start_time, tsuid));
    get.family(FAMILY);
    get.qualifier(getQualifier(start_time));
    return tsdb.getClient().get(get).addCallbackDeferring(new GetCB());   
  }
View Full Code Here

TOP

Related Classes of org.hbase.async.GetRequest

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.