@Override public XaCommand readCommand(ReadableByteChannel byteChannel, ByteBuffer buffer) throws IOException { short dataSize = IoPrimitiveUtils.readShort(byteChannel, buffer); IoPrimitiveUtils.readBytes(byteChannel, new byte[dataSize]); return new FixedSizeXaCommand(dataSize); }
/** * See {@link Index#add(PropertyContainer, String, Object)} for more generic documentation. * * <p>Adds key/value to the {@code entity} in this index. Added values are searchable within the * transaction, but composite {@code AND} queries aren't guaranteed to return added values * correctly within that transaction. When the transaction has been committed all such queries are * guaranteed to return correct results. * * @param key the key in the key/value pair to associate with the entity. * @param value the value in the key/value pair to associate with the entity. */ @Override public void addNode(long entityId, String key, Object value) { assertValidKey(key); for (Object oneValue : IoPrimitiveUtils.asArray(value)) { oneValue = getCorrectValue(oneValue); transaction.add(this, entityId, key, oneValue); commandFactory.addNode(identifier.indexName, entityId, key, oneValue); } }
/** * See {@link Index#remove(PropertyContainer, String, Object)} for more generic documentation. * * <p>Removes key/value to the {@code entity} in this index. Removed values are excluded within * the transaction, but composite {@code AND} queries aren't guaranteed to exclude removed values * correctly within that transaction. When the transaction has been committed all such queries are * guaranteed to return correct results. * * @param entity the entity (i.e {@link Node} or {@link Relationship}) to dissociate the key/value * pair from. * @param key the key in the key/value pair to dissociate from the entity. * @param value the value in the key/value pair to dissociate from the entity. */ @Override public void remove(long entity, String key, Object value) { assertValidKey(key); for (Object oneValue : IoPrimitiveUtils.asArray(value)) { oneValue = getCorrectValue(oneValue); transaction.remove(this, entity, key, oneValue); addRemoveCommand(entity, key, oneValue); } }
@Override public void addRelationship( long entity, String key, Object value, long startNode, long endNode) { assertValidKey(key); for (Object oneValue : IoPrimitiveUtils.asArray(value)) { oneValue = getCorrectValue(oneValue); transaction.add(this, RelationshipId.of(entity, startNode, endNode), key, oneValue); commandFactory.addRelationship( identifier.indexName, entity, key, oneValue, startNode, endNode); } }