Search in sources :

Example 1 with DirectoryFactory

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

the class LuceneSchemaIndexProviderFactory method newInstance.

@Override
public LuceneSchemaIndexProvider newInstance(KernelContext context, Dependencies dependencies) throws Throwable {
    Config config = dependencies.getConfig();
    LogProvider logging = dependencies.getLogging().getInternalLogProvider();
    boolean ephemeral = config.get(GraphDatabaseFacadeFactory.Configuration.ephemeral);
    FileSystemAbstraction fileSystem = dependencies.fileSystem();
    DirectoryFactory directoryFactory = directoryFactory(ephemeral, fileSystem);
    return new LuceneSchemaIndexProvider(fileSystem, directoryFactory, context.storeDir(), logging, config, context.databaseInfo().operationalMode);
}
Also used : LogProvider(org.neo4j.logging.LogProvider) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) Config(org.neo4j.kernel.configuration.Config) DirectoryFactory(org.neo4j.kernel.api.impl.index.storage.DirectoryFactory)

Example 2 with DirectoryFactory

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

the class LuceneSchemaIndexCorruptionTest method newFaultySchemaIndexProvider.

private LuceneSchemaIndexProvider newFaultySchemaIndexProvider(long faultyIndexId, Exception error) {
    DirectoryFactory directoryFactory = mock(DirectoryFactory.class);
    File indexRootFolder = testDirectory.graphDbDir();
    FaultyIndexStorageFactory storageFactory = new FaultyIndexStorageFactory(faultyIndexId, error, directoryFactory, indexRootFolder);
    return new LuceneSchemaIndexProvider(fs.get(), directoryFactory, indexRootFolder, logProvider, Config.defaults(), OperationalMode.single) {

        @Override
        protected IndexStorageFactory buildIndexStorageFactory(FileSystemAbstraction fileSystem, DirectoryFactory directoryFactory, File schemaIndexStoreFolder) {
            return storageFactory;
        }
    };
}
Also used : FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) DirectoryFactory(org.neo4j.kernel.api.impl.index.storage.DirectoryFactory) File(java.io.File)

Example 3 with DirectoryFactory

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

the class IndexProviderFactoryUtil method luceneProvider.

public static LuceneIndexProvider luceneProvider(FileSystemAbstraction fs, IndexDirectoryStructure.Factory directoryStructure, Monitors monitors, String monitorTag, Config config, DatabaseReadOnlyChecker readOnlyChecker) {
    boolean ephemeral = config.get(GraphDatabaseInternalSettings.ephemeral_lucene);
    DirectoryFactory directoryFactory = directoryFactory(ephemeral);
    return new LuceneIndexProvider(fs, directoryFactory, directoryStructure, monitors, monitorTag, config, readOnlyChecker);
}
Also used : DirectoryFactory(org.neo4j.kernel.api.impl.index.storage.DirectoryFactory)

Example 4 with DirectoryFactory

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

the class LuceneSchemaIndexCorruptionTest method newFaultyIndexProvider.

private LuceneIndexProvider newFaultyIndexProvider(long faultyIndexId, Exception error) {
    DirectoryFactory directoryFactory = mock(DirectoryFactory.class);
    Path indexRootFolder = testDirectory.homePath();
    AtomicReference<FaultyIndexStorageFactory> reference = new AtomicReference<>();
    Monitors monitors = new Monitors();
    monitors.addMonitorListener(monitor);
    return new LuceneIndexProvider(fs, directoryFactory, directoriesByProvider(indexRootFolder), monitors, Config.defaults(), readOnly()) {

        @Override
        protected IndexStorageFactory buildIndexStorageFactory(FileSystemAbstraction fileSystem, DirectoryFactory directoryFactory) {
            FaultyIndexStorageFactory storageFactory = new FaultyIndexStorageFactory(faultyIndexId, error, directoryFactory, directoryStructure());
            reference.set(storageFactory);
            return storageFactory;
        }
    };
}
Also used : Path(java.nio.file.Path) EphemeralFileSystemAbstraction(org.neo4j.io.fs.EphemeralFileSystemAbstraction) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) DirectoryFactory(org.neo4j.kernel.api.impl.index.storage.DirectoryFactory) Monitors(org.neo4j.monitoring.Monitors) AtomicReference(java.util.concurrent.atomic.AtomicReference)

Example 5 with DirectoryFactory

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

the class LuceneSchemaIndexPopulatorTest method before.

@BeforeEach
void before() throws IOException {
    directory = new ByteBuffersDirectory();
    DirectoryFactory directoryFactory = new DirectoryFactory.Single(new DirectoryFactory.UncloseableDirectory(directory));
    provider = new LuceneIndexProvider(fs, directoryFactory, directoriesByProvider(testDir.directory("folder")), new Monitors(), Config.defaults(), writable());
    propertyAccessor = mock(NodePropertyAccessor.class);
    IndexSamplingConfig samplingConfig = new IndexSamplingConfig(Config.defaults());
    index = IndexPrototype.forSchema(forLabel(42, propertyKeyId), provider.getProviderDescriptor()).withName("index").materialise(0);
    indexPopulator = provider.getPopulator(index, samplingConfig, heapBufferFactory(1024), INSTANCE, SIMPLE_TOKEN_LOOKUP);
    indexPopulator.create();
}
Also used : IndexSamplingConfig(org.neo4j.kernel.impl.api.index.IndexSamplingConfig) ByteBuffersDirectory(org.apache.lucene.store.ByteBuffersDirectory) DirectoryFactory(org.neo4j.kernel.api.impl.index.storage.DirectoryFactory) Monitors(org.neo4j.monitoring.Monitors) NodePropertyAccessor(org.neo4j.storageengine.api.NodePropertyAccessor) BeforeEach(org.junit.jupiter.api.BeforeEach)

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