Package org.apache.hadoop.hbase
Class ByteBufferKeyValue
java.lang.Object
org.apache.hadoop.hbase.ByteBufferExtendedCell
org.apache.hadoop.hbase.ByteBufferKeyValue
- All Implemented Interfaces:
Cell
,ExtendedCell
,HeapSize
,RawCell
- Direct Known Subclasses:
ByteBufferChunkKeyValue
,NoTagsByteBufferKeyValue
,SizeCachedByteBufferKeyValue
This Cell is an implementation of
ByteBufferExtendedCell
where the data resides in off
heap/ on heap ByteBuffer-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected final ByteBuffer
static final int
protected final int
protected final int
private long
Fields inherited from interface org.apache.hadoop.hbase.ExtendedCell
CELL_NOT_BASED_ON_CHUNK
Fields inherited from interface org.apache.hadoop.hbase.RawCell
MAX_TAGS_LENGTH
-
Constructor Summary
ConstructorDescriptionByteBufferKeyValue
(ByteBuffer buf, int offset, int length) ByteBufferKeyValue
(ByteBuffer buf, int offset, int length, long seqId) -
Method Summary
Modifier and TypeMethodDescriptionprivate int
Does a deep copy of the contents to a new memory area and returns it as a new cell.boolean
Needed doing 'contains' on List.byte[]
Contiguous bytes composed of legal HDFS filename characters which may start at any index in the containing array.Returns TheByteBuffer
containing the column family bytes.byte
Returns Number of family bytes.(package private) byte
getFamilyLength
(int famLenPos) (package private) int
(package private) int
getFamilyLengthPosition
(int rowLength) int
Returns Array index of first family byteint
Returns Position in theByteBuffer
where column family bytes startint
getFamilyPosition
(int familyLengthPosition) (package private) int
int
byte[]
Contiguous raw bytes that may start at any index in the containing array.Returns TheByteBuffer
containing the column qualifier bytes.int
Returns Number of qualifier bytes.(package private) int
getQualifierLength
(int keyLength, int rlength, int flength) int
Returns Array index of first qualifier byteint
Returns Position in theByteBuffer
where column qualifier bytes start(package private) int
getQualifierPosition
(int familyPosition, int familyLength) byte[]
Contiguous raw bytes that may start at any index in the containing array.Returns TheByteBuffer
containing the row bytes.short
Returns Number of row bytes.int
Returns Array index of first row byteint
Returns Position in theByteBuffer
where row bytes startlong
A region-specific unique monotonically increasing sequence ID given to each Cell.int
Returns Serialized size (defaults to include tag length).int
getSerializedSize
(boolean withTags) KeyValue formatbyte[]
Contiguous raw bytes representing tags that may start at any index in the containing array.Returns TheByteBuffer
containing the tag bytes.int
HBase internally uses 2 bytes to store tags length in Cell.int
Returns the first offset where the tags start in the Cellint
Returns Position in theByteBuffer
where tag bytes startlong
Return a long value representing time at which this cell was "Put" into the row.(package private) long
getTimestamp
(int keyLength) private int
private int
getTimestampOffset
(int keyLen) byte
Returns The byte representation of the KeyValue.TYPE of this cell: one of Put, Delete, etc(package private) byte
getTypeByte
(int keyLen) byte[]
Contiguous raw bytes that may start at any index in the containing array.Returns TheByteBuffer
containing the value bytes.int
Returns Number of value bytes.int
Returns Array index of first value byteint
Returns Position in theByteBuffer
where value bytes startint
hashCode()
In line withequals(Object)
, only uses the key portion, not the value.long
heapSize()
Return the approximate 'exclusive deep size' of implementing object.void
setSequenceId
(long seqId) Sets with the given seqId.void
setTimestamp
(byte[] ts) Sets with the given timestamp.void
setTimestamp
(long ts) Sets with the given timestamp.toString()
int
write
(OutputStream out, boolean withTags) Write this cell to an OutputStream in aKeyValue
format.void
write
(ByteBuffer buf, int offset) Write this Cell into the given buf's offset in aKeyValue
format.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.hadoop.hbase.ExtendedCell
getChunkId
-
Field Details
-
buf
-
offset
-
length
-
seqId
-
FIXED_OVERHEAD
-
-
Constructor Details
-
ByteBufferKeyValue
-
ByteBufferKeyValue
-
-
Method Details
-
getBuffer
-
getOffset
-
getRowArray
Description copied from interface:Cell
Contiguous raw bytes that may start at any index in the containing array. Max length is Short.MAX_VALUE which is 32,767 bytes.- Returns:
- The array containing the row bytes.
-
getRowOffset
Description copied from interface:Cell
Returns Array index of first row byte -
getRowLength
Description copied from interface:Cell
Returns Number of row bytes. Must be < rowArray.length - offset. -
getFamilyArray
Description copied from interface:Cell
Contiguous bytes composed of legal HDFS filename characters which may start at any index in the containing array. Max length is Byte.MAX_VALUE, which is 127 bytes.- Returns:
- the array containing the family bytes.
-
getFamilyOffset
Description copied from interface:Cell
Returns Array index of first family byte -
getFamilyLength
Description copied from interface:Cell
Returns Number of family bytes. Must be < familyArray.length - offset. -
getFamilyLengthPosition
int getFamilyLengthPosition() -
getFamilyLengthPosition
-
getFamilyLength
-
getQualifierArray
Description copied from interface:Cell
Contiguous raw bytes that may start at any index in the containing array.- Returns:
- The array containing the qualifier bytes.
-
getQualifierOffset
Description copied from interface:Cell
Returns Array index of first qualifier byte -
getQualifierLength
Description copied from interface:Cell
Returns Number of qualifier bytes. Must be < qualifierArray.length - offset. -
getQualifierLength
-
getTimestamp
Description copied from interface:Cell
Return a long value representing time at which this cell was "Put" into the row. Typically represents the time of insertion, but can be any value from 0 to Long.MAX_VALUE. -
getTimestamp
-
getKeyLength
int getKeyLength() -
getTimestampOffset
-
getTypeByte
Description copied from interface:ExtendedCell
Returns The byte representation of the KeyValue.TYPE of this cell: one of Put, Delete, etc -
getTypeByte
-
getSequenceId
Description copied from interface:ExtendedCell
A region-specific unique monotonically increasing sequence ID given to each Cell. It always exists for cells in the memstore but is not retained forever. It will be kept forHConstants.KEEP_SEQID_PERIOD
days, but generally becomes irrelevant after the cell's row is no longer involved in any operations that require strict consistency.- Returns:
- seqId (always > 0 if exists), or 0 if it no longer exists
-
setSequenceId
Description copied from interface:ExtendedCell
Sets with the given seqId.- Parameters:
seqId
- sequence ID
-
getValueArray
Description copied from interface:Cell
Contiguous raw bytes that may start at any index in the containing array. Max length is Integer.MAX_VALUE which is 2,147,483,647 bytes.- Returns:
- The array containing the value bytes.
-
getValueOffset
Description copied from interface:Cell
Returns Array index of first value byte -
getValueLength
Description copied from interface:Cell
Returns Number of value bytes. Must be < valueArray.length - offset. -
getTagsArray
Description copied from interface:ExtendedCell
Contiguous raw bytes representing tags that may start at any index in the containing array.- Returns:
- the tags byte array
-
getTagsOffset
Description copied from interface:ExtendedCell
Returns the first offset where the tags start in the Cell -
getTagsLength
Description copied from interface:ExtendedCell
HBase internally uses 2 bytes to store tags length in Cell. As the tags length is always a non-negative number, to make good use of the sign bit, the max of tags length is defined 2 * Short.MAX_VALUE + 1 = 65535. As a result, the return type is int, because a short is not capable of handling that. Please note that even if the return type is int, the max tags length is far less than Integer.MAX_VALUE.- Returns:
- the total length of the tags in the Cell.
-
getRowByteBuffer
Description copied from class:ByteBufferExtendedCell
Returns TheByteBuffer
containing the row bytes.- Specified by:
getRowByteBuffer
in classByteBufferExtendedCell
-
getRowPosition
Description copied from class:ByteBufferExtendedCell
Returns Position in theByteBuffer
where row bytes start- Specified by:
getRowPosition
in classByteBufferExtendedCell
-
getFamilyByteBuffer
Description copied from class:ByteBufferExtendedCell
Returns TheByteBuffer
containing the column family bytes.- Specified by:
getFamilyByteBuffer
in classByteBufferExtendedCell
-
getFamilyPosition
Description copied from class:ByteBufferExtendedCell
Returns Position in theByteBuffer
where column family bytes start- Specified by:
getFamilyPosition
in classByteBufferExtendedCell
-
getFamilyPosition
-
getQualifierByteBuffer
Description copied from class:ByteBufferExtendedCell
Returns TheByteBuffer
containing the column qualifier bytes.- Specified by:
getQualifierByteBuffer
in classByteBufferExtendedCell
-
getQualifierPosition
Description copied from class:ByteBufferExtendedCell
Returns Position in theByteBuffer
where column qualifier bytes start- Specified by:
getQualifierPosition
in classByteBufferExtendedCell
-
getQualifierPosition
-
getValueByteBuffer
Description copied from class:ByteBufferExtendedCell
Returns TheByteBuffer
containing the value bytes.- Specified by:
getValueByteBuffer
in classByteBufferExtendedCell
-
getValuePosition
Description copied from class:ByteBufferExtendedCell
Returns Position in theByteBuffer
where value bytes start- Specified by:
getValuePosition
in classByteBufferExtendedCell
-
getTagsByteBuffer
Description copied from class:ByteBufferExtendedCell
Returns TheByteBuffer
containing the tag bytes.- Specified by:
getTagsByteBuffer
in classByteBufferExtendedCell
-
getTagsPosition
Description copied from class:ByteBufferExtendedCell
Returns Position in theByteBuffer
where tag bytes start- Specified by:
getTagsPosition
in classByteBufferExtendedCell
-
heapSize
Description copied from interface:HeapSize
Return the approximate 'exclusive deep size' of implementing object. Includes count of payload and hosting object sizings. -
write
Description copied from interface:ExtendedCell
Write this cell to an OutputStream in aKeyValue
format.
KeyValue format
<4 bytes keylength> <4 bytes valuelength> <2 bytes rowlength> <row> <1 byte columnfamilylength> <columnfamily> <columnqualifier> <8 bytes timestamp> <1 byte keytype> <value> <2 bytes tagslength> <tags>
- Parameters:
out
- Stream to which cell has to be writtenwithTags
- Whether to write tags.- Returns:
- how many bytes are written.
- Throws:
IOException
-
getSerializedSize
Description copied from interface:ExtendedCell
KeyValue format<4 bytes keylength> <4 bytes valuelength> <2 bytes rowlength> <row> <1 byte columnfamilylength> <columnfamily> <columnqualifier> <8 bytes timestamp> <1 byte keytype> <value> <2 bytes tagslength> <tags>
- Parameters:
withTags
- Whether to write tags.- Returns:
- Bytes count required to serialize this Cell in a
KeyValue
format.
-
getSerializedSize
Description copied from interface:ExtendedCell
Returns Serialized size (defaults to include tag length). -
write
Description copied from interface:ExtendedCell
Write this Cell into the given buf's offset in aKeyValue
format.- Parameters:
buf
- The buffer where to write the Cell.offset
- The offset within buffer, to write the Cell.
-
toString
-
setTimestamp
Description copied from interface:ExtendedCell
Sets with the given timestamp.- Parameters:
ts
- timestamp- Throws:
IOException
-
getTimestampOffset
-
setTimestamp
Description copied from interface:ExtendedCell
Sets with the given timestamp.- Parameters:
ts
- buffer containing the timestamp value- Throws:
IOException
-
deepClone
Description copied from interface:ExtendedCell
Does a deep copy of the contents to a new memory area and returns it as a new cell.- Returns:
- The deep cloned cell
-
equals
Needed doing 'contains' on List. Only compares the key portion, not the value. -
hashCode
In line withequals(Object)
, only uses the key portion, not the value. -
calculateHashForKey
-