Class BufferedDataBlockEncoder
java.lang.Object
org.apache.hadoop.hbase.io.encoding.AbstractDataBlockEncoder
org.apache.hadoop.hbase.io.encoding.BufferedDataBlockEncoder
- All Implemented Interfaces:
DataBlockEncoder
- Direct Known Subclasses:
CopyKeyDataBlockEncoder,DiffKeyDeltaEncoder,FastDiffDeltaEncoder,PrefixKeyDeltaEncoder
Base class for all data block encoders that use a buffer.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static classprotected static classCopies only the key part of the keybuffer by doing a deep copy and passes the seeker state members for taking a clone.protected static classNested classes/interfaces inherited from class org.apache.hadoop.hbase.io.encoding.AbstractDataBlockEncoder
AbstractDataBlockEncoder.AbstractEncodedSeekerNested classes/interfaces inherited from interface org.apache.hadoop.hbase.io.encoding.DataBlockEncoder
DataBlockEncoder.EncodedSeeker -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static intTODO: This datablockencoder is dealing in internals of hfileblocks. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidafterDecodingKeyValue(DataInputStream source, ByteBuffer dest, HFileBlockDefaultDecodingContext decodingCtx) protected final intafterEncodingKeyValue(Cell cell, DataOutputStream out, HFileBlockDefaultEncodingContext encodingCtx) Returns unencoded size addedstatic intcompareCommonFamilyPrefix(Cell left, Cell right, int familyCommonPrefix) static intcompareCommonQualifierPrefix(Cell left, Cell right, int qualCommonPrefix) static intcompareCommonRowPrefix(Cell left, Cell right, int rowCommonPrefix) common prefixesdecodeKeyValues(DataInputStream source, HFileBlockDecodingContext blkDecodingCtx) Decode.voidencode(Cell cell, HFileBlockEncodingContext encodingCtx, DataOutputStream out) Encodes a KeyValue.voidendBlockEncoding(HFileBlockEncodingContext encodingCtx, DataOutputStream out, byte[] uncompressedBytesWithHeader) Ends encoding for a block of KeyValues.protected static voidensureSpace(ByteBuffer out, int length) Asserts that there is at least the given amount of unfilled space remaining in the given buffer.protected abstract ByteBufferinternalDecodeKeyValues(DataInputStream source, int allocateHeaderLength, int skipLastBytes, HFileBlockDefaultDecodingContext decodingCtx) abstract intinternalEncode(Cell cell, HFileBlockDefaultEncodingContext encodingCtx, DataOutputStream out) voidstartBlockEncoding(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, postEncodingMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.io.encoding.DataBlockEncoder
createSeeker, getFirstKeyCellInBlock
-
Field Details
-
INITIAL_KEY_BUFFER_SIZE
TODO: This datablockencoder is dealing in internals of hfileblocks. Purge reference to HFBs
-
-
Constructor Details
-
BufferedDataBlockEncoder
-
-
Method Details
-
decodeKeyValues
public ByteBuffer decodeKeyValues(DataInputStream source, HFileBlockDecodingContext blkDecodingCtx) throws IOException Description copied from interface:DataBlockEncoderDecode.- Parameters:
source- Compressed stream of KeyValues.- Returns:
- Uncompressed block of KeyValues.
- Throws:
IOException- If there is an error in source.
-
compareCommonRowPrefix
common prefixes -
compareCommonFamilyPrefix
-
compareCommonQualifierPrefix
-
afterEncodingKeyValue
protected final int afterEncodingKeyValue(Cell cell, DataOutputStream out, HFileBlockDefaultEncodingContext encodingCtx) throws IOException Returns unencoded size added- Throws:
IOException
-
afterDecodingKeyValue
protected final void afterDecodingKeyValue(DataInputStream source, ByteBuffer dest, HFileBlockDefaultDecodingContext decodingCtx) throws IOException - Throws:
IOException
-
internalDecodeKeyValues
protected abstract ByteBuffer internalDecodeKeyValues(DataInputStream source, int allocateHeaderLength, int skipLastBytes, HFileBlockDefaultDecodingContext decodingCtx) throws IOException - Throws:
IOException
-
ensureSpace
Asserts that there is at least the given amount of unfilled space remaining in the given buffer.- Parameters:
out- typically, the buffer we are writing tolength- the required space in the buffer- Throws:
EncoderBufferTooSmallException- If there are no enough bytes.
-
startBlockEncoding
public void startBlockEncoding(HFileBlockEncodingContext blkEncodingCtx, DataOutputStream out) throws IOException Description copied from interface:DataBlockEncoderStarts encoding for a block of KeyValues. CallDataBlockEncoder.endBlockEncoding(HFileBlockEncodingContext, DataOutputStream, byte[])to finish encoding of a block.- Throws:
IOException
-
encode
public void encode(Cell cell, HFileBlockEncodingContext encodingCtx, DataOutputStream out) throws IOException Description copied from interface:DataBlockEncoderEncodes 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
-
internalEncode
public abstract int internalEncode(Cell cell, HFileBlockDefaultEncodingContext encodingCtx, DataOutputStream out) throws IOException - Throws:
IOException
-
endBlockEncoding
public void endBlockEncoding(HFileBlockEncodingContext encodingCtx, DataOutputStream out, byte[] uncompressedBytesWithHeader) throws IOException Description copied from interface:DataBlockEncoderEnds 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
-