Skip to content

Commit

Permalink
Simplified creation of IndexDescriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
craigtaverner authored and fickludd committed Jan 23, 2017
1 parent 73b780d commit bc2790e
Show file tree
Hide file tree
Showing 71 changed files with 166 additions and 194 deletions.
Expand Up @@ -415,7 +415,7 @@ public void shouldNotReportIndexInconsistenciesIfIndexIsFailed() throws Exceptio
while ( rules.hasNext() ) while ( rules.hasNext() )
{ {
IndexRule rule = rules.next(); IndexRule rule = rules.next();
IndexDescriptor descriptor = IndexDescriptorFactory.from( rule ); IndexDescriptor descriptor = IndexDescriptorFactory.of( rule );
IndexConfiguration indexConfig = IndexConfiguration.NON_UNIQUE; IndexConfiguration indexConfig = IndexConfiguration.NON_UNIQUE;
IndexSamplingConfig samplingConfig = new IndexSamplingConfig( Config.empty() ); IndexSamplingConfig samplingConfig = new IndexSamplingConfig( Config.empty() );
IndexPopulator populator = IndexPopulator populator =
Expand Down
Expand Up @@ -27,5 +27,5 @@ trait IndexDescriptorCompatibility {
new IndexDescriptor(index.getLabelId(), index.getPropertyKeyId); new IndexDescriptor(index.getLabelId(), index.getPropertyKeyId);


implicit def toNewIndexDescriptor(index: IndexDescriptor): org.neo4j.kernel.api.schema.IndexDescriptor = implicit def toNewIndexDescriptor(index: IndexDescriptor): org.neo4j.kernel.api.schema.IndexDescriptor =
IndexDescriptorFactory.from(IndexDescriptorFactory.getNodePropertyDescriptor(index.getLabelId(), index.getPropertyKeyId)); IndexDescriptorFactory.of(index.getLabelId(), index.getPropertyKeyId);
} }
Expand Up @@ -35,7 +35,7 @@ object TransactionBoundGraphStatistics {


def indexSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] = def indexSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] =
try { try {
val indexDescriptor = IndexDescriptorFactory.from(new NodePropertyDescriptor(label, property)) val indexDescriptor = IndexDescriptorFactory.of( label, property )
val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble


// Probability of any node with the given label, to have a property with a given value // Probability of any node with the given label, to have a property with a given value
Expand All @@ -51,7 +51,7 @@ object TransactionBoundGraphStatistics {


def indexPropertyExistsSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] = def indexPropertyExistsSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] =
try { try {
val indexDescriptor = IndexDescriptorFactory.from(new NodePropertyDescriptor(label, property)) val indexDescriptor = IndexDescriptorFactory.of( label, property )
val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble


// Probability of any node with the given label, to have a given property // Probability of any node with the given label, to have a given property
Expand Down
Expand Up @@ -468,7 +468,7 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper)
} }


def dropIndexRule(labelId: Int, propertyKeyId: Int) = def dropIndexRule(labelId: Int, propertyKeyId: Int) =
tc.statement.schemaWriteOperations().indexDrop(IndexDescriptorFactory.from(new NodePropertyDescriptor(labelId, propertyKeyId))) tc.statement.schemaWriteOperations().indexDrop(IndexDescriptorFactory.of( labelId, propertyKeyId ))


