Class PrefixKeyDeltaEncoder
java.lang.Object
org.apache.hadoop.hbase.io.encoding.AbstractDataBlockEncoder
org.apache.hadoop.hbase.io.encoding.BufferedDataBlockEncoder
org.apache.hadoop.hbase.io.encoding.PrefixKeyDeltaEncoder
- All Implemented Interfaces:
DataBlockEncoder
Compress key by storing size of common prefix with previous KeyValue and storing raw size of
rest. Format: 1-5 bytes: compressed key length minus prefix (7-bit encoding) 1-5 bytes:
compressed value length (7-bit encoding) 1-3 bytes: compressed length of common key prefix ...
bytes: rest of key (including timestamp) ... bytes: value In a worst case compressed KeyValue
will be three bytes longer than original.
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static class
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.io.encoding.BufferedDataBlockEncoder
BufferedDataBlockEncoder.BufferedEncodedSeeker<STATE extends BufferedDataBlockEncoder.SeekerState>, BufferedDataBlockEncoder.OffheapDecodedExtendedCell, BufferedDataBlockEncoder.OnheapDecodedCell, BufferedDataBlockEncoder.SeekerState
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.private int
decodeKeyValue
(DataInputStream source, ByteBuffer buffer, int prevKeyOffset) getFirstKeyCellInBlock
(ByteBuff block) Return first key in block as a cell.protected ByteBuffer
internalDecodeKeyValues
(DataInputStream source, int allocateHeaderLength, int skipLastBytes, HFileBlockDefaultDecodingContext decodingCtx) int
internalEncode
(Cell cell, HFileBlockDefaultEncodingContext encodingContext, DataOutputStream out) toString()
private void
writeKeyExcludingCommon
(Cell cell, int commonPrefix, DataOutputStream out) Methods inherited from class org.apache.hadoop.hbase.io.encoding.BufferedDataBlockEncoder
afterDecodingKeyValue, afterEncodingKeyValue, compareCommonFamilyPrefix, compareCommonQualifierPrefix, compareCommonRowPrefix, decodeKeyValues, encode, endBlockEncoding, ensureSpace, startBlockEncoding
Methods inherited from class org.apache.hadoop.hbase.io.encoding.AbstractDataBlockEncoder
createFirstKeyCell, newDataBlockDecodingContext, newDataBlockEncodingContext, postEncoding
-
Constructor Details
-
PrefixKeyDeltaEncoder
public PrefixKeyDeltaEncoder()
-
-
Method Details
-
internalEncode
public int internalEncode(Cell cell, HFileBlockDefaultEncodingContext encodingContext, DataOutputStream out) throws IOException - Specified by:
internalEncode
in classBufferedDataBlockEncoder
- Throws:
IOException
-
writeKeyExcludingCommon
private void writeKeyExcludingCommon(Cell cell, int commonPrefix, DataOutputStream out) throws IOException - Throws:
IOException
-
internalDecodeKeyValues
protected ByteBuffer internalDecodeKeyValues(DataInputStream source, int allocateHeaderLength, int skipLastBytes, HFileBlockDefaultDecodingContext decodingCtx) throws IOException - Specified by:
internalDecodeKeyValues
in classBufferedDataBlockEncoder
- Throws:
IOException
-
decodeKeyValue
private int decodeKeyValue(DataInputStream source, ByteBuffer buffer, int prevKeyOffset) throws IOException, EncoderBufferTooSmallException -
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.
-
toString
-
createSeeker
Description copied from interface:DataBlockEncoder
Create a HFileBlock seeker which find KeyValues within a block.- Returns:
- A newly created seeker.
-