@Override public R getRecord( long id, R target, RecordLoad mode ) throws InvalidRecordException { return actual.getRecord( id, target, mode ); }
protected <R extends AbstractBaseRecord> R getRecord( RecordStore<R> store, long id, R into ) { store.getRecord( id, into, RecordLoad.FORCE ); return into; }
/** * Utility methods for reading records. These are not on the interface itself since it should be * an explicit choice when to create the record instances passed into it. * Also for mocking purposes it's less confusing and error prone having only a single method. */ static <R extends AbstractBaseRecord> R getRecord( RecordStore<R> store, long id ) { return getRecord( store, id, RecordLoad.NORMAL ); } }
@Override public RelationshipRecord load( long key, Void additionalData ) { return store.getRecord( key, store.newRecord(), NORMAL ); }
@Override public RelationshipGroupRecord load( long key, Integer type ) { return store.getRecord( key, store.newRecord(), NORMAL ); }
/** * Utility methods for reading records. These are not on the interface itself since it should be * an explicit choice when to create the record instances passed into it. * Also for mocking purposes it's less confusing and error prone having only a single method. */ static <R extends AbstractBaseRecord> R getRecord( RecordStore<R> store, long id, RecordLoad mode ) { R record = store.newRecord(); store.getRecord( id, record, mode ); return record; }
@Override public NodeRecord load( long key, Void additionalData ) { return store.getRecord( key, store.newRecord(), NORMAL ); }
@Override public PropertyKeyTokenRecord load( long key, Void additionalData ) { return store.getRecord( key, store.newRecord(), NORMAL ); }
@Override public LabelTokenRecord load( long key, Void additionalData ) { return store.getRecord( key, store.newRecord(), NORMAL ); }
@Override public RelationshipTypeTokenRecord load( long key, Void additionalData ) { return store.getRecord( key, store.newRecord(), NORMAL ); }
private static <R extends AbstractBaseRecord> R getRecord( RecordStore<R> store, long id ) { return RecordStore.getRecord( store, id, RecordLoad.FORCE ); }
private static <T extends AbstractBaseRecord> T[] readAllRecords( Class<T> type, RecordStore<T> store ) { @SuppressWarnings( "unchecked" ) T[] records = (T[]) Array.newInstance( type, (int) store.getHighId() ); for ( int i = 0; i < records.length; i++ ) { records[i] = store.getRecord( i, store.newRecord(), FORCE ); } return records; } }
private static Set<Long> labelsFor( RecordStore<NodeRecord> nodeStore, CheckerEngine<? extends AbstractBaseRecord,? extends ConsistencyReport> engine, RecordAccess recordAccess, long nodeId ) { return getListOfLabels( nodeStore.getRecord( nodeId, nodeStore.newRecord(), FORCE ), recordAccess, engine ); } }
protected RecordSet<RelationshipRecord> followChainFromNode( long nodeId, long relationshipId ) { return expandChain( recordStore.getRecord( relationshipId, recordStore.newRecord(), NORMAL ), nodeId, NEXT ); }
protected R getForce( S store, int id ) { return store.getRecord( id, store.newRecord(), RecordLoad.FORCE ); }
protected R getHeavy( S store, int id ) { R record = store.getRecord( id, store.newRecord(), NORMAL ); store.ensureHeavy( record ); return record; }
public RecordSet<RelationshipRecord> findRelationshipChainsThatThisRecordShouldBelongTo( RelationshipRecord relationship ) { RecordSet<RelationshipRecord> records = new RecordSet<>(); for ( RelationshipNodeField field : RelationshipNodeField.values() ) { long nodeId = field.get( relationship ); nodeStore.getRecord( nodeId, nodeRecord, RecordLoad.FORCE ); records.addAll( relationshipChainExplorer.followChainFromNode( nodeId, nodeRecord.getNextRel() ) ); } return records; } }
private static <RECORD extends AbstractBaseRecord> void assertSameStoreContents( RecordStore<RECORD> store1, RecordStore<RECORD> store2 ) { long highId1 = store1.getHighId(); long highId2 = store2.getHighId(); long maxHighId = max( highId1, highId2 ); RECORD record1 = store1.newRecord(); RECORD record2 = store2.newRecord(); for ( long id = store1.getNumberOfReservedLowIds(); id < maxHighId; id++ ) { store1.getRecord( id, record1, RecordLoad.CHECK ); store2.getRecord( id, record2, RecordLoad.CHECK ); assertEquals( record1, record2 ); } }
public static <RECORD extends AbstractBaseRecord> int numberOfRecordsInUse( RecordStore<RECORD> store ) { int inUse = 0; for ( long id = store.getNumberOfReservedLowIds(); id < store.getHighId(); id++ ) { RECORD record = store.getRecord( id, store.newRecord(), RecordLoad.FORCE ); if ( record.inUse() ) { inUse++; } } return inUse; }
private static void breakTheChain( RecordStore<RelationshipRecord> relationshipStore ) { RelationshipRecord record = relationshipStore.getRecord( 10, relationshipStore.newRecord(), NORMAL ); long relationshipTowardsEndOfChain = record.getFirstNode(); while ( record.inUse() && !record.isFirstInFirstChain() ) { record = relationshipStore.getRecord( relationshipTowardsEndOfChain, relationshipStore.newRecord(), FORCE ); relationshipTowardsEndOfChain = record.getFirstPrevRel(); } relationshipStore.updateRecord( new RelationshipRecord( relationshipTowardsEndOfChain, 0, 0, 0 ) ); }