org.apache.hadoop.hbase.io.hfile
Interface HFileDataBlockEncoder

All Known Implementing Classes:
HFileDataBlockEncoderImpl, NoOpDataBlockEncoder

@InterfaceAudience.Private
public interface HFileDataBlockEncoder

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
static byte[] DATA_BLOCK_ENCODING
          Type of encoding used for data blocks in HFile.
 
Method Summary
 void beforeWriteToDisk(ByteBuffer in, HFileBlockEncodingContext encodingResult, BlockType blockType)
          Should be called before an encoded or unencoded data block is written to disk.
 DataBlockEncoding getDataBlockEncoding()
           
 HFileBlockDecodingContext newDataBlockDecodingContext(HFileContext fileContext)
          create a encoder specific decoding context for reading.
 HFileBlockEncodingContext newDataBlockEncodingContext(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 disk
 boolean useEncodedScanner()
          Decides whether we should use a scanner over encoded blocks.
 

Field Detail

DATA_BLOCK_ENCODING

static final byte[] DATA_BLOCK_ENCODING
Type of encoding used for data blocks in HFile. Stored in file info.

Method Detail

beforeWriteToDisk

void beforeWriteToDisk(ByteBuffer in,
                       HFileBlockEncodingContext encodingResult,
                       BlockType blockType)
                       throws IOException
Should be called before an encoded or unencoded data block is written to disk.

Parameters:
in - KeyValues next to each other
encodingResult - the encoded result
blockType - block type
Throws:
IOException

useEncodedScanner

boolean useEncodedScanner()
Decides whether we should use a scanner over encoded blocks.

Returns:
Whether to use encoded scanner.

saveMetadata

void saveMetadata(HFile.Writer writer)
                  throws IOException
Save metadata in HFile which will be written to disk

Parameters:
writer - writer for a given HFile
Throws:
IOException - on disk problems

getDataBlockEncoding

DataBlockEncoding getDataBlockEncoding()
Returns:
the data block encoding

newDataBlockEncodingContext

HFileBlockEncodingContext newDataBlockEncodingContext(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:
headerBytes - header bytes
fileContext - HFile meta data
Returns:
a new HFileBlockEncodingContext object

newDataBlockDecodingContext

HFileBlockDecodingContext newDataBlockDecodingContext(HFileContext fileContext)
create a encoder specific decoding context for reading. And the decoding context should also do decompression if compressionAlgorithm is valid.

Parameters:
fileContext - - HFile meta data
Returns:
a new HFileBlockDecodingContext object


Copyright © 2015 The Apache Software Foundation. All rights reserved.