@Test public void shouldScanNodes() { // given List<Long> ids = new ArrayList<>(); try ( NodeCursor nodes = cursors.allocateNodeCursor() ) { // when read.allNodesScan( nodes ); while ( nodes.next() ) { ids.add( nodes.nodeReference() ); } } // then assertEquals( NODE_IDS, ids ); }
@Test public void shouldScanNodes() { // given List<Long> ids = new ArrayList<>(); try ( NodeCursor nodes = cursors.allocateNodeCursor() ) { // when read.allNodesScan( nodes ); while ( nodes.next() ) { ids.add( nodes.nodeReference() ); } } // then assertEquals( NODE_IDS, ids ); }
protected int countNodes( Transaction transaction ) { int result = 0; try ( NodeCursor cursor = transaction.cursors().allocateNodeCursor() ) { transaction.dataRead().allNodesScan( cursor ); while ( cursor.next() ) { result++; } } return result; }
ktx.dataRead().allNodesScan( cursor ); return new PrefetchingResourceIterator<Node>()
PropertyCursor propertyCursor = cursors.allocatePropertyCursor() ) dataRead.allNodesScan( nodeCursor ); while ( nodeCursor.next() )
@After public void clean() throws Exception { if ( transaction != null ) { transaction.close(); } newTransaction(); transaction.schemaWrite() .constraintDrop( ConstraintDescriptorFactory.uniqueForLabel( label, propertyIds() ) ); commit(); try ( Transaction tx = kernel.beginTransaction( Transaction.Type.implicit, LoginContext.AUTH_DISABLED ); NodeCursor node = tx.cursors().allocateNodeCursor() ) { tx.dataRead().allNodesScan( node ); while ( node.next() ) { tx.dataWrite().nodeDelete( node.nodeReference() ); } tx.success(); } }
private int[] loadNodes(int size, int relType, Direction direction) { final CursorFactory cursors = ktx.cursors(); try (NodeCursor node = cursors.allocateNodeCursor()) { // todo reuse array int[] offsets = new int[size]; Arrays.fill(offsets,-1); int offset = 0; int maxIdx = 0; ktx.dataRead().allNodesScan(node); while (node.next()) { int degree = DegreeUtil.degree(node, cursors, relType, direction); int idx = mapId(node.nodeReference()); // offsets[idx] = degree; offsets[idx] = offset; offset += degree; if (idx > maxIdx) maxIdx = idx; } return maxIdx < offsets.length -1 ? Arrays.copyOf(offsets,maxIdx+1) : offsets; } }
read.allNodesScan( node ); while ( node.next() )
int[] relTypes = relTypeId == ANY_RELATIONSHIP_TYPE ? null : new int[]{relTypeId}; if (labelId == ANY_LABEL) { read.allNodesScan(nodeCursor); while (nodeCursor.next()) { idx = loadRelsForNode(nodeCursor, idx, relTypes);
ktx.dataRead().allNodesScan( cursor ); return new PrefetchingResourceIterator<Node>()
public static void readNodes(CursorFactory cursors, Read dataRead, int labelId, LongConsumer action) { if (labelId == Read.ANY_LABEL) { try (NodeCursor nodeCursor = cursors.allocateNodeCursor()) { dataRead.allNodesScan(nodeCursor); while (nodeCursor.next()) { action.accept(nodeCursor.nodeReference()); } } } else { try (NodeLabelIndexCursor nodeCursor = cursors.allocateNodeLabelIndexCursor()) { dataRead.nodeLabelScan(labelId, nodeCursor); while (nodeCursor.next()) { action.accept(nodeCursor.nodeReference()); } } } }
public static void readNodes(CursorFactory cursors, Read dataRead, int labelId, LongConsumer action) { if (labelId == Read.ANY_LABEL) { try (NodeCursor nodeCursor = cursors.allocateNodeCursor()) { dataRead.allNodesScan(nodeCursor); while (nodeCursor.next()) { action.accept(nodeCursor.nodeReference()); } } } else { try (NodeLabelIndexCursor nodeCursor = cursors.allocateNodeLabelIndexCursor()) { dataRead.nodeLabelScan(labelId, nodeCursor); while (nodeCursor.next()) { action.accept(nodeCursor.nodeReference()); } } } }
PropertyCursor propertyCursor = cursors.allocatePropertyCursor() ) dataRead.allNodesScan( nodeCursor ); while ( nodeCursor.next() )