Skip to content

Commit

Permalink
Removed IndexConfiguration. This is covered by NewIndexDescriptor.
Browse files Browse the repository at this point in the history
  • Loading branch information
fickludd authored and ragadeeshu committed Feb 27, 2017
1 parent c4cdbff commit 3ef641d
Show file tree
Hide file tree
Showing 41 changed files with 145 additions and 252 deletions.
Expand Up @@ -28,7 +28,6 @@
import java.util.Map;

import org.neo4j.kernel.api.index.IndexAccessor;
import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.index.InternalIndexState;
import org.neo4j.kernel.api.index.SchemaIndexProvider;
import org.neo4j.kernel.api.schema_new.index.IndexBoundary;
Expand Down
Expand Up @@ -66,17 +66,13 @@
import org.neo4j.kernel.api.exceptions.schema.IllegalTokenNameException;
import org.neo4j.kernel.api.exceptions.schema.TooManyLabelsException;
import org.neo4j.kernel.api.index.IndexAccessor;
import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.index.IndexEntryUpdate;
import org.neo4j.kernel.api.index.IndexPopulator;
import org.neo4j.kernel.api.index.IndexUpdater;
import org.neo4j.kernel.api.index.SchemaIndexProvider;
import org.neo4j.kernel.api.labelscan.LabelScanStore;
import org.neo4j.kernel.api.labelscan.LabelScanWriter;
import org.neo4j.kernel.api.labelscan.NodeLabelUpdate;
import org.neo4j.kernel.api.schema.IndexDescriptor;
import org.neo4j.kernel.api.schema.IndexDescriptorFactory;
import org.neo4j.kernel.api.schema_new.index.IndexBoundary;
import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.impl.annotations.Documented;
import org.neo4j.kernel.impl.api.KernelStatement;
Expand Down

This file was deleted.

Expand Up @@ -21,8 +21,6 @@

import java.util.concurrent.Future;

import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.schema.IndexDescriptor;
import org.neo4j.kernel.api.index.IndexUpdater;
import org.neo4j.kernel.api.index.SchemaIndexProvider;
import org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor;
Expand Down
Expand Up @@ -25,8 +25,6 @@

import org.neo4j.graphdb.ResourceIterator;
import org.neo4j.kernel.api.exceptions.index.IndexPopulationFailedKernelException;
import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.schema.IndexDescriptor;
import org.neo4j.kernel.api.index.IndexPopulator;
import org.neo4j.kernel.api.index.InternalIndexState;
import org.neo4j.kernel.api.index.SchemaIndexProvider;
Expand Down
Expand Up @@ -38,16 +38,13 @@
import org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException;
import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException;
import org.neo4j.kernel.api.exceptions.index.IndexPopulationFailedKernelException;
import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.index.IndexEntryUpdate;
import org.neo4j.kernel.api.index.IndexPopulator;
import org.neo4j.kernel.api.index.IndexUpdater;
import org.neo4j.kernel.api.index.NodeUpdates;
import org.neo4j.kernel.api.index.PropertyAccessor;
import org.neo4j.kernel.api.index.SchemaIndexProvider;
import org.neo4j.kernel.api.index.SchemaIndexProvider.Descriptor;
import org.neo4j.kernel.api.schema.IndexDescriptor;
import org.neo4j.kernel.api.schema_new.index.IndexBoundary;
import org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor;
import org.neo4j.logging.Log;
import org.neo4j.logging.LogProvider;
Expand Down
Expand Up @@ -29,9 +29,7 @@
import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException;
import org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException;
import org.neo4j.kernel.api.exceptions.index.IndexPopulationFailedKernelException;
import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.index.IndexEntryUpdate;
import org.neo4j.kernel.api.schema.IndexDescriptor;
import org.neo4j.kernel.api.index.IndexUpdater;
import org.neo4j.kernel.api.index.InternalIndexState;
import org.neo4j.kernel.api.index.SchemaIndexProvider;
Expand Down
Expand Up @@ -24,8 +24,6 @@

