public void update( PropertyRecord before, PropertyRecord after ) { after.setInUse(true); add( before, after ); }
public void delete( PropertyRecord before, PropertyRecord after ) { after.setInUse(false); add( before, after ); }
private PropertyRecord propertyRecord( long nextPropertyId ) { propertyRecord.clear(); propertyRecord.setInUse( true ); propertyRecord.setId( nextPropertyId ); primitiveRecord().setIdTo( propertyRecord ); propertyRecord.setCreated(); return propertyRecord; }
public static void deletePropertyRecordIncludingValueRecords( PropertyRecord record ) { for ( PropertyBlock block : record ) { for ( DynamicRecord valueRecord : block.getValueRecords() ) { assert valueRecord.inUse(); valueRecord.setInUse( false ); record.addDeletedRecord( valueRecord ); } } record.clearPropertyBlocks(); record.setInUse( false ); }
.forChangingData(); createdPropertyRecords.accept( currentRecord ); currentRecord.setInUse( true ); currentRecord.setCreated(); PropertyRecord firstRecord = currentRecord; currentRecord = propertyRecords.create( propertyId, owner ).forChangingData(); createdPropertyRecords.accept( currentRecord ); currentRecord.setInUse( true ); currentRecord.setCreated();
private static PropertyRecord propertyRecord( PropertyBlock... propertyBlocks ) { PropertyRecord record = new PropertyRecord( 0 ); if ( propertyBlocks != null ) { record.setInUse( true ); for ( PropertyBlock propertyBlock : propertyBlocks ) { record.addPropertyBlock( propertyBlock ); } } record.setNodeId( 0 ); return record; }
@Override public boolean id( Object id, Group group ) { long nodeId = nodeIds.next(); nodeRecord.setId( nodeId ); idMapper.put( id, nodeId, group ); // also store this id as property in temp property store if ( id != null ) { idPropertyStore.encodeValue( idPropertyBlock, 0, Values.of( id ) ); idPropertyRecord.addPropertyBlock( idPropertyBlock ); idPropertyRecord.setId( nodeId ); // yes nodeId idPropertyRecord.setInUse( true ); idPropertyStore.updateRecord( idPropertyRecord ); idPropertyRecord.clear(); } return true; }
@Override protected PropertyRecord createExistingRecord( boolean light ) { PropertyRecord record = new PropertyRecord( ID ); record.setId( ID ); record.setNextProp( 2 ); record.setPrevProp( 4 ); record.setInUse( true ); PropertyBlock block = new PropertyBlock(); DynamicRecordAllocator stringAllocator = new ReusableRecordsAllocator( 64, new DynamicRecord( 7 ) ); Value value = Values.of( "a string too large to fit in the property block itself" ); PropertyStore.encodeValue( block, 6, value, stringAllocator, null, true ); if ( light ) { block.getValueRecords().clear(); } record.setPropertyBlock( block ); return record; }
record.setInUse( true );
@Override protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next ) { // structurally correct, but does not have the 'mandatory' property with the 'draconian' label NodeRecord node = new NodeRecord( next.node(), false, -1, next.property() ); node.setInUse( true ); node.setLabelField( inlinedLabelsLongRepresentation( draconian ), Collections.emptySet() ); PropertyRecord property = new PropertyRecord( node.getNextProp(), node ); property.setInUse( true ); PropertyBlock block = new PropertyBlock(); block.setSingleBlock( key1 | (((long) PropertyType.INT.intValue()) << 24) | (1337L << 28) ); property.addPropertyBlock( block ); tx.create( node ); tx.create( property ); } } );
if ( nrPropBlocks > 0 ) record.setInUse( true );
if ( nrPropBlocks > 0 ) record.setInUse( true );
private void existingChain( ExpectedRecord... initialRecords ) { PropertyRecord prev = null; for ( ExpectedRecord initialRecord : initialRecords ) { PropertyRecord record = this.records.create( propertyStore.nextId(), primitive.record ).forChangingData(); record.setInUse( true ); existingRecord( record, initialRecord ); if ( prev == null ) { // This is the first one, update primitive to point to this primitive.record.setNextProp( record.getId() ); } else { // link property records together record.setPrevProp( prev.getId() ); prev.setNextProp( record.getId() ); } prev = record; } }
record.setInUse( true ); record.addLoadedBlock( block ); int numberOfBlocksUsed = type.calculateNumberOfBlocksUsed( block );
public static PropertyCommand createProperty( long id, PropertyType type, int key, long... valueRecordIds ) { PropertyRecord record = new PropertyRecord( id ); record.setInUse( true ); record.setCreated(); PropertyBlock block = new PropertyBlock(); if ( valueRecordIds.length == 0 ) { PropertyStore.encodeValue( block, key, Values.of( 123 ), null, null, true ); } else { PropertyStore.setSingleBlockValue( block, key, type, valueRecordIds[0] ); block.setValueRecords( dynamicRecords( valueRecordIds ) ); } record.addPropertyBlock( block ); return new PropertyCommand( new PropertyRecord( id ), record ); }
@Override public Generator<PropertyRecord> property() { return ( recordSize, format, recordId ) -> { PropertyRecord record = new PropertyRecord( recordId ); int maxProperties = random.intBetween( 1, 4 ); StandaloneDynamicRecordAllocator stringAllocator = new StandaloneDynamicRecordAllocator(); StandaloneDynamicRecordAllocator arrayAllocator = new StandaloneDynamicRecordAllocator(); record.setInUse( true ); int blocksOccupied = 0; for ( int i = 0; i < maxProperties && blocksOccupied < 4; ) { PropertyBlock block = new PropertyBlock(); // Dynamic records will not be written and read by the property record format, // that happens in the store where it delegates to a "sub" store. PropertyStore.encodeValue( block, random.nextInt( tokenBits ), random.nextValue(), stringAllocator, arrayAllocator, true ); int tentativeBlocksWithThisOne = blocksOccupied + block.getValueBlocks().length; if ( tentativeBlocksWithThisOne <= 4 ) { record.addPropertyBlock( block ); blocksOccupied = tentativeBlocksWithThisOne; } } record.setPrevProp( randomLongOrOccasionallyNull( propertyBits ) ); record.setNextProp( randomLongOrOccasionallyNull( propertyBits ) ); return record; }; }
nextPropRecord.setChanged( primitive ); propRecord.setInUse( false );
stores.getNodeStore().updateRecord( record ); PropertyRecord propRecord = stores.getPropertyStore().getRecord( propId, stores.getPropertyStore().newRecord(), RecordLoad.NORMAL ); propRecord.setInUse( false ); stores.getPropertyStore().updateRecord( propRecord ); db.shutdown();
stores.getRelationshipStore().updateRecord( record ); PropertyRecord propRecord = stores.getPropertyStore().getRecord( propId, stores.getPropertyStore().newRecord(), RecordLoad.NORMAL ); propRecord.setInUse( false ); stores.getPropertyStore().updateRecord( propRecord ); db.shutdown();
@Override protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next ) { long nodeId1 = next.node(); long nodeId2 = next.node(); long relId = next.relationship(); long propId = next.property(); NodeRecord node1 = new NodeRecord( nodeId1, true, false, relId, NO_NEXT_PROPERTY.intValue(), NO_LABELS_FIELD.intValue() ); NodeRecord node2 = new NodeRecord( nodeId2, true, false, relId, NO_NEXT_PROPERTY.intValue(), NO_LABELS_FIELD.intValue() ); // structurally correct, but does not have the 'mandatory' property with the 'M' rel type RelationshipRecord relationship = new RelationshipRecord( relId, true, nodeId1, nodeId2, M, NO_PREV_RELATIONSHIP.intValue(), NO_NEXT_RELATIONSHIP.intValue(), NO_PREV_RELATIONSHIP.intValue(), NO_NEXT_RELATIONSHIP.intValue(), true, true ); relationship.setNextProp( propId ); PropertyRecord property = new PropertyRecord( propId, relationship ); property.setInUse( true ); PropertyBlock block = new PropertyBlock(); block.setSingleBlock( key1 | (((long) PropertyType.INT.intValue()) << 24) | (1337L << 28) ); property.addPropertyBlock( block ); tx.create( node1 ); tx.create( node2 ); tx.create( relationship ); tx.create( property ); tx.incrementRelationshipCount( ANY_LABEL, ANY_RELATIONSHIP_TYPE, ANY_LABEL, 1 ); tx.incrementRelationshipCount( ANY_LABEL, M, ANY_LABEL, 1 ); } } );