Search in sources :

Example 26 with SchemaRule

use of org.neo4j.storageengine.api.schema.SchemaRule in project neo4j by neo4j.

the class TransactionRecordState method dropSchemaRule.

public void dropSchemaRule(SchemaRule rule) {
    RecordProxy<Long, SchemaRecord, SchemaRule> change = recordChangeSet.getSchemaRuleChanges().getOrLoad(rule.getId(), rule);
    SchemaRecord records = change.forChangingData();
    for (DynamicRecord record : records) {
        record.setInUse(false);
    }
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) SchemaRecord(org.neo4j.kernel.impl.store.record.SchemaRecord) SchemaRule(org.neo4j.storageengine.api.schema.SchemaRule)

Example 27 with SchemaRule

use of org.neo4j.storageengine.api.schema.SchemaRule in project neo4j by neo4j.

the class SchemaCacheTest method should_construct_schema_cache.

@Test
public void should_construct_schema_cache() {
    // GIVEN
    Collection<SchemaRule> rules = asList(hans, witch, gretel);
    SchemaCache cache = new SchemaCache(new ConstraintSemantics(), rules);
    // THEN
    assertEquals(asSet(hans, gretel), Iterables.asSet(cache.indexRules()));
    assertEquals(asSet(witch), Iterables.asSet(cache.constraintRules()));
}
Also used : StandardConstraintSemantics(org.neo4j.kernel.impl.constraints.StandardConstraintSemantics) SchemaRule(org.neo4j.storageengine.api.schema.SchemaRule) Test(org.junit.Test)

Aggregations

SchemaRule (org.neo4j.storageengine.api.schema.SchemaRule)27 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)13 ArrayList (java.util.ArrayList)9 MalformedSchemaRuleException (org.neo4j.kernel.api.exceptions.schema.MalformedSchemaRuleException)8 ByteBuffer (java.nio.ByteBuffer)7 Test (org.junit.Test)4 SchemaRecord (org.neo4j.kernel.impl.store.record.SchemaRecord)4 NeoStores (org.neo4j.kernel.impl.store.NeoStores)3 LinkedList (java.util.LinkedList)2 IndexRule (org.neo4j.kernel.impl.store.record.IndexRule)2 LabelTokenRecord (org.neo4j.kernel.impl.store.record.LabelTokenRecord)2 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)2 PrimitiveRecord (org.neo4j.kernel.impl.store.record.PrimitiveRecord)2 PropertyKeyTokenRecord (org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord)2 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)2 RelationshipGroupRecord (org.neo4j.kernel.impl.store.record.RelationshipGroupRecord)2 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)2 RelationshipTypeTokenRecord (org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)2 List (java.util.List)1 Matchers.anyLong (org.mockito.Matchers.anyLong)1