Skip to content

Commit

Permalink
PR comment: Declare ENTITY_ID_SIZE in NativeIndexKey
Browse files Browse the repository at this point in the history
  • Loading branch information
burqen committed Jul 27, 2018
1 parent 6ef391b commit ac70404
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 19 deletions.
Expand Up @@ -27,9 +27,6 @@

class CompositeGenericKey extends NativeIndexKey<CompositeGenericKey>
{
// TODO we have multiple places defining size of the entityId!!
private static final int ENTITY_ID_SIZE = Long.BYTES;

private GenericKeyState[] states;

CompositeGenericKey( int length )
Expand Down
Expand Up @@ -31,8 +31,8 @@
class DateIndexKey extends NativeIndexSingleValueKey<DateIndexKey>
{
static final int SIZE =
Long.BYTES + /* epochDay */
Long.BYTES; /* entityId */
Long.BYTES + /* epochDay */
ENTITY_ID_SIZE; /* entityId */

long epochDay;

Expand Down
Expand Up @@ -45,7 +45,7 @@ class DurationIndexKey extends NativeIndexSingleValueKey<DurationIndexKey>
Integer.BYTES + /* nanosOfSecond */
Long.BYTES + /* months */
Long.BYTES + /* days */
Long.BYTES; /* entityId */
ENTITY_ID_SIZE; /* entityId */

long totalAvgSeconds;
int nanosOfSecond;
Expand Down
Expand Up @@ -33,7 +33,7 @@ class LocalDateTimeIndexKey extends NativeIndexSingleValueKey<LocalDateTimeIndex
static final int SIZE =
Long.BYTES + /* epochSecond */
Integer.BYTES + /* nanoOfSecond */
Long.BYTES; /* entityId */
ENTITY_ID_SIZE; /* entityId */

int nanoOfSecond;
long epochSecond;
Expand Down
Expand Up @@ -32,7 +32,7 @@ class LocalTimeIndexKey extends NativeIndexSingleValueKey<LocalTimeIndexKey>
{
static final int SIZE =
Long.BYTES + /* nanoOfDay */
Long.BYTES; /* entityId */
ENTITY_ID_SIZE; /* entityId */

long nanoOfDay;

Expand Down
Expand Up @@ -26,6 +26,9 @@

abstract class NativeIndexKey<SELF extends NativeIndexKey<SELF>> extends TemporalValueWriterAdapter<RuntimeException>
{
// TODO this could use 6 bytes instead and have the highest 2 bits could be used for other meta info
static final int ENTITY_ID_SIZE = Long.BYTES;

enum Inclusion
{
// Order of these is important, must be kept lower --> higher
Expand Down
Expand Up @@ -37,11 +37,9 @@
class NumberIndexKey extends NativeIndexSingleValueKey<NumberIndexKey>
{
static final int SIZE =
Byte.BYTES + /* type of value */
Long.BYTES + /* raw value bits */

// TODO this could use 6 bytes instead and have the highest 2 bits stored in the type byte
Long.BYTES; /* entityId */
Byte.BYTES + /* type of value */
Long.BYTES + /* raw value bits */
ENTITY_ID_SIZE; /* (Long.BYTES) entityId */

byte type;
long rawValueBits;
Expand Down
Expand Up @@ -38,8 +38,8 @@
class SpatialIndexKey extends NativeIndexSingleValueKey<SpatialIndexKey>
{
static final int SIZE =
Long.BYTES + /* raw value bits */
Long.BYTES; /* entityId */
Long.BYTES + /* raw value bits */
ENTITY_ID_SIZE; /* entityId */

long rawValueBits;
CoordinateReferenceSystem crs;
Expand Down
Expand Up @@ -35,8 +35,6 @@
*/
class StringIndexKey extends NativeIndexSingleValueKey<StringIndexKey>
{
static final int ENTITY_ID_SIZE = Long.BYTES;

private boolean ignoreLength;

// UTF-8 bytes, grows on demand. Actual length is dictated by bytesLength field.
Expand Down
Expand Up @@ -45,7 +45,7 @@ class ZonedDateTimeIndexKey extends NativeIndexSingleValueKey<ZonedDateTimeIndex
Long.BYTES + /* epochSecond */
Integer.BYTES + /* nanoOfSecond */
Integer.BYTES + /* timeZone */
Long.BYTES; /* entityId */
ENTITY_ID_SIZE; /* entityId */

long epochSecondUTC;
int nanoOfSecond;
Expand Down
Expand Up @@ -39,7 +39,7 @@ class ZonedTimeIndexKey extends NativeIndexSingleValueKey<ZonedTimeIndexKey>
static final int SIZE =
Long.BYTES + /* nanosOfDayUTC */
Integer.BYTES + /* zoneOffsetSeconds */
Long.BYTES; /* entityId */
ENTITY_ID_SIZE; /* entityId */

long nanosOfDayUTC;
int zoneOffsetSeconds;
Expand Down

0 comments on commit ac70404

Please sign in to comment.