|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@InterfaceAudience.Private public interface DataBlockEncoder
Encoding of KeyValue. It aims to be fast and efficient using assumptions:
encodeKeyValues(ByteBuffer, boolean, HFileBlockEncodingContext)
.
Nested Class Summary | |
---|---|
static interface |
DataBlockEncoder.EncodedSeeker
An interface which enable to seek while underlying data is encoded. |
Method Summary | |
---|---|
DataBlockEncoder.EncodedSeeker |
createSeeker(org.apache.hadoop.io.RawComparator<byte[]> comparator,
boolean includesMemstoreTS)
Create a HFileBlock seeker which find KeyValues within a block. |
ByteBuffer |
decodeKeyValues(DataInputStream source,
boolean includesMemstoreTS)
Decode. |
ByteBuffer |
decodeKeyValues(DataInputStream source,
int allocateHeaderLength,
int skipLastBytes,
boolean includesMemstoreTS)
Uncompress. |
void |
encodeKeyValues(ByteBuffer in,
boolean includesMemstoreTS,
HFileBlockEncodingContext encodingContext)
Encodes KeyValues. |
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[] headerBytes)
Creates a encoder specific encoding context |
Method Detail |
---|
void encodeKeyValues(ByteBuffer in, boolean includesMemstoreTS, HFileBlockEncodingContext encodingContext) throws IOException
in
- Source of KeyValue for compression.includesMemstoreTS
- true if including memstore timestamp after every key-value pairencodingContext
- 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.ByteBuffer decodeKeyValues(DataInputStream source, boolean includesMemstoreTS) throws IOException
source
- Compressed stream of KeyValues.includesMemstoreTS
- true if including memstore timestamp after every
key-value pair
IOException
- If there is an error in source.ByteBuffer decodeKeyValues(DataInputStream source, int allocateHeaderLength, int skipLastBytes, boolean includesMemstoreTS) throws IOException
source
- encoded stream of KeyValues.allocateHeaderLength
- allocate this many bytes for the header.skipLastBytes
- Do not copy n last bytes.includesMemstoreTS
- true if including memstore timestamp after every
key-value pair
IOException
- If there is an error in source.ByteBuffer getFirstKeyInBlock(ByteBuffer block)
block
- encoded block we want index, the position will not change
DataBlockEncoder.EncodedSeeker createSeeker(org.apache.hadoop.io.RawComparator<byte[]> comparator, boolean includesMemstoreTS)
comparator
- what kind of comparison should be usedincludesMemstoreTS
- true if including memstore timestamp after every
key-value pair
HFileBlockEncodingContext newDataBlockEncodingContext(Compression.Algorithm compressionAlgorithm, DataBlockEncoding encoding, byte[] headerBytes)
compressionAlgorithm
- compression algorithm used if the final data needs to be
compressedencoding
- encoding strategy usedheaderBytes
- header bytes to be written, put a dummy header here if the header
is unknown
HFileBlockDecodingContext newDataBlockDecodingContext(Compression.Algorithm compressionAlgorithm)
compressionAlgorithm
- compression algorithm used if the data needs to be decompressed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |