Search in sources :

Example 6 with DirectoryFactory

use of org.neo4j.kernel.api.impl.index.storage.DirectoryFactory 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 7 with DirectoryFactory

use of org.neo4j.kernel.api.impl.index.storage.DirectoryFactory in project neo4j by neo4j.

the class LuceneLabelScanStoreTest method createLabelScanStore.

@Override
protected LabelScanStore createLabelScanStore(FileSystemAbstraction fs, File rootFolder, List<NodeLabelUpdate> existingData, boolean usePersistentStore, boolean readOnly, LabelScanStore.Monitor monitor) {
    DirectoryFactory directoryFactory = usePersistentStore ? DirectoryFactory.PERSISTENT : inMemoryDirectoryFactory;
    indexStorage = new PartitionedIndexStorage(directoryFactory, fs, rootFolder, LuceneLabelScanIndexBuilder.DEFAULT_INDEX_IDENTIFIER, false);
    Config config = Config.defaults().with(MapUtil.stringMap(GraphDatabaseSettings.read_only.name(), String.valueOf(readOnly)));
    LuceneLabelScanIndexBuilder indexBuilder = LuceneLabelScanIndexBuilder.create().withDirectoryFactory(directoryFactory).withIndexStorage(indexStorage).withOperationalMode(OperationalMode.single).withConfig(config).withDocumentFormat(documentFormat);
    return new LuceneLabelScanStore(indexBuilder, asStream(existingData), monitor);
}
Also used : Config(org.neo4j.kernel.configuration.Config) DirectoryFactory(org.neo4j.kernel.api.impl.index.storage.DirectoryFactory) PartitionedIndexStorage(org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage)

Example 8 with DirectoryFactory

use of org.neo4j.kernel.api.impl.index.storage.DirectoryFactory in project neo4j by neo4j.

the class LuceneSchemaIndexProviderTest method shouldCreateReadOnlyAccessorInReadOnlyMode.

@Test
public void shouldCreateReadOnlyAccessorInReadOnlyMode() throws Exception {
    DirectoryFactory directoryFactory = DirectoryFactory.PERSISTENT;
    createEmptySchemaIndex(directoryFactory);
    Config readOnlyConfig = Config.embeddedDefaults(stringMap(GraphDatabaseSettings.read_only.name(), Settings.TRUE));
    LuceneSchemaIndexProvider readOnlyIndexProvider = getLuceneSchemaIndexProvider(readOnlyConfig, directoryFactory, fs, graphDbDir);
    IndexAccessor onlineAccessor = getIndexAccessor(readOnlyConfig, readOnlyIndexProvider);
    expectedException.expect(UnsupportedOperationException.class);
    onlineAccessor.drop();
}
Also used : Config(org.neo4j.kernel.configuration.Config) IndexSamplingConfig(org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig) IndexAccessor(org.neo4j.kernel.api.index.IndexAccessor) DirectoryFactory(org.neo4j.kernel.api.impl.index.storage.DirectoryFactory) Test(org.junit.Test)

Example 9 with DirectoryFactory

use of org.neo4j.kernel.api.impl.index.storage.DirectoryFactory in project neo4j by neo4j.

the class LuceneSchemaIndexProviderCompatibilitySuiteTest method createIndexProvider.

@Override
protected LuceneSchemaIndexProvider createIndexProvider(FileSystemAbstraction fs, File graphDbDir) {
    DirectoryFactory.InMemoryDirectoryFactory directoryFactory = new DirectoryFactory.InMemoryDirectoryFactory();
    NullLogProvider logging = NullLogProvider.getInstance();
    Config config = Config.defaults();
    OperationalMode mode = OperationalMode.single;
    return new LuceneSchemaIndexProvider(fs, directoryFactory, graphDbDir, logging, config, mode);
}
Also used : Config(org.neo4j.kernel.configuration.Config) DirectoryFactory(org.neo4j.kernel.api.impl.index.storage.DirectoryFactory) NullLogProvider(org.neo4j.logging.NullLogProvider) OperationalMode(org.neo4j.kernel.impl.factory.OperationalMode)

Example 10 with DirectoryFactory

use of org.neo4j.kernel.api.impl.index.storage.DirectoryFactory in project neo4j by neo4j.

the class LuceneIndexProviderTest method shouldCreateReadOnlyAccessorInReadOnlyMode.

@Test
void shouldCreateReadOnlyAccessorInReadOnlyMode() throws Exception {
    DirectoryFactory directoryFactory = DirectoryFactory.PERSISTENT;
    createEmptySchemaIndex(directoryFactory);
    Config readOnlyConfig = Config.defaults(read_only_database_default, true);
    LuceneIndexProvider readOnlyIndexProvider = getLuceneIndexProvider(readOnlyConfig, directoryFactory, fileSystem, graphDbDir);
    IndexAccessor onlineAccessor = getIndexAccessor(readOnlyConfig, readOnlyIndexProvider);
    assertThrows(UnsupportedOperationException.class, onlineAccessor::drop);
}
Also used : Config(org.neo4j.configuration.Config) IndexSamplingConfig(org.neo4j.kernel.impl.api.index.IndexSamplingConfig) IndexAccessor(org.neo4j.kernel.api.index.IndexAccessor) DirectoryFactory(org.neo4j.kernel.api.impl.index.storage.DirectoryFactory) Test(org.junit.jupiter.api.Test)

Aggregations

DirectoryFactory (org.neo4j.kernel.api.impl.index.storage.DirectoryFactory)11 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)5 Config (org.neo4j.kernel.configuration.Config)5 Config (org.neo4j.configuration.Config)2 IndexAccessor (org.neo4j.kernel.api.index.IndexAccessor)2 IndexSamplingConfig (org.neo4j.kernel.impl.api.index.IndexSamplingConfig)2 LogProvider (org.neo4j.logging.LogProvider)2 Monitors (org.neo4j.monitoring.Monitors)2 File (java.io.File)1 Path (java.nio.file.Path)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 ByteBuffersDirectory (org.apache.lucene.store.ByteBuffersDirectory)1 Test (org.junit.Test)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Test (org.junit.jupiter.api.Test)1 EphemeralFileSystemAbstraction (org.neo4j.io.fs.EphemeralFileSystemAbstraction)1 FulltextIndexProvider (org.neo4j.kernel.api.impl.fulltext.FulltextIndexProvider)1 PartitionedIndexStorage (org.neo4j.kernel.api.impl.index.storage.PartitionedIndexStorage)1 IndexDirectoryStructure (org.neo4j.kernel.api.index.IndexDirectoryStructure)1 Monitor (org.neo4j.kernel.api.labelscan.LabelScanStore.Monitor)1