@Override public void clear() { initialize( false, NO_NEXT_PROPERTY.intValue(), -1, -1, -1, 1, NO_NEXT_RELATIONSHIP.intValue(), 1, NO_NEXT_RELATIONSHIP.intValue(), true, true ); }
@Override public RelationshipRecord clone() { RelationshipRecord record = new RelationshipRecord( getId() ).initialize( inUse(), nextProp, firstNode, secondNode, type, firstPrevRel, firstNextRel, secondPrevRel, secondNextRel, firstInFirstChain, firstInSecondChain ); record.setSecondaryUnitId( getSecondaryUnitId() ); return record; }
private void createRelationshipRecord( long id, int type, RelationshipStore relationshipStore, boolean used ) { relationshipStore.updateRecord( new RelationshipRecord( id ).initialize( used, -1, 1, 2, type, -1, -1, -1, -1, true, true ) ); }
public static RelationshipRecord rel( long id, Consumer<RelationshipRecord>... modifiers ) { RelationshipRecord record = new RelationshipRecord( id ); record.initialize( true, Record.NO_NEXT_PROPERTY.intValue(), -1, -1, 0, Record.NO_PREV_RELATIONSHIP.longValue(), Record.NO_NEXT_RELATIONSHIP.longValue(), Record.NO_PREV_RELATIONSHIP.longValue(), Record.NO_NEXT_RELATIONSHIP.longValue(), true, true ); for ( Consumer<RelationshipRecord> modifier : modifiers ) { modifier.accept( record ); } return record; }
private RelationshipRecord getRelationship( long relId, boolean inUse, int type ) { return new RelationshipRecord( relId ).initialize( inUse, NO_NEXT_PROPERTY.longValue(), 0, 0, type, NO_NEXT_RELATIONSHIP.longValue(), NO_NEXT_RELATIONSHIP.longValue(), NO_NEXT_RELATIONSHIP.longValue(), NO_NEXT_RELATIONSHIP.longValue(), true, false ); } }
private static RelationshipRecord relationship( long id, long startNodeId, long endNodeId ) { return new RelationshipRecord( id ).initialize( true, Record.NO_NEXT_PROPERTY.longValue(), startNodeId, endNodeId, 0, NULL_REFERENCE.longValue(), NULL_REFERENCE.longValue(), NULL_REFERENCE.longValue(), NULL_REFERENCE.longValue(), false, false ); } }
@Override public Generator<RelationshipRecord> relationship() { return ( recordSize, format, recordId ) -> new RelationshipRecord( recordId ).initialize( random.nextBoolean(), randomLongOrOccasionallyNull( propertyBits ), random.nextLong( entityBits ), random.nextLong( entityBits ), randomInt( tokenBits ), randomLongOrOccasionallyNull( entityBits ), randomLongOrOccasionallyNull( entityBits ), randomLongOrOccasionallyNull( entityBits ), randomLongOrOccasionallyNull( entityBits ), random.nextBoolean(), random.nextBoolean() ); }
record.initialize( inUse, BaseRecordFormat.longFromIntAndMod( nextProp, nextPropMod ), BaseRecordFormat.longFromIntAndMod( firstNode, firstNodeMod ),
@Test public void shouldDeleteIdGeneratorsWhenOpeningExistingStore() throws IOException { // given long expectedHighId; try ( BatchingNeoStores stores = BatchingNeoStores.batchingNeoStoresWithExternalPageCache( storage.fileSystem(), storage.pageCache(), PageCacheTracer.NULL, storage.directory().absolutePath(), LATEST_RECORD_FORMATS, DEFAULT, NullLogService.getInstance(), EMPTY, Config.defaults() ) ) { stores.createNew(); RelationshipStore relationshipStore = stores.getRelationshipStore(); RelationshipRecord record = relationshipStore.newRecord(); long no = NULL_REFERENCE.longValue(); record.initialize( true, no, 1, 2, 0, no, no, no, no, true, true ); record.setId( relationshipStore.nextId() ); expectedHighId = relationshipStore.getHighId(); relationshipStore.updateRecord( record ); // fiddle with the highId relationshipStore.setHighId( record.getId() + 999 ); } // when try ( BatchingNeoStores stores = BatchingNeoStores.batchingNeoStoresWithExternalPageCache( storage.fileSystem(), storage.pageCache(), PageCacheTracer.NULL, storage.directory().absolutePath(), LATEST_RECORD_FORMATS, DEFAULT, NullLogService.getInstance(), EMPTY, Config.defaults() ) ) { stores.pruneAndOpenExistingStore( Predicates.alwaysTrue(), Predicates.alwaysTrue() ); // then assertEquals( expectedHighId, stores.getRelationshipStore().getHighId() ); } }
.initialize( true, 1, 2, 3, 4, 5, 6, 7, 8, true, true ); relationship.setSecondaryUnitId( 12 ); relationship.setRequiresSecondaryUnit( true );
@Override public void clear() { initialize( false, NO_NEXT_PROPERTY.intValue(), -1, -1, -1, 1, NO_NEXT_RELATIONSHIP.intValue(), 1, NO_NEXT_RELATIONSHIP.intValue(), true, true ); }
@Override public RelationshipRecord clone() { RelationshipRecord record = new RelationshipRecord( getId() ).initialize( inUse(), nextProp, firstNode, secondNode, type, firstPrevRel, firstNextRel, secondPrevRel, secondNextRel, firstInFirstChain, firstInSecondChain ); record.setSecondaryUnitId( getSecondaryUnitId() ); return record; }
@Override protected void doReadInternal( RelationshipRecord record, PageCursor cursor, int recordSize, long headerByte, boolean inUse ) { int type = cursor.getShort() & 0xFFFF; long recordId = record.getId(); record.initialize( inUse, decodeCompressedReference( cursor, headerByte, HAS_PROPERTY_BIT, NULL ), decodeCompressedReference( cursor ), decodeCompressedReference( cursor ), type, decodeAbsoluteOrRelative( cursor, headerByte, FIRST_IN_FIRST_CHAIN_BIT, recordId ), decodeAbsoluteIfPresent( cursor, headerByte, HAS_FIRST_CHAIN_NEXT_BIT, recordId ), decodeAbsoluteOrRelative( cursor, headerByte, FIRST_IN_SECOND_CHAIN_BIT, recordId ), decodeAbsoluteIfPresent( cursor, headerByte, HAS_SECOND_CHAIN_NEXT_BIT, recordId ), has( headerByte, FIRST_IN_FIRST_CHAIN_BIT ), has( headerByte, FIRST_IN_SECOND_CHAIN_BIT ) ); }
@Override protected void doReadInternal( RelationshipRecord record, PageCursor cursor, int recordSize, long headerByte, boolean inUse ) { int type = cursor.getShort() & 0xFFFF; if ( record.isUseFixedReferences() ) { // read record in fixed reference format readFixedReferencesRecord( record, cursor, headerByte, inUse, type ); record.setUseFixedReferences( true ); } else { long recordId = record.getId(); record.initialize( inUse, decodeCompressedReference( cursor, headerByte, HAS_PROPERTY_BIT, NULL ), decodeCompressedReference( cursor ), decodeCompressedReference( cursor ), type, decodeAbsoluteOrRelative( cursor, headerByte, FIRST_IN_FIRST_CHAIN_BIT, recordId ), decodeAbsoluteIfPresent( cursor, headerByte, HAS_FIRST_CHAIN_NEXT_BIT, recordId ), decodeAbsoluteOrRelative( cursor, headerByte, FIRST_IN_SECOND_CHAIN_BIT, recordId ), decodeAbsoluteIfPresent( cursor, headerByte, HAS_SECOND_CHAIN_NEXT_BIT, recordId ), has( headerByte, FIRST_IN_FIRST_CHAIN_BIT ), has( headerByte, FIRST_IN_SECOND_CHAIN_BIT ) ); } }
@Override protected void doReadInternal( RelationshipRecord record, PageCursor cursor, int recordSize, long headerByte, boolean inUse ) { if ( record.isUseFixedReferences() ) { int type = cursor.getShort() & 0xFFFF; // read record in fixed reference format readFixedReferencesRecord( record, cursor, headerByte, inUse, type ); record.setUseFixedReferences( true ); } else { int typeLowWord = cursor.getShort() & 0xFFFF; int typeHighWord = cursor.getByte() & 0xFF; int type = (typeHighWord << Short.SIZE) | typeLowWord; long recordId = record.getId(); record.initialize( inUse, decodeCompressedReference( cursor, headerByte, HAS_PROPERTY_BIT, NULL ), decodeCompressedReference( cursor ), decodeCompressedReference( cursor ), type, decodeAbsoluteOrRelative( cursor, headerByte, FIRST_IN_FIRST_CHAIN_BIT, recordId ), decodeAbsoluteIfPresent( cursor, headerByte, HAS_FIRST_CHAIN_NEXT_BIT, recordId ), decodeAbsoluteOrRelative( cursor, headerByte, FIRST_IN_SECOND_CHAIN_BIT, recordId ), decodeAbsoluteIfPresent( cursor, headerByte, HAS_SECOND_CHAIN_NEXT_BIT, recordId ), has( headerByte, FIRST_IN_FIRST_CHAIN_BIT ), has( headerByte, FIRST_IN_SECOND_CHAIN_BIT ) ); } }
@Override protected void doReadInternal( RelationshipRecord record, PageCursor cursor, int recordSize, long headerByte, boolean inUse ) { if ( record.isUseFixedReferences() ) { int type = cursor.getShort() & 0xFFFF; // read record in fixed reference format readFixedReferencesRecord( record, cursor, headerByte, inUse, type ); record.setUseFixedReferences( true ); } else { int typeLowWord = cursor.getShort() & 0xFFFF; int typeHighWord = cursor.getByte() & 0xFF; int type = (typeHighWord << Short.SIZE) | typeLowWord; long recordId = record.getId(); record.initialize( inUse, decodeCompressedReference( cursor, headerByte, HAS_PROPERTY_BIT, NULL ), decodeCompressedReference( cursor ), decodeCompressedReference( cursor ), type, decodeAbsoluteOrRelative( cursor, headerByte, FIRST_IN_FIRST_CHAIN_BIT, recordId ), decodeAbsoluteIfPresent( cursor, headerByte, HAS_FIRST_CHAIN_NEXT_BIT, recordId ), decodeAbsoluteOrRelative( cursor, headerByte, FIRST_IN_SECOND_CHAIN_BIT, recordId ), decodeAbsoluteIfPresent( cursor, headerByte, HAS_SECOND_CHAIN_NEXT_BIT, recordId ), has( headerByte, FIRST_IN_FIRST_CHAIN_BIT ), has( headerByte, FIRST_IN_SECOND_CHAIN_BIT ) ); } }
@Override protected void doReadInternal( RelationshipRecord record, PageCursor cursor, int recordSize, long headerByte, boolean inUse ) { if ( record.isUseFixedReferences() ) { int type = cursor.getShort() & 0xFFFF; // read record in fixed reference format readFixedReferencesRecord( record, cursor, headerByte, inUse, type ); record.setUseFixedReferences( true ); } else { int typeLowWord = cursor.getShort() & 0xFFFF; int typeHighWord = cursor.getByte() & 0xFF; int type = (typeHighWord << Short.SIZE) | typeLowWord; long recordId = record.getId(); record.initialize( inUse, decodeCompressedReference( cursor, headerByte, HAS_PROPERTY_BIT, NULL ), decodeCompressedReference( cursor ), decodeCompressedReference( cursor ), type, decodeAbsoluteOrRelative( cursor, headerByte, FIRST_IN_FIRST_CHAIN_BIT, recordId ), decodeAbsoluteIfPresent( cursor, headerByte, HAS_FIRST_CHAIN_NEXT_BIT, recordId ), decodeAbsoluteOrRelative( cursor, headerByte, FIRST_IN_SECOND_CHAIN_BIT, recordId ), decodeAbsoluteIfPresent( cursor, headerByte, HAS_SECOND_CHAIN_NEXT_BIT, recordId ), has( headerByte, FIRST_IN_FIRST_CHAIN_BIT ), has( headerByte, FIRST_IN_SECOND_CHAIN_BIT ) ); } }
long nextPropMod = (modifiers & NEXT_PROP_BIT) << 26; record.initialize( inUse, BaseHighLimitRecordFormatV3_0_6.longFromIntAndMod( nextProp, nextPropMod ), BaseHighLimitRecordFormatV3_0_6.longFromIntAndMod( firstNode, firstNodeMod ),
long nextPropMod = (modifiers & NEXT_PROP_BIT) << 26; record.initialize( inUse, BaseRecordFormat.longFromIntAndMod( nextProp, nextPropMod ), BaseRecordFormat.longFromIntAndMod( firstNode, firstNodeMod ),
long nextPropMod = (modifiers & NEXT_PROP_BIT) << 26; record.initialize( inUse, BaseRecordFormat.longFromIntAndMod( nextProp, nextPropMod ), BaseRecordFormat.longFromIntAndMod( firstNode, firstNodeMod ),