Skip to content

Commit

Permalink
Remove the old IndexDescriptor + related classes
Browse files Browse the repository at this point in the history
  • Loading branch information
ragadeeshu committed Mar 13, 2017
1 parent 2691ca8 commit 23656a2
Show file tree
Hide file tree
Showing 97 changed files with 215 additions and 645 deletions.
Expand Up @@ -30,7 +30,6 @@
import org.neo4j.kernel.api.index.IndexAccessor;
import org.neo4j.kernel.api.index.InternalIndexState;
import org.neo4j.kernel.api.index.SchemaIndexProvider;
import org.neo4j.kernel.api.schema_new.index.IndexBoundary;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
import org.neo4j.kernel.impl.store.RecordStore;
import org.neo4j.kernel.impl.store.SchemaStorage;
Expand Down
Expand Up @@ -454,7 +454,7 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper)
}

def addIndexRule(labelId: Int, propertyKeyId: Int): IdempotentResult[IndexDescriptor] = try {
IdempotentResult(tc.statement.schemaWriteOperations().indexCreate(new NodePropertyDescriptor(labelId, propertyKeyId)))
IdempotentResult(tc.statement.schemaWriteOperations().indexCreate(SchemaDescriptorFactory.forLabel(labelId, propertyKeyId)))
} catch {
case _: AlreadyIndexedException =>

Expand Down
Expand Up @@ -460,7 +460,7 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper)
}

