private RelationshipRecord loadRelationship( long relationshipId ) { if ( relationshipRecord == null ) { relationshipRecord = relationshipStore.newRecord(); } relationshipStore.getRecord( relationshipId, relationshipRecord, RecordLoad.NORMAL ); return relationshipRecord; } }
@Override protected RelationshipRecord getLight( long id, RelationshipStore store ) { return store.getRecord( id, store.newRecord(), NORMAL ); }
@Override public <EXCEPTION extends Exception> void relationshipVisit( long relationshipId, RelationshipVisitor<EXCEPTION> relationshipVisitor ) throws EntityNotFoundException, EXCEPTION { // TODO Please don't create a record for this, it's ridiculous RelationshipRecord record = relationshipStore.getRecord( relationshipId, relationshipStore.newRecord(), CHECK ); if ( !record.inUse() ) { throw new EntityNotFoundException( EntityType.RELATIONSHIP, relationshipId ); } relationshipVisitor.visit( relationshipId, record.getType(), record.getFirstNode(), record.getSecondNode() ); }
private <RECEIVER extends PropertyReceiver> void relLoadProperties( long relId, RECEIVER receiver ) { RelationshipRecord relRecord = relStore.getRecord( relId, relStore.newRecord(), NORMAL ); loadProperties( relRecord.getNextProp(), receiver ); }
private void assertRelationshipChain( RelationshipStore relationshipStore, Node node, long firstId, long... chainedIds ) { long nodeId = node.getId(); RelationshipRecord record = relationshipStore.getRecord( firstId, relationshipStore.newRecord(), NORMAL ); Set<Long> readChain = new HashSet<>(); readChain.add( firstId ); while ( true ) { long nextId = record.getFirstNode() == nodeId ? record.getFirstNextRel() : record.getSecondNextRel(); if ( nextId == -1 ) { break; } readChain.add( nextId ); relationshipStore.getRecord( nextId, record, NORMAL ); } Set<Long> expectedChain = new HashSet<>( asList( firstId ) ); for ( long id : chainedIds ) { expectedChain.add( id ); } assertEquals( expectedChain, readChain ); } }
private void unUseRecord( long recordId ) { RelationshipStore relationshipStore = neoStores.getRelationshipStore(); RelationshipRecord relationshipRecord = relationshipStore.getRecord( recordId, new RelationshipRecord( -1 ), RecordLoad.FORCE ); relationshipRecord.setInUse( false ); relationshipStore.updateRecord( relationshipRecord ); }
private Sabotage sabotage( RelationshipStore store, long id ) { RelationshipRecord before = store.getRecord( id, store.newRecord(), RecordLoad.NORMAL ); RelationshipRecord after = before.clone(); long otherReference; if ( !after.isFirstInFirstChain() ) { after.setFirstPrevRel( otherReference = after.getFirstPrevRel() + 1 ); } else { after.setFirstNextRel( otherReference = after.getFirstNextRel() + 1 ); } store.prepareForCommit( after ); store.updateRecord( after ); RelationshipRecord other = store.getRecord( otherReference, store.newRecord(), RecordLoad.FORCE ); return new Sabotage( before, after, other ); } }
entity = relationshipStore.getRecord( entityId, relationshipStore.newRecord(), FORCE );
record = stores.getRelationshipStore().getRecord( relId, record, RecordLoad.NORMAL ); long propId = record.getNextProp(); record.setNextProp( AbstractBaseRecord.NO_ID );
RelationshipStore relationshipStore = neoStores.getRelationshipStore(); RelationshipRecord relationshipRecord = new RelationshipRecord( -1 ); RelationshipRecord record = relationshipStore.getRecord( 4, relationshipRecord, RecordLoad.FORCE ); record.setInUse( false ); relationshipStore.updateRecord( relationshipRecord );
private RelationshipRecord loadRelationship( long relationshipId ) { if ( relationshipRecord == null ) { relationshipRecord = relationshipStore.newRecord(); } relationshipStore.getRecord( relationshipId, relationshipRecord, RecordLoad.NORMAL ); return relationshipRecord; } }
@Override public <EXCEPTION extends Exception> void relationshipVisit( long relationshipId, RelationshipVisitor<EXCEPTION> relationshipVisitor ) throws EntityNotFoundException, EXCEPTION { // TODO Please don't create a record for this, it's ridiculous RelationshipRecord record = relationshipStore.getRecord( relationshipId, relationshipStore.newRecord(), CHECK ); if ( !record.inUse() ) { throw new EntityNotFoundException( EntityType.RELATIONSHIP, relationshipId ); } relationshipVisitor.visit( relationshipId, record.getType(), record.getFirstNode(), record.getSecondNode() ); }
entity = relationshipStore.getRecord( entityId, relationshipStore.newRecord(), FORCE );