private boolean relationshipExists( long id ) { try ( StorageRelationshipScanCursor relationship = storageReader.allocateRelationshipScanCursor() ) { relationship.single( id ); return relationship.next(); } } }
private Value committedValue( RelationshipState relState, int property, StorageRelationshipScanCursor relationship, StoragePropertyCursor properties ) { if ( state.relationshipIsAddedInThisTx( relState.getId() ) ) { return Values.NO_VALUE; } relationship.single( relState.getId() ); if ( !relationship.next() ) { return Values.NO_VALUE; } return committedValue( properties, relationship.propertiesReference(), property ); }
private void testGetRels( long[] relIds ) { for ( long relId : relIds ) { try ( StorageRelationshipScanCursor relationship = storageReader.allocateRelationshipScanCursor() ) { relationship.single( relId ); assertFalse( relationship.next() ); } } }
@Override public boolean next() { // Check tx state boolean hasChanges = hasChanges(); if ( hasChanges && addedRelationships.hasNext() ) { read.txState().relationshipVisit( addedRelationships.next(), storeCursor ); return true; } while ( storeCursor.next() ) { if ( !hasChanges || !read.txState().relationshipIsDeletedInThisTx( storeCursor.entityReference() ) ) { return true; } } return false; }
if ( relationship.next() )
@Test public void processAllRelationshipProperties() throws Exception { createAlistairAndStefanNodes(); CopyUpdateVisitor propertyUpdateVisitor = new CopyUpdateVisitor(); RelationshipStoreScan relationshipStoreScan = new RelationshipStoreScan( new RecordStorageReader( neoStores ), locks, propertyUpdateVisitor, new int[]{relTypeId}, id -> true ); try ( StorageRelationshipScanCursor relationshipScanCursor = reader.allocateRelationshipScanCursor() ) { relationshipScanCursor.single( 1 ); relationshipScanCursor.next(); relationshipStoreScan.process( relationshipScanCursor ); } EntityUpdates propertyUpdates = propertyUpdateVisitor.getPropertyUpdates(); assertNotNull( "Visitor should contain container with updates.", propertyUpdates ); RelationTypeSchemaDescriptor index1 = SchemaDescriptorFactory.forRelType( 0, 2 ); RelationTypeSchemaDescriptor index2 = SchemaDescriptorFactory.forRelType( 0, 3 ); RelationTypeSchemaDescriptor index3 = SchemaDescriptorFactory.forRelType( 0, 2, 3 ); RelationTypeSchemaDescriptor index4 = SchemaDescriptorFactory.forRelType( 1, 3 ); List<RelationTypeSchemaDescriptor> indexes = Arrays.asList( index1, index2, index3, index4 ); assertThat( Iterables.map( IndexEntryUpdate::indexKey, propertyUpdates.forIndexKeys( indexes ) ), containsInAnyOrder( index1, index2, index3 ) ); }
private StorageProperty relAddProperty( long relationshipId, int key, Object value ) { StorageProperty property = new PropertyKeyValue( key, Values.of( value ) ); Value oldValue = Values.NO_VALUE; try ( StorageRelationshipScanCursor cursor = storageReader.allocateRelationshipScanCursor() ) { cursor.single( relationshipId ); if ( cursor.next() ) { StorageProperty fetched = getProperty( key, cursor.propertiesReference() ); if ( fetched != null ) { oldValue = fetched.value(); } } } transaction.relationshipDoReplaceProperty( relationshipId, key, oldValue, Values.of( value ) ); return property; }
private Value committedValue( RelationshipState relState, int property, StorageRelationshipScanCursor relationship, StoragePropertyCursor properties ) { if ( state.relationshipIsAddedInThisTx( relState.getId() ) ) { return Values.NO_VALUE; } relationship.single( relState.getId() ); if ( !relationship.next() ) { return Values.NO_VALUE; } return committedValue( properties, relationship.propertiesReference(), property ); }
@Override public boolean next() { // Check tx state boolean hasChanges = hasChanges(); if ( hasChanges && addedRelationships.hasNext() ) { read.txState().relationshipVisit( addedRelationships.next(), storeCursor ); return true; } while ( storeCursor.next() ) { if ( !hasChanges || !read.txState().relationshipIsDeletedInThisTx( storeCursor.entityReference() ) ) { return true; } } return false; }
if ( relationship.next() )