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