Search in sources :

Example 51 with PropertyRecord

use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.

the class BatchInserterImpl method setPrimitiveProperty.

private void setPrimitiveProperty(RecordProxy<Long, ? extends PrimitiveRecord, Void> primitiveRecord, String propertyName, Object propertyValue) {
    int propertyKey = getOrCreatePropertyKeyId(propertyName);
    RecordAccess<Long, PropertyRecord, PrimitiveRecord> propertyRecords = recordAccess.getPropertyRecords();
    propertyCreator.primitiveSetProperty(primitiveRecord, propertyKey, propertyValue, propertyRecords);
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) UniquenessConstraint(org.neo4j.kernel.api.constraints.UniquenessConstraint) PrimitiveRecord(org.neo4j.kernel.impl.store.record.PrimitiveRecord)

Example 52 with PropertyRecord

use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.

the class StorePropertyCursorTest method createSinglePropertyValue.

private static PropertyRecord createSinglePropertyValue(PropertyStore store, int keyId, Object value) {
    DynamicRecordAllocator stringAllocator = store.getStringStore();
    DynamicRecordAllocator arrayAllocator = store.getArrayStore();
    PropertyBlock block = new PropertyBlock();
    PropertyStore.encodeValue(block, keyId, value, stringAllocator, arrayAllocator);
    PropertyRecord record = new PropertyRecord(store.nextId());
    record.addPropertyBlock(block);
    record.setInUse(true);
    updateRecord(store, record);
    return record;
}
Also used : DynamicRecordAllocator(org.neo4j.kernel.impl.store.DynamicRecordAllocator) PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) PropertyBlock(org.neo4j.kernel.impl.store.record.PropertyBlock)

Example 53 with PropertyRecord

use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.

the class StorePropertyCursorTest method createPropertyChain.

private static List<PropertyRecord> createPropertyChain(PropertyStore store, int keyId, Object... values) {
    List<PropertyRecord> records = new ArrayList<>();
    for (Object value : values) {
        PropertyRecord record = createSinglePropertyValue(store, keyId, value);
        if (!records.isEmpty()) {
            PropertyRecord previousRecord = records.get(records.size() - 1);
            record.setPrevProp(previousRecord.getId());
            store.updateRecord(record);
            previousRecord.setNextProp(record.getId());
            store.updateRecord(previousRecord);
        }
        records.add(record);
    }
    return records;
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) ArrayList(java.util.ArrayList)

Example 54 with PropertyRecord

use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.

the class StorePropertyCursorTest method markPropertyRecordsNoInUse.

private static void markPropertyRecordsNoInUse(PropertyStore store, int... recordIds) {
    for (int recordId : recordIds) {
        PropertyRecord record = RecordStore.getRecord(store, recordId);
        record.setInUse(false);
        store.updateRecord(record);
    }
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord)

Example 55 with PropertyRecord

use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.

the class StorePropertyCursorTest method newStorePropertyCursor.

private static StorePropertyCursor newStorePropertyCursor(PropertyStore propertyStore, Consumer<StorePropertyCursor> cache) {
    RecordCursor<PropertyRecord> propertyRecordCursor = propertyStore.newRecordCursor(propertyStore.newRecord());
    propertyRecordCursor.acquire(0, NORMAL);
    DynamicStringStore stringStore = propertyStore.getStringStore();
    RecordCursor<DynamicRecord> dynamicStringCursor = stringStore.newRecordCursor(stringStore.nextRecord());
    dynamicStringCursor.acquire(0, NORMAL);
    DynamicArrayStore arrayStore = propertyStore.getArrayStore();
    RecordCursor<DynamicRecord> dynamicArrayCursor = arrayStore.newRecordCursor(arrayStore.nextRecord());
    dynamicArrayCursor.acquire(0, NORMAL);
    RecordCursors cursors = mock(RecordCursors.class);
    when(cursors.property()).thenReturn(propertyRecordCursor);
    when(cursors.propertyString()).thenReturn(dynamicStringCursor);
    when(cursors.propertyArray()).thenReturn(dynamicArrayCursor);
    return new StorePropertyCursor(cursors, cache);
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) DynamicStringStore(org.neo4j.kernel.impl.store.DynamicStringStore) RecordCursors(org.neo4j.kernel.impl.store.RecordCursors) DynamicArrayStore(org.neo4j.kernel.impl.store.DynamicArrayStore)

Aggregations

PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)230 PropertyBlock (org.neo4j.kernel.impl.store.record.PropertyBlock)86 Test (org.junit.Test)75 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)37 Test (org.junit.jupiter.api.Test)36 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)35 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)28 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)19 ArrayList (java.util.ArrayList)17 Value (org.neo4j.values.storable.Value)17 PrimitiveRecord (org.neo4j.kernel.impl.store.record.PrimitiveRecord)14 PropertyKeyTokenRecord (org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord)14 RecordAccessStub (org.neo4j.consistency.store.RecordAccessStub)12 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)10 PropertyStore (org.neo4j.kernel.impl.store.PropertyStore)9 IOException (java.io.IOException)8 InterruptedIOException (java.io.InterruptedIOException)8 Pair (org.neo4j.helpers.collection.Pair)8 DefinedProperty (org.neo4j.kernel.api.properties.DefinedProperty)8 NodeStore (org.neo4j.kernel.impl.store.NodeStore)8