Search in sources :

Example 1 with RelationshipTypeStore

use of org.neo4j.kernel.impl.nioneo.store.RelationshipTypeStore in project graphdb by neo4j-attic.

the class BatchInserterImpl method createNewRelationshipType.

private int createNewRelationshipType(String name) {
    RelationshipTypeStore typeStore = getRelationshipTypeStore();
    int id = (int) typeStore.nextId();
    RelationshipTypeRecord record = new RelationshipTypeRecord(id);
    record.setInUse(true);
    record.setCreated();
    int typeBlockId = (int) typeStore.nextBlockId();
    record.setTypeBlock(typeBlockId);
    int length = name.length();
    char[] chars = new char[length];
    name.getChars(0, length, chars, 0);
    Collection<DynamicRecord> typeRecords = typeStore.allocateTypeNameRecords(typeBlockId, chars);
    for (DynamicRecord typeRecord : typeRecords) {
        record.addTypeRecord(typeRecord);
    }
    typeStore.updateRecord(record);
    typeHolder.addRelationshipType(name, id);
    return id;
}
Also used : DynamicRecord(org.neo4j.kernel.impl.nioneo.store.DynamicRecord) RelationshipTypeRecord(org.neo4j.kernel.impl.nioneo.store.RelationshipTypeRecord) RelationshipTypeStore(org.neo4j.kernel.impl.nioneo.store.RelationshipTypeStore)

Example 2 with RelationshipTypeStore

use of org.neo4j.kernel.impl.nioneo.store.RelationshipTypeStore in project neo4j-mobile-android by neo4j-contrib.

the class BatchInserterImpl method createNewRelationshipType.

private int createNewRelationshipType(String name) {
    RelationshipTypeStore typeStore = getRelationshipTypeStore();
    int id = (int) typeStore.nextId();
    RelationshipTypeRecord record = new RelationshipTypeRecord(id);
    record.setInUse(true);
    record.setCreated();
    int typeBlockId = (int) typeStore.nextBlockId();
    record.setTypeBlock(typeBlockId);
    Collection<DynamicRecord> typeRecords = typeStore.allocateTypeNameRecords(typeBlockId, encodeString(name));
    for (DynamicRecord typeRecord : typeRecords) {
        record.addTypeRecord(typeRecord);
    }
    typeStore.updateRecord(record);
    typeHolder.addRelationshipType(name, id);
    return id;
}
Also used : DynamicRecord(org.neo4j.kernel.impl.nioneo.store.DynamicRecord) RelationshipTypeRecord(org.neo4j.kernel.impl.nioneo.store.RelationshipTypeRecord) RelationshipTypeStore(org.neo4j.kernel.impl.nioneo.store.RelationshipTypeStore)

Aggregations

DynamicRecord (org.neo4j.kernel.impl.nioneo.store.DynamicRecord)2 RelationshipTypeRecord (org.neo4j.kernel.impl.nioneo.store.RelationshipTypeRecord)2 RelationshipTypeStore (org.neo4j.kernel.impl.nioneo.store.RelationshipTypeStore)2