/** * Creates a node for the given id * * @param nodeId The id of the node to create. */ public void nodeCreate( long nodeId ) { NodeRecord nodeRecord = recordChangeSet.getNodeRecords().create( nodeId, null ).forChangingData(); nodeRecord.setInUse( true ); nodeRecord.setCreated(); }
private static NodeRecord createdNode() { NodeRecord record = new NodeRecord( 2, false, -1, -1 ); record.setInUse( true ); record.setCreated(); return record; }
private Command visitNodeCommand( ReadableChannel channel ) throws IOException { long id = channel.getLong(); NodeRecord before = readNodeRecord( id, channel ); if ( before == null ) { return null; } NodeRecord after = readNodeRecord( id, channel ); if ( after == null ) { return null; } if ( !before.inUse() && after.inUse() ) { after.setCreated(); } return new Command.NodeCommand( before, after ); }
private Command visitNodeCommand( ReadableChannel channel ) throws IOException { long id = channel.getLong(); NodeRecord before = readNodeRecord( id, channel ); if ( before == null ) { return null; } NodeRecord after = readNodeRecord( id, channel ); if ( after == null ) { return null; } if ( !before.inUse() && after.inUse() ) { after.setCreated(); } return new Command.NodeCommand( before, after ); }
private Command visitNodeCommand( ReadableChannel channel ) throws IOException { long id = channel.getLong(); NodeRecord before = readNodeRecord( id, channel ); if ( before == null ) { return null; } NodeRecord after = readNodeRecord( id, channel ); if ( after == null ) { return null; } if ( !before.inUse() && after.inUse() ) { after.setCreated(); } return new Command.NodeCommand( before, after ); }
private Command visitNodeCommand( ReadableChannel channel ) throws IOException { long id = channel.getLong(); NodeRecord before = readNodeRecord( id, channel ); if ( before == null ) { return null; } NodeRecord after = readNodeRecord( id, channel ); if ( after == null ) { return null; } if ( !before.inUse() && after.inUse() ) { after.setCreated(); } return new Command.NodeCommand( before, after ); }
private long internalCreateNode( long nodeId, Map<String, Object> properties, Label... labels ) { NodeRecord nodeRecord = recordAccess.getNodeRecords().create( nodeId, null ).forChangingData(); nodeRecord.setInUse( true ); nodeRecord.setCreated(); nodeRecord.setNextProp( propertyCreator.createPropertyChain( nodeRecord, propertiesIterator( properties ), recordAccess.getPropertyRecords() ) ); if ( labels.length > 0 ) { setNodeLabels( nodeRecord, labels ); } flushStrategy.flush(); return nodeId; }
public void create( NodeRecord node ) { node.setCreated(); update( new NodeRecord( node.getId(), false, NO_PREV_RELATIONSHIP.intValue(), NO_NEXT_PROPERTY.intValue() ), node ); }
@Test public void shouldSerializeCreatedRecord() throws Exception { // Given NodeRecord before = new NodeRecord( 12, false, 1, 2 ); NodeRecord after = new NodeRecord( 12, false, 2, 1 ); after.setCreated(); after.setInUse( true ); // When assertSerializationWorksFor( new Command.NodeCommand( before, after ) ); }
public static NodeCommand createNode( long id, long... dynamicLabelRecordIds ) { NodeRecord record = new NodeRecord( id ); record.setInUse( true ); record.setCreated(); if ( dynamicLabelRecordIds.length > 0 ) { Collection<DynamicRecord> dynamicRecords = dynamicRecords( dynamicLabelRecordIds ); record.setLabelField( DynamicNodeLabels.dynamicPointer( dynamicRecords ), dynamicRecords ); } return new NodeCommand( new NodeRecord( id ), record ); }
@Override public void checkConsistency( RelationshipRecord relationship, CheckerEngine<RelationshipRecord, ConsistencyReport.RelationshipConsistencyReport> engine, RecordAccess records ) { if ( valueFrom( relationship ) < 0 ) { illegalNode( engine.report() ); } else { // build the node record from cached values with only valid fields as id, inUse, and nextRel. NodeRecord node = new NodeRecord( valueFrom( relationship ) ); CacheAccess.Client client = records.cacheAccess().client(); node.setInUse( client.getFromCache( node.getId(), SLOT_SOURCE_OR_TARGET ) != RelationshipLink.SOURCE ); node.setNextRel( client.getFromCache( node.getId(), SLOT_RELATIONSHIP_ID ) ); // We use "created" flag here. Consistency checking code revolves around records and so // even in scenarios where records are built from other sources, f.ex half-and-purpose-built from cache, // this flag is used to signal that the real record needs to be read in order to be used as a general // purpose record. node.setCreated(); if ( records.shouldCheck( node.getId(), MultiPassStore.NODES ) ) { engine.comparativeCheck( new DirectRecordReference<>( node, records ), this ); } } }
/** * Creates a node for the given id * * @param nodeId The id of the node to create. */ public void nodeCreate( long nodeId ) { NodeRecord nodeRecord = recordChangeSet.getNodeRecords().create( nodeId, null ).forChangingData(); nodeRecord.setInUse( true ); nodeRecord.setCreated(); }
private Command visitNodeCommand( ReadableChannel channel ) throws IOException { long id = channel.getLong(); NodeRecord before = readNodeRecord( id, channel ); if ( before == null ) { return null; } NodeRecord after = readNodeRecord( id, channel ); if ( after == null ) { return null; } if ( !before.inUse() && after.inUse() ) { after.setCreated(); } return new Command.NodeCommand( before, after ); }
private Command visitNodeCommand( ReadableChannel channel ) throws IOException { long id = channel.getLong(); NodeRecord before = readNodeRecord( id, channel ); if ( before == null ) { return null; } NodeRecord after = readNodeRecord( id, channel ); if ( after == null ) { return null; } if ( !before.inUse() && after.inUse() ) { after.setCreated(); } return new Command.NodeCommand( before, after ); }
private Command visitNodeCommand( ReadableChannel channel ) throws IOException { long id = channel.getLong(); NodeRecord before = readNodeRecord( id, channel ); if ( before == null ) { return null; } NodeRecord after = readNodeRecord( id, channel ); if ( after == null ) { return null; } if ( !before.inUse() && after.inUse() ) { after.setCreated(); } return new Command.NodeCommand( before, after ); }
private Command visitNodeCommand( ReadableChannel channel ) throws IOException { long id = channel.getLong(); NodeRecord before = readNodeRecord( id, channel ); if ( before == null ) { return null; } NodeRecord after = readNodeRecord( id, channel ); if ( after == null ) { return null; } if ( !before.inUse() && after.inUse() ) { after.setCreated(); } return new Command.NodeCommand( before, after ); }
private long internalCreateNode( long nodeId, Map<String, Object> properties, Label... labels ) { NodeRecord nodeRecord = recordAccess.getNodeRecords().create( nodeId, null ).forChangingData(); nodeRecord.setInUse( true ); nodeRecord.setCreated(); nodeRecord.setNextProp( propertyCreator.createPropertyChain( nodeRecord, propertiesIterator( properties ), recordAccess.getPropertyRecords() ) ); if ( labels.length > 0 ) { setNodeLabels( nodeRecord, labels ); } flushStrategy.flush(); return nodeId; }
public void create( NodeRecord node ) { node.setCreated(); update( new NodeRecord( node.getId(), false, NO_PREV_RELATIONSHIP.intValue(), NO_NEXT_PROPERTY.intValue() ), node ); }