Skip to content

Commit

Permalink
Rename LuceneIndex to DatabaseIndex (and all derivatives)
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaDemianenko committed Aug 3, 2016
1 parent a26a40b commit 770c411
Show file tree
Hide file tree
Showing 31 changed files with 78 additions and 78 deletions.
Expand Up @@ -51,8 +51,8 @@
* {@link AbstractIndexPartition partitions}.
* Class and it's subclasses should not be directly used, instead please use corresponding writable or read only
* wrapper.
* @see WritableAbstractLuceneIndex
* @see ReadOnlyAbstractLuceneIndex
* @see WritableAbstractDatabaseIndex
* @see ReadOnlyAbstractDatabaseIndex
*/
public abstract class AbstractLuceneIndex
{
Expand Down
Expand Up @@ -32,7 +32,7 @@
* Lucene index that may consist of one or multiple separate lucene indexes that are represented as independent
* {@link AbstractIndexPartition partitions}.
*/
public interface LuceneIndex extends Closeable
public interface DatabaseIndex extends Closeable
{
/**
* Creates new index.
Expand Down
Expand Up @@ -31,11 +31,11 @@
* allow read only operations only on top of it.
* @param <T> - particular index implementation
*/
public abstract class ReadOnlyAbstractLuceneIndex<T extends AbstractLuceneIndex> implements LuceneIndex
public abstract class ReadOnlyAbstractDatabaseIndex<T extends AbstractLuceneIndex> implements DatabaseIndex
{
protected T luceneIndex;

public ReadOnlyAbstractLuceneIndex(T luceneIndex )
public ReadOnlyAbstractDatabaseIndex(T luceneIndex )
{
this.luceneIndex = luceneIndex;
}
Expand Down
Expand Up @@ -32,7 +32,7 @@
* allow read only operations only on top of it.
* @param <T> - particular index implementation
*/
public class WritableAbstractLuceneIndex<T extends AbstractLuceneIndex> implements LuceneIndex
public class WritableAbstractDatabaseIndex<T extends AbstractLuceneIndex> implements DatabaseIndex
{
// lock used to guard commits and close of lucene indexes from separate threads
protected final ReentrantLock commitCloseLock = new ReentrantLock();
Expand All @@ -41,7 +41,7 @@ public class WritableAbstractLuceneIndex<T extends AbstractLuceneIndex> implemen

protected T luceneIndex;

public WritableAbstractLuceneIndex( T luceneIndex )
public WritableAbstractDatabaseIndex( T luceneIndex )
{
this.luceneIndex = luceneIndex;
}
Expand Down
Expand Up @@ -19,7 +19,7 @@
*/
package org.neo4j.kernel.api.impl.labelscan;

import org.neo4j.kernel.api.impl.index.LuceneIndex;
import org.neo4j.kernel.api.impl.index.DatabaseIndex;
import org.neo4j.kernel.api.labelscan.AllEntriesLabelScanReader;
import org.neo4j.kernel.api.labelscan.LabelScanWriter;
import org.neo4j.kernel.api.labelscan.NodeLabelRange;
Expand All @@ -28,7 +28,7 @@
/**
* Partitioned lucene labels Label scan index.
*/
public interface LabelScanIndex extends LuceneIndex
public interface LabelScanIndex extends DatabaseIndex
{
LabelScanReader getLabelScanReader();

Expand Down
Expand Up @@ -74,7 +74,7 @@ public LabelScanReader getLabelScanReader()

}

public LabelScanWriter getLabelScanWriter( WritableLuceneLabelScanIndex labelScanIndex )
public LabelScanWriter getLabelScanWriter( WritableDatabaseLabelScanIndex labelScanIndex )
{
ensureOpen();
return new PartitionedLuceneLabelScanWriter( labelScanIndex, format );
Expand All @@ -85,7 +85,7 @@ public LabelScanWriter getLabelScanWriter( WritableLuceneLabelScanIndex labelSca
* <p>
* <b>NOTE:</b>
* There are no guarantees that reader returned from this method will see consistent documents with respect to
* {@link #getLabelScanReader() regular reader} and {@link #getLabelScanWriter(WritableLuceneLabelScanIndex) regular writer}.
* {@link #getLabelScanReader() regular reader} and {@link #getLabelScanWriter(WritableDatabaseLabelScanIndex) regular writer}.
*
* @return the {@link AllEntriesLabelScanReader reader}.
*/
Expand Down
Expand Up @@ -68,7 +68,7 @@ public LuceneLabelScanIndexBuilder withDocumentFormat( BitmapDocumentFormat form
*/
public LabelScanIndex build()
{
return isReadOnly() ? new ReadOnlyLuceneLabelScanIndex( format, storageBuilder.build() )
: new WritableLuceneLabelScanIndex( format, storageBuilder.build() );
return isReadOnly() ? new ReadOnlyDatabaseLabelScanIndex( format, storageBuilder.build() )
: new WritableDatabaseLabelScanIndex( format, storageBuilder.build() );
}
}
Expand Up @@ -19,7 +19,7 @@
*/
package org.neo4j.kernel.api.impl.labelscan;

import org.neo4j.kernel.api.impl.index.ReadOnlyAbstractLuceneIndex;
import org.neo4j.kernel.api.impl.index.ReadOnlyAbstractDatabaseIndex;
import org.neo4j.kernel.api.impl.index.partition.ReadOnlyIndexPartitionFactory;
import org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage;
import org.neo4j.kernel.api.impl.labelscan.storestrategy.BitmapDocumentFormat;
Expand All @@ -30,11 +30,11 @@
/**
* Read only label scan store index
*/
public class ReadOnlyLuceneLabelScanIndex extends ReadOnlyAbstractLuceneIndex<LuceneLabelScanIndex> implements
public class ReadOnlyDatabaseLabelScanIndex extends ReadOnlyAbstractDatabaseIndex<LuceneLabelScanIndex> implements
LabelScanIndex
{

public ReadOnlyLuceneLabelScanIndex( BitmapDocumentFormat format, PartitionedIndexStorage indexStorage )
public ReadOnlyDatabaseLabelScanIndex( BitmapDocumentFormat format, PartitionedIndexStorage indexStorage )
{
super( new LuceneLabelScanIndex( indexStorage, new ReadOnlyIndexPartitionFactory(), format ) );
}
Expand Down
Expand Up @@ -20,7 +20,7 @@
package org.neo4j.kernel.api.impl.labelscan;

import org.neo4j.kernel.api.impl.index.IndexWriterConfigs;
import org.neo4j.kernel.api.impl.index.WritableAbstractLuceneIndex;
import org.neo4j.kernel.api.impl.index.WritableAbstractDatabaseIndex;
import org.neo4j.kernel.api.impl.index.partition.WritableIndexPartitionFactory;
import org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage;
import org.neo4j.kernel.api.impl.labelscan.storestrategy.BitmapDocumentFormat;
Expand All @@ -31,11 +31,11 @@
/**
* Writable implementation of Lucene label scan store index.
*/
public class WritableLuceneLabelScanIndex extends WritableAbstractLuceneIndex<LuceneLabelScanIndex>
public class WritableDatabaseLabelScanIndex extends WritableAbstractDatabaseIndex<LuceneLabelScanIndex>
implements LabelScanIndex
{

public WritableLuceneLabelScanIndex( BitmapDocumentFormat format, PartitionedIndexStorage indexStorage )
public WritableDatabaseLabelScanIndex( BitmapDocumentFormat format, PartitionedIndexStorage indexStorage )
{
super( new LuceneLabelScanIndex( indexStorage,
new WritableIndexPartitionFactory( IndexWriterConfigs::standard ), format ) );
Expand Down
Expand Up @@ -35,7 +35,7 @@
import org.neo4j.kernel.api.impl.index.collector.FirstHitCollector;
import org.neo4j.kernel.api.impl.index.partition.AbstractIndexPartition;
import org.neo4j.kernel.api.impl.index.partition.PartitionSearcher;
import org.neo4j.kernel.api.impl.labelscan.WritableLuceneLabelScanIndex;
import org.neo4j.kernel.api.impl.labelscan.WritableDatabaseLabelScanIndex;
import org.neo4j.kernel.api.impl.labelscan.bitmaps.Bitmap;
import org.neo4j.kernel.api.impl.labelscan.storestrategy.BitmapDocumentFormat;
import org.neo4j.kernel.api.labelscan.LabelScanWriter;
Expand All @@ -61,9 +61,9 @@ public class PartitionedLuceneLabelScanWriter implements LabelScanWriter

private final List<NodeLabelUpdate> updates;
private long currentRange;
private WritableLuceneLabelScanIndex index;
private WritableDatabaseLabelScanIndex index;

public PartitionedLuceneLabelScanWriter( WritableLuceneLabelScanIndex index, BitmapDocumentFormat format)
public PartitionedLuceneLabelScanWriter( WritableDatabaseLabelScanIndex index, BitmapDocumentFormat format)
{
this.index = index;
this.format = format;
Expand Down
Expand Up @@ -71,7 +71,7 @@ class LuceneSchemaIndex extends AbstractLuceneIndex
this.samplingConfig = samplingConfig;
}

public LuceneIndexWriter getIndexWriter( WritableLuceneSchemaIndex writableLuceneSchemaIndex ) throws IOException
public LuceneIndexWriter getIndexWriter( WritableDatabaseSchemaIndex writableLuceneSchemaIndex ) throws IOException
{
ensureOpen();
return new PartitionedIndexWriter( writableLuceneSchemaIndex );
Expand Down
Expand Up @@ -113,9 +113,9 @@ public LuceneSchemaIndexBuilder uniqueIndex()
*/
public SchemaIndex build()
{
return isReadOnly() ? new ReadOnlyLuceneSchemaIndex( storageBuilder.build(), indexConfig, samplingConfig,
return isReadOnly() ? new ReadOnlyDatabaseSchemaIndex( storageBuilder.build(), indexConfig, samplingConfig,
new ReadOnlyIndexPartitionFactory() )
: new WritableLuceneSchemaIndex( storageBuilder.build(), indexConfig, samplingConfig,
: new WritableDatabaseSchemaIndex( storageBuilder.build(), indexConfig, samplingConfig,
new WritableIndexPartitionFactory( writerConfigFactory ) );
}

Expand Down
Expand Up @@ -23,7 +23,7 @@
import java.util.List;

import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException;
import org.neo4j.kernel.api.impl.index.ReadOnlyAbstractLuceneIndex;
import org.neo4j.kernel.api.impl.index.ReadOnlyAbstractDatabaseIndex;
import org.neo4j.kernel.api.impl.index.partition.ReadOnlyIndexPartitionFactory;
import org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage;
import org.neo4j.kernel.api.impl.schema.writer.LuceneIndexWriter;
Expand All @@ -35,9 +35,9 @@
/**
* Read only schema index
*/
public class ReadOnlyLuceneSchemaIndex extends ReadOnlyAbstractLuceneIndex<LuceneSchemaIndex> implements SchemaIndex
public class ReadOnlyDatabaseSchemaIndex extends ReadOnlyAbstractDatabaseIndex<LuceneSchemaIndex> implements SchemaIndex
{
public ReadOnlyLuceneSchemaIndex( PartitionedIndexStorage indexStorage, IndexConfiguration indexConfig,
public ReadOnlyDatabaseSchemaIndex( PartitionedIndexStorage indexStorage, IndexConfiguration indexConfig,
IndexSamplingConfig samplingConfig, ReadOnlyIndexPartitionFactory readOnlyIndexPartitionFactory )
{
super( new LuceneSchemaIndex( indexStorage, indexConfig, samplingConfig, readOnlyIndexPartitionFactory ) );
Expand Down
Expand Up @@ -23,7 +23,7 @@
import java.util.List;

import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException;
import org.neo4j.kernel.api.impl.index.LuceneIndex;
import org.neo4j.kernel.api.impl.index.DatabaseIndex;
import org.neo4j.kernel.api.impl.schema.verification.UniquenessVerifier;
import org.neo4j.kernel.api.impl.schema.writer.LuceneIndexWriter;
import org.neo4j.kernel.api.index.PropertyAccessor;
Expand All @@ -32,7 +32,7 @@
/**
* Partitioned lucene schema index.
*/
public interface SchemaIndex extends LuceneIndex
public interface SchemaIndex extends DatabaseIndex
{
LuceneIndexWriter getIndexWriter() throws IOException;

Expand Down
Expand Up @@ -23,7 +23,7 @@
import java.util.List;

import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException;
import org.neo4j.kernel.api.impl.index.WritableAbstractLuceneIndex;
import org.neo4j.kernel.api.impl.index.WritableAbstractDatabaseIndex;
import org.neo4j.kernel.api.impl.index.partition.AbstractIndexPartition;
import org.neo4j.kernel.api.impl.index.partition.WritableIndexPartitionFactory;
import org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage;
Expand All @@ -36,10 +36,10 @@
/**
* Writable schema index
*/
public class WritableLuceneSchemaIndex extends WritableAbstractLuceneIndex<LuceneSchemaIndex> implements SchemaIndex
public class WritableDatabaseSchemaIndex extends WritableAbstractDatabaseIndex<LuceneSchemaIndex> implements SchemaIndex
{

public WritableLuceneSchemaIndex( PartitionedIndexStorage indexStorage, IndexConfiguration indexConfig,
public WritableDatabaseSchemaIndex( PartitionedIndexStorage indexStorage, IndexConfiguration indexConfig,
IndexSamplingConfig samplingConfig, WritableIndexPartitionFactory writableIndexPartitionFactory )
{
super( new LuceneSchemaIndex( indexStorage, indexConfig, samplingConfig, writableIndexPartitionFactory ) );
Expand Down
Expand Up @@ -29,7 +29,7 @@
import java.util.Optional;

import org.neo4j.kernel.api.impl.index.partition.AbstractIndexPartition;
import org.neo4j.kernel.api.impl.schema.WritableLuceneSchemaIndex;
import org.neo4j.kernel.api.impl.schema.WritableDatabaseSchemaIndex;

/**
* Schema Lucene index writer implementation that supports writing into multiple partitions and creates partitions
Expand All @@ -41,12 +41,12 @@
*/
public class PartitionedIndexWriter implements LuceneIndexWriter
{
private WritableLuceneSchemaIndex index;
private WritableDatabaseSchemaIndex index;

private final Integer MAXIMUM_PARTITION_SIZE = Integer.getInteger( "luceneSchemaIndex.maxPartitionSize",
Integer.MAX_VALUE - (Integer.MAX_VALUE / 10) );

public PartitionedIndexWriter( WritableLuceneSchemaIndex index ) throws IOException
public PartitionedIndexWriter( WritableDatabaseSchemaIndex index ) throws IOException
{
this.index = index;
}
Expand Down
Expand Up @@ -21,9 +21,9 @@

import org.neo4j.kernel.api.index.SchemaConstraintProviderApprovalTest;

public class LuceneIndexConstraintProviderApprovalTest extends SchemaConstraintProviderApprovalTest
public class DatabaseIndexConstraintProviderApprovalTest extends SchemaConstraintProviderApprovalTest
{
public LuceneIndexConstraintProviderApprovalTest( TestValue value )
public DatabaseIndexConstraintProviderApprovalTest( TestValue value )
{
super( value );
}
Expand Down
Expand Up @@ -21,9 +21,9 @@

import org.neo4j.kernel.api.index.SchemaIndexProviderApprovalTest;

public class LuceneIndexIndexProviderApprovalTest extends SchemaIndexProviderApprovalTest
public class DatabaseIndexIndexProviderApprovalTest extends SchemaIndexProviderApprovalTest
{
public LuceneIndexIndexProviderApprovalTest( TestValue value )
public DatabaseIndexIndexProviderApprovalTest( TestValue value )
{
super( value );
}
Expand Down
Expand Up @@ -59,7 +59,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

public class AbstractLuceneIndexIntegrationTest
public class DatabaseIndexIntegrationTest
{
private static final int THREAD_NUMBER = 5;
@Rule
Expand All @@ -70,7 +70,7 @@ public class AbstractLuceneIndexIntegrationTest
private final CountDownLatch closeRaceSignal = new CountDownLatch( 1 );

private SyncNotifierDirectoryFactory directoryFactory;
private WritableTestLuceneIndex luceneIndex;
private WritableTestDatabaseIndex luceneIndex;
private ExecutorService workers;

@Before
Expand Down Expand Up @@ -103,11 +103,11 @@ public void testSaveCallCommitAndCloseFromMultipleThreads() throws Exception
assertFalse( luceneIndex.isOpen() );
}

private static WritableTestLuceneIndex createTestLuceneIndex( DirectoryFactory dirFactory, File folder ) throws IOException
private static WritableTestDatabaseIndex createTestLuceneIndex( DirectoryFactory dirFactory, File folder ) throws IOException
{
DefaultFileSystemAbstraction fs = new DefaultFileSystemAbstraction();
PartitionedIndexStorage indexStorage = new PartitionedIndexStorage( dirFactory, fs, folder, "test" );
WritableTestLuceneIndex index = new WritableTestLuceneIndex( indexStorage );
WritableTestDatabaseIndex index = new WritableTestDatabaseIndex( indexStorage );
index.create();
index.open();
return index;
Expand Down Expand Up @@ -179,9 +179,9 @@ private IndexWriter firstPartitionWriter()
return partition.getIndexWriter();
}

private static class WritableTestLuceneIndex extends WritableAbstractLuceneIndex
private static class WritableTestDatabaseIndex extends WritableAbstractDatabaseIndex
{
WritableTestLuceneIndex( PartitionedIndexStorage indexStorage )
WritableTestDatabaseIndex( PartitionedIndexStorage indexStorage )
{
super( new TestLuceneIndex( indexStorage,
new WritableIndexPartitionFactory( IndexWriterConfigs::standard ) ) );
Expand Down

0 comments on commit 770c411

Please sign in to comment.