Skip to content

Commit

Permalink
Remove the now unused next( id, record, mode) API from RecordCursor
Browse files Browse the repository at this point in the history
  • Loading branch information
davidegrohmann committed May 8, 2017
1 parent 7f9d75a commit 5e760ad
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 48 deletions.
Expand Up @@ -44,7 +44,7 @@ protected <R extends AbstractBaseRecord> RecordStore<R> wrapStore( RecordStore<R
{
AccessStats accessStats = new AccessStats( store.getClass().getSimpleName(), store.getRecordsPerPage() );
accessStatistics.register( store, accessStats );
return new AccessStatsKeepingRecordStore( store, accessStats );
return new AccessStatsKeepingRecordStore<>( store, accessStats );
}

private static class AccessStatsKeepingRecordStore<RECORD extends AbstractBaseRecord>
Expand All @@ -58,11 +58,6 @@ private static class AccessStatsKeepingRecordStore<RECORD extends AbstractBaseRe
this.accessStats = accessStats;
}

protected AccessStats getAccessStats()
{
return accessStats;
}

@Override
public RECORD getRecord( long id, RECORD record, RecordLoad load )
{
Expand Down
Expand Up @@ -77,20 +77,6 @@ public interface RecordCursor<R extends AbstractBaseRecord> extends Cursor<R>
*/
boolean next( long id );

/**
* An additional way of placing this cursor at an arbitrary record id.
* Calling this method will not advance the "current id" as to change which {@link #next()} will load next.
* This method is useful when there's an opportunity to load a record from an already acquired
* {@link PageCursor} and potentially even an already pinned page.
*
* @param id record id to place cursor at.
* @param record record to load the record data into.
* @param mode {@link RecordLoad} mode temporarily overriding the default provided in
* {@link #acquire(long, RecordLoad)}.
* @return whether or not that record is in use.
*/
boolean next( long id, R record, RecordLoad mode );

/**
* Read all records in the chain starting from the id this cursor is positioned at using either
* {@link #acquire(long, RecordLoad)} or {@link #placeAt(long, RecordLoad)}. Each next record in the chain is
Expand Down Expand Up @@ -155,11 +141,5 @@ public boolean next( long id )
{
return actual.next( id );
}

@Override
public boolean next( long id, R record, RecordLoad mode )
{
return actual.next( id, record, mode );
}
}
}
Expand Up @@ -47,7 +47,7 @@ public boolean next()
{
try
{
return next( currentId, record, mode );
return next( currentId );
}
finally
{
Expand All @@ -62,12 +62,6 @@ public boolean next()

@Override
public boolean next( long id )
{
return next( id, record, mode );
}

@Override
public boolean next( long id, RECORD record, RecordLoad mode )
{
assert pageCursor != null : "Not initialized";
if ( NULL_REFERENCE.is( id ) )
Expand Down
Expand Up @@ -257,7 +257,7 @@ public void pageCursorErrorsMustNotLingerInRecordCursor() throws Exception
// This will encounter a decoding error, which is ignored because FORCE
assertTrue( cursor.next() );
// Then this should not fail because of the previous decoding error, even though we stay on the same page
assertTrue( cursor.next( 2, new IntRecord( 2 ), NORMAL ) );
assertTrue( cursor.next( 2 ) );
}

@Test
Expand All @@ -277,10 +277,6 @@ public void shouldReadTheCorrectRecordWhenGivenAnExplicitIdAndNotUseTheCurrentId
assertTrue( cursor.next( 43 ) );
assertEquals( record43, cursor.get() );

IntRecord record = new IntRecord( -1 );
assertTrue( cursor.next( 43, record, NORMAL ) );
assertEquals( record43, record );

// next with id does not affect the old pointer either, so 42 is read now
assertTrue( cursor.next() );
assertEquals( record42, cursor.get() );
Expand All @@ -305,10 +301,6 @@ public void shouldJumpAroundPageIds() throws Exception
assertTrue( cursor.next( idOnAnotherPage ) );
assertEquals( record43, cursor.get() );

IntRecord record = new IntRecord( -1 );
assertTrue( cursor.next( idOnAnotherPage, record, NORMAL ) );
assertEquals( record43, record );

// next with id does not affect the old pointer either, so 42 is read now
assertTrue( cursor.next() );
assertEquals( record42, cursor.get() );
Expand Down
Expand Up @@ -157,11 +157,5 @@ public boolean next( long id )
record.setId( id );
return populator.test( record );
}

@Override
public boolean next( long id, RECORD record, RecordLoad mode )
{
throw new UnsupportedOperationException();
}
}
}

0 comments on commit 5e760ad

Please sign in to comment.