def createUniqueConstraint(labelId: Int, propertyKeyId: Int): IdempotentResult[UniquenessConstraint] = try { def createUniqueConstraint(labelId: Int, propertyKeyId: Int): IdempotentResult[UniquenessConstraint] = try {
IdempotentResult(tc.statement.schemaWriteOperations().uniquePropertyConstraintCreate(new NodePropertyDescriptor(labelId, IdempotentResult(tc.statement.schemaWriteOperations().uniquePropertyConstraintCreate(new NodePropertyDescriptor(labelId,
Expand Down
Expand Up @@ -24,7 +24,7 @@ import org.neo4j.cypher.internal.compiler.v3_1.spi.{GraphStatistics, StatisticsC
import org.neo4j.cypher.internal.frontend.v3_1.{LabelId, NameId, PropertyKeyId, RelTypeId} import org.neo4j.cypher.internal.frontend.v3_1.{LabelId, NameId, PropertyKeyId, RelTypeId}
import org.neo4j.kernel.api.ReadOperations import org.neo4j.kernel.api.ReadOperations
import org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException import org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException
import org.neo4j.kernel.api.schema.{IndexDescriptorFactory, NodePropertyDescriptor} import org.neo4j.kernel.api.schema.IndexDescriptorFactory


object TransactionBoundGraphStatistics { object TransactionBoundGraphStatistics {
def apply(ops: ReadOperations) = new StatisticsCompletingGraphStatistics(new BaseTransactionBoundGraphStatistics(ops)) def apply(ops: ReadOperations) = new StatisticsCompletingGraphStatistics(new BaseTransactionBoundGraphStatistics(ops))
Expand All @@ -35,7 +35,7 @@ object TransactionBoundGraphStatistics {


def indexSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] = def indexSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] =
try { try {
val indexDescriptor = IndexDescriptorFactory.from(new NodePropertyDescriptor(label, property)) val indexDescriptor = IndexDescriptorFactory.of( label, property )
val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble


// Probability of any node with the given label, to have a property with a given value // Probability of any node with the given label, to have a property with a given value
Expand All @@ -51,7 +51,7 @@ object TransactionBoundGraphStatistics {


def indexPropertyExistsSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] = def indexPropertyExistsSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] =
try { try {
val indexDescriptor = IndexDescriptorFactory.from(new NodePropertyDescriptor(label, property)) val indexDescriptor = IndexDescriptorFactory.of( label, property )
val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble


// Probability of any node with the given label, to have a given property // Probability of any node with the given label, to have a given property
Expand Down
Expand Up @@ -472,7 +472,7 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper)
} }


override def dropIndexRule(labelId: Int, propertyKeyId: Int) = override def dropIndexRule(labelId: Int, propertyKeyId: Int) =
txContext.statement.schemaWriteOperations().indexDrop(IndexDescriptorFactory.from(new NodePropertyDescriptor(labelId, propertyKeyId))) txContext.statement.schemaWriteOperations().indexDrop(IndexDescriptorFactory.of( labelId, propertyKeyId ))


override def createUniqueConstraint(labelId: Int, propertyKeyId: Int): IdempotentResult[UniquenessConstraint] = try { override def createUniqueConstraint(labelId: Int, propertyKeyId: Int): IdempotentResult[UniquenessConstraint] = try {
IdempotentResult(txContext.statement.schemaWriteOperations().uniquePropertyConstraintCreate(new NodePropertyDescriptor(labelId, propertyKeyId))) IdempotentResult(txContext.statement.schemaWriteOperations().uniquePropertyConstraintCreate(new NodePropertyDescriptor(labelId, propertyKeyId)))
Expand Down
Expand Up @@ -24,7 +24,7 @@ import org.neo4j.cypher.internal.frontend.v3_2.{LabelId, NameId, PropertyKeyId,
import org.neo4j.cypher.internal.ir.v3_2.{Cardinality, Selectivity} import org.neo4j.cypher.internal.ir.v3_2.{Cardinality, Selectivity}
import org.neo4j.kernel.api.ReadOperations import org.neo4j.kernel.api.ReadOperations
import org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException import org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException
import org.neo4j.kernel.api.schema.{IndexDescriptorFactory, NodePropertyDescriptor} import org.neo4j.kernel.api.schema.IndexDescriptorFactory


object TransactionBoundGraphStatistics { object TransactionBoundGraphStatistics {
def apply(ops: ReadOperations) = new StatisticsCompletingGraphStatistics(new BaseTransactionBoundGraphStatistics(ops)) def apply(ops: ReadOperations) = new StatisticsCompletingGraphStatistics(new BaseTransactionBoundGraphStatistics(ops))
Expand All @@ -35,7 +35,7 @@ object TransactionBoundGraphStatistics {


def indexSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] = def indexSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] =
try { try {
val indexDescriptor = IndexDescriptorFactory.from(new NodePropertyDescriptor(label, property)) val indexDescriptor = IndexDescriptorFactory.of( label, property )
val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble


// Probability of any node with the given label, to have a property with a given value // Probability of any node with the given label, to have a property with a given value
Expand All @@ -51,7 +51,7 @@ object TransactionBoundGraphStatistics {


def indexPropertyExistsSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] = def indexPropertyExistsSelectivity(label: LabelId, property: PropertyKeyId): Option[Selectivity] =
try { try {
val indexDescriptor = IndexDescriptorFactory.from(new NodePropertyDescriptor(label, property)) val indexDescriptor = IndexDescriptorFactory.of( label, property )
val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble val labeledNodes = operations.countsForNodeWithoutTxState( label ).toDouble


// Probability of any node with the given label, to have a given property // Probability of any node with the given label, to have a given property
Expand Down
Expand Up @@ -263,10 +263,10 @@ final class TransactionBoundQueryContext(val transactionalContext: Transactional
} }


implicit private def toKernelIndexDescriptor(descriptor: CypherIndexDescriptor): IndexDescriptor = implicit private def toKernelIndexDescriptor(descriptor: CypherIndexDescriptor): IndexDescriptor =
IndexDescriptorFactory.from(toNodePropertyDescriptor(descriptor)) IndexDescriptorFactory.of(toNodePropertyDescriptor(descriptor))


implicit private def toIndexDescriptor(descriptor: NodePropertyDescriptor): IndexDescriptor = implicit private def toIndexDescriptor(descriptor: NodePropertyDescriptor): IndexDescriptor =
IndexDescriptorFactory.from(descriptor) IndexDescriptorFactory.of(descriptor)


implicit private def toNodePropertyDescriptor(descriptor: CypherIndexDescriptor): NodePropertyDescriptor = implicit private def toNodePropertyDescriptor(descriptor: CypherIndexDescriptor): NodePropertyDescriptor =
if (descriptor.isComposite) if (descriptor.isComposite)
Expand Down
Expand Up @@ -54,7 +54,7 @@ public boolean matches( NodePropertyDescriptor descriptor )
@Override @Override
public IndexDescriptor indexDescriptor() public IndexDescriptor indexDescriptor()
{ {
return IndexDescriptorFactory.from( descriptor ); return IndexDescriptorFactory.of( descriptor );
} }


@Override @Override
Expand Down
Expand Up @@ -34,16 +34,32 @@
*/ */
public class IndexDescriptorFactory public class IndexDescriptorFactory
{ {
public static IndexDescriptor from( NodePropertyDescriptor descriptor ) public static IndexDescriptor of( int labelId, int... propertyKeyIds )
{
if ( propertyKeyIds.length == 0 )
{
throw new IllegalArgumentException( "Index descriptors must contain at least one property" );
}
else if ( propertyKeyIds.length == 1 )
{
return new SinglePropertyIndexDescriptor( labelId, propertyKeyIds[0] );
}
else
{
return new CompositeIndexDescriptor( labelId, propertyKeyIds );
}
}

public static IndexDescriptor of( NodePropertyDescriptor descriptor )
{ {
return descriptor.isComposite() ? new CompositeIndexDescriptor( descriptor.getLabelId(), return descriptor.isComposite() ? new CompositeIndexDescriptor( descriptor.getLabelId(),
descriptor.getPropertyKeyIds() ) : new SinglePropertyIndexDescriptor( descriptor.getLabelId(), descriptor.getPropertyKeyIds() ) : new SinglePropertyIndexDescriptor( descriptor.getLabelId(),
descriptor.getPropertyKeyId() ); descriptor.getPropertyKeyId() );
} }


public static IndexDescriptor from( IndexRule rule ) public static IndexDescriptor of( IndexRule rule )
{ {
return from( rule.descriptor() ); return of( rule.descriptor() );
} }


public static NodePropertyDescriptor getNodePropertyDescriptor( int labelId, int[] propertyKeyIds ) public static NodePropertyDescriptor getNodePropertyDescriptor( int labelId, int[] propertyKeyIds )
Expand All @@ -63,16 +79,14 @@ public static NodePropertyDescriptor getOrCreateTokens( SchemaWriteOperations sc
int labelId = schemaWriteOperations.labelGetOrCreateForName( indexDefinition.getLabel().name() ); int labelId = schemaWriteOperations.labelGetOrCreateForName( indexDefinition.getLabel().name() );
int[] propertyKeyIds = getOrCreatePropertyKeyIds( schemaWriteOperations, indexDefinition ); int[] propertyKeyIds = getOrCreatePropertyKeyIds( schemaWriteOperations, indexDefinition );


return propertyKeyIds.length > 1 ? new NodeMultiPropertyDescriptor( labelId, propertyKeyIds ) return getNodePropertyDescriptor( labelId, propertyKeyIds );
: new NodePropertyDescriptor( labelId, propertyKeyIds[0] );
} }


public static NodePropertyDescriptor getTokens( ReadOperations readOperations, IndexDefinition indexDefinition ) public static NodePropertyDescriptor getTokens( ReadOperations readOperations, IndexDefinition indexDefinition )
{ {
int labelId = readOperations.labelGetForName( indexDefinition.getLabel().name() ); int labelId = readOperations.labelGetForName( indexDefinition.getLabel().name() );
int[] propertyKeyIds = getPropertyKeyIds( readOperations, indexDefinition.getPropertyKeys() ); int[] propertyKeyIds = getPropertyKeyIds( readOperations, indexDefinition.getPropertyKeys() );


return propertyKeyIds.length > 1 ? new NodeMultiPropertyDescriptor( labelId, propertyKeyIds ) return getNodePropertyDescriptor( labelId, propertyKeyIds );
: new NodePropertyDescriptor( labelId, propertyKeyIds[0] );
} }
} }
Expand Up @@ -377,7 +377,7 @@ public long relationshipsGetCount( KernelStatement state )
@Override @Override
public IndexDescriptor indexCreate( KernelStatement state, NodePropertyDescriptor descriptor ) public IndexDescriptor indexCreate( KernelStatement state, NodePropertyDescriptor descriptor )
{ {
IndexDescriptor indexDescriptor = IndexDescriptorFactory.from(descriptor); IndexDescriptor indexDescriptor = IndexDescriptorFactory.of(descriptor);
state.txState().indexRuleDoAdd( indexDescriptor ); state.txState().indexRuleDoAdd( indexDescriptor );
return indexDescriptor; return indexDescriptor;
} }
Expand Down
Expand Up @@ -31,7 +31,6 @@


import org.neo4j.helpers.collection.Pair; import org.neo4j.helpers.collection.Pair;
import org.neo4j.helpers.collection.PrefetchingIterator; import org.neo4j.helpers.collection.PrefetchingIterator;
import org.neo4j.kernel.api.schema.NodePropertyDescriptor;
import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException; import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException;
import org.neo4j.kernel.api.schema.IndexDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptor;
import org.neo4j.kernel.api.schema.IndexDescriptorFactory; import org.neo4j.kernel.api.schema.IndexDescriptorFactory;
Expand Down Expand Up @@ -63,7 +62,7 @@ class IndexUpdaterMap implements AutoCloseable, Iterable<IndexUpdater>


List<IndexUpdater> getUpdaters( int labelId, int propertyKeyId ) List<IndexUpdater> getUpdaters( int labelId, int propertyKeyId )
{ {
IndexDescriptor key = IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId, propertyKeyId ) ); IndexDescriptor key = IndexDescriptorFactory.of( labelId, propertyKeyId );
IndexUpdater updater = getUpdater( key ); IndexUpdater updater = getUpdater( key );
if ( updater != null ) if ( updater != null )
{ {
Expand Down
Expand Up @@ -196,7 +196,7 @@ public void init()
IndexProxy indexProxy; IndexProxy indexProxy;


long indexId = indexRule.getId(); long indexId = indexRule.getId();
IndexDescriptor descriptor = IndexDescriptorFactory.from( indexRule ); IndexDescriptor descriptor = IndexDescriptorFactory.of( indexRule );
SchemaIndexProvider.Descriptor providerDescriptor = indexRule.getProviderDescriptor(); SchemaIndexProvider.Descriptor providerDescriptor = indexRule.getProviderDescriptor();
SchemaIndexProvider provider = providerMap.apply( providerDescriptor ); SchemaIndexProvider provider = providerMap.apply( providerDescriptor );
InternalIndexState initialState = provider.getInitialState( indexId ); InternalIndexState initialState = provider.getInitialState( indexId );
Expand Down Expand Up @@ -532,7 +532,7 @@ public void createIndexes( IndexRule... rules ) throws IOException
indexMapRef.setIndexMap( indexMap ); indexMapRef.setIndexMap( indexMap );
continue; continue;
} }
final IndexDescriptor descriptor = IndexDescriptorFactory.from( rule ); final IndexDescriptor descriptor = IndexDescriptorFactory.of( rule );
SchemaIndexProvider.Descriptor providerDescriptor = rule.getProviderDescriptor(); SchemaIndexProvider.Descriptor providerDescriptor = rule.getProviderDescriptor();
boolean constraint = rule.isConstraintIndex(); boolean constraint = rule.isConstraintIndex();
if ( state == State.RUNNING ) if ( state == State.RUNNING )
Expand Down
Expand Up @@ -105,7 +105,7 @@ private static Iterator<IndexDescriptor> toIndexDescriptors( Iterable<SchemaRule
final SchemaRule.Kind kind ) final SchemaRule.Kind kind )
{ {
Iterator<SchemaRule> filteredRules = Iterators.filter( item -> item.getKind() == kind, rules.iterator() ); Iterator<SchemaRule> filteredRules = Iterators.filter( item -> item.getKind() == kind, rules.iterator() );
return Iterators.map( from -> IndexDescriptorFactory.from( (IndexRule) from ), filteredRules ); return Iterators.map( from -> IndexDescriptorFactory.of( (IndexRule) from ), filteredRules );
} }


@Override @Override
Expand Down
Expand Up @@ -187,7 +187,7 @@ public IndexDescriptor indexGetForLabelAndPropertyKey( NodePropertyDescriptor de


private static IndexDescriptor descriptor( IndexRule ruleRecord ) private static IndexDescriptor descriptor( IndexRule ruleRecord )
{ {
return IndexDescriptorFactory.from( ruleRecord ); return IndexDescriptorFactory.of( ruleRecord );
} }


@Override @Override
Expand Down
Expand Up @@ -147,7 +147,7 @@ else if ( constraint instanceof RelationshipPropertyConstraint )
else if ( rule instanceof IndexRule ) else if ( rule instanceof IndexRule )
{ {
IndexRule indexRule = (IndexRule) rule; IndexRule indexRule = (IndexRule) rule;
IndexDescriptor index = IndexDescriptorFactory.from( indexRule ); IndexDescriptor index = IndexDescriptorFactory.of( indexRule );
if ( !indexDescriptors.containsKey( index ) ) if ( !indexDescriptors.containsKey( index ) )
{ {
indexDescriptors.put( index, new CommittedIndexDescriptor( index, indexRule.getId() ) ); indexDescriptors.put( index, new CommittedIndexDescriptor( index, indexRule.getId() ) );
Expand Down Expand Up @@ -218,13 +218,13 @@ else if ( rule instanceof RelationshipPropertyConstraintRule )
else if ( rule instanceof IndexRule ) else if ( rule instanceof IndexRule )
{ {
IndexRule indexRule = (IndexRule) rule; IndexRule indexRule = (IndexRule) rule;
indexDescriptors.remove( IndexDescriptorFactory.from( indexRule ) ); indexDescriptors.remove( IndexDescriptorFactory.of( indexRule ) );
} }
} }


public IndexDescriptor indexDescriptor( NodePropertyDescriptor descriptor ) public IndexDescriptor indexDescriptor( NodePropertyDescriptor descriptor )
{ {
IndexDescriptor indexDescriptor = IndexDescriptorFactory.from( descriptor ); IndexDescriptor indexDescriptor = IndexDescriptorFactory.of( descriptor );
return indexDescriptors.containsKey(indexDescriptor) ? indexDescriptor : null; return indexDescriptors.containsKey(indexDescriptor) ? indexDescriptor : null;
} }
} }
Expand Up @@ -69,14 +69,14 @@ public static CountsSnapshot deserialize( ReadableClosableChannel channel ) thro
break; break;


case INDEX_SAMPLE: case INDEX_SAMPLE:
descriptor = IndexDescriptorFactory.from( readPropertyKeyIds( channel ) ); descriptor = IndexDescriptorFactory.of( readNodePropertyDescriptor( channel ) );
key = indexSampleKey( descriptor ); key = indexSampleKey( descriptor );
value = new long[]{channel.getLong(), channel.getLong()}; value = new long[]{channel.getLong(), channel.getLong()};
map.put( key, value ); map.put( key, value );
break; break;


case INDEX_STATISTICS: case INDEX_STATISTICS:
descriptor = IndexDescriptorFactory.from( readPropertyKeyIds( channel ) ); descriptor = IndexDescriptorFactory.of( readNodePropertyDescriptor( channel ) );
key = indexStatisticsKey( descriptor ); key = indexStatisticsKey( descriptor );
value = new long[]{channel.getLong(), channel.getLong()}; value = new long[]{channel.getLong(), channel.getLong()};
map.put( key, value ); map.put( key, value );
Expand All @@ -92,7 +92,7 @@ public static CountsSnapshot deserialize( ReadableClosableChannel channel ) thro
return new CountsSnapshot( txid, map ); return new CountsSnapshot( txid, map );
} }


private static NodePropertyDescriptor readPropertyKeyIds( ReadableClosableChannel channel ) throws IOException private static NodePropertyDescriptor readNodePropertyDescriptor( ReadableClosableChannel channel ) throws IOException
{ {
int labelId = channel.getInt(); int labelId = channel.getInt();
short length = channel.getShort(); short length = channel.getShort();
Expand Down
Expand Up @@ -146,10 +146,7 @@ public static CountsKey readKey( ReadableBuffer key ) throws UnknownKey
{ {
propertyKeyIds[i] = key.getInt( 10 + 4 * i ); propertyKeyIds[i] = key.getInt( 10 + 4 * i );
} }
NodePropertyDescriptor descriptor = IndexDescriptor index = IndexDescriptorFactory.of( labelId, propertyKeyIds );
propertyKeyIds.length > 1 ? new NodeMultiPropertyDescriptor( labelId, propertyKeyIds )
: new NodePropertyDescriptor( labelId, propertyKeyIds[0] );
IndexDescriptor index = IndexDescriptorFactory.from( descriptor );
byte indexKeyByte = key.getByte( 10 + 4 * propertyKeyIds.length ); byte indexKeyByte = key.getByte( 10 + 4 * propertyKeyIds.length );
switch ( indexKeyByte ) switch ( indexKeyByte )
{ {
Expand Down
Expand Up @@ -89,7 +89,7 @@ else if ( arg instanceof IndexDescriptor )
{ {
NodePropertyDescriptor descriptor = (NodePropertyDescriptor) arg; NodePropertyDescriptor descriptor = (NodePropertyDescriptor) arg;
int labelId = descriptor.getLabelId(); int labelId = descriptor.getLabelId();
builder.append( format( "IndexDescriptorFactory.from( new NodePropertyDescriptor( %s, %s ) )", labelId, descriptor.propertyIdText( ) ) ); builder.append( format( "IndexDescriptorFactory.of( %s, %s )", labelId, descriptor.propertyIdText( ) ) );
} }
else if ( arg instanceof NodePropertyDescriptor ) else if ( arg instanceof NodePropertyDescriptor )
{ {
Expand Down
Expand Up @@ -335,7 +335,7 @@ public void putIndex( IndexDescriptor descriptor, String userDescription, double


public IndexStatistics getIndex( NodePropertyDescriptor descriptor ) public IndexStatistics getIndex( NodePropertyDescriptor descriptor )
{ {
return indexMap.get( IndexDescriptorFactory.from( descriptor ) ); return indexMap.get( IndexDescriptorFactory.of( descriptor ) );
} }


public Iterator<Pair<String, String>> iterator() public Iterator<Pair<String, String>> iterator()
Expand Down
Expand Up @@ -478,7 +478,7 @@ private void repopulateAllIndexes() throws IOException, IndexEntryConflictExcept
propertyKeyIds[i] = propertyKeyId; propertyKeyIds[i] = propertyKeyId;


IndexDescriptor descriptor = IndexDescriptor descriptor =
IndexDescriptorFactory.from( new NodePropertyDescriptor( labelId, propertyKeyId ) ); IndexDescriptorFactory.of( labelId, propertyKeyId );
populators[i] = schemaIndexProviders.apply( rule.getProviderDescriptor() ) populators[i] = schemaIndexProviders.apply( rule.getProviderDescriptor() )
.getPopulator( rule.getId(), .getPopulator( rule.getId(),
descriptor, descriptor,
Expand Down
Expand Up @@ -29,7 +29,6 @@
import org.neo4j.io.fs.FileSystemAbstraction; import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.kernel.api.schema.IndexDescriptor; import org.neo4j.kernel.api.schema.IndexDescriptor;
import org.neo4j.kernel.api.schema.IndexDescriptorFactory; import org.neo4j.kernel.api.schema.IndexDescriptorFactory;
import org.neo4j.kernel.api.schema.NodePropertyDescriptor;
import org.neo4j.test.rule.TestDirectory; import org.neo4j.test.rule.TestDirectory;
import org.neo4j.test.rule.fs.DefaultFileSystemRule; import org.neo4j.test.rule.fs.DefaultFileSystemRule;
import org.neo4j.test.runner.ParameterizedSuiteRunner; import org.neo4j.test.runner.ParameterizedSuiteRunner;
Expand Down Expand Up @@ -64,7 +63,7 @@ public void setup()
public abstract static class Compatibility public abstract static class Compatibility
{ {
protected final SchemaIndexProvider indexProvider; protected final SchemaIndexProvider indexProvider;
protected IndexDescriptor descriptor = IndexDescriptorFactory.from( new NodePropertyDescriptor( 1, 2 ) ); protected IndexDescriptor descriptor = IndexDescriptorFactory.of( 1, 2 );


public Compatibility( IndexProviderCompatibilityTestSuite testSuite ) public Compatibility( IndexProviderCompatibilityTestSuite testSuite )
{ {
Expand Down
Expand Up @@ -62,7 +62,7 @@ public class AwaitIndexProcedureTest
private final IndexProcedures procedure = new IndexProcedures( new StubKernelTransaction( operations ), null ); private final IndexProcedures procedure = new IndexProcedures( new StubKernelTransaction( operations ), null );
private final NodePropertyDescriptor descriptor = new NodePropertyDescriptor( 123, 456 ); private final NodePropertyDescriptor descriptor = new NodePropertyDescriptor( 123, 456 );
private final NodePropertyDescriptor anyDescriptor = new NodePropertyDescriptor( 0, 0 ); private final NodePropertyDescriptor anyDescriptor = new NodePropertyDescriptor( 0, 0 );
private final IndexDescriptor anyIndex = IndexDescriptorFactory.from( anyDescriptor ); private final IndexDescriptor anyIndex = IndexDescriptorFactory.of( anyDescriptor );


@Test @Test
public void shouldThrowAnExceptionIfTheLabelDoesntExist() throws ProcedureException public void shouldThrowAnExceptionIfTheLabelDoesntExist() throws ProcedureException
Expand Down

0 comments on commit bc2790e

Please sign in to comment.