Package org.apache.hadoop.hbase.io.hfile
Interface HFileDataBlockEncoder
- All Known Implementing Classes:
HFileDataBlockEncoderImpl
,NoOpDataBlockEncoder
Controls what kind of data block encoding is used. If data block encoding is not set or the given
block is not a data block (encoded or not), methods should just return the unmodified block.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final byte[]
Type of encoding used for data blocks in HFile. -
Method Summary
Modifier and TypeMethodDescriptionvoid
encode
(Cell cell, HFileBlockEncodingContext encodingCtx, DataOutputStream out) Encodes a KeyValue.void
endBlockEncoding
(HFileBlockEncodingContext encodingCtx, DataOutputStream out, byte[] uncompressedBytesWithHeader, BlockType blockType) Ends encoding for a block of KeyValues.Returns the data block encodinggetEffectiveEncodingInCache
(boolean isCompaction) newDataBlockDecodingContext
(org.apache.hadoop.conf.Configuration conf, HFileContext fileContext) create a encoder specific decoding context for reading.newDataBlockEncodingContext
(org.apache.hadoop.conf.Configuration conf, byte[] headerBytes, HFileContext fileContext) Create an encoder specific encoding context object for writing.void
saveMetadata
(HFile.Writer writer) Save metadata in HFile which will be written to diskvoid
startBlockEncoding
(HFileBlockEncodingContext encodingCtx, DataOutputStream out) Starts encoding for a block of KeyValues.boolean
Decides whether we should use a scanner over encoded blocks.
-
Field Details
-
DATA_BLOCK_ENCODING
Type of encoding used for data blocks in HFile. Stored in file info.
-
-
Method Details
-
startBlockEncoding
void startBlockEncoding(HFileBlockEncodingContext encodingCtx, DataOutputStream out) throws IOException Starts encoding for a block of KeyValues. CallendBlockEncoding(HFileBlockEncodingContext, DataOutputStream, byte[], BlockType)
to finish encoding of a block.- Throws:
IOException
-
encode
void encode(Cell cell, HFileBlockEncodingContext encodingCtx, DataOutputStream out) throws IOException Encodes a KeyValue.- Throws:
IOException
-
endBlockEncoding
void endBlockEncoding(HFileBlockEncodingContext encodingCtx, DataOutputStream out, byte[] uncompressedBytesWithHeader, BlockType blockType) throws IOException 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
-
useEncodedScanner
boolean useEncodedScanner()Decides whether we should use a scanner over encoded blocks.- Returns:
- Whether to use encoded scanner.
-
saveMetadata
Save metadata in HFile which will be written to disk- Parameters:
writer
- writer for a given HFile- Throws:
IOException
- on disk problems
-
getDataBlockEncoding
Returns the data block encoding -
getEffectiveEncodingInCache
- Returns:
- the effective in-cache data block encoding, taking into account whether we are doing a compaction.
-
newDataBlockEncodingContext
HFileBlockEncodingContext newDataBlockEncodingContext(org.apache.hadoop.conf.Configuration conf, byte[] headerBytes, HFileContext fileContext) Create an encoder specific encoding context object for writing. And the encoding context should also perform compression if compressionAlgorithm is valid.- Parameters:
conf
- store configurationheaderBytes
- header bytesfileContext
- HFile meta data- Returns:
- a new
HFileBlockEncodingContext
object
-
newDataBlockDecodingContext
HFileBlockDecodingContext newDataBlockDecodingContext(org.apache.hadoop.conf.Configuration conf, HFileContext fileContext) create a encoder specific decoding context for reading. And the decoding context should also do decompression if compressionAlgorithm is valid.- Parameters:
conf
- store configurationfileContext
- - HFile meta data- Returns:
- a new
HFileBlockDecodingContext
object
-