Search in sources :

Example 1 with RecordLoad

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

the class Loaders method propertyLoader.

public static RecordLoader<PropertyRecord, PrimitiveRecord> propertyLoader(final PropertyStore store, CursorContext cursorContext) {
    return new RecordLoader<>(store, cursorContext) {

        @Override
        public PropertyRecord newUnused(long key, PrimitiveRecord additionalData) {
            PropertyRecord record = new PropertyRecord(key);
            setOwner(record, additionalData);
            return andMarkAsCreated(record);
        }

        private void setOwner(PropertyRecord record, PrimitiveRecord owner) {
            if (owner != null) {
                owner.setIdTo(record);
            }
        }

        @Override
        public PropertyRecord load(long key, PrimitiveRecord additionalData, RecordLoad load, CursorContext cursorContext) {
            PropertyRecord record = super.load(key, additionalData, load, cursorContext);
            setOwner(record, additionalData);
            return record;
        }

        @Override
        public PropertyRecord copy(PropertyRecord propertyRecord) {
            return new PropertyRecord(propertyRecord);
        }
    };
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) CursorContext(org.neo4j.io.pagecache.context.CursorContext) RecordLoad(org.neo4j.kernel.impl.store.record.RecordLoad) PrimitiveRecord(org.neo4j.kernel.impl.store.record.PrimitiveRecord)

Aggregations

CursorContext (org.neo4j.io.pagecache.context.CursorContext)1 PrimitiveRecord (org.neo4j.kernel.impl.store.record.PrimitiveRecord)1 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)1 RecordLoad (org.neo4j.kernel.impl.store.record.RecordLoad)1