use of org.neo4j.storageengine.api.RelationshipVisitor in project neo4j by neo4j.
the class NeoStoresTest method relDelete.
private void relDelete(long id) {
RelationshipVisitor<RuntimeException> visitor = (relId, type, startNode, endNode) -> transactionState.relationshipDoDelete(relId, type, startNode, endNode);
if (!transactionState.relationshipVisit(id, visitor)) {
try (StorageRelationshipScanCursor cursor = storageReader.allocateRelationshipScanCursor(NULL)) {
cursor.single(id);
if (!cursor.next()) {
throw new RuntimeException("Relationship " + id + " not found");
}
visitor.visit(id, cursor.type(), cursor.sourceNodeReference(), cursor.targetNodeReference());
}
}
}
use of org.neo4j.storageengine.api.RelationshipVisitor in project neo4j by neo4j.
the class RelationshipModifications method idsAsBatch.
static RelationshipBatch idsAsBatch(LongSet ids, IdDataDecorator idDataDecorator) {
return new RelationshipBatch() {
@Override
public int size() {
return ids.size();
}
@Override
public boolean isEmpty() {
return ids.isEmpty();
}
@Override
public boolean contains(long id) {
return ids.contains(id);
}
@Override
public long first() {
return ids.longIterator().next();
}
@Override
public <E extends Exception> void forEach(RelationshipVisitor<E> relationship) throws E {
LongIterator iterator = ids.longIterator();
while (iterator.hasNext()) {
long id = iterator.next();
idDataDecorator.accept(id, relationship);
}
}
};
}
Aggregations