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);
}
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;
}
};
}
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);
}
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;
}
};
}
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();
}
Aggregations