Search in sources :

Example 1 with DynamicRecord

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

the class RelativeIdRecordAllocator method nextRecord.

@Override
public DynamicRecord nextRecord() {
    DynamicRecord record = new DynamicRecord(id++);
    record.setInUse(true);
    record.setCreated();
    return record;
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord)

Example 2 with DynamicRecord

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

the class BatchInserterImpl method createNodePropertyExistenceConstraintRule.

private void createNodePropertyExistenceConstraintRule(int labelId, int... propertyKeyIds) {
    SchemaRule rule = ConstraintRule.constraintRule(schemaStore.nextId(), ConstraintDescriptorFactory.existsForLabel(labelId, propertyKeyIds));
    for (DynamicRecord record : schemaStore.allocateFrom(rule)) {
        schemaStore.updateRecord(record);
    }
    schemaCache.addSchemaRule(rule);
    labelsTouched = true;
    flushStrategy.forceFlush();
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) SchemaRule(org.neo4j.storageengine.api.schema.SchemaRule)

Example 3 with DynamicRecord

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

the class BatchInserterImpl method createNewRelationshipType.

private int createNewRelationshipType(String name) {
    int id = (int) relationshipTypeTokenStore.nextId();
    RelationshipTypeTokenRecord record = new RelationshipTypeTokenRecord(id);
    record.setInUse(true);
    record.setCreated();
    Collection<DynamicRecord> nameRecords = relationshipTypeTokenStore.allocateNameRecords(encodeString(name));
    record.setNameId((int) Iterables.first(nameRecords).getId());
    record.addNameRecords(nameRecords);
    relationshipTypeTokenStore.updateRecord(record);
    relationshipTypeTokens.addToken(new RelationshipTypeToken(name, id));
    return id;
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord) RelationshipTypeToken(org.neo4j.kernel.impl.core.RelationshipTypeToken) UniquenessConstraint(org.neo4j.kernel.api.constraints.UniquenessConstraint)

Example 4 with DynamicRecord

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

the class BatchInserterImpl method createIndexRule.

private void createIndexRule(int labelId, int[] propertyKeyIds) {
    IndexRule schemaRule = IndexRule.indexRule(schemaStore.nextId(), NewIndexDescriptorFactory.forLabel(labelId, propertyKeyIds), schemaIndexProviders.getDefaultProvider().getProviderDescriptor());
    for (DynamicRecord record : schemaStore.allocateFrom(schemaRule)) {
        schemaStore.updateRecord(record);
    }
    schemaCache.addSchemaRule(schemaRule);
    labelsTouched = true;
    flushStrategy.forceFlush();
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) IndexRule(org.neo4j.kernel.impl.store.record.IndexRule)

Example 5 with DynamicRecord

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

the class BatchInserterImpl method createUniquenessConstraintRule.

private void createUniquenessConstraintRule(UniquenessConstraint constraint) {
    // TODO: Do not create duplicate index
    long indexRuleId = schemaStore.nextId();
    long constraintRuleId = schemaStore.nextId();
    int propertyKeyId = constraint.indexDescriptor().schema().getPropertyId();
    IndexRule indexRule = IndexRule.constraintIndexRule(indexRuleId, NewIndexDescriptorFactory.uniqueForLabel(constraint.label(), propertyKeyId), this.schemaIndexProviders.getDefaultProvider().getProviderDescriptor(), constraintRuleId);
    ConstraintRule constraintRule = ConstraintRule.constraintRule(constraintRuleId, ConstraintDescriptorFactory.uniqueForLabel(constraint.label(), propertyKeyId), indexRuleId);
    for (DynamicRecord record : schemaStore.allocateFrom(constraintRule)) {
        schemaStore.updateRecord(record);
    }
    schemaCache.addSchemaRule(constraintRule);
    for (DynamicRecord record : schemaStore.allocateFrom(indexRule)) {
        schemaStore.updateRecord(record);
    }
    schemaCache.addSchemaRule(indexRule);
    labelsTouched = true;
    flushStrategy.forceFlush();
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) IndexRule(org.neo4j.kernel.impl.store.record.IndexRule) ConstraintRule(org.neo4j.kernel.impl.store.record.ConstraintRule) UniquenessConstraint(org.neo4j.kernel.api.constraints.UniquenessConstraint)

Aggregations

DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)225 Test (org.junit.Test)117 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)51 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)38 ArrayList (java.util.ArrayList)32 PropertyKeyTokenRecord (org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord)28 LabelTokenRecord (org.neo4j.kernel.impl.store.record.LabelTokenRecord)23 IndexRule (org.neo4j.kernel.impl.store.record.IndexRule)21 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)21 IOException (java.io.IOException)20 RecordAccessStub (org.neo4j.consistency.store.RecordAccessStub)16 ReusableRecordsAllocator (org.neo4j.kernel.impl.store.allocator.ReusableRecordsAllocator)16 ConstraintRule (org.neo4j.kernel.impl.store.record.ConstraintRule)16 PropertyBlock (org.neo4j.kernel.impl.store.record.PropertyBlock)16 GraphStoreFixture (org.neo4j.consistency.checking.GraphStoreFixture)15 IdGenerator (org.neo4j.consistency.checking.GraphStoreFixture.IdGenerator)15 TransactionDataBuilder (org.neo4j.consistency.checking.GraphStoreFixture.TransactionDataBuilder)15 SchemaIndexProvider (org.neo4j.kernel.api.index.SchemaIndexProvider)15 ConsistencySummaryStatistics (org.neo4j.consistency.report.ConsistencySummaryStatistics)14 RelationshipTypeTokenRecord (org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)14