Package org.apache.hadoop.hbase.io.hfile
Class HFileDataBlockEncoderImpl
java.lang.Object
org.apache.hadoop.hbase.io.hfile.HFileDataBlockEncoderImpl
- All Implemented Interfaces:
HFileDataBlockEncoder
Do different kinds of data block encoding according to column family options.
-
Field Summary
Fields inherited from interface org.apache.hadoop.hbase.io.hfile.HFileDataBlockEncoder
DATA_BLOCK_ENCODING
-
Constructor Summary
ConstructorDescriptionHFileDataBlockEncoderImpl
(DataBlockEncoding encoding) Do data block encoding with specified options. -
Method Summary
Modifier and TypeMethodDescriptionstatic HFileDataBlockEncoder
createFromFileInfo
(HFileInfo fileInfo) void
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[] dummyHeader, 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.toString()
boolean
Decides whether we should use a scanner over encoded blocks.boolean
useEncodedScanner
(boolean isCompaction)
-
Field Details
-
encoding
-
-
Constructor Details
-
HFileDataBlockEncoderImpl
Do data block encoding with specified options.- Parameters:
encoding
- What kind of data block encoding will be used.
-
-
Method Details
-
createFromFileInfo
- Throws:
IOException
-
saveMetadata
Description copied from interface:HFileDataBlockEncoder
Save metadata in HFile which will be written to disk- Specified by:
saveMetadata
in interfaceHFileDataBlockEncoder
- Parameters:
writer
- writer for a given HFile- Throws:
IOException
- on disk problems
-
getDataBlockEncoding
Description copied from interface:HFileDataBlockEncoder
Returns the data block encoding- Specified by:
getDataBlockEncoding
in interfaceHFileDataBlockEncoder
-
useEncodedScanner
-
getEffectiveEncodingInCache
- Specified by:
getEffectiveEncodingInCache
in interfaceHFileDataBlockEncoder
- Returns:
- the effective in-cache data block encoding, taking into account whether we are doing a compaction.
-
encode
public void encode(Cell cell, HFileBlockEncodingContext encodingCtx, DataOutputStream out) throws IOException Description copied from interface:HFileDataBlockEncoder
Encodes a KeyValue.- Specified by:
encode
in interfaceHFileDataBlockEncoder
- Throws:
IOException
-
useEncodedScanner
Description copied from interface:HFileDataBlockEncoder
Decides whether we should use a scanner over encoded blocks.- Specified by:
useEncodedScanner
in interfaceHFileDataBlockEncoder
- Returns:
- Whether to use encoded scanner.
-
toString
-
newDataBlockEncodingContext
public HFileBlockEncodingContext newDataBlockEncodingContext(org.apache.hadoop.conf.Configuration conf, byte[] dummyHeader, HFileContext fileContext) Description copied from interface:HFileDataBlockEncoder
Create an encoder specific encoding context object for writing. And the encoding context should also perform compression if compressionAlgorithm is valid.- Specified by:
newDataBlockEncodingContext
in interfaceHFileDataBlockEncoder
- Parameters:
conf
- store configurationdummyHeader
- header bytesfileContext
- HFile meta data- Returns:
- a new
HFileBlockEncodingContext
object
-
newDataBlockDecodingContext
public HFileBlockDecodingContext newDataBlockDecodingContext(org.apache.hadoop.conf.Configuration conf, HFileContext fileContext) Description copied from interface:HFileDataBlockEncoder
create a encoder specific decoding context for reading. And the decoding context should also do decompression if compressionAlgorithm is valid.- Specified by:
newDataBlockDecodingContext
in interfaceHFileDataBlockEncoder
- Parameters:
conf
- store configurationfileContext
- - HFile meta data- Returns:
- a new
HFileBlockDecodingContext
object
-
startBlockEncoding
public void startBlockEncoding(HFileBlockEncodingContext encodingCtx, DataOutputStream out) throws IOException Description copied from interface:HFileDataBlockEncoder
Starts encoding for a block of KeyValues. CallHFileDataBlockEncoder.endBlockEncoding(HFileBlockEncodingContext, DataOutputStream, byte[], BlockType)
to finish encoding of a block.- Specified by:
startBlockEncoding
in interfaceHFileDataBlockEncoder
- Throws:
IOException
-
endBlockEncoding
public void endBlockEncoding(HFileBlockEncodingContext encodingCtx, DataOutputStream out, byte[] uncompressedBytesWithHeader, BlockType blockType) throws IOException Description copied from interface:HFileDataBlockEncoder
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.- Specified by:
endBlockEncoding
in interfaceHFileDataBlockEncoder
- Throws:
IOException
-