Search in sources :

Example 1 with TokenScan

use of org.neo4j.kernel.impl.index.schema.TokenScan in project neo4j by neo4j.

the class Read method nodeLabelScan.

@Override
public final Scan<NodeLabelIndexCursor> nodeLabelScan(int label) {
    ktx.assertOpen();
    CursorContext cursorContext = ktx.cursorContext();
    TokenScan tokenScan;
    try {
        Iterator<IndexDescriptor> index = index(SchemaDescriptor.forAnyEntityTokens(EntityType.NODE));
        if (!index.hasNext()) {
            throw new IndexNotFoundKernelException("There is no index that can back a node label scan.");
        }
        IndexDescriptor nliDescriptor = index.next();
        DefaultTokenReadSession session = (DefaultTokenReadSession) tokenReadSession(nliDescriptor);
        tokenScan = session.reader.entityTokenScan(label, cursorContext);
    } catch (IndexNotFoundKernelException e) {
        throw new RuntimeException(e);
    }
    return new NodeLabelIndexCursorScan(this, label, tokenScan, cursorContext);
}
Also used : TokenScan(org.neo4j.kernel.impl.index.schema.TokenScan) CursorContext(org.neo4j.io.pagecache.context.CursorContext) IndexNotFoundKernelException(org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException) IndexDescriptor(org.neo4j.internal.schema.IndexDescriptor)

Aggregations

IndexNotFoundKernelException (org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException)1 IndexDescriptor (org.neo4j.internal.schema.IndexDescriptor)1 CursorContext (org.neo4j.io.pagecache.context.CursorContext)1 TokenScan (org.neo4j.kernel.impl.index.schema.TokenScan)1