@InterfaceAudience.Private public class PrefixTreeCodec extends Object implements DataBlockEncoder
PrefixTreeEncoder
, and decoding is delegated to instances of
CellSearcher
. Encoder and decoder instances are
created and recycled by static PtEncoderFactory and PtDecoderFactory.DataBlockEncoder.EncodedSeeker
Constructor and Description |
---|
PrefixTreeCodec()
no-arg constructor for reflection
|
Modifier and Type | Method and Description |
---|---|
DataBlockEncoder.EncodedSeeker |
createSeeker(KeyValue.KVComparator comparator,
boolean includesMvccVersion)
Is this the correct handling of an illegal comparator? How to prevent that from getting all
the way to this point.
|
ByteBuffer |
decodeKeyValues(DataInputStream source,
boolean includesMvccVersion)
Decode.
|
ByteBuffer |
decodeKeyValues(DataInputStream source,
int allocateHeaderLength,
int skipLastBytes,
boolean includesMvccVersion)
I don't think this method is called during normal HBase operation, so efficiency is not
important.
|
void |
encodeKeyValues(ByteBuffer in,
boolean includesMvccVersion,
HFileBlockEncodingContext blkEncodingCtx)
Copied from BufferedDataBlockEncoder.
|
ByteBuffer |
getFirstKeyInBlock(ByteBuffer block)
Return first key in block.
|
HFileBlockDecodingContext |
newDataBlockDecodingContext(Compression.Algorithm compressionAlgorithm)
Creates an encoder specific decoding context, which will prepare the data
before actual decoding
|
HFileBlockEncodingContext |
newDataBlockEncodingContext(Compression.Algorithm compressionAlgorithm,
DataBlockEncoding encoding,
byte[] header)
Creates a encoder specific encoding context
|
public void encodeKeyValues(ByteBuffer in, boolean includesMvccVersion, HFileBlockEncodingContext blkEncodingCtx) throws IOException
encodeKeyValues
in interface DataBlockEncoder
in
- Source of KeyValue for compression.includesMvccVersion
- true if including memstore timestamp after every key-value pairblkEncodingCtx
- the encoding context which will contain encoded uncompressed bytes
as well as compressed encoded bytes if compression is enabled, and
also it will reuse resources across multiple calls.IOException
- If there is an error writing to output stream.public ByteBuffer decodeKeyValues(DataInputStream source, boolean includesMvccVersion) throws IOException
DataBlockEncoder
decodeKeyValues
in interface DataBlockEncoder
source
- Compressed stream of KeyValues.includesMvccVersion
- true if including memstore timestamp after every
key-value pairIOException
- If there is an error in source.public ByteBuffer decodeKeyValues(DataInputStream source, int allocateHeaderLength, int skipLastBytes, boolean includesMvccVersion) throws IOException
decodeKeyValues
in interface DataBlockEncoder
source
- encoded stream of KeyValues.allocateHeaderLength
- allocate this many bytes for the header.skipLastBytes
- Do not copy n last bytes.includesMvccVersion
- true if including memstore timestamp after every
key-value pairIOException
- If there is an error in source.public ByteBuffer getFirstKeyInBlock(ByteBuffer block)
DataBlockEncoder
getFirstKeyInBlock
in interface DataBlockEncoder
block
- encoded block we want index, the position will not changepublic HFileBlockEncodingContext newDataBlockEncodingContext(Compression.Algorithm compressionAlgorithm, DataBlockEncoding encoding, byte[] header)
DataBlockEncoder
newDataBlockEncodingContext
in interface DataBlockEncoder
compressionAlgorithm
- compression algorithm used if the final data needs to be
compressedencoding
- encoding strategy usedheader
- header bytes to be written, put a dummy header here if the header
is unknownpublic HFileBlockDecodingContext newDataBlockDecodingContext(Compression.Algorithm compressionAlgorithm)
DataBlockEncoder
newDataBlockDecodingContext
in interface DataBlockEncoder
compressionAlgorithm
- compression algorithm used if the data needs to be decompressedpublic DataBlockEncoder.EncodedSeeker createSeeker(KeyValue.KVComparator comparator, boolean includesMvccVersion)
createSeeker
in interface DataBlockEncoder
comparator
- what kind of comparison should be usedincludesMvccVersion
- true if including memstore timestamp after every
key-value pairCopyright © 2013 The Apache Software Foundation. All rights reserved.