Skip to content

Commit

Permalink
Refactor so that Read is monomorphic
Browse files Browse the repository at this point in the history
This is probably not a bottleneck but it makes sense from code style perspective
as well so why not.
  • Loading branch information
pontusmelke committed Dec 7, 2017
1 parent f2c3efe commit 5294a0b
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 288 deletions.
Expand Up @@ -478,7 +478,7 @@ private void assertTransactionOpen()
}
}

private void assertOpen()
public void assertOpen()
{
Optional<Status> terminationReason = getReasonIfTerminated();
if ( terminationReason.isPresent() )
Expand Down Expand Up @@ -724,7 +724,7 @@ public void visitCreatedRelationship( long id, int type, long startNode, long en
public Read dataRead()
{
currentStatement.assertAllows( AccessMode::allowsReads, "Read" );
return operations;
return operations.dataRead();
}

@Override
Expand Down Expand Up @@ -754,7 +754,7 @@ public TokenRead tokenRead()
@Override
public ExplicitIndexRead indexRead()
{
return operations;
return operations.indexRead();
}

@Override
Expand All @@ -766,7 +766,7 @@ public ExplicitIndexWrite indexWrite()
@Override
public SchemaRead schemaRead()
{
return operations;
return operations.schemaRead();
}

@Override
Expand Down
Expand Up @@ -505,7 +505,7 @@ public Object getProperty( String key ) throws NotFoundException
}
NodeCursor nodes = transaction.nodeCursor();
PropertyCursor properties = transaction.propertyCursor();
try ( Statement ignore = actions.statement())
try ( Statement ignore = actions.statement() )
{
transaction.dataRead().singleNode( nodeId, nodes );
if ( !nodes.next() )
Expand Down
Expand Up @@ -332,7 +332,7 @@ public Node getNodeById( long id )
}

KernelTransaction ktx = spi.currentTransaction();
try ( Statement ignore = spi.currentStatement())
try ( Statement ignore = spi.currentStatement() )
{
if ( !ktx.dataRead().nodeExists( id ) )
{
Expand Down
Expand Up @@ -152,6 +152,7 @@ ExplicitIndex explicitRelationshipIndex( String indexName ) throws ExplicitIndex
@Override
public CapableIndexReference index( int label, int... properties )
{
assertOpen.assertOpen();
IndexDescriptor indexDescriptor = storeReadLayer.indexGetForSchema( new LabelSchemaDescriptor( label, properties ) );
if ( indexDescriptor == null )
{
Expand Down

0 comments on commit 5294a0b

Please sign in to comment.