@InterfaceAudience.Private public class DiffKeyDeltaEncoder extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
BufferedDataBlockEncoder.BufferedEncodedSeeker<STATE extends BufferedDataBlockEncoder.SeekerState> |
protected static class |
BufferedDataBlockEncoder.SeekerState |
protected static class |
DiffKeyDeltaEncoder.DiffCompressionState |
protected static class |
DiffKeyDeltaEncoder.DiffSeekerState |
DataBlockEncoder.EncodedSeeker
Constructor and Description |
---|
DiffKeyDeltaEncoder() |
Modifier and Type | Method and Description |
---|---|
protected void |
afterDecodingKeyValue(DataInputStream source,
ByteBuffer dest,
boolean includesMemstoreTS) |
protected void |
afterEncodingKeyValue(ByteBuffer in,
DataOutputStream out,
boolean includesMemstoreTS) |
DataBlockEncoder.EncodedSeeker |
createSeeker(KeyValue.KVComparator 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 allocHeaderLength,
int skipLastBytes,
boolean includesMemstoreTS)
Uncompress.
|
void |
encodeKeyValues(ByteBuffer in,
boolean includesMemstoreTS,
HFileBlockEncodingContext blkEncodingCtx)
Encodes KeyValues.
|
protected static void |
ensureSpace(ByteBuffer out,
int length)
Asserts that there is at least the given amount of unfilled space
remaining in the given buffer.
|
ByteBuffer |
getFirstKeyInBlock(ByteBuffer block)
Return first key in block.
|
void |
internalEncodeKeyValues(DataOutputStream out,
ByteBuffer in,
boolean includesMemstoreTS)
Compress KeyValues and write them to output buffer.
|
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
|
String |
toString() |
public void internalEncodeKeyValues(DataOutputStream out, ByteBuffer in, boolean includesMemstoreTS) throws IOException
out
- Where to write compressed data.in
- Source of KeyValue for compression.includesMemstoreTS
- true if including memstore timestamp after every
key-value pairIOException
- If there is an error writing to output stream.public ByteBuffer decodeKeyValues(DataInputStream source, int allocHeaderLength, int skipLastBytes, boolean includesMemstoreTS) throws IOException
DataBlockEncoder
source
- encoded stream of KeyValues.allocHeaderLength
- allocate this many bytes for the header.skipLastBytes
- Do not copy n last bytes.includesMemstoreTS
- true if including memstore timestamp after every
key-value pairIOException
- If there is an error in source.public ByteBuffer getFirstKeyInBlock(ByteBuffer block)
DataBlockEncoder
block
- encoded block we want index, the position will not changepublic DataBlockEncoder.EncodedSeeker createSeeker(KeyValue.KVComparator comparator, boolean includesMemstoreTS)
DataBlockEncoder
comparator
- what kind of comparison should be usedincludesMemstoreTS
- true if including memstore timestamp after every
key-value pairpublic ByteBuffer decodeKeyValues(DataInputStream source, boolean includesMemstoreTS) throws IOException
DataBlockEncoder
decodeKeyValues
in interface DataBlockEncoder
source
- Compressed stream of KeyValues.includesMemstoreTS
- true if including memstore timestamp after every
key-value pairIOException
- If there is an error in source.protected final void afterEncodingKeyValue(ByteBuffer in, DataOutputStream out, boolean includesMemstoreTS)
protected final void afterDecodingKeyValue(DataInputStream source, ByteBuffer dest, boolean includesMemstoreTS)
public 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 void encodeKeyValues(ByteBuffer in, boolean includesMemstoreTS, HFileBlockEncodingContext blkEncodingCtx) throws IOException
DataBlockEncoder
encodeKeyValues
in interface DataBlockEncoder
in
- Source of KeyValue for compression.includesMemstoreTS
- 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.protected static void ensureSpace(ByteBuffer out, int length) throws EncoderBufferTooSmallException
out
- typically, the buffer we are writing tolength
- the required space in the bufferEncoderBufferTooSmallException
- If there are no enough bytes.Copyright © 2013 The Apache Software Foundation. All Rights Reserved.