use of org.neo4j.storageengine.api.schema.SchemaRule in project neo4j by neo4j.
the class IndexLookup method buildIndexRuleIndex.
private PrimitiveIntObjectMap<List<IndexRule>> buildIndexRuleIndex(SchemaStore schemaStore) {
final PrimitiveIntObjectMap<List<IndexRule>> indexRuleIndex = Primitive.intObjectMap();
for (SchemaRule schemaRule : schemaStore) {
if (schemaRule instanceof IndexRule) {
IndexRule rule = (IndexRule) schemaRule;
// assuming 1 property always
int propertyId = rule.schema().getPropertyId();
List<IndexRule> ruleList = indexRuleIndex.get(propertyId);
if (ruleList == null) {
ruleList = new LinkedList<>();
indexRuleIndex.put(propertyId, ruleList);
}
ruleList.add(rule);
}
}
return indexRuleIndex;
}
use of org.neo4j.storageengine.api.schema.SchemaRule in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_0 method readSchemaRule.
private SchemaRule readSchemaRule(Collection<DynamicRecord> recordsBefore) {
assert Iterables.first(recordsBefore).inUse() : "Asked to deserialize schema records that were not in use.";
SchemaRule rule;
ByteBuffer deserialized = AbstractDynamicStore.concatData(recordsBefore, new byte[100]);
try {
rule = SchemaRuleSerialization.deserialize(Iterables.first(recordsBefore).getId(), deserialized);
} catch (MalformedSchemaRuleException e) {
// TODO This is bad. We should probably just shut down if that happens
throw launderedException(e);
}
return rule;
}
use of org.neo4j.storageengine.api.schema.SchemaRule in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_1 method visitSchemaRuleCommand.
private Command visitSchemaRuleCommand(ReadableChannel channel) throws IOException {
Collection<DynamicRecord> recordsBefore = new ArrayList<>();
readDynamicRecords(channel, recordsBefore, COLLECTION_DYNAMIC_RECORD_ADDER);
Collection<DynamicRecord> recordsAfter = new ArrayList<>();
readDynamicRecords(channel, recordsAfter, COLLECTION_DYNAMIC_RECORD_ADDER);
byte isCreated = channel.get();
if (1 == isCreated) {
for (DynamicRecord record : recordsAfter) {
record.setCreated();
}
}
// txId - ignored
channel.getLong();
SchemaRule rule = Iterables.first(recordsAfter).inUse() ? readSchemaRule(recordsAfter) : readSchemaRule(recordsBefore);
return new Command.SchemaRuleCommand(recordsBefore, recordsAfter, rule);
}
use of org.neo4j.storageengine.api.schema.SchemaRule in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_2_10 method readSchemaRule.
private SchemaRule readSchemaRule(Collection<DynamicRecord> recordsBefore) {
// TODO: Why was this assertion here?
// assert first(recordsBefore).inUse() : "Asked to deserialize schema records that were not in
// use.";
SchemaRule rule;
ByteBuffer deserialized = AbstractDynamicStore.concatData(recordsBefore, new byte[100]);
try {
rule = SchemaRuleSerialization.deserialize(Iterables.first(recordsBefore).getId(), deserialized);
} catch (MalformedSchemaRuleException e) {
return null;
}
return rule;
}
use of org.neo4j.storageengine.api.schema.SchemaRule in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_2_4 method readSchemaRule.
private SchemaRule readSchemaRule(Collection<DynamicRecord> recordsBefore) {
// TODO: Why was this assertion here?
// assert first(recordsBefore).inUse() : "Asked to deserialize schema records that were not in
// use.";
SchemaRule rule;
ByteBuffer deserialized = AbstractDynamicStore.concatData(recordsBefore, new byte[100]);
try {
rule = SchemaRuleSerialization.deserialize(Iterables.first(recordsBefore).getId(), deserialized);
} catch (MalformedSchemaRuleException e) {
return null;
}
return rule;
}
Aggregations