import org.neo4j.graphdb.ResourceIterator;
import org.neo4j.kernel.api.exceptions.index.IndexPopulationFailedKernelException;
import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.schema.IndexDescriptor;
import org.neo4j.kernel.api.index.InternalIndexState;
import org.neo4j.kernel.api.index.SchemaIndexProvider;
import org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor;
Expand Down
Expand Up @@ -29,7 +29,6 @@
import org.neo4j.collection.primitive.Primitive;
import org.neo4j.collection.primitive.PrimitiveIntObjectMap;
import org.neo4j.kernel.api.index.IndexAccessor;
import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.index.SchemaIndexProvider;
import org.neo4j.kernel.api.schema_new.SchemaDescriptorPredicates;
import org.neo4j.kernel.api.schema_new.index.IndexBoundary;
Expand Down
Expand Up @@ -53,7 +53,6 @@ public IndexAccessorCompatibility( IndexProviderCompatibilityTestSuite testSuite
NewIndexDescriptor descriptor, boolean isUnique )
{
super( testSuite, descriptor );
this.isUnique = isUnique;
}

@Before
Expand Down
Expand Up @@ -57,7 +57,6 @@ public NonUniqueIndexPopulatorCompatibility( IndexProviderCompatibilityTestSuite
public void shouldProvidePopulatorThatAcceptsDuplicateEntries() throws Exception
{
// when
IndexConfiguration config = IndexConfiguration.NON_UNIQUE;
IndexSamplingConfig indexSamplingConfig = new IndexSamplingConfig( Config.empty() );
IndexPopulator populator = indexProvider.getPopulator( 17, descriptor, indexSamplingConfig );
populator.create();
Expand All @@ -79,7 +78,6 @@ public void shouldProvidePopulatorThatAcceptsDuplicateEntries() throws Exception
public void shouldStorePopulationFailedForRetrievalFromProviderLater() throws Exception
{
// GIVEN
IndexConfiguration config = IndexConfiguration.NON_UNIQUE;
IndexSamplingConfig indexSamplingConfig = new IndexSamplingConfig( Config.empty() );
IndexPopulator populator = indexProvider.getPopulator( 17, descriptor, indexSamplingConfig );
String failure = "The contrived failure";
Expand All @@ -96,7 +94,6 @@ public void shouldStorePopulationFailedForRetrievalFromProviderLater() throws Ex
public void shouldReportInitialStateAsFailedIfPopulationFailed() throws Exception
{
// GIVEN
IndexConfiguration config = IndexConfiguration.NON_UNIQUE;
IndexSamplingConfig indexSamplingConfig = new IndexSamplingConfig( Config.empty() );
IndexPopulator populator = indexProvider.getPopulator( 17, descriptor, indexSamplingConfig );
String failure = "The contrived failure";
Expand All @@ -113,7 +110,6 @@ public void shouldReportInitialStateAsFailedIfPopulationFailed() throws Exceptio
public void shouldBeAbleToDropAClosedIndexPopulator() throws Exception
{
// GIVEN
IndexConfiguration config = IndexConfiguration.NON_UNIQUE;
IndexSamplingConfig indexSamplingConfig = new IndexSamplingConfig( Config.empty() );
IndexPopulator populator = indexProvider.getPopulator( 17, descriptor, indexSamplingConfig );
populator.close( false );
Expand Down
Expand Up @@ -23,9 +23,6 @@

import java.io.IOException;

import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.schema.IndexDescriptor;
import org.neo4j.kernel.api.schema.IndexDescriptorFactory;
import org.neo4j.kernel.api.index.IndexPopulator;
import org.neo4j.kernel.api.index.SchemaIndexProvider;
import org.neo4j.kernel.api.schema_new.index.NewIndexDescriptorFactory;
Expand Down
Expand Up @@ -23,7 +23,6 @@
import java.util.concurrent.Future;

import org.neo4j.graphdb.ResourceIterator;
import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.index.IndexUpdater;
import org.neo4j.kernel.api.index.InternalIndexState;
import org.neo4j.kernel.api.index.SchemaIndexProvider;
Expand Down
Expand Up @@ -45,9 +45,7 @@
import org.neo4j.kernel.api.Statement;
import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException;
import org.neo4j.kernel.api.index.IndexAccessor;
import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.index.IndexEntryUpdate;
import org.neo4j.kernel.api.schema.IndexDescriptor;
import org.neo4j.kernel.api.index.IndexPopulator;
import org.neo4j.kernel.api.index.IndexUpdater;
import org.neo4j.kernel.api.index.InternalIndexState;
Expand Down
Expand Up @@ -33,7 +33,6 @@

import org.neo4j.helpers.collection.Visitor;
import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException;
import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.index.IndexEntryUpdate;
import org.neo4j.kernel.api.schema.IndexDescriptor;
import org.neo4j.kernel.api.schema.IndexDescriptorFactory;
Expand Down
Expand Up @@ -35,10 +35,7 @@
import org.neo4j.helpers.collection.Visitor;
import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException;
import org.neo4j.kernel.api.exceptions.index.IndexPopulationFailedKernelException;
import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.index.IndexEntryUpdate;
import org.neo4j.kernel.api.schema.IndexDescriptor;
import org.neo4j.kernel.api.schema.IndexDescriptorFactory;
import org.neo4j.kernel.api.index.IndexPopulator;
import org.neo4j.kernel.api.index.IndexUpdater;
import org.neo4j.kernel.api.index.NodeUpdates;
Expand Down
Expand Up @@ -24,7 +24,6 @@
import java.io.IOException;

import org.neo4j.kernel.api.index.IndexAccessor;
import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.index.SchemaIndexProvider;
import org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor;
import org.neo4j.kernel.api.schema_new.index.NewIndexDescriptorFactory;
Expand Down
Expand Up @@ -23,9 +23,6 @@
import org.junit.Test;

import org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException;
import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.schema.IndexDescriptor;
import org.neo4j.kernel.api.schema.IndexDescriptorFactory;
import org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor;
import org.neo4j.kernel.api.schema_new.index.NewIndexDescriptorFactory;
import org.neo4j.kernel.impl.api.index.IndexProxy;
Expand Down
Expand Up @@ -31,9 +31,7 @@
import org.neo4j.collection.primitive.PrimitiveLongIterator;
import org.neo4j.collection.primitive.PrimitiveLongResourceIterator;
import org.neo4j.helpers.collection.Visitor;
import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.index.IndexEntryUpdate;
import org.neo4j.kernel.api.schema.IndexDescriptor;
import org.neo4j.kernel.api.index.IndexPopulator;
import org.neo4j.kernel.api.index.NodeUpdates;
import org.neo4j.kernel.api.index.SchemaIndexProvider;
Expand Down
Expand Up @@ -42,8 +42,8 @@
import org.neo4j.kernel.api.impl.schema.verification.UniquenessVerifier;
import org.neo4j.kernel.api.impl.schema.writer.LuceneIndexWriter;
import org.neo4j.kernel.api.impl.schema.writer.PartitionedIndexWriter;
import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.index.PropertyAccessor;
import org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;
import org.neo4j.storageengine.api.schema.IndexReader;

Expand All @@ -58,16 +58,16 @@ class LuceneSchemaIndex extends AbstractLuceneIndex
private static final String ONLINE = "online";
private static final Map<String,String> ONLINE_COMMIT_USER_DATA = singletonMap( KEY_STATUS, ONLINE );

private final IndexConfiguration config;
private final NewIndexDescriptor descriptor;
private final IndexSamplingConfig samplingConfig;

private final TaskCoordinator taskCoordinator = new TaskCoordinator( 10, TimeUnit.MILLISECONDS );

LuceneSchemaIndex( PartitionedIndexStorage indexStorage, IndexConfiguration config,
LuceneSchemaIndex( PartitionedIndexStorage indexStorage, NewIndexDescriptor descriptor,
IndexSamplingConfig samplingConfig, IndexPartitionFactory partitionFactory )
{
super( indexStorage, partitionFactory );
this.config = config;
this.descriptor = descriptor;
this.samplingConfig = samplingConfig;
}

Expand Down Expand Up @@ -193,7 +193,7 @@ private UniquenessVerifier createUniquenessVerifier() throws IOException
private SimpleIndexReader createSimpleReader( List<AbstractIndexPartition> partitions ) throws IOException
{
AbstractIndexPartition singlePartition = getFirstPartition( partitions );
return new SimpleIndexReader( singlePartition.acquireSearcher(), config, samplingConfig, taskCoordinator );
return new SimpleIndexReader( singlePartition.acquireSearcher(), descriptor, samplingConfig, taskCoordinator );
}

private UniquenessVerifier createSimpleUniquenessVerifier( List<AbstractIndexPartition> partitions ) throws IOException
Expand All @@ -206,7 +206,7 @@ private UniquenessVerifier createSimpleUniquenessVerifier( List<AbstractIndexPar
private PartitionedIndexReader createPartitionedReader( List<AbstractIndexPartition> partitions ) throws IOException
{
List<PartitionSearcher> searchers = acquireSearchers( partitions );
return new PartitionedIndexReader( searchers, config, samplingConfig, taskCoordinator );
return new PartitionedIndexReader( searchers, descriptor, samplingConfig, taskCoordinator );
}

private UniquenessVerifier createPartitionedUniquenessVerifier( List<AbstractIndexPartition> partitions ) throws IOException
Expand Down
Expand Up @@ -29,7 +29,7 @@
import org.neo4j.kernel.api.impl.index.partition.ReadOnlyIndexPartitionFactory;
import org.neo4j.kernel.api.impl.index.partition.WritableIndexPartitionFactory;
import org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage;
import org.neo4j.kernel.api.index.IndexConfiguration;
import org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor;
import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig;

Expand All @@ -43,22 +43,24 @@
*/
public class LuceneSchemaIndexBuilder extends AbstractLuceneIndexBuilder<LuceneSchemaIndexBuilder>
{
private final NewIndexDescriptor descriptor;
private IndexSamplingConfig samplingConfig = new IndexSamplingConfig( Config.empty() );
private IndexConfiguration indexConfig = IndexConfiguration.NON_UNIQUE;
private Factory<IndexWriterConfig> writerConfigFactory = IndexWriterConfigs::standard;

private LuceneSchemaIndexBuilder()
private LuceneSchemaIndexBuilder( NewIndexDescriptor descriptor )
{
this.descriptor = descriptor;
}

/**
* Create new lucene schema index builder.
*
* @return new LuceneSchemaIndexBuilder
* @param descriptor The descriptor for this index
*/
public static LuceneSchemaIndexBuilder create()
public static LuceneSchemaIndexBuilder create( NewIndexDescriptor descriptor )
{
return new LuceneSchemaIndexBuilder();
return new LuceneSchemaIndexBuilder( descriptor );
}

/**
Expand All @@ -73,18 +75,6 @@ public LuceneSchemaIndexBuilder withSamplingConfig( IndexSamplingConfig sampling
return this;
}

/**
* Specify lucene schema index config
*
* @param indexConfig index config
* @return index builder
*/
public LuceneSchemaIndexBuilder withIndexConfig( IndexConfiguration indexConfig )
{
this.indexConfig = indexConfig;
return this;
}

/**
* Specify {@link Factory} of lucene {@link IndexWriterConfig} to create {@link IndexWriter}s.
*
Expand All @@ -97,17 +87,6 @@ public LuceneSchemaIndexBuilder withWriterConfig( Factory<IndexWriterConfig> wri
return this;
}

/**
* Transform builder to build unique index
*
* @return index builder
*/
public LuceneSchemaIndexBuilder uniqueIndex()
{
this.indexConfig = IndexConfiguration.UNIQUE;
return this;
}

/**
* Build lucene schema index with specified configuration
*
Expand All @@ -117,14 +96,14 @@ public SchemaIndex build()
{
if ( isReadOnly() )
{
return new ReadOnlyDatabaseSchemaIndex( storageBuilder.build(), indexConfig, samplingConfig,
return new ReadOnlyDatabaseSchemaIndex( storageBuilder.build(), descriptor, samplingConfig,
new ReadOnlyIndexPartitionFactory() );
}
else
{
Boolean archiveFailed = getConfig( GraphDatabaseSettings.archive_failed_index );
PartitionedIndexStorage storage = storageBuilder.archivingFailed( archiveFailed ).build();
return new WritableDatabaseSchemaIndex( storage, indexConfig, samplingConfig,
return new WritableDatabaseSchemaIndex( storage, descriptor, samplingConfig,
new WritableIndexPartitionFactory( writerConfigFactory ) );
}
}
Expand Down

0 comments on commit 3ef641d

Please sign in to comment.