Skip to content

Commit

Permalink
Remove 'Schema' from NativeSchemaIndex and sub-components
Browse files Browse the repository at this point in the history
Naming convention was inconsistent between including or excluding
'Schema' as part of class name and including 'Schema' adds very
little additional information and clutters naming.

For example
TemporalIndexAccessor and StringSchemaIndexAccessor.
  • Loading branch information
burqen committed Jun 13, 2018
1 parent 0f3a067 commit d063062
Show file tree
Hide file tree
Showing 133 changed files with 543 additions and 543 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*
* @param <VALUE> type of values being merged.
*/
class ConflictDetectingValueMerger<KEY extends NativeSchemaKey<KEY>, VALUE extends NativeSchemaValue> implements ValueMerger<KEY,VALUE>
class ConflictDetectingValueMerger<KEY extends NativeIndexKey<KEY>, VALUE extends NativeIndexValue> implements ValueMerger<KEY,VALUE>
{
private final boolean compareEntityIds;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* Includes value and entity id (to be able to handle non-unique values). A value can be any {@link DateValue}.
*/
class DateSchemaKey extends NativeSchemaKey<DateSchemaKey>
class DateIndexKey extends NativeIndexKey<DateIndexKey>
{
static final int SIZE =
Long.BYTES + /* epochDay */
Expand All @@ -54,7 +54,7 @@ void initValueAsHighest()
}

@Override
public int compareValueTo( DateSchemaKey other )
public int compareValueTo( DateIndexKey other )
{
return Long.compare( epochDay, other.epochDay );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@
/**
* {@link Layout} for dates.
*/
class DateLayout extends SchemaLayout<DateSchemaKey>
class DateLayout extends IndexLayout<DateIndexKey>
{
DateLayout()
{
super( "Tda", 0, 1 );
}

@Override
public DateSchemaKey newKey()
public DateIndexKey newKey()
{
return new DateSchemaKey();
return new DateIndexKey();
}

@Override
public DateSchemaKey copyKey( DateSchemaKey key, DateSchemaKey into )
public DateIndexKey copyKey( DateIndexKey key, DateIndexKey into )
{
into.epochDay = key.epochDay;
into.setEntityId( key.getEntityId() );
Expand All @@ -48,20 +48,20 @@ public DateSchemaKey copyKey( DateSchemaKey key, DateSchemaKey into )
}

@Override
public int keySize( DateSchemaKey key )
public int keySize( DateIndexKey key )
{
return DateSchemaKey.SIZE;
return DateIndexKey.SIZE;
}

@Override
public void writeKey( PageCursor cursor, DateSchemaKey key )
public void writeKey( PageCursor cursor, DateIndexKey key )
{
cursor.putLong( key.epochDay );
cursor.putLong( key.getEntityId() );
}

@Override
public void readKey( PageCursor cursor, DateSchemaKey into, int keySize )
public void readKey( PageCursor cursor, DateIndexKey into, int keySize )
{
into.epochDay = cursor.getLong();
into.setEntityId( cursor.getLong() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* Durations are tricky, because exactly how long a duration is depends on the start date. We therefore sort them by
* average total time in seconds, but keep the original months and days so we can reconstruct the value.
*/
class DurationSchemaKey extends NativeSchemaKey<DurationSchemaKey>
class DurationIndexKey extends NativeIndexKey<DurationIndexKey>
{
/**
* An average month is 30 days, 10 hours and 30 minutes.
Expand Down Expand Up @@ -77,7 +77,7 @@ public void initValueAsHighest()
}

@Override
public int compareValueTo( DurationSchemaKey other )
public int compareValueTo( DurationIndexKey other )
{
int comparison = Long.compare( totalAvgSeconds, other.totalAvgSeconds );
if ( comparison == 0 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@
/**
* {@link Layout} for durations.
*/
class DurationLayout extends SchemaLayout<DurationSchemaKey>
class DurationLayout extends IndexLayout<DurationIndexKey>
{
DurationLayout()
{
super( "Tdu", 0, 1 );
}

@Override
public DurationSchemaKey newKey()
public DurationIndexKey newKey()
{
return new DurationSchemaKey();
return new DurationIndexKey();
}

@Override
public DurationSchemaKey copyKey( DurationSchemaKey key, DurationSchemaKey into )
public DurationIndexKey copyKey( DurationIndexKey key, DurationIndexKey into )
{
into.totalAvgSeconds = key.totalAvgSeconds;
into.nanosOfSecond = key.nanosOfSecond;
Expand All @@ -51,13 +51,13 @@ public DurationSchemaKey copyKey( DurationSchemaKey key, DurationSchemaKey into
}

@Override
public int keySize( DurationSchemaKey key )
public int keySize( DurationIndexKey key )
{
return DurationSchemaKey.SIZE;
return DurationIndexKey.SIZE;
}

@Override
public void writeKey( PageCursor cursor, DurationSchemaKey key )
public void writeKey( PageCursor cursor, DurationIndexKey key )
{
cursor.putLong( key.totalAvgSeconds );
cursor.putInt( key.nanosOfSecond );
Expand All @@ -67,7 +67,7 @@ public void writeKey( PageCursor cursor, DurationSchemaKey key )
}

@Override
public void readKey( PageCursor cursor, DurationSchemaKey into, int keySize )
public void readKey( PageCursor cursor, DurationIndexKey into, int keySize )
{
into.totalAvgSeconds = cursor.getLong();
into.nanosOfSecond = cursor.getInt();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class FailureHeaderWriter implements Consumer<PageCursor>
public void accept( PageCursor cursor )
{
byte[] bytesToWrite = failureBytes;
cursor.putByte( NativeSchemaIndexPopulator.BYTE_FAILED );
cursor.putByte( NativeIndexPopulator.BYTE_FAILED );
int availableSpace = cursor.getCurrentPageSize() - cursor.getOffset();
if ( bytesToWrite.length + HEADER_LENGTH_FIELD_LENGTH > availableSpace )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.neo4j.internal.kernel.api.IndexQuery;
import org.neo4j.values.storable.Value;

class FilteringNativeHitIndexProgressor<KEY extends NativeSchemaKey<KEY>, VALUE extends NativeSchemaValue> extends NativeHitIndexProgressor<KEY,VALUE>
class FilteringNativeHitIndexProgressor<KEY extends NativeIndexKey<KEY>, VALUE extends NativeIndexValue> extends NativeHitIndexProgressor<KEY,VALUE>
{
private final IndexQuery[] filter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.neo4j.internal.kernel.api.IndexQuery;
import org.neo4j.values.storable.Value;

class FilteringNativeHitIterator<KEY extends NativeSchemaKey<KEY>, VALUE extends NativeSchemaValue> extends NativeHitIterator<KEY,VALUE>
class FilteringNativeHitIterator<KEY extends NativeIndexKey<KEY>, VALUE extends NativeIndexValue> extends NativeHitIterator<KEY,VALUE>
{
private final IndexQuery[] filters;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @param <KEY> type of keys in tree.
* @param <VALUE> type of values in tree.
*/
class FullScanNonUniqueIndexSampler<KEY extends NativeSchemaKey<KEY>, VALUE extends NativeSchemaValue>
class FullScanNonUniqueIndexSampler<KEY extends NativeIndexKey<KEY>, VALUE extends NativeIndexValue>
extends NonUniqueIndexSampler.Adapter
{
private final GBPTree<KEY,VALUE> gbpTree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,45 +22,45 @@
import org.neo4j.index.internal.gbptree.Layout;
import org.neo4j.io.pagecache.PageCursor;

abstract class SchemaLayout<KEY extends NativeSchemaKey<KEY>> extends Layout.Adapter<KEY,NativeSchemaValue>
abstract class IndexLayout<KEY extends NativeIndexKey<KEY>> extends Layout.Adapter<KEY,NativeIndexValue>
{
private final long identifier;
private final int majorVersion;
private final int minorVersion;

// allows more control of the identifier, needed for legacy reasons for the two number layouts
SchemaLayout( long identifier, int majorVersion, int minorVersion )
IndexLayout( long identifier, int majorVersion, int minorVersion )
{
this.identifier = identifier;
this.majorVersion = majorVersion;
this.minorVersion = minorVersion;
}

SchemaLayout( String layoutName, int majorVersion, int minorVersion )
IndexLayout( String layoutName, int majorVersion, int minorVersion )
{
this( Layout.namedIdentifier( layoutName, NativeSchemaValue.SIZE ), majorVersion, minorVersion );
this( Layout.namedIdentifier( layoutName, NativeIndexValue.SIZE ), majorVersion, minorVersion );
}

@Override
public NativeSchemaValue newValue()
public NativeIndexValue newValue()
{
return NativeSchemaValue.INSTANCE;
return NativeIndexValue.INSTANCE;
}

@Override
public int valueSize( NativeSchemaValue nativeSchemaValue )
public int valueSize( NativeIndexValue nativeIndexValue )
{
return NativeSchemaValue.SIZE;
return NativeIndexValue.SIZE;
}

@Override
public void writeValue( PageCursor cursor, NativeSchemaValue nativeSchemaValue )
public void writeValue( PageCursor cursor, NativeIndexValue nativeIndexValue )
{
// nothing to write
}

@Override
public void readValue( PageCursor cursor, NativeSchemaValue into, int valueSize )
public void readValue( PageCursor cursor, NativeIndexValue into, int valueSize )
{
// nothing to read
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* Includes value and entity id (to be able to handle non-unique values). A value can be any {@link LocalDateTimeValue}.
*/
class LocalDateTimeSchemaKey extends NativeSchemaKey<LocalDateTimeSchemaKey>
class LocalDateTimeIndexKey extends NativeIndexKey<LocalDateTimeIndexKey>
{
static final int SIZE =
Long.BYTES + /* epochSecond */
Expand Down Expand Up @@ -58,7 +58,7 @@ public void initValueAsHighest()
}

@Override
public int compareValueTo( LocalDateTimeSchemaKey other )
public int compareValueTo( LocalDateTimeIndexKey other )
{
int compare = Long.compare( epochSecond, other.epochSecond );
if ( compare == 0 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@
/**
* {@link Layout} for local date times.
*/
class LocalDateTimeLayout extends SchemaLayout<LocalDateTimeSchemaKey>
class LocalDateTimeLayout extends IndexLayout<LocalDateTimeIndexKey>
{
LocalDateTimeLayout()
{
super( "Tld", 0, 1 );
}

@Override
public LocalDateTimeSchemaKey newKey()
public LocalDateTimeIndexKey newKey()
{
return new LocalDateTimeSchemaKey();
return new LocalDateTimeIndexKey();
}

@Override
public LocalDateTimeSchemaKey copyKey( LocalDateTimeSchemaKey key, LocalDateTimeSchemaKey into )
public LocalDateTimeIndexKey copyKey( LocalDateTimeIndexKey key, LocalDateTimeIndexKey into )
{
into.epochSecond = key.epochSecond;
into.nanoOfSecond = key.nanoOfSecond;
Expand All @@ -49,21 +49,21 @@ public LocalDateTimeSchemaKey copyKey( LocalDateTimeSchemaKey key, LocalDateTime
}

@Override
public int keySize( LocalDateTimeSchemaKey key )
public int keySize( LocalDateTimeIndexKey key )
{
return LocalDateTimeSchemaKey.SIZE;
return LocalDateTimeIndexKey.SIZE;
}

@Override
public void writeKey( PageCursor cursor, LocalDateTimeSchemaKey key )
public void writeKey( PageCursor cursor, LocalDateTimeIndexKey key )
{
cursor.putLong( key.epochSecond );
cursor.putInt( key.nanoOfSecond );
cursor.putLong( key.getEntityId() );
}

@Override
public void readKey( PageCursor cursor, LocalDateTimeSchemaKey into, int keySize )
public void readKey( PageCursor cursor, LocalDateTimeIndexKey into, int keySize )
{
into.epochSecond = cursor.getLong();
into.nanoOfSecond = cursor.getInt();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* Includes value and entity id (to be able to handle non-unique values). A value can be any {@link LocalTimeValue}.
*/
class LocalTimeSchemaKey extends NativeSchemaKey<LocalTimeSchemaKey>
class LocalTimeIndexKey extends NativeIndexKey<LocalTimeIndexKey>
{
static final int SIZE =
Long.BYTES + /* nanoOfDay */
Expand All @@ -54,7 +54,7 @@ public void initValueAsHighest()
}

@Override
public int compareValueTo( LocalTimeSchemaKey other )
public int compareValueTo( LocalTimeIndexKey other )
{
return Long.compare( nanoOfDay, other.nanoOfDay );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@
/**
* {@link Layout} for local times.
*/
class LocalTimeLayout extends SchemaLayout<LocalTimeSchemaKey>
class LocalTimeLayout extends IndexLayout<LocalTimeIndexKey>
{
LocalTimeLayout()
{
super( "Tlt", 0, 1 );
}

@Override
public LocalTimeSchemaKey newKey()
public LocalTimeIndexKey newKey()
{
return new LocalTimeSchemaKey();
return new LocalTimeIndexKey();
}

@Override
public LocalTimeSchemaKey copyKey( LocalTimeSchemaKey key, LocalTimeSchemaKey into )
public LocalTimeIndexKey copyKey( LocalTimeIndexKey key, LocalTimeIndexKey into )
{
into.nanoOfDay = key.nanoOfDay;
into.setEntityId( key.getEntityId() );
Expand All @@ -48,20 +48,20 @@ public LocalTimeSchemaKey copyKey( LocalTimeSchemaKey key, LocalTimeSchemaKey in
}

@Override
public int keySize( LocalTimeSchemaKey key )
public int keySize( LocalTimeIndexKey key )
{
return LocalTimeSchemaKey.SIZE;
return LocalTimeIndexKey.SIZE;
}

@Override
public void writeKey( PageCursor cursor, LocalTimeSchemaKey key )
public void writeKey( PageCursor cursor, LocalTimeIndexKey key )
{
cursor.putLong( key.nanoOfDay );
cursor.putLong( key.getEntityId() );
}

@Override
public void readKey( PageCursor cursor, LocalTimeSchemaKey into, int keySize )
public void readKey( PageCursor cursor, LocalTimeIndexKey into, int keySize )
{
into.nanoOfDay = cursor.getLong();
into.setEntityId( cursor.getLong() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.neo4j.index.internal.gbptree.Hit;
import org.neo4j.index.internal.gbptree.Layout;

public class NativeAllEntriesReader<KEY extends NativeSchemaKey<KEY>,VALUE extends NativeSchemaValue> implements BoundedIterable<Long>
public class NativeAllEntriesReader<KEY extends NativeIndexKey<KEY>,VALUE extends NativeIndexValue> implements BoundedIterable<Long>
{
private final GBPTree<KEY,VALUE> tree;
private final Layout<KEY,VALUE> layout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.neo4j.storageengine.api.schema.IndexProgressor;
import org.neo4j.values.storable.Value;

public class NativeHitIndexProgressor<KEY extends NativeSchemaKey<KEY>, VALUE extends NativeSchemaValue> implements IndexProgressor
public class NativeHitIndexProgressor<KEY extends NativeIndexKey<KEY>, VALUE extends NativeIndexValue> implements IndexProgressor
{
private final RawCursor<Hit<KEY,VALUE>,IOException> seeker;
private final NodeValueClient client;
Expand Down

0 comments on commit d063062

Please sign in to comment.