Package org.apache.hadoop.hbase.ipc
Class CellBlockBuilder
java.lang.Object
org.apache.hadoop.hbase.ipc.CellBlockBuilder
Helper class for building cell block.
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static final class
private static final class
private static interface
-
Field Summary
Modifier and TypeFieldDescriptionprivate final int
private final int
How much we think the decompressor will expand the original compressed content.private final org.apache.hadoop.conf.Configuration
(package private) static final org.slf4j.Logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuildCellBlock
(Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor, ExtendedCellScanner cellScanner) Puts CellScanner Cells into a cell block using passed incodec
and/orcompressor
.private boolean
buildCellBlock
(Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor, ExtendedCellScanner cellScanner, CellBlockBuilder.OutputStreamSupplier supplier) org.apache.hbase.thirdparty.io.netty.buffer.ByteBuf
buildCellBlock
(Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor, ExtendedCellScanner cellScanner, org.apache.hbase.thirdparty.io.netty.buffer.ByteBufAllocator alloc) buildCellBlockStream
(Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor, ExtendedCellScanner cellScanner, ByteBuffAllocator allocator) Puts CellScanner Cells into a cell block using passed incodec
and/orcompressor
.createCellScanner
(Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor, byte[] cellBlock) Create a cell scanner.createCellScannerReusingBuffers
(Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor, ByteBuff cellBlock) Create a cell scanner using an existing bytebuff.private ByteBuffer
decompress
(org.apache.hadoop.io.compress.CompressionCodec compressor, byte[] compressedCellBlock) private ByteBuffer
decompress
(org.apache.hadoop.io.compress.CompressionCodec compressor, InputStream cellBlockStream, int osInitialSize) private ByteBuff
decompress
(org.apache.hadoop.io.compress.CompressionCodec compressor, ByteBuff compressedCellBlock) private void
encodeCellsTo
(OutputStream os, ExtendedCellScanner cellScanner, Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor)
-
Field Details
-
LOG
-
conf
-
cellBlockDecompressionMultiplier
How much we think the decompressor will expand the original compressed content. -
cellBlockBuildingInitialBufferSize
-
-
Constructor Details
-
CellBlockBuilder
-
-
Method Details
-
buildCellBlock
public ByteBuffer buildCellBlock(Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor, ExtendedCellScanner cellScanner) throws IOException Puts CellScanner Cells into a cell block using passed incodec
and/orcompressor
.- Returns:
- Null or byte buffer filled with a cellblock filled with passed-in Cells encoded using
passed in
codec
and/orcompressor
; the returned buffer has been flipped and is ready for reading. Use limit to find total size. - Throws:
IOException
-
buildCellBlock
public org.apache.hbase.thirdparty.io.netty.buffer.ByteBuf buildCellBlock(Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor, ExtendedCellScanner cellScanner, org.apache.hbase.thirdparty.io.netty.buffer.ByteBufAllocator alloc) throws IOException - Throws:
IOException
-
buildCellBlock
private boolean buildCellBlock(Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor, ExtendedCellScanner cellScanner, CellBlockBuilder.OutputStreamSupplier supplier) throws IOException - Throws:
IOException
-
encodeCellsTo
private void encodeCellsTo(OutputStream os, ExtendedCellScanner cellScanner, Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor) throws IOException - Throws:
IOException
-
buildCellBlockStream
public ByteBufferListOutputStream buildCellBlockStream(Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor, ExtendedCellScanner cellScanner, ByteBuffAllocator allocator) throws IOException Puts CellScanner Cells into a cell block using passed incodec
and/orcompressor
.- Parameters:
codec
- to use for encodingcompressor
- to use for encodingcellScanner
- to encodeallocator
- to allocate theByteBuff
.- Returns:
- Null or byte buffer filled with a cellblock filled with passed-in Cells encoded using
passed in
codec
and/orcompressor
; the returned buffer has been flipped and is ready for reading. Use limit to find total size. Ifpool
was not null, then this returned ByteBuffer came from there and should be returned to the pool when done. - Throws:
IOException
- if encoding the cells fail
-
createCellScanner
public ExtendedCellScanner createCellScanner(Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor, byte[] cellBlock) throws IOException Create a cell scanner.- Parameters:
codec
- to use for cellblockcellBlock
- to encode- Returns:
- CellScanner to work against the content of
cellBlock
- Throws:
IOException
- if encoding fails
-
createCellScannerReusingBuffers
public ExtendedCellScanner createCellScannerReusingBuffers(Codec codec, org.apache.hadoop.io.compress.CompressionCodec compressor, ByteBuff cellBlock) throws IOException Create a cell scanner using an existing bytebuff.- Parameters:
codec
- to use for cellblockcellBlock
- ByteBuffer containing the cells written by the Codec. The buffer should be position()'ed at the start of the cell block and limit()'ed at the end.- Returns:
- CellScanner to work against the content of
cellBlock
. All cells created out of the CellScanner will share the same ByteBuffer being passed. - Throws:
IOException
- if cell encoding fails
-
decompress
private ByteBuffer decompress(org.apache.hadoop.io.compress.CompressionCodec compressor, byte[] compressedCellBlock) throws IOException - Throws:
IOException
-
decompress
private ByteBuff decompress(org.apache.hadoop.io.compress.CompressionCodec compressor, ByteBuff compressedCellBlock) throws IOException - Throws:
IOException
-
decompress
private ByteBuffer decompress(org.apache.hadoop.io.compress.CompressionCodec compressor, InputStream cellBlockStream, int osInitialSize) throws IOException - Throws:
IOException
-