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
Modifier and TypeClassDescriptionprotected static class
protected static class
protected static class
Copies only the key part of the keybuffer by doing a deep copy and passes the seeker state members for taking a clone.protected static class
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
-
Field Summary
Modifier and TypeFieldDescriptionprivate static int
TODO: This datablockencoder is dealing in internals of hfileblocks. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected final void
afterDecodingKeyValue
(DataInputStream source, ByteBuffer dest, HFileBlockDefaultDecodingContext decodingCtx) protected final int
afterEncodingKeyValue
(ExtendedCell cell, DataOutputStream out, HFileBlockDefaultEncodingContext encodingCtx) Returns unencoded size addedstatic int
compareCommonFamilyPrefix
(Cell left, Cell right, int familyCommonPrefix) static int
compareCommonQualifierPrefix
(Cell left, Cell right, int qualCommonPrefix) static int
compareCommonRowPrefix
(Cell left, Cell right, int rowCommonPrefix) common prefixesdecodeKeyValues
(DataInputStream source, HFileBlockDecodingContext blkDecodingCtx) 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.protected static void
ensureSpace
(ByteBuffer out, int length) Asserts that there is at least the given amount of unfilled space remaining in the given buffer.protected abstract ByteBuffer
internalDecodeKeyValues
(DataInputStream source, int allocateHeaderLength, int skipLastBytes, HFileBlockDefaultDecodingContext decodingCtx) abstract int
internalEncode
(ExtendedCell cell, HFileBlockDefaultEncodingContext encodingCtx, DataOutputStream out) 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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:DataBlockEncoder
Decode.- 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(ExtendedCell 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: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
-
internalEncode
public abstract int internalEncode(ExtendedCell 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: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
-