Package org.hbase.async

Examples of org.hbase.async.GetRequest


      super(conf, options, status);
    }

    @Override
    void testRow(final int i) throws IOException {
      final GetRequest get = new GetRequest(tableName, getRandomRow(this.rand, this.totalRows));
      get.family(FAMILY_NAME).qualifier(QUALIFIER_NAME);

      client().get(get).addCallback(readCallback).addErrback(errback);
    }
View Full Code Here


      super(conf, options, status);
    }

    @Override
    void testRow(final int i) throws IOException {
      final GetRequest get = new GetRequest(tableName, format(i));
      get.family(FAMILY_NAME).qualifier(QUALIFIER_NAME);
      client().get(get).addCallback(readCallback).addErrback(errback);
    }
View Full Code Here

  @Test
  public void putRead() throws Exception {
    client.setFlushInterval(FAST_FLUSH);
    final double write_time = System.currentTimeMillis();
    final PutRequest put = new PutRequest(table, "k", family, "q", "val");
    final GetRequest get = new GetRequest(table, "k", family, "q");
    client.put(put).join();
    final ArrayList<KeyValue> kvs = client.get(get).join();
    assertSizeIs(1, kvs);
    final KeyValue kv = kvs.get(0);
    assertEq("k", kv.key());
View Full Code Here

  /** Write a single thing to HBase and read it back, delete it, read it. */
  @Test
  public void putReadDeleteRead() throws Exception {
    client.setFlushInterval(FAST_FLUSH);
    final PutRequest put = new PutRequest(table, "k", family, "q", "val");
    final GetRequest get = new GetRequest(table, "k", family, "q");
    client.put(put).join();
    final ArrayList<KeyValue> kvs = client.get(get).join();
    assertSizeIs(1, kvs);
    assertEq("val", kvs.get(0).value());
    final DeleteRequest del = new DeleteRequest(table, "k", family, "q");
View Full Code Here

    byte[] v2 = "val2".getBytes();
    final PutRequest put1 = new PutRequest(t, k, f, q, v1, 100L);
    final PutRequest put2 = new PutRequest(t, k, f, q, v2, 200L);
    client.put(put1).join();
    client.put(put2).join();
    final GetRequest get = new GetRequest(t, k, f, q).maxVersions(2);
    final ArrayList<KeyValue> kvs = client.get(get).join();
    assertSizeIs(2, kvs);
    assertEq("val2", kvs.get(0).value());
    assertEq("val1", kvs.get(1).value());
    final DeleteRequest del = new DeleteRequest(t, k, f, q, 200L);
View Full Code Here

    final DeleteRequest del2 = new DeleteRequest(table, "mdk1", family, "q2");
    final DeleteRequest del3 = new DeleteRequest(table, "mdk2", family, "q3");
    final DeleteRequest del1 = new DeleteRequest(table, "mdk1", family, "q1");
    Deferred.group(client.delete(del2), client.delete(del3),
                   client.delete(del1)).join();
    GetRequest get = new GetRequest(table, "mdk1");
    ArrayList<KeyValue> kvs = client.get(get).join();
    assertSizeIs(0, kvs);
    get = new GetRequest(table, "mdk2");
    kvs = client.get(get).join();
    assertSizeIs(0, kvs);
  }
View Full Code Here

    final DeleteRequest del2 = new DeleteRequest(table1, "mdk1", family, "q2");
    final DeleteRequest del3 = new DeleteRequest(table1, "mdk2", family, "q3");
    final DeleteRequest del1 = new DeleteRequest(table2, "mdk1", family, "q1");
    Deferred.group(client.delete(del2), client.delete(del3),
                   client.delete(del1)).join();
    GetRequest get = new GetRequest(table1, "mdk1");
    ArrayList<KeyValue> kvs = client.get(get).join();
    assertSizeIs(0, kvs);
    get = new GetRequest(table1, "mdk2");
    kvs = client.get(get).join();
    assertSizeIs(0, kvs);
    get = new GetRequest(table2, "mdk1");
    kvs = client.get(get).join();
    assertSizeIs(0, kvs);
  }
View Full Code Here

      if (!(res2 instanceof NoSuchColumnFamilyException)) {
        throw new AssertionError("res2 wasn't a NoSuchColumnFamilyException: "
                                 + res2);
      }
      assertEquals(put2, ((NoSuchColumnFamilyException) res2).getFailedRpc());
      final GetRequest get1 = new GetRequest(table, "mk1", family, "m1");
      ArrayList<KeyValue> kvs = client.get(get1).join();
      assertSizeIs(1, kvs);
      assertEq("mpb1", kvs.get(0).value());
      final GetRequest get2 = new GetRequest(table, "mk2", family, "m2");
      assertSizeIs(0, client.get(get2).join());
      final GetRequest get3 = new GetRequest(table, "mk3", family, "m3");
      kvs = client.get(get3).join();
      assertSizeIs(1, kvs);
      assertEq("mpb3", kvs.get(0).value());
      return;
    }
View Full Code Here

      bufferIncrement(table, key, family, qual, big),
      bufferIncrement(table, key, family, qual, big)
    ).addCallbackDeferring(new Callback<Deferred<ArrayList<KeyValue>>,
                                        ArrayList<Long>>() {
      public Deferred<ArrayList<KeyValue>> call(final ArrayList<Long> incs) {
        final GetRequest get = new GetRequest(table, key)
          .family(family).qualifier(qual);
        return client.get(get);
      }
    }).join();
    assertSizeIs(1, kvs);
View Full Code Here

    bufferIncrement(table, key, family, qual, 1);
    // This one would cause an overflow, so will be sent as a separate RPC.
    // Overflow would happen because the max value is (1L << 48) - 1.
    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

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.