String hexKey = "008C1DB3BD5A3C10";
byte[] byteArr = BaseEncoding.base16().decode(hexKey);
StaticArrayBuffer buff = new StaticArrayBuffer(byteArr,0,hexKey.length());
// The code from titan with some simplifications
long partitionBits = 6;
long normalVertexOffset = 3l;
long TOTAL_BITS = Long.SIZE - 1;
long value = b.getLong(0);
long partitionOffset = Long.Size - partitionBits;
IDManager.VertexIDType type = IDManager.VertexIDType.NormalVertex;
long partition = partitionOffset < Long.SIZE ? value >>> partitionOffset : 0;
long USERVERTEX_PADDING_BITWIDTH = normalVertexOffset;
long count = ( value >>> USERVERTEX_PADDING_BITWIDTH & ((1l <<(partitionOffset - USERVERTEX_PADDING_BITWIDTH )) -1 );
long partitionIDBound = (1l << (partitionBits));
long id = (count << partitionBits) + partition;
if(type != null) id = type.addPadding(id);
System.out.println("Key is " + id);
1条答案
按热度按时间ffvjumwh1#
用于转换的函数
HBase
键列到Titan
顶点id为getKey
在班级下面IDManager
(在泰坦核心)。这是取出后的密码。它只适用于法线顶点。