Examples of HFileBlockDefaultEncodingContext


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

          HFileDataBlockEncoder dataBlockEncoder, boolean includesMemstoreTS,
          ChecksumType checksumType, int bytesPerChecksum) {
      this.dataBlockEncoder = dataBlockEncoder != null
          ? dataBlockEncoder : NoOpDataBlockEncoder.INSTANCE;
      defaultBlockEncodingCtx =
        new HFileBlockDefaultEncodingContext(compressionAlgorithm, null, HConstants.HFILEBLOCK_DUMMY_HEADER);
      dataBlockEncodingCtx =
        this.dataBlockEncoder.newOnDiskDataBlockEncodingContext(
            compressionAlgorithm, HConstants.HFILEBLOCK_DUMMY_HEADER);

      if (bytesPerChecksum < HConstants.HFILEBLOCK_HEADER_SIZE) {
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, includesMvccVersion);

    //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(compressionAlgorithm, encoding, header);
  }
View Full Code Here

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.compressAfterEncoding(in.array(), blockType);
  }
View Full Code Here

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

  }

  @Override
  public HFileBlockEncodingContext newOnDiskDataBlockEncodingContext(
      Algorithm compressionAlgorithm, byte[] dummyHeader) {
    return new HFileBlockDefaultEncodingContext(compressionAlgorithm,
        null, dummyHeader);
  }
View Full Code Here

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

      encoder.encodeKeyValues(rawBuf, includesMemstoreTS,
          encodingCtx);
      encodedResultWithHeader =
          encodingCtx.getUncompressedBytesWithHeader();
    } else {
      HFileBlockDefaultEncodingContext defaultEncodingCtx =
        new HFileBlockDefaultEncodingContext(algo, encoding, dummyHeader);
      byte[] rawBufWithHeader =
          new byte[rawBuf.array().length + headerLen];
      System.arraycopy(rawBuf.array(), 0, rawBufWithHeader,
          headerLen, rawBuf.array().length);
      defaultEncodingCtx.compressAfterEncoding(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

   */
  @Test
  public void testEncodingWritePath() throws IOException {
    // usually we have just block without headers, but don't complicate that
    HFileBlock block = getSampleHFileBlock();
    HFileBlockEncodingContext context = new HFileBlockDefaultEncodingContext(
        Compression.Algorithm.NONE, blockEncoder.getEncodingOnDisk(), HConstants.HFILEBLOCK_DUMMY_HEADER);
    blockEncoder.beforeWriteToDisk(block.getBufferWithoutHeader(),
            includesMemstoreTS, context, block.getBlockType());

    byte[] encodedBytes = context.getUncompressedBytesWithHeader();
    int size = encodedBytes.length - HConstants.HFILEBLOCK_HEADER_SIZE;
    HFileBlock blockOnDisk =
        new HFileBlock(context.getBlockType(), size, size, -1,
            ByteBuffer.wrap(encodedBytes), HFileBlock.FILL_HEADER, 0,
        includesMemstoreTS, block.getMinorVersion(),
        block.getBytesPerChecksum(), block.getChecksumType(),
        block.getOnDiskDataSizeWithHeader());

View Full Code Here

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

      compressAlgo = compressionAlgorithm == null ? NONE : compressionAlgorithm;
      this.dataBlockEncoder = dataBlockEncoder != null
          ? dataBlockEncoder : NoOpDataBlockEncoder.INSTANCE;

      defaultBlockEncodingCtx =
          new HFileBlockDefaultEncodingContext(compressionAlgorithm,
              null, DUMMY_HEADER);
      dataBlockEncodingCtx =
        this.dataBlockEncoder.newOnDiskDataBlockEncodingContext(
            compressionAlgorithm, DUMMY_HEADER);
View Full Code Here

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

          this.inCache.getEncoder().newDataBlockEncodingContext(
              Algorithm.NONE, this.inCache, dummyHeader);
    } else {
      // create a default encoding context
      inCacheEncodeCtx =
          new HFileBlockDefaultEncodingContext(Algorithm.NONE,
              this.inCache, dummyHeader);
    }

    Preconditions.checkArgument(onDisk == DataBlockEncoding.NONE ||
        onDisk == inCache, "on-disk encoding (" + onDisk + ") must be " +
View Full Code Here

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

      if (encoder != null) {
        return encoder.newDataBlockEncodingContext(
            compressionAlgorithm, onDisk, dummyHeader);
      }
    }
    return new HFileBlockDefaultEncodingContext(compressionAlgorithm,
        null, dummyHeader);
  }
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.