Skip to content

Commit

Permalink
PR comment: Use GraphDatabaseSettings#SchemaIndex as source of truth …
Browse files Browse the repository at this point in the history
…for index provider names
  • Loading branch information
burqen committed Jul 27, 2018
1 parent a313086 commit 8c2d23a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 14 deletions.
Expand Up @@ -559,22 +559,34 @@ public class GraphDatabaseSettings implements LoadableConfig


public enum SchemaIndex public enum SchemaIndex
{ {
NATIVE_GBPTREE10( "native-gbptree-1.0" ), NATIVE_GBPTREE10( "native-gbptree", "1.0" ),
NATIVE20( "lucene+native-2.0" ), NATIVE20( "lucene+native", "2.0" ),
NATIVE10( "lucene+native-1.0" ), NATIVE10( "lucene+native", "1.0" ),
LUCENE10( "lucene-1.0" ); LUCENE10( "lucene", "1.0" );


private final String providerName; private final String providerName;
private final String providerVersion;


SchemaIndex( String providerName ) SchemaIndex( String providerName, String providerVersion )
{ {
this.providerName = providerName; this.providerName = providerName;
this.providerVersion = providerVersion;
} }


public String providerIdentifier() public String providerIdentifier()
{
return providerName + "-" + providerVersion;
}

public String providerName()
{ {
return providerName; return providerName;
} }

public String providerVersion()
{
return providerVersion;
}
} }


@Description( "Index provider to use for newly created schema indexes. " + @Description( "Index provider to use for newly created schema indexes. " +
Expand Down
Expand Up @@ -22,6 +22,7 @@
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;


import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.index.internal.gbptree.Layout; import org.neo4j.index.internal.gbptree.Layout;
import org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector; import org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector;
import org.neo4j.internal.kernel.api.IndexCapability; import org.neo4j.internal.kernel.api.IndexCapability;
Expand Down Expand Up @@ -81,8 +82,9 @@
*/ */
public class GenericNativeIndexProvider extends NativeIndexProvider<CompositeGenericKey,NativeIndexValue> public class GenericNativeIndexProvider extends NativeIndexProvider<CompositeGenericKey,NativeIndexValue>
{ {
public static final String KEY = "native-gbptree"; public static final String KEY = GraphDatabaseSettings.SchemaIndex.NATIVE_GBPTREE10.providerName();
public static final IndexProvider.Descriptor DESCRIPTOR = new IndexProvider.Descriptor( KEY, "1.0" ); public static final String VERSION = GraphDatabaseSettings.SchemaIndex.NATIVE_GBPTREE10.providerVersion();
public static final IndexProvider.Descriptor DESCRIPTOR = new IndexProvider.Descriptor( KEY, VERSION );


// TODO implement // TODO implement
public static final IndexCapability CAPABILITY = new IndexCapability() public static final IndexCapability CAPABILITY = new IndexCapability()
Expand Down
Expand Up @@ -25,18 +25,15 @@
import org.neo4j.kernel.api.index.IndexProvider; import org.neo4j.kernel.api.index.IndexProvider;
import org.neo4j.kernel.extension.ExtensionType; import org.neo4j.kernel.extension.ExtensionType;
import org.neo4j.kernel.extension.KernelExtensionFactory; import org.neo4j.kernel.extension.KernelExtensionFactory;
import org.neo4j.kernel.impl.index.schema.NumberIndexProvider;


import static org.neo4j.kernel.api.index.IndexDirectoryStructure.directoriesByProvider; import static org.neo4j.kernel.api.index.IndexDirectoryStructure.directoriesByProvider;
import static org.neo4j.kernel.api.index.IndexDirectoryStructure.directoriesBySubProvider; import static org.neo4j.kernel.api.index.IndexDirectoryStructure.directoriesBySubProvider;


abstract class NativeLuceneFusionIndexProviderFactory<DEPENDENCIES> extends KernelExtensionFactory<DEPENDENCIES> abstract class NativeLuceneFusionIndexProviderFactory<DEPENDENCIES> extends KernelExtensionFactory<DEPENDENCIES>
{ {
public static final String KEY = LuceneIndexProviderFactory.KEY + "+" + NumberIndexProvider.KEY; NativeLuceneFusionIndexProviderFactory( String key )

NativeLuceneFusionIndexProviderFactory()
{ {
super( ExtensionType.DATABASE, KEY ); super( ExtensionType.DATABASE, key );
} }


public static IndexDirectoryStructure.Factory subProviderDirectoryStructure( File databaseDirectory, IndexProvider.Descriptor descriptor ) public static IndexDirectoryStructure.Factory subProviderDirectoryStructure( File databaseDirectory, IndexProvider.Descriptor descriptor )
Expand Down
Expand Up @@ -48,9 +48,16 @@
public class NativeLuceneFusionIndexProviderFactory10 extends public class NativeLuceneFusionIndexProviderFactory10 extends
NativeLuceneFusionIndexProviderFactory<NativeLuceneFusionIndexProviderFactory10.Dependencies> NativeLuceneFusionIndexProviderFactory<NativeLuceneFusionIndexProviderFactory10.Dependencies>
{ {
public static final IndexProvider.Descriptor DESCRIPTOR = new IndexProvider.Descriptor( KEY, "1.0" ); public static final String KEY = GraphDatabaseSettings.SchemaIndex.NATIVE10.providerName();
public static final String VERSION = GraphDatabaseSettings.SchemaIndex.NATIVE10.providerVersion();
public static final IndexProvider.Descriptor DESCRIPTOR = new IndexProvider.Descriptor( KEY, VERSION );
static final int PRIORITY = LuceneIndexProvider.PRIORITY + 1; static final int PRIORITY = LuceneIndexProvider.PRIORITY + 1;


public NativeLuceneFusionIndexProviderFactory10()
{
super( KEY );
}

public interface Dependencies extends LuceneIndexProviderFactory.Dependencies public interface Dependencies extends LuceneIndexProviderFactory.Dependencies
{ {
} }
Expand Down
Expand Up @@ -48,9 +48,16 @@
public class NativeLuceneFusionIndexProviderFactory20 extends public class NativeLuceneFusionIndexProviderFactory20 extends
NativeLuceneFusionIndexProviderFactory<NativeLuceneFusionIndexProviderFactory20.Dependencies> NativeLuceneFusionIndexProviderFactory<NativeLuceneFusionIndexProviderFactory20.Dependencies>
{ {
public static final IndexProvider.Descriptor DESCRIPTOR = new IndexProvider.Descriptor( KEY, "2.0" ); public static final String KEY = GraphDatabaseSettings.SchemaIndex.NATIVE20.providerName();
public static final String VERSION = GraphDatabaseSettings.SchemaIndex.NATIVE20.providerVersion();
public static final IndexProvider.Descriptor DESCRIPTOR = new IndexProvider.Descriptor( KEY, VERSION );
private static final int PRIORITY = NativeLuceneFusionIndexProviderFactory10.PRIORITY + 1; private static final int PRIORITY = NativeLuceneFusionIndexProviderFactory10.PRIORITY + 1;


public NativeLuceneFusionIndexProviderFactory20()
{
super( KEY );
}

public interface Dependencies extends LuceneIndexProviderFactory.Dependencies public interface Dependencies extends LuceneIndexProviderFactory.Dependencies
{ {
} }
Expand Down

0 comments on commit 8c2d23a

Please sign in to comment.