Package org.apache.hadoop.hbase
Class ByteBufferKeyOnlyKeyValue
java.lang.Object
org.apache.hadoop.hbase.ByteBufferExtendedCell
org.apache.hadoop.hbase.ByteBufferKeyOnlyKeyValue
- All Implemented Interfaces:
Cell,ExtendedCell,HeapSize,RawCell
This is a key only Cell implementation which is identical to
KeyValue.KeyOnlyKeyValue
with respect to key serialization but have its data in the form of Byte buffer (onheap and
offheap).-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ByteBufferstatic final intprivate intprivate intprivate shortFields inherited from interface org.apache.hadoop.hbase.ExtendedCell
CELL_NOT_BASED_ON_CHUNKFields inherited from interface org.apache.hadoop.hbase.RawCell
MAX_TAGS_LENGTH -
Constructor Summary
ConstructorsConstructorDescriptionUsed in cases where we want to avoid lot of garbage by allocating new objects with different keys.ByteBufferKeyOnlyKeyValue(ByteBuffer buf, int offset, int length) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Contiguous bytes composed of legal HDFS filename characters which may start at any index in the containing array.Returns TheByteBuffercontaining the column family bytes.byteReturns Number of family bytes.private bytegetFamilyLength(int famLenPos) private int(package private) intgetFamilyLengthPosition(int rowLength) intReturns Array index of first family byteintReturns Position in theByteBufferwhere column family bytes startbyte[]Contiguous raw bytes that may start at any index in the containing array.Returns TheByteBuffercontaining the column qualifier bytes.intReturns Number of qualifier bytes.private intgetQualifierLength(int rlength, int flength) intReturns Array index of first qualifier byteintReturns Position in theByteBufferwhere column qualifier bytes startbyte[]Contiguous raw bytes that may start at any index in the containing array.Returns TheByteBuffercontaining the row bytes.shortReturns Number of row bytes.intReturns Array index of first row byteintReturns Position in theByteBufferwhere row bytes startlongA region-specific unique monotonically increasing sequence ID given to each Cell.getTag(byte type) Returns the specific tag of the given typegetTags()Creates a list of tags in the current cellbyte[]Contiguous raw bytes representing tags that may start at any index in the containing array.Returns TheByteBuffercontaining the tag bytes.intHBase internally uses 2 bytes to store tags length in Cell.intReturns the first offset where the tags start in the CellintReturns Position in theByteBufferwhere tag bytes startlongReturn a long value representing time at which this cell was "Put" into the row.private intbyteReturns The byte representation of the KeyValue.TYPE of this cell: one of Put, Delete, etc(package private) bytegetTypeByte(int keyLen) byte[]Contiguous raw bytes that may start at any index in the containing array.Returns TheByteBuffercontaining the value bytes.intReturns Number of value bytes.intReturns Array index of first value byteintReturns Position in theByteBufferwhere value bytes startlongheapSize()Return the approximate 'exclusive deep size' of implementing object.voidsetKey(ByteBuffer key, int offset, int length) A setter that helps to avoid object creation every time and whenever there is a need to create new OffheapKeyOnlyKeyValue.voidsetKey(ByteBuffer key, int offset, int length, short rowLen) A setter that helps to avoid object creation every time and whenever there is a need to create new OffheapKeyOnlyKeyValue.voidsetSequenceId(long seqId) Sets with the given seqId.voidsetTimestamp(byte[] ts) Sets with the given timestamp.voidsetTimestamp(long ts) Sets with the given timestamp.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.ExtendedCell
deepClone, getChunkId, getSerializedSize, getSerializedSize, write, write
-
Field Details
-
FIXED_OVERHEAD
-
buf
-
offset
-
length
-
rowLen
-
-
Constructor Details
-
ByteBufferKeyOnlyKeyValue
public ByteBufferKeyOnlyKeyValue()Used in cases where we want to avoid lot of garbage by allocating new objects with different keys. Use the emtpy construtor and set the keys usingsetKey(ByteBuffer, int, int) -
ByteBufferKeyOnlyKeyValue
-
-
Method Details
-
setKey
A setter that helps to avoid object creation every time and whenever there is a need to create new OffheapKeyOnlyKeyValue. -
setKey
A setter that helps to avoid object creation every time and whenever there is a need to create new OffheapKeyOnlyKeyValue.- Parameters:
key- - the key part of the celloffset- - offset of the celllength- - length of the cellrowLen- - the rowlen part of the cell
-
getRowArray
Description copied from interface:CellContiguous 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:CellReturns Array index of first row byte -
getRowLength
Description copied from interface:CellReturns Number of row bytes. Must be < rowArray.length - offset. -
getFamilyArray
Description copied from interface:CellContiguous 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:CellReturns Array index of first family byte -
getFamilyLength
Description copied from interface:CellReturns Number of family bytes. Must be < familyArray.length - offset. -
getFamilyLength
-
getQualifierArray
Description copied from interface:CellContiguous raw bytes that may start at any index in the containing array.- Returns:
- The array containing the qualifier bytes.
-
getQualifierOffset
Description copied from interface:CellReturns Array index of first qualifier byte -
getQualifierLength
Description copied from interface:CellReturns Number of qualifier bytes. Must be < qualifierArray.length - offset. -
getQualifierLength
-
getTimestamp
Description copied from interface:CellReturn 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. -
getTimestampOffset
-
getTypeByte
Description copied from interface:ExtendedCellReturns The byte representation of the KeyValue.TYPE of this cell: one of Put, Delete, etc -
getTypeByte
-
setSequenceId
Description copied from interface:ExtendedCellSets with the given seqId.- Parameters:
seqId- sequence ID- Throws:
IOException
-
setTimestamp
Description copied from interface:ExtendedCellSets with the given timestamp.- Parameters:
ts- timestamp- Throws:
IOException
-
setTimestamp
Description copied from interface:ExtendedCellSets with the given timestamp.- Parameters:
ts- buffer containing the timestamp value- Throws:
IOException
-
getSequenceId
Description copied from interface:ExtendedCellA 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_PERIODdays, 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
-
getValueArray
Description copied from interface:CellContiguous 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:CellReturns Array index of first value byte -
getValueLength
Description copied from interface:CellReturns Number of value bytes. Must be < valueArray.length - offset. -
getTagsArray
Description copied from interface:ExtendedCellContiguous raw bytes representing tags that may start at any index in the containing array.- Returns:
- the tags byte array
-
getTagsOffset
Description copied from interface:ExtendedCellReturns the first offset where the tags start in the Cell -
getTagsLength
Description copied from interface:ExtendedCellHBase 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:ByteBufferExtendedCellReturns TheByteBuffercontaining the row bytes.- Specified by:
getRowByteBufferin classByteBufferExtendedCell
-
getRowPosition
Description copied from class:ByteBufferExtendedCellReturns Position in theByteBufferwhere row bytes start- Specified by:
getRowPositionin classByteBufferExtendedCell
-
getFamilyByteBuffer
Description copied from class:ByteBufferExtendedCellReturns TheByteBuffercontaining the column family bytes.- Specified by:
getFamilyByteBufferin classByteBufferExtendedCell
-
getFamilyPosition
Description copied from class:ByteBufferExtendedCellReturns Position in theByteBufferwhere column family bytes start- Specified by:
getFamilyPositionin classByteBufferExtendedCell
-
getFamilyLengthPosition
-
getFamilyLengthPosition
-
getQualifierByteBuffer
Description copied from class:ByteBufferExtendedCellReturns TheByteBuffercontaining the column qualifier bytes.- Specified by:
getQualifierByteBufferin classByteBufferExtendedCell
-
getQualifierPosition
Description copied from class:ByteBufferExtendedCellReturns Position in theByteBufferwhere column qualifier bytes start- Specified by:
getQualifierPositionin classByteBufferExtendedCell
-
getValueByteBuffer
Description copied from class:ByteBufferExtendedCellReturns TheByteBuffercontaining the value bytes.- Specified by:
getValueByteBufferin classByteBufferExtendedCell
-
getValuePosition
Description copied from class:ByteBufferExtendedCellReturns Position in theByteBufferwhere value bytes start- Specified by:
getValuePositionin classByteBufferExtendedCell
-
getTagsByteBuffer
Description copied from class:ByteBufferExtendedCellReturns TheByteBuffercontaining the tag bytes.- Specified by:
getTagsByteBufferin classByteBufferExtendedCell
-
getTagsPosition
Description copied from class:ByteBufferExtendedCellReturns Position in theByteBufferwhere tag bytes start- Specified by:
getTagsPositionin classByteBufferExtendedCell
-
toString
-
getTags
Description copied from interface:RawCellCreates a list of tags in the current cell- Returns:
- a list of tags
-
getTag
Description copied from interface:RawCellReturns the specific tag of the given type- Parameters:
type- the type of the tag- Returns:
- the specific tag if available or null
-
heapSize
Description copied from interface:HeapSizeReturn the approximate 'exclusive deep size' of implementing object. Includes count of payload and hosting object sizings.
-