public class IDManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
IDManager.VertexIDType
bit mask- Description (+ indicates defined type, * indicates proper & defined type)
0 - + User created Vertex
000 - * Normal vertices
010 - * Partitioned vertices
100 - * Unmodifiable (e.g.
|
Modifier and Type | Field and Description |
---|---|
static long |
MAX_PADDING_BITWIDTH
The maximum number of padding bits of any type
|
static int |
PARTITIONED_VERTEX_PARTITION |
static int |
SCHEMA_PARTITION
Id of the partition that schema elements are assigned to
|
static int |
TYPE_LEN_RESERVE
Number of bits that need to be reserved from the type ids for storing additional information during serialization
|
static long |
USERVERTEX_PADDING_BITWIDTH
The padding bit width for user vertices
|
Constructor and Description |
---|
IDManager() |
IDManager(long partitionBits) |
Modifier and Type | Method and Description |
---|---|
static long |
addRelationTypePadding(long id) |
long |
fromVertexId(long id)
Converts a JanusGraph vertex id to the user provided id as the inverse mapping of
toVertexId(long) . |
long |
getCanonicalVertexId(long partitionedVertexId) |
StaticBuffer |
getKey(Object vertexId) |
Object |
getKeyID(StaticBuffer b)
Parse and get vertex ID from static buffer
Historically, JanusGraph only supports long-type ID, so the buffer was assumed to be 8-byte and represent
a long value.
|
long |
getPartitionBound() |
long |
getPartitionedVertexId(long partitionedVertexId,
long otherPartition) |
long[] |
getPartitionedVertexRepresentatives(long partitionedVertexId) |
long |
getPartitionHashForId(long id) |
long |
getPartitionId(long vertexId) |
long |
getRelationCountBound() |
long |
getRelationID(long count,
long partition) |
static long |
getSchemaCountBound() |
static long |
getSchemaId(IDManager.VertexIDType type,
long count) |
static long |
getTemporaryRelationID(long count) |
static long |
getTemporaryVertexID(IDManager.VertexIDType type,
long count) |
long |
getVertexCountBound() |
long |
getVertexID(long count,
long partition,
IDManager.VertexIDType vertexType) |
boolean |
isCanonicalVertexId(long partitionVertexId) |
boolean |
isEdgeLabelId(Object id) |
boolean |
isGenericSchemaVertexId(Object id) |
boolean |
isPartitionedVertex(Object id) |
boolean |
isPropertyKeyId(Object id) |
boolean |
isRelationTypeId(Object id) |
boolean |
isSchemaVertexId(Object id) |
static boolean |
isSystemRelationTypeId(Object id) |
static boolean |
isTemporary(long id) |
boolean |
isUnmodifiableVertex(Object id) |
boolean |
isUserVertexId(Object vertexId) |
boolean |
isVertexLabelVertexId(Object id) |
static long |
stripEntireRelationTypePadding(long id) |
static long |
stripRelationTypePadding(long id) |
long |
toVertexId(long id)
Converts a user provided long id into a JanusGraph vertex id.
|
public static final int SCHEMA_PARTITION
public static final int PARTITIONED_VERTEX_PARTITION
public static final int TYPE_LEN_RESERVE
public static final long USERVERTEX_PADDING_BITWIDTH
public static final long MAX_PADDING_BITWIDTH
public long getPartitionBound()
public final boolean isUserVertexId(Object vertexId)
public long getPartitionId(long vertexId)
public StaticBuffer getKey(Object vertexId)
public Object getKeyID(StaticBuffer b)
BufferUtil.getStringIdBuffer(String)
to encode it. Note that if
the marker + length of the ID is equivalent to 8 bytes, then we add a dummy padding byte at the
end to make it not equivalent to 8 bytes.
NOTE: due to design reason, the encoding scheme of long-type ID here is different
from IDHandler
. An important difference here is that the first bit of the
first byte for a long-type ID is not guaranteed to be zero (as opposed to the case in
IDHandler)). Therefore, we cannot rely on the first byte to check if it's long-type
or not. Luckily, we can use the "size == 8" trick to know if the buffer stores a long value,
because we know the entire buffer represents the ID only. While in IDHandler
, only
a (non-fixed) portion of the buffer represents the ID, so we use a different trick there.b
- public long getRelationID(long count, long partition)
public long getVertexID(long count, long partition, IDManager.VertexIDType vertexType)
public long getPartitionHashForId(long id)
public long getCanonicalVertexId(long partitionedVertexId)
public boolean isCanonicalVertexId(long partitionVertexId)
public long getPartitionedVertexId(long partitionedVertexId, long otherPartition)
public long[] getPartitionedVertexRepresentatives(long partitionedVertexId)
public long toVertexId(long id)
getVertexCountBound()
.
This method is useful when providing ids during vertex creation via Graph.addVertex(Object...)
.id
- long idfromVertexId(long)
public long fromVertexId(long id)
toVertexId(long)
.id
- JanusGraph vertex id (must be positive)toVertexId(long)
public boolean isPartitionedVertex(Object id)
public long getRelationCountBound()
public long getVertexCountBound()
public static long getTemporaryRelationID(long count)
public static long getTemporaryVertexID(IDManager.VertexIDType type, long count)
public static boolean isTemporary(long id)
public static long getSchemaId(IDManager.VertexIDType type, long count)
public static long stripEntireRelationTypePadding(long id)
public static long stripRelationTypePadding(long id)
public static long addRelationTypePadding(long id)
public static boolean isSystemRelationTypeId(Object id)
public static long getSchemaCountBound()
public final boolean isSchemaVertexId(Object id)
public final boolean isRelationTypeId(Object id)
public final boolean isEdgeLabelId(Object id)
public final boolean isPropertyKeyId(Object id)
public boolean isGenericSchemaVertexId(Object id)
public boolean isVertexLabelVertexId(Object id)
public boolean isUnmodifiableVertex(Object id)
Copyright © 2012–2024. All rights reserved.