本文整理了Java中org.apache.hadoop.hbase.KeyValue.getSequenceId()
方法的一些代码示例,展示了KeyValue.getSequenceId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyValue.getSequenceId()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.KeyValue
类名称:KeyValue
方法名:getSequenceId
[英]used to achieve atomic operations in the memstore.
[中]用于在memstore中实现原子操作。
代码示例来源:origin: apache/hbase
@Override
public long getSequenceId() {
return this.kv.getSequenceId();
}
代码示例来源:origin: apache/hbase
public static int lengthWithMvccVersion(final KeyValue kv, final boolean includeMvccVersion) {
int length = kv.getLength();
if (includeMvccVersion) {
length += WritableUtils.getVIntSize(kv.getSequenceId());
}
return length;
}
代码示例来源:origin: apache/hbase
/**
* @param cell
* @return <code>cell</code> if it is an object of class {@link KeyValue} else we will return a
* new {@link KeyValue} instance made from <code>cell</code> Note: Even if the cell is an
* object of any of the subclass of {@link KeyValue}, we will create a new
* {@link KeyValue} object wrapping same buffer. This API is used only with MR based tools
* which expect the type to be exactly KeyValue. That is the reason for doing this way.
* @deprecated without any replacement.
*/
@Deprecated
public static KeyValue ensureKeyValue(final Cell cell) {
if (cell == null) return null;
if (cell instanceof KeyValue) {
if (cell.getClass().getName().equals(KeyValue.class.getName())) {
return (KeyValue) cell;
}
// Cell is an Object of any of the sub classes of KeyValue. Make a new KeyValue wrapping the
// same byte[]
KeyValue kv = (KeyValue) cell;
KeyValue newKv = new KeyValue(kv.bytes, kv.offset, kv.length);
newKv.setSequenceId(kv.getSequenceId());
return newKv;
}
return copyToNewKeyValue(cell);
}
代码示例来源:origin: apache/hbase
public static void appendToByteBuffer(final ByteBuffer bb, final KeyValue kv,
final boolean includeMvccVersion) {
// keep pushing the limit out. assume enough capacity
bb.limit(bb.position() + kv.getLength());
bb.put(kv.getBuffer(), kv.getOffset(), kv.getLength());
if (includeMvccVersion) {
int numMvccVersionBytes = WritableUtils.getVIntSize(kv.getSequenceId());
ByteBufferUtils.extendLimit(bb, numMvccVersionBytes);
ByteBufferUtils.writeVLong(bb, kv.getSequenceId());
}
}
代码示例来源:origin: apache/hbase
@Override
public ExtendedCell deepClone() {
byte[] copy = Bytes.copy(this.bytes, this.offset, this.length);
KeyValue kv = new KeyValue(copy, 0, copy.length);
kv.setSequenceId(this.getSequenceId());
return kv;
}
}
代码示例来源:origin: apache/hbase
/**
* Convert list of KeyValues to byte buffer.
* @param keyValues list of KeyValues to be converted.
* @return buffer with content from key values
*/
public static ByteBuffer convertKvToByteBuffer(List<KeyValue> keyValues,
boolean includesMemstoreTS) {
int totalSize = 0;
for (KeyValue kv : keyValues) {
totalSize += kv.getLength();
if (includesMemstoreTS) {
totalSize += WritableUtils.getVIntSize(kv.getSequenceId());
}
}
ByteBuffer result = ByteBuffer.allocate(totalSize);
for (KeyValue kv : keyValues) {
result.put(kv.getBuffer(), kv.getOffset(), kv.getLength());
if (includesMemstoreTS) {
ByteBufferUtils.writeVLong(result, kv.getSequenceId());
}
}
return result;
}
代码示例来源:origin: apache/hbase
kv.getTagsLength(), kv1.getTagsArray(), kv1.getTagsOffset(),
kv1.getTagsLength()));
Assert.assertEquals(kv1.getSequenceId(), kv.getSequenceId());
代码示例来源:origin: apache/hbase
new DataOutputStream(uncompressedOutputStream), currentKV.getSequenceId());
代码示例来源:origin: apache/hbase
kv1.getQualifierOffset() - KeyValue.ROW_OFFSET, kv1.getQualifierLength(),
kv1.getTimestamp(), kv1.getTypeByte(), kv1.getValueArray(), kv1.getValueOffset(),
kv1.getValueLength(), kv1.getSequenceId(), kv1.getTagsArray(), kv1.getTagsOffset(),
kv1.getTagsLength());
KeyValue kv2 = new KeyValue(Bytes.toBytes("r2"), Bytes.toBytes("f"), Bytes.toBytes("2"),
kv2.getQualifierOffset() - KeyValue.ROW_OFFSET, kv2.getQualifierLength(),
kv2.getTimestamp(), kv2.getTypeByte(), kv2.getValueArray(), kv2.getValueOffset(),
kv2.getValueLength(), kv2.getSequenceId(), kv2.getTagsArray(), kv2.getTagsOffset(),
kv2.getTagsLength());
KeyValue kv3 = new KeyValue(Bytes.toBytes("r3"), Bytes.toBytes("cf"), Bytes.toBytes("qual"),
kv2.getQualifierOffset() - KeyValue.ROW_OFFSET, kv2.getQualifierLength(),
kv2.getTimestamp(), kv2.getTypeByte(), ByteBuffer.wrap(kv2.getValueArray()),
kv2.getValueOffset(), kv2.getValueLength(), kv2.getSequenceId(),
ByteBuffer.wrap(kv2.getTagsArray()), kv2.getTagsOffset(), kv2.getTagsLength());
ByteArrayOutputStream os = new ByteArrayOutputStream();
代码示例来源:origin: apache/hbase
static void writeCell(PositionedByteRange pbr, KeyValue kv) throws Exception {
pbr.putInt(kv.getKeyLength());
pbr.putInt(kv.getValueLength());
pbr.put(kv.getBuffer(), kv.getKeyOffset(), kv.getKeyLength());
pbr.put(kv.getBuffer(), kv.getValueOffset(), kv.getValueLength());
int tagsLen = kv.getTagsLength();
pbr.put((byte) (tagsLen >> 8 & 0xff));
pbr.put((byte) (tagsLen & 0xff));
pbr.put(kv.getTagsArray(), kv.getTagsOffset(), tagsLen);
pbr.putVLong(kv.getSequenceId());
}
代码示例来源:origin: com.aliyun.hbase/alihbase-common
/**
* used to achieve atomic operations in the memstore.
*/
@Override
public long getSequenceId() {
return this.kv.getSequenceId();
}
代码示例来源:origin: com.aliyun.hbase/alihbase-common
@Override
public long getSequenceId() {
return this.kv.getSequenceId();
}
代码示例来源:origin: com.aliyun.hbase/alihbase-common
public static int lengthWithMvccVersion(final KeyValue kv, final boolean includeMvccVersion) {
int length = kv.getLength();
if (includeMvccVersion) {
length += WritableUtils.getVIntSize(kv.getSequenceId());
}
return length;
}
代码示例来源:origin: org.apache.hbase/hbase-common
public static int lengthWithMvccVersion(final KeyValue kv, final boolean includeMvccVersion) {
int length = kv.getLength();
if (includeMvccVersion) {
length += WritableUtils.getVIntSize(kv.getSequenceId());
}
return length;
}
代码示例来源:origin: org.apache.hbase/hbase-common
public static void appendToByteBuffer(final ByteBuffer bb, final KeyValue kv,
final boolean includeMvccVersion) {
// keep pushing the limit out. assume enough capacity
bb.limit(bb.position() + kv.getLength());
bb.put(kv.getBuffer(), kv.getOffset(), kv.getLength());
if (includeMvccVersion) {
int numMvccVersionBytes = WritableUtils.getVIntSize(kv.getSequenceId());
ByteBufferUtils.extendLimit(bb, numMvccVersionBytes);
ByteBufferUtils.writeVLong(bb, kv.getSequenceId());
}
}
代码示例来源:origin: com.aliyun.hbase/alihbase-common
public static void appendToByteBuffer(final ByteBuffer bb, final KeyValue kv,
final boolean includeMvccVersion) {
// keep pushing the limit out. assume enough capacity
bb.limit(bb.position() + kv.getLength());
bb.put(kv.getBuffer(), kv.getOffset(), kv.getLength());
if (includeMvccVersion) {
int numMvccVersionBytes = WritableUtils.getVIntSize(kv.getSequenceId());
ByteBufferUtils.extendLimit(bb, numMvccVersionBytes);
ByteBufferUtils.writeVLong(bb, kv.getSequenceId());
}
}
代码示例来源:origin: org.apache.hbase/hbase-common
@Override
public ExtendedCell deepClone() {
byte[] copy = Bytes.copy(this.bytes, this.offset, this.length);
KeyValue kv = new KeyValue(copy, 0, copy.length);
kv.setSequenceId(this.getSequenceId());
return kv;
}
}
代码示例来源:origin: com.aliyun.hbase/alihbase-common
@Override
public ExtendedCell deepClone() {
byte[] copy = Bytes.copy(this.bytes, this.offset, this.length);
KeyValue kv = new KeyValue(copy, 0, copy.length);
kv.setSequenceId(this.getSequenceId());
return kv;
}
}
代码示例来源:origin: com.aliyun.hbase/alihbase-common
static void writeCell(PositionedByteRange pbr, KeyValue kv) throws Exception {
pbr.putInt(kv.getKeyLength());
pbr.putInt(kv.getValueLength());
pbr.put(kv.getBuffer(), kv.getKeyOffset(), kv.getKeyLength());
pbr.put(kv.getBuffer(), kv.getValueOffset(), kv.getValueLength());
int tagsLen = kv.getTagsLength();
pbr.put((byte) (tagsLen >> 8 & 0xff));
pbr.put((byte) (tagsLen & 0xff));
pbr.put(kv.getTagsArray(), kv.getTagsOffset(), tagsLen);
pbr.putVLong(kv.getSequenceId());
}
代码示例来源:origin: org.apache.hbase/hbase-common
static void writeCell(PositionedByteRange pbr, KeyValue kv) throws Exception {
pbr.putInt(kv.getKeyLength());
pbr.putInt(kv.getValueLength());
pbr.put(kv.getBuffer(), kv.getKeyOffset(), kv.getKeyLength());
pbr.put(kv.getBuffer(), kv.getValueOffset(), kv.getValueLength());
int tagsLen = kv.getTagsLength();
pbr.put((byte) (tagsLen >> 8 & 0xff));
pbr.put((byte) (tagsLen & 0xff));
pbr.put(kv.getTagsArray(), kv.getTagsOffset(), tagsLen);
pbr.putVLong(kv.getSequenceId());
}
内容来源于网络,如有侵权,请联系作者删除!