Class RowIndexCodecV1
java.lang.Object
org.apache.hadoop.hbase.io.encoding.AbstractDataBlockEncoder
org.apache.hadoop.hbase.io.encoding.RowIndexCodecV1
- All Implemented Interfaces:
DataBlockEncoder
Store cells following every row's start offset, so we can binary search to a row's cells. Format:
flat cells integer: number of rows integer: row0's offset integer: row1's offset .... integer:
dataSize
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.io.encoding.AbstractDataBlockEncoder
AbstractDataBlockEncoder.AbstractEncodedSeeker
Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.io.encoding.DataBlockEncoder
DataBlockEncoder.EncodedSeeker
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateSeeker
(HFileBlockDecodingContext decodingCtx) Create a HFileBlock seeker which find KeyValues within a block.decodeKeyValues
(DataInputStream source, HFileBlockDecodingContext decodingCtx) Decode.void
encode
(ExtendedCell cell, HFileBlockEncodingContext encodingCtx, DataOutputStream out) Encodes a KeyValue.void
endBlockEncoding
(HFileBlockEncodingContext encodingCtx, DataOutputStream out, byte[] uncompressedBytesWithHeader) Ends encoding for a block of KeyValues.getFirstKeyCellInBlock
(ByteBuff block) Return first key in block as a cell.void
startBlockEncoding
(HFileBlockEncodingContext blkEncodingCtx, DataOutputStream out) Starts encoding for a block of KeyValues.Methods inherited from class org.apache.hadoop.hbase.io.encoding.AbstractDataBlockEncoder
createFirstKeyCell, newDataBlockDecodingContext, newDataBlockEncodingContext, postEncoding
-
Constructor Details
-
RowIndexCodecV1
public RowIndexCodecV1()
-
-
Method Details
-
startBlockEncoding
public void startBlockEncoding(HFileBlockEncodingContext blkEncodingCtx, DataOutputStream out) throws IOException Description copied from interface:DataBlockEncoder
Starts encoding for a block of KeyValues. CallDataBlockEncoder.endBlockEncoding(HFileBlockEncodingContext, DataOutputStream, byte[])
to finish encoding of a block.- Throws:
IOException
-
encode
public void encode(ExtendedCell cell, HFileBlockEncodingContext encodingCtx, DataOutputStream out) throws IOException Description copied from interface:DataBlockEncoder
Encodes a KeyValue. After the encode,EncodingState.postCellEncode(int, int)
needs to be called to keep track of the encoded and unencoded data size- Throws:
IOException
-
endBlockEncoding
public void endBlockEncoding(HFileBlockEncodingContext encodingCtx, DataOutputStream out, byte[] uncompressedBytesWithHeader) throws IOException Description copied from interface:DataBlockEncoder
Ends encoding for a block of KeyValues. Gives a chance for the encoder to do the finishing stuff for the encoded block. It must be called at the end of block encoding.- Throws:
IOException
-
decodeKeyValues
public ByteBuffer decodeKeyValues(DataInputStream source, HFileBlockDecodingContext decodingCtx) throws IOException Description copied from interface:DataBlockEncoder
Decode.- Parameters:
source
- Compressed stream of KeyValues.- Returns:
- Uncompressed block of KeyValues.
- Throws:
IOException
- If there is an error in source.
-
getFirstKeyCellInBlock
Description copied from interface:DataBlockEncoder
Return first key in block as a cell. Useful for indexing. Typically does not make a deep copy but returns a buffer wrapping a segment of the actual block's byte array. This is because the first key in block is usually stored unencoded.- Parameters:
block
- encoded block we want index, the position will not change- Returns:
- First key in block as a cell.
-
createSeeker
Description copied from interface:DataBlockEncoder
Create a HFileBlock seeker which find KeyValues within a block.- Returns:
- A newly created seeker.
-