use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.
the class Commands method createProperty.
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, NULL, INSTANCE);
} else {
PropertyStore.setSingleBlockValue(block, key, type, valueRecordIds[0]);
block.setValueRecords(dynamicRecords(valueRecordIds));
}
record.addPropertyBlock(block);
return new PropertyCommand(new PropertyRecord(id), record);
}
use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.
the class LogCommandSerializationV3_0_10Test method readPropertyCommandWithSecondaryUnit.
@Test
void readPropertyCommandWithSecondaryUnit() throws IOException {
InMemoryClosableChannel channel = new InMemoryClosableChannel();
PropertyRecord before = new PropertyRecord(1);
PropertyRecord after = new PropertyRecord(2);
after.setSecondaryUnitIdOnCreate(78);
new Command.PropertyCommand(writer(), before, after).serialize(channel);
Command command = INSTANCE.read(channel);
assertTrue(command instanceof Command.PropertyCommand);
Command.PropertyCommand neoStoreCommand = (Command.PropertyCommand) command;
// Then
assertEquals(before.getNextProp(), neoStoreCommand.getBefore().getNextProp());
assertEquals(after.getNextProp(), neoStoreCommand.getAfter().getNextProp());
verifySecondaryUnit(after, neoStoreCommand.getAfter());
}
use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.
the class LogCommandSerializationV3_0_10Test method readPropertyCommandWithFixedReferenceFormat.
@Test
void readPropertyCommandWithFixedReferenceFormat() throws IOException {
InMemoryClosableChannel channel = new InMemoryClosableChannel();
PropertyRecord before = new PropertyRecord(1);
PropertyRecord after = new PropertyRecord(2);
before.setUseFixedReferences(true);
after.setUseFixedReferences(true);
new Command.PropertyCommand(writer(), before, after).serialize(channel);
Command command = INSTANCE.read(channel);
assertTrue(command instanceof Command.PropertyCommand);
Command.PropertyCommand neoStoreCommand = (Command.PropertyCommand) command;
// Then
assertEquals(before.getNextProp(), neoStoreCommand.getBefore().getNextProp());
assertEquals(after.getNextProp(), neoStoreCommand.getAfter().getNextProp());
assertTrue(neoStoreCommand.getBefore().isUseFixedReferences());
assertTrue(neoStoreCommand.getAfter().isUseFixedReferences());
}
use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.
the class LogCommandSerializationV3_0_10Test method readPropertyCommandWithNonRequiredSecondaryUnit.
@Test
void readPropertyCommandWithNonRequiredSecondaryUnit() throws IOException {
InMemoryClosableChannel channel = new InMemoryClosableChannel();
PropertyRecord before = new PropertyRecord(1);
PropertyRecord after = new PropertyRecord(2);
after.setSecondaryUnitIdOnCreate(78);
new Command.PropertyCommand(writer(), before, after).serialize(channel);
Command command = INSTANCE.read(channel);
assertTrue(command instanceof Command.PropertyCommand);
Command.PropertyCommand neoStoreCommand = (Command.PropertyCommand) command;
// Then
assertEquals(before.getNextProp(), neoStoreCommand.getBefore().getNextProp());
assertEquals(after.getNextProp(), neoStoreCommand.getAfter().getNextProp());
verifySecondaryUnit(after, neoStoreCommand.getAfter());
}
use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.
the class PropertyStoreConsistentReadTest method createExistingRecord.
@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, NULL, INSTANCE);
if (light) {
block.getValueRecords().clear();
}
record.setPropertyBlock(block);
return record;
}
Aggregations