use of org.neo4j.internal.kernel.api.TokenReadSession in project neo4j by neo4j.
the class NodeScanIT method trackPageCacheAccessOnNodeLabelScan.
@Test
void trackPageCacheAccessOnNodeLabelScan() throws KernelException {
var testLabel = Label.label("testLabel");
try (KernelTransaction tx = kernel.beginTransaction(IMPLICIT, read())) {
var cursorContext = tx.cursorContext();
assertThat(cursorContext.getCursorTracer().pins()).isZero();
var label = tx.tokenRead().nodeLabel(testLabel.name());
IndexDescriptor index = tx.schemaRead().index(SchemaDescriptor.forAnyEntityTokens(EntityType.NODE)).next();
TokenReadSession tokenReadSession = tx.dataRead().tokenReadSession(index);
try (NodeLabelIndexCursor cursor = tx.cursors().allocateNodeLabelIndexCursor(cursorContext)) {
tx.dataRead().nodeLabelScan(tokenReadSession, cursor, IndexQueryConstraints.unconstrained(), new TokenPredicate(label));
assertThat(cursorContext.getCursorTracer().pins()).isNotZero();
}
}
}
use of org.neo4j.internal.kernel.api.TokenReadSession in project neo4j by neo4j.
the class NodeLabelIndexOrderTest method tokenScan.
@Override
protected void tokenScan(IndexOrder indexOrder, KernelTransaction tx, int label, NodeLabelIndexCursor cursor) throws KernelException {
IndexDescriptor index = tx.schemaRead().index(SchemaDescriptor.forAnyEntityTokens(EntityType.NODE)).next();
TokenReadSession tokenReadSession = tx.dataRead().tokenReadSession(index);
tx.dataRead().nodeLabelScan(tokenReadSession, cursor, IndexQueryConstraints.ordered(indexOrder), new TokenPredicate(label));
}
use of org.neo4j.internal.kernel.api.TokenReadSession in project neo4j by neo4j.
the class RelationshipTypeIndexOrderTest method tokenScan.
@Override
protected void tokenScan(IndexOrder indexOrder, KernelTransaction tx, int label, RelationshipTypeIndexCursor cursor) throws KernelException {
IndexDescriptor index = tx.schemaRead().index(SchemaDescriptor.forAnyEntityTokens(EntityType.RELATIONSHIP)).next();
TokenReadSession tokenReadSession = tx.dataRead().tokenReadSession(index);
tx.dataRead().relationshipTypeScan(tokenReadSession, cursor, IndexQueryConstraints.ordered(indexOrder), new TokenPredicate(label));
}
use of org.neo4j.internal.kernel.api.TokenReadSession in project neo4j by neo4j.
the class RelationshipTypeIndexCursorTestBase method relationshipTypeScan.
private void relationshipTypeScan(KernelTransaction tx, int label, RelationshipTypeIndexCursor cursor, IndexOrder indexOrder) throws KernelException {
IndexDescriptor index = tx.schemaRead().indexGetForName("rti");
TokenReadSession tokenReadSession = tx.dataRead().tokenReadSession(index);
tx.dataRead().relationshipTypeScan(tokenReadSession, cursor, IndexQueryConstraints.ordered(indexOrder), new TokenPredicate(label));
}
Aggregations