Package org.hbase.async

Examples of org.hbase.async.KeyValue


    final byte[] qual2 = { 0x00, 0x27 };
    final byte[] val2 = Bytes.fromLong(5L);
    final byte[] qual12 = MockBase.concatByteArrays(qual1, qual2);
   
    final Span span = new Span(tsdb);
    span.addRow(new KeyValue(HOUR1, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
    span.addRow(new KeyValue(HOUR2, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
    span.addRow(new KeyValue(HOUR3, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
   
    assertEquals(6, span.size());
    assertEquals(1356998400000L, span.timestamp(0));
    assertEquals(1356998402000L, span.timestamp(1));
View Full Code Here


      System.arraycopy(Bytes.fromShort(qualifier), 0, qualifiers, i * 2, 2);
      System.arraycopy(Bytes.fromLong(i), 0, values, i * 8, 8);
    }
   
    final Span span = new Span(tsdb);
    span.addRow(new KeyValue(HOUR1, FAMILY, qualifiers, values));
    span.addRow(new KeyValue(HOUR2, FAMILY, qualifiers, values));
    span.addRow(new KeyValue(HOUR3, FAMILY, qualifiers, values));
   
    assertEquals(3600 * 3, span.size());
  }
View Full Code Here

    final byte[] qual2 = { (byte) 0xF0, 0x00, 0x02, 0x07 };
    final byte[] val2 = Bytes.fromLong(5L);
    final byte[] qual12 = MockBase.concatByteArrays(qual1, qual2);
   
    final Span span = new Span(tsdb);
    span.addRow(new KeyValue(HOUR1, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
    span.addRow(new KeyValue(HOUR2, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
    span.addRow(new KeyValue(HOUR3, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
   
    assertEquals(6, span.size());
    assertEquals(1356998400000L, span.timestamp(0));
    assertEquals(1356998400008L, span.timestamp(1));
View Full Code Here

    final byte[] qual2 = { 0x00, 0x27 };
    final byte[] val2 = Bytes.fromLong(5L);
    final byte[] qual12 = MockBase.concatByteArrays(qual1, qual2);
   
    final Span span = new Span(tsdb);
    span.addRow(new KeyValue(HOUR1, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
    span.addRow(new KeyValue(HOUR2, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));
    span.addRow(new KeyValue(HOUR3, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO)));

    assertEquals(6, span.size());
    final SeekableView it = span.iterator();
    DataPoint dp = it.next();
View Full Code Here

    final byte[] val1 = Bytes.fromLong(4L);
    final byte[] qual2 = { 0x00, 0x27 };
    final byte[] val2 = Bytes.fromLong(5L);
    final byte[] qual12 = MockBase.concatByteArrays(qual1, qual2);
   
    final KeyValue kv = new KeyValue(HOUR1, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO));
   
    assertEquals(1356998402L, Span.lastTimestampInRow((short) 3, kv));
  }
View Full Code Here

    final byte[] val1 = Bytes.fromLong(4L);
    final byte[] qual2 = { (byte) 0xF0, 0x00, 0x02, 0x07 };
    final byte[] val2 = Bytes.fromLong(5L);
    final byte[] qual12 = MockBase.concatByteArrays(qual1, qual2);
   
    final KeyValue kv = new KeyValue(HOUR1, FAMILY, qual12,
        MockBase.concatByteArrays(val1, val2, ZERO));
   
    assertEquals(1356998400008L, Span.lastTimestampInRow((short) 3, kv));
  }
View Full Code Here

        TSMeta.COUNTER_QUALIFIER());
  }

  @Test
  public void parseFromColumn() throws Exception {
    final KeyValue column = mock(KeyValue.class);
    when(column.key()).thenReturn(new byte[] { 0, 0, 1, 0, 0, 1, 0, 0, 1 });
    when(column.value()).thenReturn(storage.getColumn(
        new byte[] { 0, 0, 1, 0, 0, 1, 0, 0, 1 },
            NAME_FAMILY,
            "ts_meta".getBytes(MockBase.ASCII())));
    final TSMeta meta = TSMeta.parseFromColumn(tsdb, column, false)
      .joinUninterruptibly();
View Full Code Here

    assertNull(meta.getMetric());
  }
 
  @Test
  public void parseFromColumnWithUIDMeta() throws Exception {
    final KeyValue column = mock(KeyValue.class);
    when(column.key()).thenReturn(new byte[] { 0, 0, 1, 0, 0, 1, 0, 0, 1 });
    when(column.value()).thenReturn(storage.getColumn(
        new byte[] { 0, 0, 1, 0, 0, 1, 0, 0, 1 },
            NAME_FAMILY,
            "ts_meta".getBytes(MockBase.ASCII())));
    final TSMeta meta = TSMeta.parseFromColumn(tsdb, column, true)
      .joinUninterruptibly();
View Full Code Here

        }
        throw (Exception)ex;
      }     
    }
   
    final KeyValue column = mock(KeyValue.class);
    when(column.key()).thenReturn(new byte[] { 0, 0, 1, 0, 0, 1, 0, 0, 2 });
    when(column.value()).thenReturn(("{\"tsuid\":\"000001000001000002\",\"" +
        "description\":\"Description\",\"notes\":\"Notes\",\"created\":1328140800," +
        "\"custom\":null,\"units\":\"\",\"retention\":42,\"max\":1.0,\"min\":" +
        "\"NaN\",\"displayName\":\"Display\",\"dataType\":\"Data\"}")
        .getBytes(MockBase.ASCII()));
    TSMeta.parseFromColumn(tsdb, column, true).addErrback(new ErrBack())
View Full Code Here

    ArrayList<Deferred<Boolean>> workers
      = new ArrayList<Deferred<Boolean>>();
    while ((rows = scanner.nextRows(1).joinUninterruptibly()) != null) {
      LOG.info("received a page of users.");
      for (ArrayList<KeyValue> row : rows) {
        KeyValue kv = row.get(0);
        byte[] expected = kv.value();
        String userId = new String(kv.key());
        PutRequest put = new PutRequest(
            TABLE_NAME, kv.key(), kv.family(),
            kv.qualifier(), mkNewPassword(expected));
        Deferred<Boolean> d = client.compareAndSet(put, expected)
          .addCallback(new InterpretResponse(userId))
          .addCallbacks(new ResultToMessage(), new FailureToMessage())
          .addCallback(new SendMessage());
        workers.add(d);
View Full Code Here

TOP

Related Classes of org.hbase.async.KeyValue

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.