Skip to content

Commit

Permalink
Rename PendingIndexDescriptor => IndexDescriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
fickludd authored and ragadeeshu committed May 21, 2018
1 parent 5aee19c commit 21f8820
Show file tree
Hide file tree
Showing 149 changed files with 637 additions and 640 deletions.
Expand Up @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.spi.v2_3

import org.neo4j.cypher.internal.compiler.v2_3.spi.SchemaTypes
import org.neo4j.kernel.api.schema.constaints.{NodeExistenceConstraintDescriptor, RelExistenceConstraintDescriptor, UniquenessConstraintDescriptor}
import org.neo4j.kernel.api.schema.index.{IndexDescriptorFactory, PendingIndexDescriptor => KernelIndexDescriptor}
import org.neo4j.kernel.api.schema.index.{IndexDescriptorFactory, IndexDescriptor => KernelIndexDescriptor}

trait SchemaDescriptorTranslation {
implicit def cypherToKernel(index: SchemaTypes.IndexDescriptor): KernelIndexDescriptor =
Expand Down
Expand Up @@ -29,7 +29,7 @@ import org.neo4j.internal.kernel.api.exceptions.KernelException
import org.neo4j.internal.kernel.api.{IndexReference, InternalIndexState}
import org.neo4j.kernel.api.schema.SchemaDescriptorFactory
import org.neo4j.kernel.api.schema.constaints.ConstraintDescriptor
import org.neo4j.kernel.api.schema.index.{PendingIndexDescriptor => KernelIndexDescriptor}
import org.neo4j.kernel.api.schema.index.{IndexDescriptor => KernelIndexDescriptor}
import org.neo4j.kernel.impl.transaction.log.TransactionIdStore

import scala.collection.JavaConverters._
Expand Down
Expand Up @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.spi.v3_1
import org.neo4j.cypher.internal.compiler.v3_1.spi.SchemaTypes
import org.neo4j.internal.kernel.api.schema.SchemaDescriptor
import org.neo4j.kernel.api.schema.constaints.{ConstraintDescriptorFactory, NodeExistenceConstraintDescriptor, RelExistenceConstraintDescriptor, UniquenessConstraintDescriptor => KernelUniquenessConstraint}
import org.neo4j.kernel.api.schema.index.{IndexDescriptorFactory, PendingIndexDescriptor => KernelIndexDescriptor}
import org.neo4j.kernel.api.schema.index.{IndexDescriptorFactory, IndexDescriptor => KernelIndexDescriptor}

trait SchemaDescriptorTranslation {
implicit def toKernel(index: SchemaTypes.IndexDescriptor): KernelIndexDescriptor =
Expand Down
Expand Up @@ -36,7 +36,7 @@ import org.neo4j.internal.kernel.api.procs.{DefaultParameterValue, Neo4jTypes}
import org.neo4j.internal.kernel.api.{IndexReference, InternalIndexState, procs}
import org.neo4j.kernel.api.schema.SchemaDescriptorFactory
import org.neo4j.kernel.api.schema.constaints.ConstraintDescriptor
import org.neo4j.kernel.api.schema.index.{PendingIndexDescriptor => KernelIndexDescriptor}
import org.neo4j.kernel.api.schema.index.{IndexDescriptor => KernelIndexDescriptor}
import org.neo4j.procedure.Mode

import scala.collection.JavaConverters._
Expand Down
Expand Up @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.spi.v3_3

import org.neo4j.cypher.internal.compiler.v3_3.{IndexDescriptor => CypherIndexDescriptor}
import org.neo4j.internal.kernel.api.schema.LabelSchemaDescriptor
import org.neo4j.kernel.api.schema.index.{IndexDescriptorFactory, PendingIndexDescriptor => KernelIndexDescriptor}
import org.neo4j.kernel.api.schema.index.{IndexDescriptorFactory, IndexDescriptor => KernelIndexDescriptor}
import org.neo4j.kernel.api.schema.SchemaDescriptorFactory

trait IndexDescriptorCompatibility {
Expand Down
Expand Up @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.runtime.interpreted
import org.neo4j.cypher.internal.planner.v3_5.spi.{IndexDescriptor => CypherIndexDescriptor}
import org.neo4j.internal.kernel.api.schema.LabelSchemaDescriptor
import org.neo4j.kernel.api.schema.SchemaDescriptorFactory
import org.neo4j.kernel.api.schema.index.{IndexDescriptorFactory, PendingIndexDescriptor => KernelIndexDescriptor}
import org.neo4j.kernel.api.schema.index.{IndexDescriptorFactory, IndexDescriptor => KernelIndexDescriptor}

trait IndexDescriptorCompatibility {
def cypherToKernel(index: CypherIndexDescriptor): KernelIndexDescriptor =
Expand Down
Expand Up @@ -23,7 +23,7 @@
import org.neo4j.internal.kernel.api.exceptions.KernelException;
import org.neo4j.internal.kernel.api.schema.SchemaDescriptor;
import org.neo4j.internal.kernel.api.schema.SchemaUtil;
import org.neo4j.kernel.api.schema.index.PendingIndexDescriptor;
import org.neo4j.kernel.api.schema.index.IndexDescriptor;
import org.neo4j.values.storable.Value;
import org.neo4j.values.storable.ValueTuple;

Expand Down Expand Up @@ -58,7 +58,7 @@ public IndexEntryConflictException( long existingNodeId, long addedNodeId, Value
* was caught but it should not have been allowed to be thrown in the first place.
* Typically where the index we performed an operation on is not a unique index.
*/
public RuntimeException notAllowed( PendingIndexDescriptor descriptor )
public RuntimeException notAllowed( IndexDescriptor descriptor )
{
return new IllegalStateException( String.format(
"Index for (%s) should not require unique values.",
Expand Down
Expand Up @@ -24,7 +24,7 @@

import org.neo4j.internal.kernel.api.InternalIndexState;
import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException;
import org.neo4j.kernel.api.schema.index.PendingIndexDescriptor;
import org.neo4j.kernel.api.schema.index.IndexDescriptor;
import org.neo4j.kernel.impl.api.index.UpdateMode;
import org.neo4j.kernel.impl.api.index.updater.SwallowingIndexUpdater;
import org.neo4j.storageengine.api.schema.IndexSample;
Expand Down Expand Up @@ -107,19 +107,19 @@ void add( Collection<? extends IndexEntryUpdate<?>> updates )
* Close this populator and releases any resources related to it.
* If {@code populationCompletedSuccessfully} is {@code true} then it must mark this index
* as {@link InternalIndexState#ONLINE} so that future invocations of its parent
* {@link IndexProvider#getInitialState(long, PendingIndexDescriptor)} also returns {@link InternalIndexState#ONLINE}.
* {@link IndexProvider#getInitialState(long, IndexDescriptor)} also returns {@link InternalIndexState#ONLINE}.
*
* @param populationCompletedSuccessfully {@code true} if the index population was successful, where the index should
* be marked as {@link InternalIndexState#ONLINE}, otherwise {@code false} where index should be marked as
* {@link InternalIndexState#FAILED} and the failure, previously handed to this populator using {@link #markAsFailed(String)}
* should be stored and made available for later requests from {@link IndexProvider#getPopulationFailure(long, PendingIndexDescriptor)}.
* should be stored and made available for later requests from {@link IndexProvider#getPopulationFailure(long, IndexDescriptor)}.
* @throws IOException on I/O error.
*/
void close( boolean populationCompletedSuccessfully ) throws IOException;

/**
* Called then a population failed. The failure string should be stored for future retrieval by
* {@link IndexProvider#getPopulationFailure(long, PendingIndexDescriptor)}. Called before {@link #close(boolean)}
* {@link IndexProvider#getPopulationFailure(long, IndexDescriptor)}. Called before {@link #close(boolean)}
* if there was a failure during population.
*
* @param failure the description of the failure.
Expand Down
Expand Up @@ -27,7 +27,7 @@
import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.io.pagecache.PageCache;
import org.neo4j.kernel.api.schema.index.StoreIndexDescriptor;
import org.neo4j.kernel.api.schema.index.PendingIndexDescriptor;
import org.neo4j.kernel.api.schema.index.IndexDescriptor;
import org.neo4j.kernel.impl.api.index.IndexingService;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
import org.neo4j.kernel.impl.storemigration.StoreMigrationParticipant;
Expand Down Expand Up @@ -105,14 +105,14 @@ public void failedToOpenIndex( StoreIndexDescriptor schemaIndexDescriptor, Strin
}

@Override
public void recoveryCompleted( PendingIndexDescriptor schemaIndexDescriptor, String indexFile, Map<String,Object> data )
public void recoveryCompleted( IndexDescriptor schemaIndexDescriptor, String indexFile, Map<String,Object> data )
{ // no-op
}
}

void failedToOpenIndex( StoreIndexDescriptor schemaIndexDescriptor, String action, Exception cause );

void recoveryCompleted( PendingIndexDescriptor schemaIndexDescriptor, String indexFile, Map<String,Object> data );
void recoveryCompleted( IndexDescriptor schemaIndexDescriptor, String indexFile, Map<String,Object> data );
}

public static final IndexProvider EMPTY =
Expand Down
Expand Up @@ -23,7 +23,7 @@
import java.util.StringJoiner;

import org.neo4j.kernel.api.schema.index.StoreIndexDescriptor;
import org.neo4j.kernel.api.schema.index.PendingIndexDescriptor;
import org.neo4j.kernel.api.schema.index.IndexDescriptor;
import org.neo4j.logging.Log;

import static java.lang.String.format;
Expand All @@ -44,7 +44,7 @@ public void failedToOpenIndex( StoreIndexDescriptor descriptor, String action, E
}

@Override
public void recoveryCompleted( PendingIndexDescriptor schemaIndexDescriptor, String indexFile, Map<String,Object> data )
public void recoveryCompleted( IndexDescriptor schemaIndexDescriptor, String indexFile, Map<String,Object> data )
{
StringJoiner joiner = new StringJoiner( ", ", "Schema index recovery completed: ", "" );
joiner.add( "descriptor=" + schemaIndexDescriptor );
Expand Down
Expand Up @@ -23,7 +23,7 @@
import org.neo4j.internal.kernel.api.schema.LabelSchemaDescriptor;
import org.neo4j.internal.kernel.api.schema.LabelSchemaSupplier;
import org.neo4j.internal.kernel.api.schema.SchemaUtil;
import org.neo4j.kernel.api.schema.index.PendingIndexDescriptor;
import org.neo4j.kernel.api.schema.index.IndexDescriptor;
import org.neo4j.kernel.api.schema.index.IndexDescriptorFactory;

public abstract class IndexBackedConstraintDescriptor extends ConstraintDescriptor implements LabelSchemaSupplier
Expand All @@ -42,7 +42,7 @@ public LabelSchemaDescriptor schema()
return schema;
}

public PendingIndexDescriptor ownedIndexDescriptor()
public IndexDescriptor ownedIndexDescriptor()
{
return IndexDescriptorFactory.uniqueForSchema( schema );
}
Expand Down
Expand Up @@ -36,43 +36,43 @@
import org.neo4j.values.storable.ValueCategory;

import static java.lang.String.format;
import static org.neo4j.kernel.api.schema.index.PendingIndexDescriptor.Filter.GENERAL;
import static org.neo4j.kernel.api.schema.index.PendingIndexDescriptor.Filter.UNIQUE;
import static org.neo4j.kernel.api.schema.index.IndexDescriptor.Filter.GENERAL;
import static org.neo4j.kernel.api.schema.index.IndexDescriptor.Filter.UNIQUE;

/**
* Internal representation of a graph index, including the schema unit it targets (eg. label-property combination)
* and the type of index. UNIQUE indexes are used to back uniqueness constraints.
*/
public class PendingIndexDescriptor implements SchemaDescriptorSupplier, CapableIndexReference
public class IndexDescriptor implements SchemaDescriptorSupplier, CapableIndexReference
{
public enum Type
{
GENERAL,
UNIQUE
}

public enum Filter implements Predicate<PendingIndexDescriptor>
public enum Filter implements Predicate<IndexDescriptor>
{
GENERAL
{
@Override
public boolean test( PendingIndexDescriptor index )
public boolean test( IndexDescriptor index )
{
return index.type == Type.GENERAL;
}
},
UNIQUE
{
@Override
public boolean test( PendingIndexDescriptor index )
public boolean test( IndexDescriptor index )
{
return index.type == Type.UNIQUE;
}
},
ANY
{
@Override
public boolean test( PendingIndexDescriptor index )
public boolean test( IndexDescriptor index )
{
return true;
}
Expand All @@ -81,18 +81,18 @@ public boolean test( PendingIndexDescriptor index )

public interface Supplier
{
PendingIndexDescriptor getIndexDescriptor();
IndexDescriptor getIndexDescriptor();
}

protected final SchemaDescriptor schema;
protected final PendingIndexDescriptor.Type type;
protected final IndexDescriptor.Type type;
protected final Optional<String> name;
protected final IndexProvider.Descriptor providerDescriptor;

public PendingIndexDescriptor( SchemaDescriptor schema,
Type type,
Optional<String> name,
IndexProvider.Descriptor providerDescriptor )
public IndexDescriptor( SchemaDescriptor schema,
Type type,
Optional<String> name,
IndexProvider.Descriptor providerDescriptor )
{
this.schema = schema;
this.type = type;
Expand Down Expand Up @@ -181,9 +181,9 @@ public String userDescription( TokenNameLookup tokenNameLookup )
@Override
public boolean equals( Object o )
{
if ( o instanceof PendingIndexDescriptor )
if ( o instanceof IndexDescriptor )
{
PendingIndexDescriptor that = (PendingIndexDescriptor)o;
IndexDescriptor that = (IndexDescriptor)o;
return this.type() == that.type() && this.schema().equals( that.schema() );
}
return false;
Expand All @@ -208,9 +208,9 @@ public String toString()
* @param indexes Indexes to sort
* @return sorted indexes
*/
public static Iterator<PendingIndexDescriptor> sortByType( Iterator<PendingIndexDescriptor> indexes )
public static Iterator<IndexDescriptor> sortByType( Iterator<IndexDescriptor> indexes )
{
List<PendingIndexDescriptor> materialized = Iterators.asList( indexes );
List<IndexDescriptor> materialized = Iterators.asList( indexes );
return Iterators.concat(
Iterators.filter( GENERAL, materialized.iterator() ),
Iterators.filter( UNIQUE, materialized.iterator() ) );
Expand Down
Expand Up @@ -26,39 +26,39 @@
import org.neo4j.kernel.api.index.IndexProvider;
import org.neo4j.kernel.api.schema.SchemaDescriptorFactory;

import static org.neo4j.kernel.api.schema.index.PendingIndexDescriptor.Type.GENERAL;
import static org.neo4j.kernel.api.schema.index.PendingIndexDescriptor.Type.UNIQUE;
import static org.neo4j.kernel.api.schema.index.IndexDescriptor.Type.GENERAL;
import static org.neo4j.kernel.api.schema.index.IndexDescriptor.Type.UNIQUE;

public class IndexDescriptorFactory
{
private IndexDescriptorFactory()
{
}

public static PendingIndexDescriptor forLabel( int labelId, int... propertyIds )
public static IndexDescriptor forLabel( int labelId, int... propertyIds )
{
return forSchema( SchemaDescriptorFactory.forLabel( labelId, propertyIds ) );
}

public static PendingIndexDescriptor uniqueForLabel( int labelId, int... propertyIds )
public static IndexDescriptor uniqueForLabel( int labelId, int... propertyIds )
{
return uniqueForSchema( SchemaDescriptorFactory.forLabel( labelId, propertyIds ) );
}

public static PendingIndexDescriptor forSchema( SchemaDescriptor schema )
public static IndexDescriptor forSchema( SchemaDescriptor schema )
{
return new PendingIndexDescriptor( schema, GENERAL, null, null );
return new IndexDescriptor( schema, GENERAL, null, null );
}

public static PendingIndexDescriptor forSchema( SchemaDescriptor schema,
Optional<String> name,
IndexProvider.Descriptor providerDescriptor )
public static IndexDescriptor forSchema( SchemaDescriptor schema,
Optional<String> name,
IndexProvider.Descriptor providerDescriptor )
{
return new PendingIndexDescriptor( schema, GENERAL, name, providerDescriptor );
return new IndexDescriptor( schema, GENERAL, name, providerDescriptor );
}

public static PendingIndexDescriptor uniqueForSchema( SchemaDescriptor schema )
public static IndexDescriptor uniqueForSchema( SchemaDescriptor schema )
{
return new PendingIndexDescriptor( schema, UNIQUE, null, null );
return new IndexDescriptor( schema, UNIQUE, null, null );
}
}
Expand Up @@ -33,45 +33,45 @@
/**
* A {@link Label} can have zero or more index rules which will have data specified in the rules indexed.
*/
public class StoreIndexDescriptor extends PendingIndexDescriptor implements SchemaRule
public class StoreIndexDescriptor extends IndexDescriptor implements SchemaRule
{
private final long id;
private final Long owningConstraintId;

public static StoreIndexDescriptor indexRule( long id, PendingIndexDescriptor descriptor,
public static StoreIndexDescriptor indexRule( long id, IndexDescriptor descriptor,
IndexProvider.Descriptor providerDescriptor )
{
return new StoreIndexDescriptor( id, providerDescriptor, descriptor, null );
}

public static StoreIndexDescriptor constraintIndexRule( long id, PendingIndexDescriptor descriptor,
public static StoreIndexDescriptor constraintIndexRule( long id, IndexDescriptor descriptor,
IndexProvider.Descriptor providerDescriptor,
Long owningConstraint )
{
return new StoreIndexDescriptor( id, providerDescriptor, descriptor, owningConstraint );
}

public static StoreIndexDescriptor indexRule( long id, PendingIndexDescriptor descriptor,
public static StoreIndexDescriptor indexRule( long id, IndexDescriptor descriptor,
IndexProvider.Descriptor providerDescriptor, String name )
{
return new StoreIndexDescriptor( id, providerDescriptor, descriptor, null, name );
}

public static StoreIndexDescriptor constraintIndexRule( long id, PendingIndexDescriptor descriptor,
public static StoreIndexDescriptor constraintIndexRule( long id, IndexDescriptor descriptor,
IndexProvider.Descriptor providerDescriptor,
Long owningConstraint, String name )
{
return new StoreIndexDescriptor( id, providerDescriptor, descriptor, owningConstraint, name );
}

protected StoreIndexDescriptor( long id, IndexProvider.Descriptor providerDescriptor,
PendingIndexDescriptor descriptor, Long owningConstraintId )
IndexDescriptor descriptor, Long owningConstraintId )
{
this( id, providerDescriptor, descriptor, owningConstraintId, null );
}

protected StoreIndexDescriptor( long id, IndexProvider.Descriptor providerDescriptor,
PendingIndexDescriptor descriptor, Long owningConstraintId, String name )
IndexDescriptor descriptor, Long owningConstraintId, String name )
{
super( descriptor.schema(),
descriptor.type(),
Expand All @@ -90,7 +90,7 @@ protected StoreIndexDescriptor( long id, IndexProvider.Descriptor providerDescri

public boolean canSupportUniqueConstraint()
{
return type() == PendingIndexDescriptor.Type.UNIQUE;
return type() == IndexDescriptor.Type.UNIQUE;
}

/**
Expand Down

0 comments on commit 21f8820

Please sign in to comment.