override def addIndexRule(labelId: Int, propertyKeyId: Int): IdempotentResult[IndexDescriptor] = try {
IdempotentResult(txContext.statement.schemaWriteOperations().indexCreate(new NodePropertyDescriptor(labelId, propertyKeyId)))
IdempotentResult(txContext.statement.schemaWriteOperations().indexCreate( SchemaDescriptorFactory.forLabel(labelId, propertyKeyId)))
} catch {
case _: AlreadyIndexedException =>
val indexDescriptor = txContext.statement.readOperations().indexGetForLabelAndPropertyKey(new NodePropertyDescriptor(labelId, propertyKeyId))
Expand Down
Expand Up @@ -464,12 +464,11 @@ final class TransactionBoundQueryContext(val transactionalContext: Transactional
}

override def addIndexRule(descriptor: IndexDescriptor): IdempotentResult[IndexDescriptor] = {
val index = toNodePropertyDescriptor(descriptor)
try {
IdempotentResult(transactionalContext.statement.schemaWriteOperations().indexCreate(index))
IdempotentResult(transactionalContext.statement.schemaWriteOperations().indexCreate( SchemaDescriptorFactory.forLabel(descriptor.label, descriptor.property)))
} catch {
case _: AlreadyIndexedException =>
val indexDescriptor = transactionalContext.statement.readOperations().indexGetForLabelAndPropertyKey(index)
val indexDescriptor = transactionalContext.statement.readOperations().indexGetForLabelAndPropertyKey(new NodePropertyDescriptor( descriptor.label, descriptor.property))
if(transactionalContext.statement.readOperations().indexGetState(indexDescriptor) == InternalIndexState.FAILED)
throw new FailedIndexException(indexDescriptor.userDescription(tokenNameLookup))
IdempotentResult(indexDescriptor, wasCreated = false)
Expand Down
Expand Up @@ -24,7 +24,6 @@
import org.neo4j.kernel.api.exceptions.schema.CreateConstraintFailureException;
import org.neo4j.kernel.api.exceptions.schema.DropConstraintFailureException;
import org.neo4j.kernel.api.exceptions.schema.DropIndexFailureException;
import org.neo4j.kernel.api.schema.NodePropertyDescriptor;
import org.neo4j.kernel.api.schema_new.LabelSchemaDescriptor;
import org.neo4j.kernel.api.schema_new.RelationTypeSchemaDescriptor;
import org.neo4j.kernel.api.schema_new.constaints.ConstraintDescriptor;
Expand All @@ -38,8 +37,9 @@ public interface SchemaWriteOperations
/**
* Creates an index, indexing properties with the given {@code propertyKeyId} for nodes with the given
* {@code labelId}.
* @param schemaDescriptor
*/
NewIndexDescriptor indexCreate( NodePropertyDescriptor nodeDescriptor )
NewIndexDescriptor indexCreate( LabelSchemaDescriptor schemaDescriptor )
throws AlreadyIndexedException, AlreadyConstrainedException;

/** Drops a {@link NewIndexDescriptor} from the database */
Expand Down
Expand Up @@ -19,10 +19,11 @@
*/
package org.neo4j.kernel.api.constraints;

import org.neo4j.kernel.api.schema.IndexDescriptor;
import org.neo4j.kernel.api.schema.IndexDescriptorFactory;
import org.neo4j.kernel.api.schema.NodePropertyDescriptor;
import org.neo4j.kernel.api.TokenNameLookup;
import org.neo4j.kernel.api.schema_new.SchemaBoundary;
import org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor;
import org.neo4j.kernel.api.schema_new.index.NewIndexDescriptorFactory;

/**
* Description of uniqueness constraint over nodes given a label and a property key id.
Expand All @@ -34,9 +35,9 @@ public UniquenessConstraint( NodePropertyDescriptor descriptor )
super( descriptor );
}

public IndexDescriptor indexDescriptor()
public NewIndexDescriptor indexDescriptor()
{
return IndexDescriptorFactory.of( descriptor );
return NewIndexDescriptorFactory.forSchema( SchemaBoundary.map( descriptor ) );
}

@Override
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Expand Up @@ -19,7 +19,7 @@
*/
package org.neo4j.kernel.api.schema_new;

import org.neo4j.kernel.api.schema.IndexDescriptorFactory;
import org.neo4j.kernel.api.schema.NodeMultiPropertyDescriptor;
import org.neo4j.kernel.api.schema.NodePropertyDescriptor;
import org.neo4j.kernel.api.schema.RelationshipPropertyDescriptor;

Expand Down Expand Up @@ -47,6 +47,6 @@ public static RelationTypeSchemaDescriptor map( RelationshipPropertyDescriptor d

public static NodePropertyDescriptor map( LabelSchemaDescriptor schema )
{
return IndexDescriptorFactory.getNodePropertyDescriptor( schema.getLabelId(), schema.getPropertyIds() );
return new NodeMultiPropertyDescriptor( schema.getLabelId(), schema.getPropertyIds() );
}
}
Expand Up @@ -28,7 +28,7 @@
import org.neo4j.kernel.api.constraints.RelationshipPropertyConstraint;
import org.neo4j.kernel.api.constraints.RelationshipPropertyExistenceConstraint;
import org.neo4j.kernel.api.constraints.UniquenessConstraint;
import org.neo4j.kernel.api.schema.IndexDescriptorFactory;
import org.neo4j.kernel.api.schema.NodePropertyDescriptor;
import org.neo4j.kernel.api.schema.RelationshipPropertyDescriptor;
import org.neo4j.kernel.api.schema_new.LabelSchemaDescriptor;
import org.neo4j.kernel.api.schema_new.RelationTypeSchemaDescriptor;
Expand Down Expand Up @@ -108,11 +108,11 @@ public PropertyConstraint computeSpecific( LabelSchemaDescriptor schema )
switch ( descriptor.type() )
{
case UNIQUE:
return new UniquenessConstraint( IndexDescriptorFactory.getNodePropertyDescriptor(
return new UniquenessConstraint( new NodePropertyDescriptor(
schema.getLabelId(), schema.getPropertyId() ) );

case EXISTS:
return new NodePropertyExistenceConstraint( IndexDescriptorFactory.getNodePropertyDescriptor(
return new NodePropertyExistenceConstraint( new NodePropertyDescriptor(
schema.getLabelId(), schema.getPropertyId() ) );

default:
Expand Down

0 comments on commit 23656a2

Please sign in to comment.