Skip to content

Commit

Permalink
Drop 'Store' prefix from RelationshipCursors
Browse files Browse the repository at this point in the history
  • Loading branch information
davidegrohmann committed May 8, 2017
1 parent 5dd935c commit 9315163
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 57 deletions.
Expand Up @@ -28,13 +28,13 @@
import static org.neo4j.kernel.api.StatementConstants.NO_SUCH_RELATIONSHIP; import static org.neo4j.kernel.api.StatementConstants.NO_SUCH_RELATIONSHIP;
import static org.neo4j.kernel.api.StatementConstants.NO_SUCH_RELATIONSHIP_TYPE; import static org.neo4j.kernel.api.StatementConstants.NO_SUCH_RELATIONSHIP_TYPE;


public abstract class StoreAbstractIteratorRelationshipCursor extends StoreAbstractRelationshipCursor public abstract class AbstractIteratorRelationshipCursor extends AbstractRelationshipCursor
{ {
private ReadableTransactionState state; private ReadableTransactionState state;
private PrimitiveLongIterator addedRelationshipIterator; private PrimitiveLongIterator addedRelationshipIterator;
private boolean fromStore; private boolean fromStore;


StoreAbstractIteratorRelationshipCursor( RelationshipStore relationshipStore, LockService lockService ) AbstractIteratorRelationshipCursor( RelationshipStore relationshipStore, LockService lockService )
{ {
super( relationshipStore, lockService ); super( relationshipStore, lockService );
} }
Expand Down
Expand Up @@ -37,7 +37,7 @@
/** /**
* Base cursor for relationships. * Base cursor for relationships.
*/ */
public abstract class StoreAbstractRelationshipCursor public abstract class AbstractRelationshipCursor
implements RelationshipVisitor<RuntimeException>, RelationshipItem, Cursor<RelationshipItem>, Disposable implements RelationshipVisitor<RuntimeException>, RelationshipItem, Cursor<RelationshipItem>, Disposable
{ {
protected final RelationshipRecord relationshipRecord; protected final RelationshipRecord relationshipRecord;
Expand All @@ -46,7 +46,7 @@ public abstract class StoreAbstractRelationshipCursor
private final LockService lockService; private final LockService lockService;
protected boolean fetched; protected boolean fetched;


StoreAbstractRelationshipCursor( RelationshipStore relationshipStore, LockService lockService ) AbstractRelationshipCursor( RelationshipStore relationshipStore, LockService lockService )
{ {
this.relationshipStore = relationshipStore; this.relationshipStore = relationshipStore;
this.relationshipRecord = relationshipStore.newRecord(); this.relationshipRecord = relationshipStore.newRecord();
Expand Down
Expand Up @@ -37,9 +37,9 @@
public class GlobalCursorPools implements CursorPools public class GlobalCursorPools implements CursorPools
{ {
private final CursorPool<NodeCursor> nodeCursor; private final CursorPool<NodeCursor> nodeCursor;
private final CursorPool<StoreSingleRelationshipCursor> singleRelationshipCursor; private final CursorPool<SingleRelationshipCursor> singleRelationshipCursor;
private final CursorPool<StoreIteratorRelationshipCursor> iteratorRelationshipCursor; private final CursorPool<IteratorRelationshipCursor> iteratorRelationshipCursor;
private final CursorPool<StoreNodeRelationshipCursor> nodeRelationshipsCursor; private final CursorPool<NodeRelationshipCursor> nodeRelationshipsCursor;
private final CursorPool<PropertyCursor> propertyCursor; private final CursorPool<PropertyCursor> propertyCursor;
private final CursorPool<SinglePropertyCursor> singlePropertyCursor; private final CursorPool<SinglePropertyCursor> singlePropertyCursor;
private final CursorPool<RelationshipGroupCursor> relationshipGroupCursorCache; private final CursorPool<RelationshipGroupCursor> relationshipGroupCursorCache;
Expand All @@ -52,11 +52,11 @@ public GlobalCursorPools( NeoStores neoStores, LockService lockService )
this.nodeCursor = this.nodeCursor =
new CursorPool<>( 10, cache -> new NodeCursor( neoStores.getNodeStore(), cache, lockService ) ); new CursorPool<>( 10, cache -> new NodeCursor( neoStores.getNodeStore(), cache, lockService ) );
this.singleRelationshipCursor = new CursorPool<>( 10, this.singleRelationshipCursor = new CursorPool<>( 10,
cache -> new StoreSingleRelationshipCursor( neoStores.getRelationshipStore(), cache, lockService ) ); cache -> new SingleRelationshipCursor( neoStores.getRelationshipStore(), cache, lockService ) );
this.iteratorRelationshipCursor = new CursorPool<>( 10, this.iteratorRelationshipCursor = new CursorPool<>( 10,
cache -> new StoreIteratorRelationshipCursor( neoStores.getRelationshipStore(), cache, lockService ) ); cache -> new IteratorRelationshipCursor( neoStores.getRelationshipStore(), cache, lockService ) );
this.nodeRelationshipsCursor = new CursorPool<>( 10, this.nodeRelationshipsCursor = new CursorPool<>( 10,
cache -> new StoreNodeRelationshipCursor( neoStores.getRelationshipStore(), cache -> new NodeRelationshipCursor( neoStores.getRelationshipStore(),
neoStores.getRelationshipGroupStore(), cache, lockService ) ); neoStores.getRelationshipGroupStore(), cache, lockService ) );
this.propertyCursor = this.propertyCursor =
new CursorPool<>( 10, cache -> new PropertyCursor( neoStores.getPropertyStore(), cache ) ); new CursorPool<>( 10, cache -> new PropertyCursor( neoStores.getPropertyStore(), cache ) );
Expand Down
Expand Up @@ -32,20 +32,20 @@
/** /**
* Cursor for iterating a set of relationships. * Cursor for iterating a set of relationships.
*/ */
public class StoreIteratorRelationshipCursor extends StoreAbstractIteratorRelationshipCursor public class IteratorRelationshipCursor extends AbstractIteratorRelationshipCursor
{ {
private final Consumer<StoreIteratorRelationshipCursor> instanceCache; private final Consumer<IteratorRelationshipCursor> instanceCache;
private PrimitiveLongIterator iterator; private PrimitiveLongIterator iterator;


StoreIteratorRelationshipCursor( RelationshipStore relationshipStore, IteratorRelationshipCursor( RelationshipStore relationshipStore,
Consumer<StoreIteratorRelationshipCursor> instanceCache, Consumer<IteratorRelationshipCursor> instanceCache,
LockService lockService ) LockService lockService )
{ {
super( relationshipStore, lockService ); super( relationshipStore, lockService );
this.instanceCache = instanceCache; this.instanceCache = instanceCache;
} }


public StoreIteratorRelationshipCursor init( PrimitiveLongIterator iterator, ReadableTransactionState state ) public IteratorRelationshipCursor init( PrimitiveLongIterator iterator, ReadableTransactionState state )
{ {
internalInitTxState( state, addedRelationships( state ) ); internalInitTxState( state, addedRelationships( state ) );
this.iterator = iterator; this.iterator = iterator;
Expand Down
Expand Up @@ -45,11 +45,11 @@
* <p/> * <p/>
* This cursor handles both dense and non-dense nodes as source. * This cursor handles both dense and non-dense nodes as source.
*/ */
public class StoreNodeRelationshipCursor extends StoreAbstractIteratorRelationshipCursor public class NodeRelationshipCursor extends AbstractIteratorRelationshipCursor
{ {
private final RelationshipGroupRecord groupRecord; private final RelationshipGroupRecord groupRecord;
private final RelationshipGroupStore relationshipGroupStore; private final RelationshipGroupStore relationshipGroupStore;
private final Consumer<StoreNodeRelationshipCursor> instanceCache; private final Consumer<NodeRelationshipCursor> instanceCache;
private final PageCursor groupStorePageCursor; private final PageCursor groupStorePageCursor;


private boolean isDense; private boolean isDense;
Expand All @@ -60,9 +60,9 @@ public class StoreNodeRelationshipCursor extends StoreAbstractIteratorRelationsh
private int groupChainIndex; private int groupChainIndex;
private boolean end; private boolean end;


public StoreNodeRelationshipCursor( RelationshipStore relationshipStore, public NodeRelationshipCursor( RelationshipStore relationshipStore,
RelationshipGroupStore relationshipGroupStore, RelationshipGroupStore relationshipGroupStore,
Consumer<StoreNodeRelationshipCursor> instanceCache, Consumer<NodeRelationshipCursor> instanceCache,
LockService lockService ) LockService lockService )
{ {
super( relationshipStore, lockService ); super( relationshipStore, lockService );
Expand All @@ -72,22 +72,22 @@ public StoreNodeRelationshipCursor( RelationshipStore relationshipStore,
this.instanceCache = instanceCache; this.instanceCache = instanceCache;
} }


public StoreNodeRelationshipCursor init( boolean isDense, long firstRelId, long fromNodeId, Direction direction, public NodeRelationshipCursor init( boolean isDense, long firstRelId, long fromNodeId, Direction direction,
ReadableTransactionState state ) ReadableTransactionState state )
{ {
PrimitiveLongIterator addedNodeRelationships = addedNodeRelationships( fromNodeId, direction, null, state ); PrimitiveLongIterator addedNodeRelationships = addedNodeRelationships( fromNodeId, direction, null, state );
return init( isDense, firstRelId, fromNodeId, direction, ALWAYS_TRUE_INT, state, addedNodeRelationships ); return init( isDense, firstRelId, fromNodeId, direction, ALWAYS_TRUE_INT, state, addedNodeRelationships );
} }


public StoreNodeRelationshipCursor init( boolean isDense, long firstRelId, long fromNodeId, Direction direction, public NodeRelationshipCursor init( boolean isDense, long firstRelId, long fromNodeId, Direction direction,
int[] allowedTypes, ReadableTransactionState state ) int[] allowedTypes, ReadableTransactionState state )
{ {
PrimitiveLongIterator addedNodeRelationships = PrimitiveLongIterator addedNodeRelationships =
addedNodeRelationships( fromNodeId, direction, allowedTypes, state ); addedNodeRelationships( fromNodeId, direction, allowedTypes, state );
return init( isDense, firstRelId, fromNodeId, direction, any( allowedTypes ), state, addedNodeRelationships ); return init( isDense, firstRelId, fromNodeId, direction, any( allowedTypes ), state, addedNodeRelationships );
} }


private StoreNodeRelationshipCursor init( boolean isDense, long firstRelId, long fromNodeId, Direction direction, private NodeRelationshipCursor init( boolean isDense, long firstRelId, long fromNodeId, Direction direction,
IntPredicate allowedTypes, ReadableTransactionState state, PrimitiveLongIterator addedNodeRelationships ) IntPredicate allowedTypes, ReadableTransactionState state, PrimitiveLongIterator addedNodeRelationships )
{ {
internalInitTxState( state, addedNodeRelationships ); internalInitTxState( state, addedNodeRelationships );
Expand Down
Expand Up @@ -33,20 +33,20 @@
/** /**
* Cursor for a single relationship. * Cursor for a single relationship.
*/ */
public class StoreSingleRelationshipCursor extends StoreAbstractRelationshipCursor public class SingleRelationshipCursor extends AbstractRelationshipCursor
{ {
private final Consumer<StoreSingleRelationshipCursor> consumer; private final Consumer<SingleRelationshipCursor> consumer;
private long relationshipId = NO_SUCH_RELATIONSHIP; private long relationshipId = NO_SUCH_RELATIONSHIP;
private ReadableTransactionState state; private ReadableTransactionState state;


StoreSingleRelationshipCursor( RelationshipStore relationshipStore, SingleRelationshipCursor( RelationshipStore relationshipStore,
Consumer<StoreSingleRelationshipCursor> consumer, LockService lockService ) Consumer<SingleRelationshipCursor> consumer, LockService lockService )
{ {
super( relationshipStore, lockService ); super( relationshipStore, lockService );
this.consumer = consumer; this.consumer = consumer;
} }


public StoreSingleRelationshipCursor init( long relId, ReadableTransactionState state ) public SingleRelationshipCursor init( long relId, ReadableTransactionState state )
{ {
this.relationshipId = relId; this.relationshipId = relId;
this.state = state; this.state = state;
Expand Down
Expand Up @@ -23,14 +23,13 @@


import org.neo4j.graphdb.NotFoundException; import org.neo4j.graphdb.NotFoundException;
import org.neo4j.helpers.collection.PrefetchingIterator; import org.neo4j.helpers.collection.PrefetchingIterator;
import org.neo4j.kernel.impl.api.store.StoreNodeRelationshipCursor; import org.neo4j.kernel.impl.api.store.NodeRelationshipCursor;
import org.neo4j.kernel.impl.store.InvalidRecordException; import org.neo4j.kernel.impl.store.InvalidRecordException;
import org.neo4j.kernel.impl.store.NeoStores; import org.neo4j.kernel.impl.store.NeoStores;
import org.neo4j.kernel.impl.store.NodeStore; import org.neo4j.kernel.impl.store.NodeStore;
import org.neo4j.kernel.impl.store.RelationshipGroupStore; import org.neo4j.kernel.impl.store.RelationshipGroupStore;
import org.neo4j.kernel.impl.store.RelationshipStore; import org.neo4j.kernel.impl.store.RelationshipStore;
import org.neo4j.kernel.impl.store.record.NodeRecord; import org.neo4j.kernel.impl.store.record.NodeRecord;
import org.neo4j.storageengine.api.txstate.ReadableTransactionState;


import static org.neo4j.kernel.impl.locking.LockService.NO_LOCK_SERVICE; import static org.neo4j.kernel.impl.locking.LockService.NO_LOCK_SERVICE;
import static org.neo4j.kernel.impl.store.record.RecordLoad.NORMAL; import static org.neo4j.kernel.impl.store.record.RecordLoad.NORMAL;
Expand All @@ -39,13 +38,13 @@


abstract class BatchRelationshipIterable<T> implements Iterable<T> abstract class BatchRelationshipIterable<T> implements Iterable<T>
{ {
private final StoreNodeRelationshipCursor relationshipCursor; private final NodeRelationshipCursor relationshipCursor;


BatchRelationshipIterable( NeoStores neoStores, long nodeId ) BatchRelationshipIterable( NeoStores neoStores, long nodeId )
{ {
RelationshipStore relationshipStore = neoStores.getRelationshipStore(); RelationshipStore relationshipStore = neoStores.getRelationshipStore();
RelationshipGroupStore relationshipGroupStore = neoStores.getRelationshipGroupStore(); RelationshipGroupStore relationshipGroupStore = neoStores.getRelationshipGroupStore();
this.relationshipCursor = new StoreNodeRelationshipCursor( relationshipStore, relationshipGroupStore, this.relationshipCursor = new NodeRelationshipCursor( relationshipStore, relationshipGroupStore,
cursor -> {}, NO_LOCK_SERVICE ); cursor -> {}, NO_LOCK_SERVICE );


// TODO There's an opportunity to reuse lots of instances created here, but this isn't a // TODO There's an opportunity to reuse lots of instances created here, but this isn't a
Expand Down
Expand Up @@ -38,14 +38,14 @@
import static org.neo4j.kernel.impl.locking.LockService.NO_LOCK_SERVICE; import static org.neo4j.kernel.impl.locking.LockService.NO_LOCK_SERVICE;
import static org.neo4j.kernel.impl.store.record.RecordLoad.CHECK; import static org.neo4j.kernel.impl.store.record.RecordLoad.CHECK;


public class StoreIteratorRelationshipCursorTest public class IteratorRelationshipCursorTest
{ {
private static final long RELATIONSHIP_ID = 1L; private static final long RELATIONSHIP_ID = 1L;


@Test @Test
public void retrieveUsedRelationship() throws Exception public void retrieveUsedRelationship() throws Exception
{ {
try ( StoreIteratorRelationshipCursor cursor = createRelationshipCursor( true ) ) try ( IteratorRelationshipCursor cursor = createRelationshipCursor( true ) )
{ {
cursor.init( PrimitiveLongCollections.iterator( RELATIONSHIP_ID ), ReadableTransactionState.EMPTY ); cursor.init( PrimitiveLongCollections.iterator( RELATIONSHIP_ID ), ReadableTransactionState.EMPTY );
assertTrue( cursor.next() ); assertTrue( cursor.next() );
Expand All @@ -56,7 +56,7 @@ public void retrieveUsedRelationship() throws Exception
@Test @Test
public void retrieveUnusedRelationship() throws IOException public void retrieveUnusedRelationship() throws IOException
{ {
try ( StoreIteratorRelationshipCursor cursor = createRelationshipCursor( false ) ) try ( IteratorRelationshipCursor cursor = createRelationshipCursor( false ) )
{ {
cursor.init( PrimitiveLongCollections.iterator( RELATIONSHIP_ID ), ReadableTransactionState.EMPTY ); cursor.init( PrimitiveLongCollections.iterator( RELATIONSHIP_ID ), ReadableTransactionState.EMPTY );
assertFalse( cursor.next() ); assertFalse( cursor.next() );
Expand All @@ -66,7 +66,7 @@ public void retrieveUnusedRelationship() throws IOException
@Test @Test
public void shouldCloseThePageCursorWhenDisposed() throws IOException public void shouldCloseThePageCursorWhenDisposed() throws IOException
{ {
StoreIteratorRelationshipCursor cursor = createRelationshipCursor( false ); IteratorRelationshipCursor cursor = createRelationshipCursor( false );
cursor.close(); cursor.close();
cursor.dispose(); cursor.dispose();


Expand All @@ -75,7 +75,7 @@ public void shouldCloseThePageCursorWhenDisposed() throws IOException


private final PageCursor pageCursor = mock( PageCursor.class ); private final PageCursor pageCursor = mock( PageCursor.class );


private StoreIteratorRelationshipCursor createRelationshipCursor( boolean relationshipInUse ) throws IOException private IteratorRelationshipCursor createRelationshipCursor( boolean relationshipInUse ) throws IOException
{ {
final RelationshipRecord relationshipRecord = new RelationshipRecord( -1 ); final RelationshipRecord relationshipRecord = new RelationshipRecord( -1 );
RelationshipStore relationshipStore = mock( RelationshipStore.class ); RelationshipStore relationshipStore = mock( RelationshipStore.class );
Expand All @@ -87,10 +87,10 @@ private StoreIteratorRelationshipCursor createRelationshipCursor( boolean relati
relationshipRecord.setId( RELATIONSHIP_ID ); relationshipRecord.setId( RELATIONSHIP_ID );
return relationshipRecord; return relationshipRecord;
}); });
return new StoreIteratorRelationshipCursor( relationshipStore, this::noCache, NO_LOCK_SERVICE ); return new IteratorRelationshipCursor( relationshipStore, this::noCache, NO_LOCK_SERVICE );
} }


private void noCache( StoreIteratorRelationshipCursor c ) private void noCache( IteratorRelationshipCursor c )
{ {


} }
Expand Down
Expand Up @@ -60,7 +60,6 @@
import org.neo4j.logging.NullLogProvider; import org.neo4j.logging.NullLogProvider;
import org.neo4j.storageengine.api.Direction; import org.neo4j.storageengine.api.Direction;
import org.neo4j.storageengine.api.RelationshipItem; import org.neo4j.storageengine.api.RelationshipItem;
import org.neo4j.storageengine.api.txstate.ReadableTransactionState;
import org.neo4j.test.rule.RandomRule; import org.neo4j.test.rule.RandomRule;
import org.neo4j.test.rule.TestDirectory; import org.neo4j.test.rule.TestDirectory;


Expand All @@ -87,14 +86,14 @@
import static org.neo4j.storageengine.api.txstate.ReadableTransactionState.EMPTY; import static org.neo4j.storageengine.api.txstate.ReadableTransactionState.EMPTY;


@RunWith( Parameterized.class ) @RunWith( Parameterized.class )
public class StoreNodeRelationshipCursorTest public class NodeRelationshipCursorTest
{ {
private static final long FIRST_OWNING_NODE = 1; private static final long FIRST_OWNING_NODE = 1;
private static final long SECOND_OWNING_NODE = 2; private static final long SECOND_OWNING_NODE = 2;
private static final int TYPE = 0; private static final int TYPE = 0;


@ClassRule @ClassRule
public static TestDirectory directory = TestDirectory.testDirectory( StoreNodeRelationshipCursorTest.class ); public static TestDirectory directory = TestDirectory.testDirectory( NodeRelationshipCursorTest.class );


private static FileSystemAbstraction fs; private static FileSystemAbstraction fs;
private static PageCache pageCache; private static PageCache pageCache;
Expand Down Expand Up @@ -144,7 +143,7 @@ public void retrieveNodeRelationships() throws Exception
{ {
createNodeRelationships(); createNodeRelationships();


try ( StoreNodeRelationshipCursor cursor = nodeRelationshipCursor() ) try ( NodeRelationshipCursor cursor = nodeRelationshipCursor() )
{ {
cursor.init( dense, 1L, FIRST_OWNING_NODE, direction, EMPTY ); cursor.init( dense, 1L, FIRST_OWNING_NODE, direction, EMPTY );
assertTrue( cursor.next() ); assertTrue( cursor.next() );
Expand All @@ -162,7 +161,7 @@ public void retrieveUsedRelationshipChain()
{ {
createRelationshipChain( 4 ); createRelationshipChain( 4 );
long expectedNodeId = 1; long expectedNodeId = 1;
try ( StoreNodeRelationshipCursor cursor = nodeRelationshipCursor() ) try ( NodeRelationshipCursor cursor = nodeRelationshipCursor() )
{ {
cursor.init( dense, 1, FIRST_OWNING_NODE, direction, EMPTY ); cursor.init( dense, 1, FIRST_OWNING_NODE, direction, EMPTY );
while ( cursor.next() ) while ( cursor.next() )
Expand All @@ -180,7 +179,7 @@ public void retrieveRelationshipChainWithUnusedLink()
unUseRecord( 3 ); unUseRecord( 3 );
int[] expectedRelationshipIds = new int[]{1, 2, 4}; int[] expectedRelationshipIds = new int[]{1, 2, 4};
int relationshipIndex = 0; int relationshipIndex = 0;
try ( StoreNodeRelationshipCursor cursor = nodeRelationshipCursor() ) try ( NodeRelationshipCursor cursor = nodeRelationshipCursor() )
{ {
cursor.init( dense, 1, FIRST_OWNING_NODE, direction, EMPTY ); cursor.init( dense, 1, FIRST_OWNING_NODE, direction, EMPTY );
while ( cursor.next() ) while ( cursor.next() )
Expand All @@ -198,7 +197,7 @@ public void shouldHandleDenseNodeWithNoRelationships() throws Exception
// but we don't downgrade dense --> sparse when we delete relationships. So if we have a dense node // but we don't downgrade dense --> sparse when we delete relationships. So if we have a dense node
// which no longer has relationships, there was this assumption that we could just call getRecord // which no longer has relationships, there was this assumption that we could just call getRecord
// on the NodeRecord#getNextRel() value. Although that value could actually be -1 // on the NodeRecord#getNextRel() value. Although that value could actually be -1
try ( StoreNodeRelationshipCursor cursor = nodeRelationshipCursor() ) try ( NodeRelationshipCursor cursor = nodeRelationshipCursor() )
{ {
// WHEN // WHEN
cursor.init( dense, NO_NEXT_RELATIONSHIP.intValue(), FIRST_OWNING_NODE, direction, EMPTY ); cursor.init( dense, NO_NEXT_RELATIONSHIP.intValue(), FIRST_OWNING_NODE, direction, EMPTY );
Expand Down Expand Up @@ -291,8 +290,8 @@ public void shouldClosePageCursorsWhenDisposed()
RelationshipGroupStore relationshipGroupStore = mock( RelationshipGroupStore.class ); RelationshipGroupStore relationshipGroupStore = mock( RelationshipGroupStore.class );
PageCursor relationshipGroupCursor = mock( PageCursor.class ); PageCursor relationshipGroupCursor = mock( PageCursor.class );
when( relationshipGroupStore.newPageCursor() ).thenReturn( relationshipGroupCursor ); when( relationshipGroupStore.newPageCursor() ).thenReturn( relationshipGroupCursor );
StoreNodeRelationshipCursor cursor = NodeRelationshipCursor cursor =
new StoreNodeRelationshipCursor( relationshipStore, relationshipGroupStore, this::noCache, new NodeRelationshipCursor( relationshipStore, relationshipGroupStore, this::noCache,
NO_LOCK_SERVICE ); NO_LOCK_SERVICE );


cursor.close(); cursor.close();
Expand Down Expand Up @@ -335,8 +334,8 @@ private Cursor<RelationshipItem> cursor( long nodeId, Map<Long,RelationshipItem>
return record; return record;
} ).when( relationshipStore ) } ).when( relationshipStore )
.readRecord( anyLong(), eq( relationshipRecord ), any( RecordLoad.class ), any( PageCursor.class ) ); .readRecord( anyLong(), eq( relationshipRecord ), any( RecordLoad.class ), any( PageCursor.class ) );
StoreNodeRelationshipCursor cursor = NodeRelationshipCursor cursor =
new StoreNodeRelationshipCursor( relationshipStore, mock( RelationshipGroupStore.class ), this::noCache, new NodeRelationshipCursor( relationshipStore, mock( RelationshipGroupStore.class ), this::noCache,
NO_LOCK_SERVICE ); NO_LOCK_SERVICE );


return relationshipTypes == null return relationshipTypes == null
Expand Down Expand Up @@ -528,9 +527,9 @@ private long getFirstNode()
return direction == OUTGOING ? FIRST_OWNING_NODE : SECOND_OWNING_NODE; return direction == OUTGOING ? FIRST_OWNING_NODE : SECOND_OWNING_NODE;
} }


private StoreNodeRelationshipCursor nodeRelationshipCursor() private NodeRelationshipCursor nodeRelationshipCursor()
{ {
return new StoreNodeRelationshipCursor( neoStores.getRelationshipStore(), neoStores.getRelationshipGroupStore(), return new NodeRelationshipCursor( neoStores.getRelationshipStore(), neoStores.getRelationshipGroupStore(),
this::noCache, NO_LOCK_SERVICE ); this::noCache, NO_LOCK_SERVICE );
} }


Expand Down
Expand Up @@ -40,7 +40,7 @@
import static org.neo4j.kernel.impl.locking.LockService.NO_LOCK_SERVICE; import static org.neo4j.kernel.impl.locking.LockService.NO_LOCK_SERVICE;
import static org.neo4j.storageengine.api.txstate.ReadableTransactionState.EMPTY; import static org.neo4j.storageengine.api.txstate.ReadableTransactionState.EMPTY;


public class StoreSingleRelationshipCursorTest public class SingleRelationshipCursorTest
{ {


private static final long RELATIONSHIP_ID = 1L; private static final long RELATIONSHIP_ID = 1L;
Expand Down Expand Up @@ -76,7 +76,7 @@ public void retrieveUsedRelationship() throws Exception
RelationshipStore relationshipStore = neoStores.getRelationshipStore(); RelationshipStore relationshipStore = neoStores.getRelationshipStore();
createRelationshipRecord( relationshipStore, true ); createRelationshipRecord( relationshipStore, true );


try ( StoreSingleRelationshipCursor cursor = createRelationshipCursor() ) try ( SingleRelationshipCursor cursor = createRelationshipCursor() )
{ {
cursor.init( RELATIONSHIP_ID, EMPTY ); cursor.init( RELATIONSHIP_ID, EMPTY );
assertTrue( cursor.next() ); assertTrue( cursor.next() );
Expand All @@ -91,7 +91,7 @@ public void retrieveUnusedRelationship()
relationshipStore.setHighId( 10 ); relationshipStore.setHighId( 10 );
createRelationshipRecord( relationshipStore, false ); createRelationshipRecord( relationshipStore, false );


try ( StoreSingleRelationshipCursor cursor = createRelationshipCursor() ) try ( SingleRelationshipCursor cursor = createRelationshipCursor() )
{ {
cursor.init( RELATIONSHIP_ID, EMPTY ); cursor.init( RELATIONSHIP_ID, EMPTY );
assertFalse( cursor.next() ); assertFalse( cursor.next() );
Expand All @@ -110,12 +110,12 @@ private StoreFactory getStoreFactory()
fileSystemRule.get(), NullLogProvider.getInstance() ); fileSystemRule.get(), NullLogProvider.getInstance() );
} }


private StoreSingleRelationshipCursor createRelationshipCursor() private SingleRelationshipCursor createRelationshipCursor()
{ {
return new StoreSingleRelationshipCursor( neoStores.getRelationshipStore(), this::noCache, NO_LOCK_SERVICE ); return new SingleRelationshipCursor( neoStores.getRelationshipStore(), this::noCache, NO_LOCK_SERVICE );
} }


private void noCache( StoreSingleRelationshipCursor c ) private void noCache( SingleRelationshipCursor c )
{ {
} }
} }

0 comments on commit 9315163

Please sign in to comment.