Search in sources :

Example 11 with LabelScanStoreProvider

use of org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider in project neo4j by neo4j.

the class LuceneLabelScanStoreExtension method newInstance.

@Override
public LabelScanStoreProvider newInstance(KernelContext context, Dependencies dependencies) throws Throwable {
    Config config = dependencies.getConfig();
    boolean ephemeral = config.get(GraphDatabaseFacadeFactory.Configuration.ephemeral);
    FileSystemAbstraction fileSystem = dependencies.fileSystem();
    DirectoryFactory directoryFactory = directoryFactory(ephemeral, fileSystem);
    LuceneLabelScanIndexBuilder indexBuilder = getIndexBuilder(context, directoryFactory, fileSystem, config);
    LogProvider logger = dependencies.getLogService().getInternalLogProvider();
    Monitor loggingMonitor = new LoggingMonitor(logger.getLog(LuceneLabelScanStore.class), monitor);
    LuceneLabelScanStore scanStore = new LuceneLabelScanStore(indexBuilder, new FullLabelStream(dependencies.indexStoreView()), loggingMonitor);
    return new LabelScanStoreProvider(NAME, scanStore);
}
Also used : LogProvider(org.neo4j.logging.LogProvider) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) LoggingMonitor(org.neo4j.kernel.api.labelscan.LoggingMonitor) Monitor(org.neo4j.kernel.api.labelscan.LabelScanStore.Monitor) LabelScanStoreProvider(org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider) LoggingMonitor(org.neo4j.kernel.api.labelscan.LoggingMonitor) Config(org.neo4j.kernel.configuration.Config) DirectoryFactory(org.neo4j.kernel.api.impl.index.storage.DirectoryFactory) FullLabelStream(org.neo4j.kernel.impl.api.scan.FullLabelStream)

Example 12 with LabelScanStoreProvider

use of org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider in project neo4j by neo4j.

the class NamedLabelScanStoreSelectionStrategyTest method shouldAutoSelectDefaultProviderIfNoProviderWithPresentStore.

@Test
public void shouldAutoSelectDefaultProviderIfNoProviderWithPresentStore() throws Exception {
    // GIVEN
    NamedLabelScanStoreSelectionStrategy strategy = strategy(LabelIndex.AUTO);
    LabelScanStoreProvider nativeProvider = provider(LabelIndex.NATIVE, store(false));
    LabelScanStoreProvider luceneProvider = provider(LabelIndex.LUCENE, store(false));
    // WHEN
    LabelScanStoreProvider selected = select(strategy, nativeProvider, luceneProvider);
    // THEN
    assertEquals(GraphDatabaseSettings.label_index.getDefaultValue(), selected.getName());
}
Also used : LabelScanStoreProvider(org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider) Test(org.junit.Test)

Example 13 with LabelScanStoreProvider

use of org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider in project neo4j by neo4j.

the class NamedLabelScanStoreSelectionStrategyTest method shouldAutoSelectSingleProviderWithPresentStoreAmongMultipleProviders.

@Test
public void shouldAutoSelectSingleProviderWithPresentStoreAmongMultipleProviders() throws Exception {
    // GIVEN
    NamedLabelScanStoreSelectionStrategy strategy = strategy(LabelIndex.AUTO);
    LabelScanStoreProvider nativeProvider = provider(LabelIndex.NATIVE, store(false));
    LabelScanStoreProvider luceneProvider = provider(LabelIndex.LUCENE, store(true));
    // WHEN
    LabelScanStoreProvider selected = select(strategy, nativeProvider, luceneProvider);
    // THEN
    assertSame(luceneProvider, selected);
}
Also used : LabelScanStoreProvider(org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider) Test(org.junit.Test)

Example 14 with LabelScanStoreProvider

use of org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider in project neo4j by neo4j.

the class NamedLabelScanStoreSelectionStrategyTest method shouldAutoSelectProviderWithPresentStoreEvenIfSomeOtherReportedIOException.

@Test
public void shouldAutoSelectProviderWithPresentStoreEvenIfSomeOtherReportedIOException() throws Exception {
    // GIVEN
    NamedLabelScanStoreSelectionStrategy strategy = strategy(LabelIndex.AUTO);
    LabelScanStoreProvider nativeProvider = provider(LabelIndex.NATIVE, store(true));
    LabelScanStoreProvider luceneProvider = provider(LabelIndex.LUCENE, store(null));
    // WHEN
    LabelScanStoreProvider selected = select(strategy, nativeProvider, luceneProvider);
    // THEN
    assertSame(nativeProvider, selected);
}
Also used : LabelScanStoreProvider(org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider) Test(org.junit.Test)

Example 15 with LabelScanStoreProvider

use of org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider in project neo4j by neo4j.

the class NamedLabelScanStoreSelectionStrategyTest method shouldSelectSpecificallyConfiguredProviderWhenSingle.

@Test
public void shouldSelectSpecificallyConfiguredProviderWhenSingle() throws Exception {
    // GIVEN
    NamedLabelScanStoreSelectionStrategy strategy = strategy(LabelIndex.NATIVE);
    LabelScanStoreProvider single = provider(LabelIndex.NATIVE, store(false));
    // WHEN
    LabelScanStoreProvider selected = select(strategy, single);
    // THEN
    assertSame(single, selected);
}
Also used : LabelScanStoreProvider(org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider) Test(org.junit.Test)

Aggregations

LabelScanStoreProvider (org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider)17 Test (org.junit.Test)9 IOException (java.io.IOException)4 Dependencies (org.neo4j.kernel.impl.util.Dependencies)3 SchemaIndexProvider (org.neo4j.kernel.api.index.SchemaIndexProvider)2 Config (org.neo4j.kernel.configuration.Config)2 NamedLabelScanStoreSelectionStrategy (org.neo4j.kernel.extension.dependency.NamedLabelScanStoreSelectionStrategy)2 StandardConstraintSemantics (org.neo4j.kernel.impl.constraints.StandardConstraintSemantics)2 IndexConfigStore (org.neo4j.kernel.impl.index.IndexConfigStore)2 KernelContext (org.neo4j.kernel.impl.spi.KernelContext)2 SimpleKernelContext (org.neo4j.kernel.impl.spi.SimpleKernelContext)2 VisibleMigrationProgressMonitor (org.neo4j.kernel.impl.storemigration.monitoring.VisibleMigrationProgressMonitor)2 SynchronizedArrayIdOrderingQueue (org.neo4j.kernel.impl.util.SynchronizedArrayIdOrderingQueue)2 ArrayList (java.util.ArrayList)1 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)1 PageCache (org.neo4j.io.pagecache.PageCache)1 AvailabilityGuard (org.neo4j.kernel.AvailabilityGuard)1 GraphDatabaseDependencies (org.neo4j.kernel.GraphDatabaseDependencies)1 NeoStoreDataSource (org.neo4j.kernel.NeoStoreDataSource)1 KernelException (org.neo4j.kernel.api.exceptions.KernelException)1