private Collection<DynamicRecord> markNotInUse( Collection<DynamicRecord> dynamicLabelRecords ) { for ( DynamicRecord record : dynamicLabelRecords ) { record.setInUse( false ); } return dynamicLabelRecords; }
private static void setNotInUse( Collection<DynamicRecord> changedDynamicRecords ) { for ( DynamicRecord record : changedDynamicRecords ) { record.setInUse( false ); } }
public void setInUse( boolean inUse, int type ) { this.type = type; this.setInUse( inUse ); }
/** * @deprecated use {@link #initialize(boolean, boolean, long, int, int)} instead. */ @Deprecated public static DynamicRecord dynamicRecord( long id, boolean inUse ) { DynamicRecord record = new DynamicRecord( id ); record.setInUse( inUse ); return record; }
@Override public DynamicRecord nextRecord() { DynamicRecord record = recordIterator.next(); if ( !record.inUse() ) { record.setCreated(); } record.setInUse( true ); return record; }
public static DynamicRecord allocateRecord( long id ) { DynamicRecord record = new DynamicRecord( id ); record.setCreated(); record.setInUse( true ); return record; } }
@Override public DynamicRecord nextRecord() { DynamicRecord record = super.nextRecord(); record.setInUse( false ); return record; } }
public void updateSchema( Collection<DynamicRecord> beforeRecords, Collection<DynamicRecord> afterRecords, SchemaRule rule ) { for ( DynamicRecord record : afterRecords ) { record.setInUse( true ); } addSchema( beforeRecords, afterRecords, rule ); }
private DynamicRecord newDeletedDynamicRecord( long id ) { DynamicRecord record = new DynamicRecord( id ); record.setInUse( false ); return record; }
private static List<DynamicRecord> dynamicRecords( long... dynamicLabelRecordIds ) { List<DynamicRecord> dynamicRecords = new ArrayList<>(); for ( long did : dynamicLabelRecordIds ) { DynamicRecord dynamicRecord = new DynamicRecord( did ); dynamicRecord.setInUse( true ); dynamicRecords.add( dynamicRecord ); } return dynamicRecords; }
private Collection<DynamicRecord> asRecords( SchemaRule rule, boolean inUse ) { // Only used to transfer List<DynamicRecord> records = new ArrayList<>(); DynamicRecord dynamicRecord = new DynamicRecord( rule.getId() ); dynamicRecord.setInUse( inUse ); records.add( dynamicRecord ); return records; }
void createSchemaRule( SchemaRule schemaRule ) { for ( DynamicRecord change : recordChangeSet.getSchemaRuleChanges() .create( schemaRule.getId(), schemaRule ) .forChangingData() ) { change.setInUse( true ); change.setCreated(); } }
void dropSchemaRule( SchemaRule rule ) { RecordProxy<SchemaRecord, SchemaRule> change = recordChangeSet.getSchemaRuleChanges().getOrLoad( rule.getId(), rule ); SchemaRecord records = change.forChangingData(); for ( DynamicRecord record : records ) { record.setInUse( false ); } records.setInUse( false ); }
private void removeProperty( PrimitiveRecord primitive, PropertyRecord host, PropertyBlock block ) { host.removePropertyBlock( block.getKeyIndexId() ); host.setChanged( primitive ); for ( DynamicRecord record : block.getValueRecords() ) { assert record.inUse(); record.setInUse( false, block.getType().intValue() ); host.addDeletedRecord( record ); } }
public static SchemaRuleCommand createIndexRule( IndexProviderDescriptor provider, long id, LabelSchemaDescriptor descriptor ) { SchemaRule rule = IndexDescriptorFactory.forSchema( descriptor, provider ).withId( id ); DynamicRecord record = new DynamicRecord( id ); record.setInUse( true ); record.setCreated(); record.setData( SchemaRuleSerialization.serialize( rule ) ); return new SchemaRuleCommand( Collections.emptyList(), singletonList( record ), rule ); }
@Override protected DynamicRecord createExistingRecord( boolean light ) { DynamicRecord record = new DynamicRecord( ID ); record.setInUse( true ); record.setStartRecord( true ); record.setLength( EXISTING_RECORD_DATA.length ); record.setData( EXISTING_RECORD_DATA ); return record; }
private DynamicRecord createDynamicRecord( long id, AbstractDynamicStore store, int dataSize ) { DynamicRecord first = new DynamicRecord( id ); first.setInUse( true ); first.setData( RandomUtils.nextBytes( dataSize == 0 ? BLOCK_SIZE - formats.dynamic().getRecordHeaderSize() : 10 ) ); store.updateRecord( first ); return first; }
private static void populateTokenRecord( TokenRecord record, int nameId ) { record.setInUse( true ); record.setNameId( nameId ); record.setCreated(); DynamicRecord dynamicRecord = new DynamicRecord( nameId ); dynamicRecord.setInUse( true ); dynamicRecord.setData( new byte[10] ); dynamicRecord.setCreated(); record.addNameRecord( dynamicRecord ); }
@Test public void allocatePreviouslyUsedRecord() { DynamicRecord dynamicRecord = new DynamicRecord( 1 ); dynamicRecord.setInUse( true ); ReusableRecordsAllocator recordsAllocator = new ReusableRecordsAllocator( 10, dynamicRecord ); DynamicRecord allocatedRecord = recordsAllocator.nextRecord(); assertSame( "Records should be the same.", allocatedRecord, dynamicRecord ); assertTrue( "Record should be marked as used.", allocatedRecord.inUse() ); assertFalse( "Record should be marked as created.", allocatedRecord.isCreated() ); }
@Test public void allocatePreviouslyNotUsedRecord() { DynamicRecord dynamicRecord = new DynamicRecord( 1 ); dynamicRecord.setInUse( false ); ReusableRecordsAllocator recordsAllocator = new ReusableRecordsAllocator( 10, dynamicRecord ); DynamicRecord allocatedRecord = recordsAllocator.nextRecord(); assertSame( "Records should be the same.", allocatedRecord, dynamicRecord ); assertTrue( "Record should be marked as used.", allocatedRecord.inUse() ); assertTrue( "Record should be marked as created.", allocatedRecord.isCreated() ); }