Java Code Examples for org.apache.hadoop.hbase.KeyValue#TIMESTAMP_TYPE_SIZE

The following examples show how to use org.apache.hadoop.hbase.KeyValue#TIMESTAMP_TYPE_SIZE . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hbase   File: RowColBloomHashKey.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int length() {
  // For ROW_COL blooms we use bytes
  // <RK length> (2 bytes) , <RK>, 0 (one byte CF length), <CQ>, <TS> (8 btes), <TYPE> ( 1 byte)
  return KeyValue.ROW_LENGTH_SIZE + this.t.getRowLength() + KeyValue.FAMILY_LENGTH_SIZE
      + this.t.getQualifierLength() + KeyValue.TIMESTAMP_TYPE_SIZE;
}
 
Example 2
Source Project: hbase   File: FastDiffDeltaEncoder.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Copies the first key/value from the given stream, and initializes
 * decompression state based on it. Assumes that we have already read key
 * and value lengths. Does not set {@link #qualifierLength} (not used by
 * decompression) or {@link #prevOffset} (set by the calle afterwards).
 */
private void decompressFirstKV(ByteBuffer out, DataInputStream in)
    throws IOException {
  int kvPos = out.position();
  out.putInt(keyLength);
  out.putInt(valueLength);
  prevTimestampOffset = out.position() + keyLength -
      KeyValue.TIMESTAMP_TYPE_SIZE;
  ByteBufferUtils.copyFromStreamToBuffer(out, in, keyLength + valueLength);
  rowLength = out.getShort(kvPos + KeyValue.ROW_OFFSET);
  familyLength = out.get(kvPos + KeyValue.ROW_OFFSET +
      KeyValue.ROW_LENGTH_SIZE + rowLength);
  type = out.get(prevTimestampOffset + KeyValue.TIMESTAMP_SIZE);
}
 
Example 3
/**
 * @return Sum of all elements that make up a key; does not include infrastructure, tags or
 *         values.
 */
private static int getSumOfCellKeyElementLengths(final Cell cell) {
  return cell.getRowLength() + cell.getFamilyLength() + cell.getQualifierLength()
      + KeyValue.TIMESTAMP_TYPE_SIZE;
}