@Override protected StorageNodeCursor allocateCursor( StorageReader storageReader ) { return storageReader.allocateNodeCursor(); }
@Override protected StorageNodeCursor allocateCursor( StorageReader storageReader ) { return storageReader.allocateNodeCursor(); } };
public TransactionCountingStateVisitor( TxStateVisitor next, StorageReader storageReader, ReadableTransactionState txState, CountsRecordState counts ) { super( next ); this.storageReader = storageReader; this.txState = txState; this.counts = counts; this.nodeCursor = storageReader.allocateNodeCursor(); this.groupCursor = storageReader.allocateRelationshipGroupCursor(); }
@Override public DefaultNodeCursor allocateNodeCursor() { if ( nodeCursor == null ) { return trace( new DefaultNodeCursor( this, storageReader.allocateNodeCursor() ) ); } try { return nodeCursor; } finally { nodeCursor = null; } }
private StorageNodeCursor allocateNodeCursor( long nodeId ) { StorageNodeCursor nodeCursor = storageReader.allocateNodeCursor(); nodeCursor.single( nodeId ); return nodeCursor; }
private boolean nodeExists( long id ) { try ( StorageNodeCursor node = storageReader.allocateNodeCursor() ) { node.single( id ); return node.next(); } }
@SuppressWarnings( "unchecked" ) private StorageNodeCursor newCursor( long nodeId ) { StorageNodeCursor nodeCursor = storageReader.allocateNodeCursor(); nodeCursor.single( nodeId ); assertTrue( nodeCursor.next() ); return nodeCursor; }
private void takeSnapshot() try ( StorageNodeCursor node = store.allocateNodeCursor(); StoragePropertyCursor properties = store.allocatePropertyCursor(); StorageRelationshipScanCursor relationship = store.allocateRelationshipScanCursor() )
@Test public void processAllNodeProperties() throws Exception { CopyUpdateVisitor propertyUpdateVisitor = new CopyUpdateVisitor(); StoreViewNodeStoreScan storeViewNodeStoreScan = new StoreViewNodeStoreScan( new RecordStorageReader( neoStores ), locks, null, propertyUpdateVisitor, new int[]{labelId}, id -> true ); try ( StorageNodeCursor nodeCursor = reader.allocateNodeCursor() ) { nodeCursor.single( 1 ); nodeCursor.next(); storeViewNodeStoreScan.process( nodeCursor ); } EntityUpdates propertyUpdates = propertyUpdateVisitor.getPropertyUpdates(); assertNotNull( "Visitor should contain container with updates.", propertyUpdates ); LabelSchemaDescriptor index1 = SchemaDescriptorFactory.forLabel( 0, 0 ); LabelSchemaDescriptor index2 = SchemaDescriptorFactory.forLabel( 0, 1 ); LabelSchemaDescriptor index3 = SchemaDescriptorFactory.forLabel( 0, 0, 1 ); LabelSchemaDescriptor index4 = SchemaDescriptorFactory.forLabel( 1, 1 ); List<LabelSchemaDescriptor> indexes = Arrays.asList( index1, index2, index3, index4 ); assertThat( Iterables.map( IndexEntryUpdate::indexKey, propertyUpdates.forIndexKeys( indexes ) ), containsInAnyOrder( index1, index2, index3 ) ); }
private StorageProperty nodeAddProperty( long nodeId, int key, Object value ) { StorageProperty property = new PropertyKeyValue( key, Values.of( value ) ); StorageProperty oldProperty = null; try ( StorageNodeCursor nodeCursor = storageReader.allocateNodeCursor() ) { nodeCursor.single( nodeId ); if ( nodeCursor.next() ) { StorageProperty fetched = getProperty( key, nodeCursor.propertiesReference() ); if ( fetched != null ) { oldProperty = fetched; } } } if ( oldProperty == null ) { transaction.nodeDoAddProperty( nodeId, key, property.value() ); } else { transaction.nodeDoChangeProperty( nodeId, key, property.value() ); } return property; }
@Test public void shouldBeAbleToListLabelsForNode() throws Exception { // GIVEN long nodeId; int labelId1; int labelId2; try ( Transaction tx = db.beginTx() ) { nodeId = db.createNode( label1, label2 ).getId(); String labelName1 = label1.name(); String labelName2 = label2.name(); labelId1 = labelId( Label.label( labelName1 ) ); labelId2 = labelId( Label.label( labelName2 ) ); tx.success(); } // THEN StorageNodeCursor nodeCursor = storageReader.allocateNodeCursor(); nodeCursor.single( nodeId ); assertTrue( nodeCursor.next() ); assertEquals( newSetWith( labelId1, labelId2 ), newSetWith( nodeCursor.labels() ) ); }
try ( StorageNodeCursor node = storageReader.allocateNodeCursor() )
@Override protected StorageNodeCursor allocateCursor( StorageReader storageReader ) { return storageReader.allocateNodeCursor(); }
public TransactionCountingStateVisitor( TxStateVisitor next, StorageReader storageReader, ReadableTransactionState txState, CountsRecordState counts ) { super( next ); this.storageReader = storageReader; this.txState = txState; this.counts = counts; this.nodeCursor = storageReader.allocateNodeCursor(); this.groupCursor = storageReader.allocateRelationshipGroupCursor(); }
@Override public DefaultNodeCursor allocateNodeCursor() { if ( nodeCursor == null ) { return trace( new DefaultNodeCursor( this, storageReader.allocateNodeCursor() ) ); } try { return nodeCursor; } finally { nodeCursor = null; } }
private void takeSnapshot() try ( StorageNodeCursor node = store.allocateNodeCursor(); StoragePropertyCursor properties = store.allocatePropertyCursor(); StorageRelationshipScanCursor relationship = store.allocateRelationshipScanCursor() )