org.apache.hadoop.hbase.io.hfile
Class NoOpDataBlockEncoder

java.lang.Object
  extended by org.apache.hadoop.hbase.io.hfile.NoOpDataBlockEncoder
All Implemented Interfaces:
HFileDataBlockEncoder

public class NoOpDataBlockEncoder
extends Object
implements HFileDataBlockEncoder

Does not perform any kind of encoding/decoding.


Field Summary
static NoOpDataBlockEncoder INSTANCE
           
 
Fields inherited from interface org.apache.hadoop.hbase.io.hfile.HFileDataBlockEncoder
DATA_BLOCK_ENCODING
 
Method Summary
 Pair<ByteBuffer,BlockType> beforeWriteToDisk(ByteBuffer in, boolean includesMemstoreTS, byte[] dummyHeader)
          Should be called before an encoded or unencoded data block is written to disk.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INSTANCE

public static final NoOpDataBlockEncoder INSTANCE
Method Detail

diskToCacheFormat

public HFileBlock diskToCacheFormat(HFileBlock block,
                                    boolean isCompaction)
Description copied from interface: HFileDataBlockEncoder
Converts a block from the on-disk format to the in-cache format. Called in the following cases:

Specified by:
diskToCacheFormat in interface HFileDataBlockEncoder
Parameters:
block - a block in an on-disk format (read from HFile or freshly generated).
Returns:
non null block which is coded according to the settings.

beforeWriteToDisk

public Pair<ByteBuffer,BlockType> beforeWriteToDisk(ByteBuffer in,
                                                    boolean includesMemstoreTS,
                                                    byte[] dummyHeader)
Description copied from interface: HFileDataBlockEncoder
Should be called before an encoded or unencoded data block is written to disk.

Specified by:
beforeWriteToDisk in interface HFileDataBlockEncoder
Parameters:
in - KeyValues next to each other
dummyHeader - A dummy header to be written as a placeholder
Returns:
a non-null on-heap buffer containing the contents of the HFileBlock with unfilled header and block type

useEncodedScanner

public boolean useEncodedScanner(boolean isCompaction)
Description copied from interface: HFileDataBlockEncoder
Decides whether we should use a scanner over encoded blocks.

Specified by:
useEncodedScanner in interface HFileDataBlockEncoder
Parameters:
isCompaction - whether we are in a compaction.
Returns:
Whether to use encoded scanner.

saveMetadata

public void saveMetadata(HFile.Writer writer)
Description copied from interface: HFileDataBlockEncoder
Save metadata in HFile which will be written to disk

Specified by:
saveMetadata in interface HFileDataBlockEncoder
Parameters:
writer - writer for a given HFile

getEncodingOnDisk

public DataBlockEncoding getEncodingOnDisk()
Specified by:
getEncodingOnDisk in interface HFileDataBlockEncoder
Returns:
the on-disk data block encoding

getEncodingInCache

public DataBlockEncoding getEncodingInCache()
Specified by:
getEncodingInCache in interface HFileDataBlockEncoder
Returns:
the preferred in-cache data block encoding for normal reads

getEffectiveEncodingInCache

public DataBlockEncoding getEffectiveEncodingInCache(boolean isCompaction)
Specified by:
getEffectiveEncodingInCache in interface HFileDataBlockEncoder
Returns:
the effective in-cache data block encoding, taking into account whether we are doing a compaction.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015 The Apache Software Foundation. All Rights Reserved.