Skip to content

Commit

Permalink
Minor clean-ups and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
OliviaYtterbrink authored and fickludd committed Mar 1, 2018
1 parent 958a4a0 commit 478f20e
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 54 deletions.
Expand Up @@ -63,7 +63,7 @@ class NativeAllEntriesLabelScanReader implements AllEntriesLabelScanReader
@Override
public long maxCount()
{
return -1;
return UNKNOWN_MAX_COUNT;
}

@Override
Expand Down
Expand Up @@ -25,11 +25,11 @@

import static org.neo4j.kernel.impl.index.schema.fusion.FusionSchemaIndexProvider.combineSamples;

class FusionIndexSampler implements IndexSampler
public class FusionIndexSampler implements IndexSampler
{
private final IndexSampler[] samplers;

FusionIndexSampler( IndexSampler... samplers )
public FusionIndexSampler( IndexSampler... samplers )
{
this.samplers = samplers;
}
Expand Down
Expand Up @@ -47,7 +47,7 @@ public abstract class FusionIndexUtils
* @param <E> the type of exception anticipated, inferred from the lambda
* @throws E if consumption fails with this exception
*/
public static <T, E extends Exception> void forAll( ThrowingConsumer<T,E> consumer, Collection<T> subjects ) throws E
public static <T, E extends Exception> void forAll( ThrowingConsumer<T,E> consumer, Iterable<T> subjects ) throws E
{
E exception = null;
for ( T subject : subjects )
Expand Down Expand Up @@ -76,7 +76,7 @@ public static <T, E extends Exception> void forAll( ThrowingConsumer<T,E> consum
}

/**
* See {@link FusionIndexUtils#forAll(ThrowingConsumer, Collection)}
* See {@link FusionIndexUtils#forAll(ThrowingConsumer, Iterable)}
*/
public static <T, E extends Exception> void forAll( ThrowingConsumer<T,E> consumer, T... subjects ) throws E
{
Expand Down
Expand Up @@ -90,7 +90,7 @@ private <R> R selectAndRun( ActionableWithResult<R> actionable, Value... values
@Override
public IndexSampler createSampler()
{
return new SpatialFusionIndexSampler( readerMap.values().stream().map( IndexReader::createSampler ).toArray( IndexSampler[]::new ) );
return new FusionIndexSampler( readerMap.values().stream().map( IndexReader::createSampler ).toArray( IndexSampler[]::new ) );
}

@Override
Expand Down

This file was deleted.

Expand Up @@ -36,6 +36,7 @@
import org.neo4j.kernel.impl.index.schema.NativeSelector;
import org.neo4j.kernel.impl.index.schema.fusion.FusionSchemaIndexProvider;
import org.neo4j.kernel.impl.index.schema.fusion.SpatialFusionSchemaIndexProvider;
import org.neo4j.kernel.impl.index.schema.temporal.TemporalSchemaIndexProvider;
import org.neo4j.kernel.impl.spi.KernelContext;
import org.neo4j.kernel.monitoring.Monitors;
import org.neo4j.logging.Log;
Expand Down Expand Up @@ -90,12 +91,14 @@ public static FusionSchemaIndexProvider newInstance( PageCache pageCache, File s
new NumberSchemaIndexProvider( pageCache, fs, childDirectoryStructure, monitor, recoveryCleanupWorkCollector, readOnly );
SpatialFusionSchemaIndexProvider spatialProvider =
new SpatialFusionSchemaIndexProvider( pageCache, fs, childDirectoryStructure, monitor, recoveryCleanupWorkCollector, readOnly );
TemporalSchemaIndexProvider temporalProvider =
new TemporalSchemaIndexProvider( pageCache, fs, childDirectoryStructure, monitor, recoveryCleanupWorkCollector, readOnly );
LuceneSchemaIndexProvider luceneProvider = LuceneSchemaIndexProviderFactory.create( fs, childDirectoryStructure, monitor, config,
operationalMode );
boolean useNativeIndex = config.get( GraphDatabaseSettings.enable_native_schema_index );
int priority = useNativeIndex ? PRIORITY : 0;
return new FusionSchemaIndexProvider( nativeProvider,
spatialProvider, luceneProvider, new NativeSelector(), DESCRIPTOR, priority, directoriesByProvider( storeDir ), fs );
spatialProvider, temporalProvider, luceneProvider, new NativeSelector(), DESCRIPTOR, priority, directoriesByProvider( storeDir ), fs );
}

public static IndexDirectoryStructure.Factory subProviderDirectoryStructure( File storeDir )
Expand Down
Expand Up @@ -22,6 +22,7 @@
import java.io.File;

import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.helpers.collection.Iterables;
import org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector;
import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.io.pagecache.PageCache;
Expand All @@ -30,6 +31,7 @@
import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.configuration.Settings;
import org.neo4j.kernel.impl.factory.OperationalMode;
import org.neo4j.values.storable.Value;

import static org.neo4j.helpers.collection.MapUtil.stringMap;

Expand All @@ -44,4 +46,10 @@ protected SchemaIndexProvider createIndexProvider( PageCache pageCache, FileSyst
.newInstance( pageCache, graphDbDir, fs, monitor, config, OperationalMode.single,
RecoveryCleanupWorkCollector.IMMEDIATE );
}

@Override
public Iterable<Value> getSupportedValues()
{
return Iterables.concat( commonValues, spatialValues, temporalValues );
}
}
Expand Up @@ -30,6 +30,7 @@
import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.configuration.Settings;
import org.neo4j.kernel.impl.factory.OperationalMode;
import org.neo4j.values.storable.Value;

import static org.neo4j.helpers.collection.MapUtil.stringMap;

Expand All @@ -44,4 +45,10 @@ protected LuceneSchemaIndexProvider createIndexProvider( PageCache pageCache, Fi
OperationalMode mode = OperationalMode.single;
return LuceneSchemaIndexProviderFactory.create( fs, graphDbDir, monitor, config, mode );
}

@Override
public Iterable<Value> getSupportedValues()
{
return commonValues;
}
}

0 comments on commit 478f20e

Please sign in to comment.