public class HFileDataBlockEncoderImpl extends Object implements HFileDataBlockEncoder
DATA_BLOCK_ENCODING
Constructor and Description |
---|
HFileDataBlockEncoderImpl(DataBlockEncoding encoding) |
HFileDataBlockEncoderImpl(DataBlockEncoding onDisk,
DataBlockEncoding inCache)
Do data block encoding with specified options.
|
Modifier and Type | Method and Description |
---|---|
Pair<ByteBuffer,BlockType> |
beforeWriteToDisk(ByteBuffer in,
boolean includesMemstoreTS,
byte[] dummyHeader)
Precondition: a non-encoded buffer.
|
static HFileDataBlockEncoder |
createFromFileInfo(org.apache.hadoop.hbase.io.hfile.HFile.FileInfo fileInfo,
DataBlockEncoding preferredEncodingInCache) |
HFileBlock |
diskToCacheFormat(HFileBlock block,
boolean isCompaction)
Converts a block from the on-disk format to the in-cache format.
|
DataBlockEncoding |
getEffectiveEncodingInCache(boolean isCompaction) |
DataBlockEncoding |
getEncodingInCache() |
DataBlockEncoding |
getEncodingOnDisk() |
void |
saveMetadata(HFile.Writer writer)
Save metadata in HFile which will be written to disk
|
String |
toString() |
boolean |
useEncodedScanner(boolean isCompaction)
Decides whether we should use a scanner over encoded blocks.
|
public HFileDataBlockEncoderImpl(DataBlockEncoding encoding)
public HFileDataBlockEncoderImpl(DataBlockEncoding onDisk, DataBlockEncoding inCache)
onDisk
- What kind of data block encoding will be used before writing
HFileBlock to disk. This must be either the same as inCache or
DataBlockEncoding.NONE
.inCache
- What kind of data block encoding will be used in block
cache.public static HFileDataBlockEncoder createFromFileInfo(org.apache.hadoop.hbase.io.hfile.HFile.FileInfo fileInfo, DataBlockEncoding preferredEncodingInCache) throws IOException
IOException
public void saveMetadata(HFile.Writer writer) throws IOException
HFileDataBlockEncoder
saveMetadata
in interface HFileDataBlockEncoder
writer
- writer for a given HFileIOException
- on disk problemspublic DataBlockEncoding getEncodingOnDisk()
getEncodingOnDisk
in interface HFileDataBlockEncoder
public DataBlockEncoding getEncodingInCache()
getEncodingInCache
in interface HFileDataBlockEncoder
public DataBlockEncoding getEffectiveEncodingInCache(boolean isCompaction)
getEffectiveEncodingInCache
in interface HFileDataBlockEncoder
public HFileBlock diskToCacheFormat(HFileBlock block, boolean isCompaction)
HFileDataBlockEncoder
diskToCacheFormat
in interface HFileDataBlockEncoder
block
- a block in an on-disk format (read from HFile or freshly
generated).public Pair<ByteBuffer,BlockType> beforeWriteToDisk(ByteBuffer in, boolean includesMemstoreTS, byte[] dummyHeader)
beforeWriteToDisk
in interface HFileDataBlockEncoder
in
- KeyValues next to each otherdummyHeader
- A dummy header to be written as a placeholderpublic boolean useEncodedScanner(boolean isCompaction)
HFileDataBlockEncoder
useEncodedScanner
in interface HFileDataBlockEncoder
isCompaction
- whether we are in a compaction.Copyright © 2014 The Apache Software Foundation. All Rights Reserved.