use of org.neo4j.storageengine.api.StorageSchemaReader in project neo4j by neo4j.
the class RecordStorageReaderSchemaTest method shouldListAllIndexesForRelationshipTypeAtTimeOfSnapshot.
@Test
void shouldListAllIndexesForRelationshipTypeAtTimeOfSnapshot() throws Exception {
// Given
IndexDescriptor expectedIndex = createIndex(relType1, propertyKey);
createIndex(relType2, propertyKey);
// When
StorageSchemaReader snapshot = storageReader.schemaSnapshot();
Set<IndexDescriptor> indexes = asSet(snapshot.indexesGetForRelationshipType(relationshipTypeId(relType1)));
// Then
assertEquals(asSet(expectedIndex), indexes);
}
use of org.neo4j.storageengine.api.StorageSchemaReader in project neo4j by neo4j.
the class RecordStorageReaderSchemaTest method shouldListAllConstraintsForLabelAtTimeOfSnapshot.
@Test
void shouldListAllConstraintsForLabelAtTimeOfSnapshot() throws Exception {
// Given
createUniquenessConstraint(label1, propertyKey);
createUniquenessConstraint(label2, propertyKey);
// When
StorageSchemaReader snapshot = storageReader.schemaSnapshot();
createUniquenessConstraint(label1, otherPropertyKey);
Set<ConstraintDescriptor> constraints = asSet(snapshot.constraintsGetForLabel(labelId(label1)));
// Then
Set<ConstraintDescriptor> expectedConstraints = asSet(uniqueConstraintDescriptor(label1, propertyKey));
assertEquals(expectedConstraints, constraints);
}
use of org.neo4j.storageengine.api.StorageSchemaReader in project neo4j by neo4j.
the class AllStoreHolder method snapshot.
@Override
public SchemaReadCore snapshot() {
ktx.assertOpen();
StorageSchemaReader snapshot = storageReader.schemaSnapshot();
return new SchemaReadCoreSnapshot(snapshot, ktx, this);
}
use of org.neo4j.storageengine.api.StorageSchemaReader in project neo4j by neo4j.
the class AllStoreHolder method indexGetForName.
IndexDescriptor indexGetForName(StorageSchemaReader reader, String name) {
ktx.assertOpen();
IndexDescriptor index = reader.indexGetForName(name);
if (ktx.hasTxStateWithChanges()) {
Predicate<IndexDescriptor> namePredicate = indexDescriptor -> indexDescriptor.getName().equals(name);
Iterator<IndexDescriptor> indexes = ktx.txState().indexChanges().filterAdded(namePredicate).apply(Iterators.iterator(index));
index = singleOrNull(indexes);
}
return lockIndex(index);
}
use of org.neo4j.storageengine.api.StorageSchemaReader in project neo4j by neo4j.
the class AllStoreHolder method constraintGetForName.
ConstraintDescriptor constraintGetForName(StorageSchemaReader reader, String name) {
ktx.assertOpen();
ConstraintDescriptor constraint = reader.constraintGetForName(name);
if (ktx.hasTxStateWithChanges()) {
Predicate<ConstraintDescriptor> namePredicate = constraintDescriptor -> constraintDescriptor.getName().equals(name);
Iterator<ConstraintDescriptor> constraints = ktx.txState().constraintsChanges().filterAdded(namePredicate).apply(Iterators.iterator(constraint));
constraint = singleOrNull(constraints);
}
return lockConstraint(constraint);
}
Aggregations