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);
}
Aggregations