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); } }
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)); } } }
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); } } }
private ByteBuffer getIndexValue(TitanProperty prop) { assert prop.getType().isSimple(); return VariableLong.positiveByteBuffer(prop.getVertex().getID()); }