Examples of HFileBlockDefaultEncodingContext


Examples of org.apache.hadoop.hbase.io.encoding.HFileBlockDefaultEncodingContext

        HFileBlockDefaultEncodingContext.class.getName()))) {
      throw new IOException (this.getClass().getName() + " only accepts " +
          HFileBlockDefaultEncodingContext.class.getName() + ".");
    }

    HFileBlockDefaultEncodingContext defaultContext =
        (HFileBlockDefaultEncodingContext) encodeCtx;
    defaultContext.compressAfterEncodingWithBlockType(in.array(), blockType);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.io.encoding.HFileBlockDefaultEncodingContext

  }

  @Override
  public HFileBlockEncodingContext newDataBlockEncodingContext(
      byte[] dummyHeader, HFileContext meta) {
    return new HFileBlockDefaultEncodingContext(null, dummyHeader, meta);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.io.encoding.HFileBlockDefaultEncodingContext

      byte[] dummyHeader, HFileContext fileContext) {
    DataBlockEncoder encoder = encoding.getEncoder();
    if (encoder != null) {
      return encoder.newDataBlockEncodingContext(encoding, dummyHeader, fileContext);
    }
    return new HFileBlockDefaultEncodingContext(null, dummyHeader, fileContext);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.io.encoding.HFileBlockDefaultEncodingContext

    if (blkEncodingCtx.getClass() != HFileBlockDefaultEncodingContext.class) {
      throw new IOException(this.getClass().getName() + " only accepts "
          + HFileBlockDefaultEncodingContext.class.getName() + " as the " + "encoding context.");
    }

    HFileBlockDefaultEncodingContext encodingCtx
        = (HFileBlockDefaultEncodingContext) blkEncodingCtx;
    encodingCtx.prepareEncoding();
    DataOutputStream dataOut = encodingCtx.getOutputStreamForEncoder();
    internalEncodeKeyValues(dataOut, in, encodingCtx.getHFileContext().isIncludesMvcc(),
        encodingCtx.getHFileContext().isIncludesTags());

    //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 {
      encodingCtx.postEncoding(BlockType.DATA);
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.io.encoding.HFileBlockDefaultEncodingContext

    if(DataBlockEncoding.PREFIX_TREE != encoding){
      //i'm not sure why encoding is in the interface.  Each encoder implementation should probably
      //know it's encoding type
      throw new IllegalArgumentException("only DataBlockEncoding.PREFIX_TREE supported");
    }
    return new HFileBlockDefaultEncodingContext(encoding, header, meta);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.io.encoding.HFileBlockDefaultEncodingContext

    if(DataBlockEncoding.PREFIX_TREE != encoding){
      //i'm not sure why encoding is in the interface.  Each encoder implementation should probably
      //know it's encoding type
      throw new IllegalArgumentException("only DataBlockEncoding.PREFIX_TREE supported");
    }
    return new HFileBlockDefaultEncodingContext(encoding, header, meta);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.io.encoding.HFileBlockDefaultEncodingContext

    if (blkEncodingCtx.getClass() != HFileBlockDefaultEncodingContext.class) {
      throw new IOException(this.getClass().getName() + " only accepts "
          + HFileBlockDefaultEncodingContext.class.getName() + " as the " + "encoding context.");
    }

    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

Examples of org.apache.hadoop.hbase.io.encoding.HFileBlockDefaultEncodingContext

    assertEquals(headerSize, cacheBlock.getDummyHeaderForVersion().length);
  }

  private HFileBlock createBlockOnDisk(HFileBlock block, boolean useTags) throws IOException {
    int size;
    HFileBlockEncodingContext context = new HFileBlockDefaultEncodingContext(
        blockEncoder.getDataBlockEncoding(),
        HConstants.HFILEBLOCK_DUMMY_HEADER, block.getHFileContext());
    context.setDummyHeader(block.getDummyHeaderForVersion());
    blockEncoder.beforeWriteToDisk(block.getBufferWithoutHeader(), context, block.getBlockType());
    byte[] encodedBytes = context.getUncompressedBytesWithHeader();
    size = encodedBytes.length - block.getDummyHeaderForVersion().length;
    return new HFileBlock(context.getBlockType(), size, size, -1,
            ByteBuffer.wrap(encodedBytes), HFileBlock.FILL_HEADER, 0,
            block.getOnDiskDataSizeWithHeader(), block.getHFileContext());
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.io.encoding.HFileBlockDefaultEncodingContext

          dummyHeader, meta);
      encoder.encodeKeyValues(rawBuf, encodingCtx);
      encodedResultWithHeader =
          encodingCtx.getUncompressedBytesWithHeader();
    } else {
      HFileBlockDefaultEncodingContext defaultEncodingCtx = new HFileBlockDefaultEncodingContext(
          encoding, dummyHeader, meta);
      byte[] rawBufWithHeader =
          new byte[rawBuf.array().length + headerLen];
      System.arraycopy(rawBuf.array(), 0, rawBufWithHeader,
          headerLen, rawBuf.array().length);
      defaultEncodingCtx.compressAfterEncodingWithBlockType(rawBufWithHeader,
          BlockType.DATA);
      encodedResultWithHeader =
        defaultEncodingCtx.getUncompressedBytesWithHeader();
    }
    final int encodedSize =
        encodedResultWithHeader.length - headerLen;
    if (encoder != null) {
      // We need to account for the two-byte encoding algorithm ID that
View Full Code Here

Examples of org.apache.hadoop.hbase.io.encoding.HFileBlockDefaultEncodingContext

     * @param dataBlockEncoder data block encoding algorithm to use
     */
    public Writer(HFileDataBlockEncoder dataBlockEncoder, HFileContext fileContext) {
      this.dataBlockEncoder = dataBlockEncoder != null
          ? dataBlockEncoder : NoOpDataBlockEncoder.INSTANCE;
      defaultBlockEncodingCtx = new HFileBlockDefaultEncodingContext(null,
          HConstants.HFILEBLOCK_DUMMY_HEADER, fileContext);
      dataBlockEncodingCtx = this.dataBlockEncoder
          .newDataBlockEncodingContext(HConstants.HFILEBLOCK_DUMMY_HEADER, fileContext);

      if (fileContext.getBytesPerChecksum() < HConstants.HFILEBLOCK_HEADER_SIZE) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.