Skip to content

Commit

Permalink
Simplified record hierarchy w/ regards to int/long
Browse files Browse the repository at this point in the history
  • Loading branch information
tinwelint committed Feb 1, 2016
1 parent 23db4b0 commit e3f10fa
Show file tree
Hide file tree
Showing 54 changed files with 126 additions and 210 deletions.
Expand Up @@ -57,7 +57,7 @@ public void checkReference( DynamicRecord record, NodeRecord nodeRecord,
{
// if this node record is in use but doesn't point to the dynamic label record
// that label record has an invalid owner
long recordId = record.getLongId();
long recordId = record.getId();
if ( fieldPointsToDynamicRecordOfLabels( nodeRecord.getLabelField() ) )
{
long dynamicLabelRecordId = firstDynamicLabelRecordId( nodeRecord.getLabelField() );
Expand Down
Expand Up @@ -318,7 +318,7 @@ public boolean test( T record )
return false;
}

if ( record.getLongId() == 0 )
if ( record.getId() == 0 )
{
if ( started )
{
Expand Down
Expand Up @@ -193,7 +193,7 @@ static class PropertyKey extends NameOwner<PropertyKeyTokenRecord, ConsistencyRe

PropertyKey( PropertyKeyTokenRecord record )
{
this.id = record.getId();
this.id = record.getIntId();
}

@Override
Expand All @@ -209,7 +209,7 @@ static class LabelToken extends NameOwner<LabelTokenRecord, ConsistencyReport.La

LabelToken( LabelTokenRecord record )
{
this.id = record.getId();
this.id = record.getIntId();
}

@Override
Expand All @@ -225,7 +225,7 @@ static class RelationshipTypeToken extends NameOwner<RelationshipTypeTokenRecord

RelationshipTypeToken( RelationshipTypeTokenRecord record )
{
this.id = record.getId();
this.id = record.getIntId();
}

@Override
Expand Down
Expand Up @@ -23,11 +23,11 @@
import java.util.Iterator;
import java.util.Map;

import org.neo4j.kernel.impl.store.record.Abstract64BitRecord;
import org.neo4j.kernel.impl.store.record.AbstractBaseRecord;

class RecordSet<R extends Abstract64BitRecord> implements Iterable<R>
class RecordSet<R extends AbstractBaseRecord> implements Iterable<R>
{
private Map<Long, R> map = new HashMap<Long, R>();
private final Map<Long, R> map = new HashMap<Long, R>();

void add( R record )
{
Expand Down Expand Up @@ -84,7 +84,7 @@ public String toString()
return builder.append( "]\n" ).toString();
}

public static <R extends Abstract64BitRecord> RecordSet<R> asSet( R... records )
public static <R extends AbstractBaseRecord> RecordSet<R> asSet( R... records )
{
RecordSet<R> set = new RecordSet<R>();
for ( R record : records )
Expand Down
Expand Up @@ -277,7 +277,7 @@ static class ReportHandler
@Override
long recordId()
{
return record.getLongId();
return record.getId();
}

@Override
Expand Down Expand Up @@ -329,7 +329,7 @@ private DiffReportHandler( InconsistencyReport report, ProxyFactory<REPORT> fact
@Override
long recordId()
{
return newRecord.getLongId();
return newRecord.getId();
}

@Override
Expand Down
Expand Up @@ -37,6 +37,7 @@ public class CountsEntry extends AbstractBaseRecord

public CountsEntry( CountsKey key, long count )
{
super( -1 );
this.key = key;
this.count = count;
setInUse( true );
Expand All @@ -57,7 +58,7 @@ public String toString()
}

@Override
public long getLongId()
public long getId()
{
throw new UnsupportedOperationException();
}
Expand Down
Expand Up @@ -19,13 +19,13 @@
*/
package org.neo4j.legacy.consistency.store.synthetic;

import org.neo4j.kernel.impl.store.record.Abstract64BitRecord;
import org.neo4j.kernel.impl.store.record.AbstractBaseRecord;

/**
* Synthetic record type that stands in for a real record to fit in conveniently
* with consistency checking
*/
public class IndexEntry extends Abstract64BitRecord
public class IndexEntry extends AbstractBaseRecord
{
public IndexEntry( long nodeId )
{
Expand Down
Expand Up @@ -20,13 +20,13 @@
package org.neo4j.legacy.consistency.store.synthetic;

import org.neo4j.kernel.api.labelscan.NodeLabelRange;
import org.neo4j.kernel.impl.store.record.Abstract64BitRecord;
import org.neo4j.kernel.impl.store.record.AbstractBaseRecord;

/**
* Synthetic record type that stands in for a real record to fit in conveniently
* with consistency checking
*/
public class LabelScanDocument extends Abstract64BitRecord
public class LabelScanDocument extends AbstractBaseRecord
{
private NodeLabelRange nodeLabelRange;

Expand Down
Expand Up @@ -107,13 +107,13 @@ public void create( NodeRecord node )
public void create( LabelTokenRecord labelToken )
{
labelToken.setCreated();
update( new LabelTokenRecord( labelToken.getId() ), labelToken );
update( new LabelTokenRecord( labelToken.getIntId() ), labelToken );
}

public void create( PropertyKeyTokenRecord token )
{
token.setCreated();
update( new PropertyKeyTokenRecord( token.getId() ), token );
update( new PropertyKeyTokenRecord( token.getIntId() ), token );
}

public void create( RelationshipGroupRecord group )
Expand Down Expand Up @@ -193,7 +193,7 @@ public void delete( RelationshipRecord record )
public void create( PropertyRecord property )
{
property.setCreated();
PropertyRecord before = new PropertyRecord( property.getLongId() );
PropertyRecord before = new PropertyRecord( property.getId() );
if ( property.isNodeSet() )
{
before.setNodeId( property.getNodeId() );
Expand Down
Expand Up @@ -172,7 +172,7 @@ void log( PendingReferenceCheck<?> check, InvocationOnMock invocation )
{
AbstractBaseRecord record = (AbstractBaseRecord) arg;
entry.append( ',' ).append( record.getClass().getSimpleName() )
.append( '[' ).append( record.getLongId() ).append( ']' );
.append( '[' ).append( record.getId() ).append( ']' );
}
}
String message = entry.append( ')' ).toString();
Expand Down
Expand Up @@ -300,7 +300,7 @@ protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx,
NodeRecord nodeRecord = new NodeRecord( next.node(), false, -1, -1 );
DynamicRecord record = inUse( new DynamicRecord( next.nodeLabel() ) );
Collection<DynamicRecord> newRecords = new ArrayList<>();
allocateFromNumbers( newRecords, prependNodeId( nodeRecord.getLongId(), new long[]{42l} ),
allocateFromNumbers( newRecords, prependNodeId( nodeRecord.getId(), new long[]{42l} ),
iterator( record ), new PreAllocatedRecords( 60 ) );
nodeRecord.setLabelField( dynamicPointer( newRecords ), newRecords );

Expand Down Expand Up @@ -750,7 +750,7 @@ protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx,
DynamicRecord record1 = inUse( new DynamicRecord( next.nodeLabel() ) );
DynamicRecord record2 = inUse( new DynamicRecord( next.nodeLabel() ) );
DynamicRecord record3 = inUse( new DynamicRecord( next.nodeLabel() ) );
labels[0] = nodeRecord.getLongId(); // the first id should not be a label id, but the id of the node
labels[0] = nodeRecord.getId(); // the first id should not be a label id, but the id of the node
PreAllocatedRecords allocator = new PreAllocatedRecords( 60 );
allocateFromNumbers( chain, labels, iterator( record1, record2, record3 ), allocator );

Expand Down Expand Up @@ -778,7 +778,7 @@ protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx,
DynamicRecord record = inUse( new DynamicRecord( next.nodeLabel() ) );
Collection<DynamicRecord> newRecords = new ArrayList<>();
allocateFromNumbers( newRecords,
prependNodeId( nodeRecord.getLongId(), new long[]{42l, 42l} ),
prependNodeId( nodeRecord.getId(), new long[]{42l, 42l} ),
iterator( record ), new PreAllocatedRecords( 60 ) );
nodeRecord.setLabelField( dynamicPointer( newRecords ), newRecords );

Expand Down
Expand Up @@ -234,13 +234,13 @@ <R extends AbstractBaseRecord> R get( Delta<R> delta )

private static <R extends AbstractBaseRecord> R add( Map<Long, Delta<R>> records, R record )
{
records.put( record.getLongId(), new Delta<>( record ) );
records.put( record.getId(), new Delta<>( record ) );
return record;
}

private static <R extends AbstractBaseRecord> void add( Map<Long, Delta<R>> records, R oldRecord, R newRecord )
{
records.put( newRecord.getLongId(), new Delta<>( oldRecord, newRecord ) );
records.put( newRecord.getId(), new Delta<>( oldRecord, newRecord ) );
}

public DynamicRecord addSchema( DynamicRecord schema )
Expand Down
Expand Up @@ -57,7 +57,7 @@ public void checkReference( DynamicRecord record, NodeRecord nodeRecord,
{
// if this node record is in use but doesn't point to the dynamic label record
// that label record has an invalid owner
long recordId = record.getLongId();
long recordId = record.getId();
if ( fieldPointsToDynamicRecordOfLabels( nodeRecord.getLabelField() ) )
{
long dynamicLabelRecordId = firstDynamicLabelRecordId( nodeRecord.getLabelField() );
Expand Down
Expand Up @@ -344,12 +344,12 @@ public boolean test( T record )
{
return false;
}
if ( record.getLongId() == terminationId )
if ( record.getId() == terminationId )
{
done = true;
return true;
}
if ( record.getLongId() == 0 )
if ( record.getId() == 0 )
{
if ( started )
{
Expand Down
Expand Up @@ -193,7 +193,7 @@ static class PropertyKey extends NameOwner<PropertyKeyTokenRecord, ConsistencyRe

PropertyKey( PropertyKeyTokenRecord record )
{
this.id = record.getId();
this.id = record.getIntId();
}

@Override
Expand All @@ -209,7 +209,7 @@ static class LabelToken extends NameOwner<LabelTokenRecord, ConsistencyReport.La

LabelToken( LabelTokenRecord record )
{
this.id = record.getId();
this.id = record.getIntId();
}

@Override
Expand All @@ -225,7 +225,7 @@ static class RelationshipTypeToken extends NameOwner<RelationshipTypeTokenRecord

RelationshipTypeToken( RelationshipTypeTokenRecord record )
{
this.id = record.getId();
this.id = record.getIntId();
}

@Override
Expand All @@ -249,6 +249,7 @@ RecordReference<AbstractBaseRecord> record( RecordAccess records )
return skipReference();
}

@Override
public void checkOrphanage()
{
PendingReferenceCheck<AbstractBaseRecord> reporter = pop();
Expand Down
Expand Up @@ -23,11 +23,11 @@
import java.util.Iterator;
import java.util.Map;

import org.neo4j.kernel.impl.store.record.Abstract64BitRecord;
import org.neo4j.kernel.impl.store.record.AbstractBaseRecord;

class RecordSet<R extends Abstract64BitRecord> implements Iterable<R>
class RecordSet<R extends AbstractBaseRecord> implements Iterable<R>
{
private Map<Long, R> map = new HashMap<Long, R>();
private final Map<Long, R> map = new HashMap<Long, R>();

void add( R record )
{
Expand Down Expand Up @@ -84,7 +84,7 @@ public String toString()
return builder.append( "]\n" ).toString();
}

public static <R extends Abstract64BitRecord> RecordSet<R> asSet( R... records )
public static <R extends AbstractBaseRecord> RecordSet<R> asSet( R... records )
{
RecordSet<R> set = new RecordSet<R>();
for ( R record : records )
Expand Down
Expand Up @@ -341,7 +341,7 @@ public ReportHandler( InconsistencyReport report, ProxyFactory<REPORT> factory,
@Override
long recordId()
{
return record.getLongId();
return record.getId();
}

@Override
Expand Down Expand Up @@ -394,7 +394,7 @@ private DiffReportHandler( InconsistencyReport report, ProxyFactory<REPORT> fact
@Override
long recordId()
{
return newRecord.getLongId();
return newRecord.getId();
}

@Override
Expand Down
Expand Up @@ -36,10 +36,12 @@ public class CountsEntry extends AbstractBaseRecord
// ========= TRANSITIONAL CONSTRUCTORS =============
public CountsEntry()
{
super( -1 );
}

public CountsEntry( CountsKey key, long count )
{
super( -1 );
initialize( key, count );
}
// ========= TRANSITIONAL CONSTRUCTORS =============
Expand Down Expand Up @@ -73,7 +75,7 @@ public void setId( long id )
}

@Override
public long getLongId()
public long getId()
{
throw new UnsupportedOperationException();
}
Expand Down
Expand Up @@ -19,13 +19,13 @@
*/
package org.neo4j.consistency.store.synthetic;

import org.neo4j.kernel.impl.store.record.Abstract64BitRecord;
import org.neo4j.kernel.impl.store.record.AbstractBaseRecord;

/**
* Synthetic record type that stands in for a real record to fit in conveniently
* with consistency checking
*/
public class IndexEntry extends Abstract64BitRecord
public class IndexEntry extends AbstractBaseRecord
{
public IndexEntry( long nodeId )
{
Expand Down
Expand Up @@ -20,13 +20,13 @@
package org.neo4j.consistency.store.synthetic;

import org.neo4j.kernel.api.labelscan.NodeLabelRange;
import org.neo4j.kernel.impl.store.record.Abstract64BitRecord;
import org.neo4j.kernel.impl.store.record.AbstractBaseRecord;

/**
* Synthetic record type that stands in for a real record to fit in conveniently
* with consistency checking
*/
public class LabelScanDocument extends Abstract64BitRecord
public class LabelScanDocument extends AbstractBaseRecord
{
private NodeLabelRange nodeLabelRange;

Expand Down
Expand Up @@ -107,13 +107,13 @@ public void create( NodeRecord node )
public void create( LabelTokenRecord labelToken )
{
labelToken.setCreated();
update( new LabelTokenRecord( labelToken.getId() ), labelToken );
update( new LabelTokenRecord( labelToken.getIntId() ), labelToken );
}

public void create( PropertyKeyTokenRecord token )
{
token.setCreated();
update( new PropertyKeyTokenRecord( token.getId() ), token );
update( new PropertyKeyTokenRecord( token.getIntId() ), token );
}

public void create( RelationshipGroupRecord group )
Expand Down Expand Up @@ -193,7 +193,7 @@ public void delete( RelationshipRecord record )
public void create( PropertyRecord property )
{
property.setCreated();
PropertyRecord before = new PropertyRecord( property.getLongId() );
PropertyRecord before = new PropertyRecord( property.getId() );
if ( property.isNodeSet() )
{
before.setNodeId( property.getNodeId() );
Expand Down

0 comments on commit e3f10fa

Please sign in to comment.