@InterfaceAudience.Private public class ByteBufferKeyOnlyKeyValue extends ByteBufferExtendedCell
KeyValue.KeyOnlyKeyValue
with respect to key serialization but have its data in the form of Byte buffer (onheap and
offheap).Modifier and Type | Field and Description |
---|---|
private ByteBuffer |
buf |
static int |
FIXED_OVERHEAD |
private int |
length |
private int |
offset |
private short |
rowLen |
CELL_NOT_BASED_ON_CHUNK
MAX_TAGS_LENGTH
Constructor and Description |
---|
ByteBufferKeyOnlyKeyValue()
Used in cases where we want to avoid lot of garbage by allocating new objects with different
keys.
|
ByteBufferKeyOnlyKeyValue(ByteBuffer buf,
int offset,
int length) |
Modifier and Type | Method and Description |
---|---|
byte[] |
getFamilyArray()
Contiguous bytes composed of legal HDFS filename characters which may start at any index in the
containing array.
|
ByteBuffer |
getFamilyByteBuffer()
Returns The
ByteBuffer containing the column family bytes. |
byte |
getFamilyLength()
Returns Number of family bytes.
|
private byte |
getFamilyLength(int famLenPos) |
private int |
getFamilyLengthPosition() |
(package private) int |
getFamilyLengthPosition(int rowLength) |
int |
getFamilyOffset()
Returns Array index of first family byte
|
int |
getFamilyPosition()
Returns Position in the
ByteBuffer where column family bytes start |
byte[] |
getQualifierArray()
Contiguous raw bytes that may start at any index in the containing array.
|
ByteBuffer |
getQualifierByteBuffer()
Returns The
ByteBuffer containing the column qualifier bytes. |
int |
getQualifierLength()
Returns Number of qualifier bytes.
|
private int |
getQualifierLength(int rlength,
int flength) |
int |
getQualifierOffset()
Returns Array index of first qualifier byte
|
int |
getQualifierPosition()
Returns Position in the
ByteBuffer where column qualifier bytes start |
byte[] |
getRowArray()
Contiguous raw bytes that may start at any index in the containing array.
|
ByteBuffer |
getRowByteBuffer()
Returns The
ByteBuffer containing the row bytes. |
short |
getRowLength()
Returns Number of row bytes.
|
int |
getRowOffset()
Returns Array index of first row byte
|
int |
getRowPosition()
Returns Position in the
ByteBuffer where row bytes start |
long |
getSequenceId()
A region-specific unique monotonically increasing sequence ID given to each Cell.
|
Optional<Tag> |
getTag(byte type)
Returns the specific tag of the given type
|
Iterator<Tag> |
getTags()
Creates a list of tags in the current cell
|
byte[] |
getTagsArray()
Contiguous raw bytes representing tags that may start at any index in the containing array.
|
ByteBuffer |
getTagsByteBuffer()
Returns The
ByteBuffer containing the tag bytes. |
int |
getTagsLength()
HBase internally uses 2 bytes to store tags length in Cell.
|
int |
getTagsOffset()
Returns the first offset where the tags start in the Cell
|
int |
getTagsPosition()
Returns Position in the
ByteBuffer where tag bytes start |
long |
getTimestamp()
Return a long value representing time at which this cell was "Put" into the row.
|
private int |
getTimestampOffset() |
byte |
getTypeByte()
Returns The byte representation of the KeyValue.TYPE of this cell: one of Put, Delete, etc
|
(package private) byte |
getTypeByte(int keyLen) |
byte[] |
getValueArray()
Contiguous raw bytes that may start at any index in the containing array.
|
ByteBuffer |
getValueByteBuffer()
Returns The
ByteBuffer containing the value bytes. |
int |
getValueLength()
Returns Number of value bytes.
|
int |
getValueOffset()
Returns Array index of first value byte
|
int |
getValuePosition()
Returns Position in the
ByteBuffer where value bytes start |
long |
heapSize()
Return the approximate 'exclusive deep size' of implementing object.
|
void |
setKey(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.
|
void |
setKey(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.
|
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.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
deepClone, getChunkId, getSerializedSize, getSerializedSize, write, write
checkForTagsLength, cloneTags, createCell
public static final int FIXED_OVERHEAD
private ByteBuffer buf
private int offset
private int length
private short rowLen
public ByteBufferKeyOnlyKeyValue()
setKey(ByteBuffer, int, int)
public ByteBufferKeyOnlyKeyValue(ByteBuffer buf, int offset, int length)
public void setKey(ByteBuffer key, int offset, int length)
public void setKey(ByteBuffer key, int offset, int length, short rowLen)
key
- - the key part of the celloffset
- - offset of the celllength
- - length of the cellrowLen
- - the rowlen part of the cellpublic byte[] getRowArray()
Cell
public int getRowOffset()
Cell
public short getRowLength()
Cell
public byte[] getFamilyArray()
Cell
public int getFamilyOffset()
Cell
public byte getFamilyLength()
Cell
private byte getFamilyLength(int famLenPos)
public byte[] getQualifierArray()
Cell
public int getQualifierOffset()
Cell
public int getQualifierLength()
Cell
private int getQualifierLength(int rlength, int flength)
public long getTimestamp()
Cell
private int getTimestampOffset()
public byte getTypeByte()
ExtendedCell
byte getTypeByte(int keyLen)
public void setSequenceId(long seqId) throws IOException
ExtendedCell
seqId
- sequence IDIOException
public void setTimestamp(long ts) throws IOException
ExtendedCell
ts
- timestampIOException
public void setTimestamp(byte[] ts) throws IOException
ExtendedCell
ts
- buffer containing the timestamp valueIOException
public long getSequenceId()
ExtendedCell
HConstants.KEEP_SEQID_PERIOD
days, but generally becomes irrelevant after the cell's
row is no longer involved in any operations that require strict consistency.public byte[] getValueArray()
Cell
public int getValueOffset()
Cell
public int getValueLength()
Cell
public byte[] getTagsArray()
ExtendedCell
public int getTagsOffset()
ExtendedCell
public int getTagsLength()
ExtendedCell
public ByteBuffer getRowByteBuffer()
ByteBufferExtendedCell
ByteBuffer
containing the row bytes.getRowByteBuffer
in class ByteBufferExtendedCell
public int getRowPosition()
ByteBufferExtendedCell
ByteBuffer
where row bytes startgetRowPosition
in class ByteBufferExtendedCell
public ByteBuffer getFamilyByteBuffer()
ByteBufferExtendedCell
ByteBuffer
containing the column family bytes.getFamilyByteBuffer
in class ByteBufferExtendedCell
public int getFamilyPosition()
ByteBufferExtendedCell
ByteBuffer
where column family bytes startgetFamilyPosition
in class ByteBufferExtendedCell
private int getFamilyLengthPosition()
int getFamilyLengthPosition(int rowLength)
public ByteBuffer getQualifierByteBuffer()
ByteBufferExtendedCell
ByteBuffer
containing the column qualifier bytes.getQualifierByteBuffer
in class ByteBufferExtendedCell
public int getQualifierPosition()
ByteBufferExtendedCell
ByteBuffer
where column qualifier bytes startgetQualifierPosition
in class ByteBufferExtendedCell
public ByteBuffer getValueByteBuffer()
ByteBufferExtendedCell
ByteBuffer
containing the value bytes.getValueByteBuffer
in class ByteBufferExtendedCell
public int getValuePosition()
ByteBufferExtendedCell
ByteBuffer
where value bytes startgetValuePosition
in class ByteBufferExtendedCell
public ByteBuffer getTagsByteBuffer()
ByteBufferExtendedCell
ByteBuffer
containing the tag bytes.getTagsByteBuffer
in class ByteBufferExtendedCell
public int getTagsPosition()
ByteBufferExtendedCell
ByteBuffer
where tag bytes startgetTagsPosition
in class ByteBufferExtendedCell
public Iterator<Tag> getTags()
RawCell
public Optional<Tag> getTag(byte type)
RawCell
type
- the type of the tagCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.