Package org.apache.hadoop.hbase.codec.prefixtree.encode

Examples of org.apache.hadoop.hbase.codec.prefixtree.encode.PrefixTreeEncoder


  }

  private void internalEncodeKeyValues(DataOutputStream encodedOutputStream,
      ByteBuffer rawKeyValues, boolean includesMvccVersion) throws IOException {
    rawKeyValues.rewind();
    PrefixTreeEncoder builder = EncoderFactory.checkOut(encodedOutputStream, includesMvccVersion);

    try{
      KeyValue kv;
      while ((kv = KeyValueUtil.nextShallowCopy(rawKeyValues, includesMvccVersion)) != null) {
        builder.write(kv);
      }
      builder.flush();
    }finally{
      EncoderFactory.checkIn(builder);
    }
  }
View Full Code Here


  }

  private void internalEncodeKeyValues(DataOutputStream encodedOutputStream,
      ByteBuffer rawKeyValues, boolean includesMvccVersion) throws IOException {
    rawKeyValues.rewind();
    PrefixTreeEncoder builder = EncoderFactory.checkOut(encodedOutputStream, includesMvccVersion);

    try{
      KeyValue kv;
      while ((kv = KeyValueUtil.nextShallowCopy(rawKeyValues, includesMvccVersion)) != null) {
        builder.write(kv);
      }
      builder.flush();
    }finally{
      EncoderFactory.checkIn(builder);
    }
  }
View Full Code Here

  }

  @Before
  public void compile() throws IOException {
    os = new ByteArrayOutputStream(1 << 20);
    encoder = new PrefixTreeEncoder(os, includeMemstoreTS);

    inputKvs = rows.getInputs();
    for (KeyValue kv : inputKvs) {
      encoder.write(kv);
    }
View Full Code Here

  }

  private void internalEncodeKeyValues(DataOutputStream encodedOutputStream,
      ByteBuffer rawKeyValues, boolean includesMvccVersion) throws IOException {
    rawKeyValues.rewind();
    PrefixTreeEncoder builder = EncoderFactory.checkOut(encodedOutputStream, includesMvccVersion);

    try{
      KeyValue kv;
      while ((kv = KeyValueUtil.nextShallowCopy(rawKeyValues, includesMvccVersion)) != null) {
        builder.write(kv);
      }
      builder.flush();
    }finally{
      EncoderFactory.checkIn(builder);
    }
  }
View Full Code Here

  protected ByteBuffer block;

  public TestPrefixTreeSearcher(TestRowData testRows) throws IOException {
    this.rows = testRows;
    ByteArrayOutputStream os = new ByteArrayOutputStream(1 << 20);
    PrefixTreeEncoder kvBuilder = new PrefixTreeEncoder(os, true);
    for (KeyValue kv : rows.getInputs()) {
      kvBuilder.write(kv);
    }
    kvBuilder.flush();
    byte[] outputBytes = os.toByteArray();
    this.block = ByteBuffer.wrap(outputBytes);
  }
View Full Code Here

  @Override
  public int encode(KeyValue kv, HFileBlockEncodingContext encodingCtx, DataOutputStream out)
      throws IOException {
    PrefixTreeEncodingState state = (PrefixTreeEncodingState) encodingCtx.getEncodingState();
    PrefixTreeEncoder builder = state.builder;
    builder.write(kv);
    int size = kv.getLength();
    if (encodingCtx.getHFileContext().isIncludesMvcc()) {
      size += WritableUtils.getVIntSize(kv.getMvccVersion());
    }
    return size;
View Full Code Here

    HFileBlockDefaultEncodingContext encodingCtx =
        (HFileBlockDefaultEncodingContext) blkEncodingCtx;
    encodingCtx.prepareEncoding(out);

    PrefixTreeEncoder builder = EncoderFactory.checkOut(out, encodingCtx.getHFileContext()
        .isIncludesMvcc());
    PrefixTreeEncodingState state = new PrefixTreeEncodingState();
    state.builder = builder;
    blkEncodingCtx.setEncodingState(state);
  }
View Full Code Here

  @Override
  public void endBlockEncoding(HFileBlockEncodingContext encodingCtx, DataOutputStream out,
      byte[] uncompressedBytesWithHeader) throws IOException {
    PrefixTreeEncodingState state = (PrefixTreeEncodingState) encodingCtx.getEncodingState();
    PrefixTreeEncoder builder = state.builder;
    builder.flush();
    EncoderFactory.checkIn(builder);
    // do i need to check this, or will it always be DataBlockEncoding.PREFIX_TREE?
    if (encodingCtx.getDataBlockEncoding() != DataBlockEncoding.NONE) {
      encodingCtx.postEncoding(BlockType.ENCODED_DATA);
    } else {
View Full Code Here

  @Before
  public void compile() throws IOException {
    // Always run with tags. But should also ensure that KVs without tags work fine
    os = new ByteArrayOutputStream(1 << 20);
    encoder = new PrefixTreeEncoder(os, includeMemstoreTS);

    inputKvs = rows.getInputs();
    for (KeyValue kv : inputKvs) {
      encoder.write(kv);
    }
View Full Code Here

  protected ByteBuffer block;

  public TestPrefixTreeSearcher(TestRowData testRows) throws IOException {
    this.rows = testRows;
    ByteArrayOutputStream os = new ByteArrayOutputStream(1 << 20);
    PrefixTreeEncoder kvBuilder = new PrefixTreeEncoder(os, true);
    for (KeyValue kv : rows.getInputs()) {
      kvBuilder.write(kv);
    }
    kvBuilder.flush();
    byte[] outputBytes = os.toByteArray();
    this.block = ByteBuffer.wrap(outputBytes);
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.codec.prefixtree.encode.PrefixTreeEncoder

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.