Exemplo n.º 1
0
 private static void writeAttribute(DataOutput out, TitanProperty property) {
   Object attribute = property.getAttribute();
   TitanKey key = (TitanKey) property.getType();
   assert attribute != null;
   assert key.getDataType().isInstance(attribute);
   if (hasGenericDataType(key)) {
     out.writeClassAndObject(attribute);
   } else {
     out.writeObjectNotNull(attribute);
   }
 }
Exemplo n.º 2
0
 private void lockKeyedProperty(TitanProperty prop, StoreMutator mutator) throws StorageException {
   TitanKey pt = prop.getPropertyKey();
   assert pt.isSimple();
   if (pt.hasIndex() && pt.isUnique()) {
     if (prop.isNew()) {
       mutator.acquireIndexLock(getIndexKey(prop.getAttribute()), getKeyedIndexColumn(pt), null);
     } else {
       assert prop.isRemoved();
       mutator.acquireIndexLock(
           getIndexKey(prop.getAttribute()), getKeyedIndexColumn(pt), getIndexValue(prop));
     }
   }
 }
Exemplo n.º 3
0
 private void addIndexEntry(TitanProperty prop, StoreMutator mutator) throws StorageException {
   TitanKey pt = prop.getPropertyKey();
   assert pt.isSimple();
   if (pt.hasIndex()) {
     if (pt.isUnique()) {
       mutator.mutateIndex(
           getIndexKey(prop.getAttribute()),
           Lists.newArrayList(new Entry(getKeyedIndexColumn(pt), getIndexValue(prop))),
           null);
     } else {
       mutator.mutateIndex(
           getIndexKey(prop.getAttribute()),
           Lists.newArrayList(new Entry(getIndexColumn(pt, prop.getID()), getIndexValue(prop))),
           null);
     }
   }
 }
Exemplo n.º 4
0
 private ByteBuffer getIndexValue(TitanProperty prop) {
   assert prop.getType().isSimple();
   return VariableLong.positiveByteBuffer(prop.getVertex().getID());
 }