use of org.neo4j.consistency.RecordType in project neo4j by neo4j.
the class OwnerCheck method decoratePropertyChecker.
@Override
public RecordCheck<PropertyRecord, ConsistencyReport.PropertyConsistencyReport> decoratePropertyChecker(final RecordCheck<PropertyRecord, ConsistencyReport.PropertyConsistencyReport> checker) {
if (owners == null && dynamics == null) {
return checker;
}
return new RecordCheck<PropertyRecord, ConsistencyReport.PropertyConsistencyReport>() {
@Override
public void check(PropertyRecord record, CheckerEngine<PropertyRecord, ConsistencyReport.PropertyConsistencyReport> engine, RecordAccess records) {
if (record.inUse()) {
if (owners != null && Record.NO_PREVIOUS_PROPERTY.is(record.getPrevProp())) {
// this record is first in a chain
PropertyOwner.UnknownOwner owner = new PropertyOwner.UnknownOwner();
engine.comparativeCheck(owner, ORPHAN_CHECKER);
if (null == owners.putIfAbsent(record.getId(), owner)) {
owner.markInCustody();
}
}
if (dynamics != null) {
for (PropertyBlock block : record) {
RecordType type = recordType(block.forceGetType());
if (type != null) {
ConcurrentMap<Long, DynamicOwner> dynamicOwners = dynamics.get(type);
if (dynamicOwners != null) {
long id = block.getSingleValueLong();
DynamicOwner.Property owner = new DynamicOwner.Property(type, record);
DynamicOwner prev = dynamicOwners.put(id, owner);
if (prev != null) {
engine.comparativeCheck(prev.record(records), owner);
}
}
}
}
}
}
checker.check(record, engine, records);
}
};
}
use of org.neo4j.consistency.RecordType in project neo4j by neo4j.
the class AbstractStoreProcessor method processString.
@Override
public final void processString(RecordStore<DynamicRecord> store, DynamicRecord string, IdType idType) {
RecordType type;
DynamicStore dereference;
switch(idType) {
case STRING_BLOCK:
type = RecordType.STRING_PROPERTY;
dereference = DynamicStore.STRING;
break;
case RELATIONSHIP_TYPE_TOKEN_NAME:
type = RecordType.RELATIONSHIP_TYPE_NAME;
dereference = DynamicStore.RELATIONSHIP_TYPE;
break;
case PROPERTY_KEY_TOKEN_NAME:
type = RecordType.PROPERTY_KEY_NAME;
dereference = DynamicStore.PROPERTY_KEY;
break;
case LABEL_TOKEN_NAME:
type = RecordType.LABEL_NAME;
dereference = DynamicStore.LABEL;
break;
default:
throw new IllegalArgumentException(format("The id type [%s] is not valid for String records.", idType));
}
checkDynamic(type, store, string, new DynamicRecordCheck(store, dereference));
}
Aggregations