use of org.neo4j.kernel.impl.store.record.PropertyBlock in project neo4j by neo4j.
the class BatchingNeoStoresTest method createRecordIn.
private static <RECORD extends AbstractBaseRecord> void createRecordIn(RecordStore<RECORD> store) {
RECORD record = store.newRecord();
record.setId(store.nextId(NULL));
record.setInUse(true);
if (record instanceof PropertyRecord) {
// Special hack for property store, since it's not enough to simply set a record as in use there
PropertyBlock block = new PropertyBlock();
((PropertyStore) store).encodeValue(block, 0, Values.of(10), NULL, INSTANCE);
((PropertyRecord) record).addPropertyBlock(block);
}
store.updateRecord(record, NULL);
}
use of org.neo4j.kernel.impl.store.record.PropertyBlock 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.PropertyBlock 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;
}
use of org.neo4j.kernel.impl.store.record.PropertyBlock in project neo4j by neo4j.
the class TestLongerShortString method assertCanEncodeAndDecodeToSame.
private static void assertCanEncodeAndDecodeToSame(String string, int payloadSize) {
PropertyBlock target = new PropertyBlock();
assertTrue(LongerShortString.encode(0, string, target, payloadSize));
assertEquals(Values.stringValue(string), LongerShortString.decode(target));
}
use of org.neo4j.kernel.impl.store.record.PropertyBlock in project neo4j by neo4j.
the class TestShortArray method assertCanEncodeAndDecodeToSameValue.
private static void assertCanEncodeAndDecodeToSameValue(Object value, int payloadSize) {
PropertyBlock target = new PropertyBlock();
boolean encoded = ShortArray.encode(0, value, target, payloadSize);
assertTrue(encoded);
assertEquals(Values.of(value), ShortArray.decode(target));
}
Aggregations