use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV3_0_2 method readNodeRecord.
private NodeRecord readNodeRecord(long id, ReadableChannel channel) throws IOException {
byte flags = channel.get();
boolean inUse = bitFlag(flags, Record.IN_USE.byteValue());
boolean requiresSecondaryUnit = bitFlag(flags, Record.REQUIRE_SECONDARY_UNIT);
boolean hasSecondaryUnit = bitFlag(flags, Record.HAS_SECONDARY_UNIT);
NodeRecord record;
Collection<DynamicRecord> dynamicLabelRecords = new ArrayList<>();
long labelField = Record.NO_LABELS_FIELD.intValue();
if (inUse) {
boolean dense = channel.get() == 1;
record = new NodeRecord(id, dense, channel.getLong(), channel.getLong());
// labels
labelField = channel.getLong();
record.setRequiresSecondaryUnit(requiresSecondaryUnit);
if (hasSecondaryUnit) {
record.setSecondaryUnitId(channel.getLong());
}
} else {
record = new NodeRecord(id);
}
readDynamicRecords(channel, dynamicLabelRecords, COLLECTION_DYNAMIC_RECORD_ADDER);
record.setLabelField(labelField, dynamicLabelRecords);
record.setInUse(inUse);
return record;
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class PropertyLoader method nodeLoadProperties.
public <RECEIVER extends PropertyReceiver> RECEIVER nodeLoadProperties(long nodeId, RECEIVER receiver) {
NodeRecord nodeRecord = nodeStore.getRecord(nodeId, nodeStore.newRecord(), NORMAL);
loadProperties(nodeRecord.getNextProp(), receiver);
return receiver;
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class RelationshipCreator method relationshipCreate.
/**
* Creates a relationship with the given id, from the nodes identified by id
* and of type typeId
*
* @param id The id of the relationship to create.
* @param type The id of the relationship type this relationship will
* have.
* @param firstNodeId The id of the start node.
* @param secondNodeId The id of the end node.
*/
public void relationshipCreate(long id, int type, long firstNodeId, long secondNodeId, RecordAccessSet recordChangeSet, ResourceLocker locks) {
// TODO could be unnecessary to mark as changed here already, dense nodes may not need to change
NodeRecord firstNode = recordChangeSet.getNodeRecords().getOrLoad(firstNodeId, null).forChangingLinkage();
NodeRecord secondNode = recordChangeSet.getNodeRecords().getOrLoad(secondNodeId, null).forChangingLinkage();
convertNodeToDenseIfNecessary(firstNode, recordChangeSet.getRelRecords(), recordChangeSet.getRelGroupRecords(), locks);
convertNodeToDenseIfNecessary(secondNode, recordChangeSet.getRelRecords(), recordChangeSet.getRelGroupRecords(), locks);
RelationshipRecord record = recordChangeSet.getRelRecords().create(id, null).forChangingLinkage();
record.setLinks(firstNodeId, secondNodeId, type);
record.setInUse(true);
record.setCreated();
connectRelationship(firstNode, secondNode, record, recordChangeSet.getRelRecords(), recordChangeSet.getRelGroupRecords(), locks);
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV3_0 method visitNodeCommand.
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);
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_2_4 method readNodeRecord.
private NodeRecord readNodeRecord(long id, ReadableChannel channel) throws IOException {
byte inUseFlag = channel.get();
boolean inUse = false;
if (inUseFlag == Record.IN_USE.byteValue()) {
inUse = true;
} else if (inUseFlag != Record.NOT_IN_USE.byteValue()) {
throw new IOException("Illegal in use flag: " + inUseFlag);
}
NodeRecord record;
Collection<DynamicRecord> dynamicLabelRecords = new ArrayList<>();
long labelField = Record.NO_LABELS_FIELD.intValue();
if (inUse) {
boolean dense = channel.get() == 1;
record = new NodeRecord(id, dense, channel.getLong(), channel.getLong());
// labels
labelField = channel.getLong();
} else {
record = new NodeRecord(id);
}
readDynamicRecords(channel, dynamicLabelRecords, COLLECTION_DYNAMIC_RECORD_ADDER);
record.setLabelField(labelField, dynamicLabelRecords);
record.setInUse(inUse);
return record;
}
Aggregations