internal static LuceneIndexProvider LuceneProvider(FileSystemAbstraction fs, IndexDirectoryStructure.Factory directoryStructure, IndexProvider.Monitor monitor, Config config, OperationalMode operationalMode) { bool ephemeral = config.Get(GraphDatabaseSettings.ephemeral); DirectoryFactory directoryFactory = directoryFactory(ephemeral); return(new LuceneIndexProvider(fs, directoryFactory, directoryStructure, monitor, config, operationalMode)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void createEmptySchemaIndex(org.neo4j.kernel.api.impl.index.storage.DirectoryFactory directoryFactory) throws java.io.IOException private void CreateEmptySchemaIndex(DirectoryFactory directoryFactory) { Config config = Config.defaults(); LuceneIndexProvider indexProvider = GetLuceneIndexProvider(config, directoryFactory, _fileSystem, _graphDbDir); IndexAccessor onlineAccessor = GetIndexAccessor(config, indexProvider); onlineAccessor.Dispose(); }
public LuceneIndexProvider(FileSystemAbstraction fileSystem, DirectoryFactory directoryFactory, IndexDirectoryStructure.Factory directoryStructureFactory, Monitor monitor, Config config, OperationalMode operationalMode) : base(LuceneIndexProviderFactory.ProviderDescriptor, directoryStructureFactory) { this._monitor = monitor; this._indexStorageFactory = BuildIndexStorageFactory(fileSystem, directoryFactory); this._fileSystem = fileSystem; this._config = config; this._operationalMode = operationalMode; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldCreateReadOnlyAccessorInReadOnlyMode() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldCreateReadOnlyAccessorInReadOnlyMode() { DirectoryFactory directoryFactory = DirectoryFactory.PERSISTENT; CreateEmptySchemaIndex(directoryFactory); Config readOnlyConfig = Config.defaults(GraphDatabaseSettings.read_only, Settings.TRUE); LuceneIndexProvider readOnlyIndexProvider = GetLuceneIndexProvider(readOnlyConfig, directoryFactory, _fileSystem, _graphDbDir); IndexAccessor onlineAccessor = GetIndexAccessor(readOnlyConfig, readOnlyIndexProvider); assertThrows(typeof(System.NotSupportedException), onlineAccessor.drop); }
public override Lifecycle NewInstance(KernelContext context, Dependencies dependencies) { Config config = dependencies.Config; bool ephemeral = config.Get(GraphDatabaseSettings.ephemeral); FileSystemAbstraction fileSystemAbstraction = dependencies.FileSystem(); DirectoryFactory directoryFactory = directoryFactory(ephemeral); OperationalMode operationalMode = context.DatabaseInfo().OperationalMode; JobScheduler scheduler = dependencies.Scheduler(); IndexDirectoryStructure.Factory directoryStructureFactory = SubProviderDirectoryStructure(context.Directory()); TokenHolders tokenHolders = dependencies.TokenHolders(); Log log = dependencies.LogService.getInternalLog(typeof(FulltextIndexProvider)); AuxiliaryTransactionStateManager auxiliaryTransactionStateManager; try { auxiliaryTransactionStateManager = dependencies.AuxiliaryTransactionStateManager(); } catch (UnsatisfiedDependencyException e) { string message = "Fulltext indexes failed to register as transaction state providers. This means that, if queried, they will not be able to " + "uncommitted transactional changes into account. This is fine if the indexes are opened for non-transactional work, such as for " + "consistency checking. The reason given is: " + e.Message; LogDependencyException(context, log.ErrorLogger(), message); auxiliaryTransactionStateManager = new NullAuxiliaryTransactionStateManager(); } FulltextIndexProvider provider = new FulltextIndexProvider(Descriptor, directoryStructureFactory, fileSystemAbstraction, config, tokenHolders, directoryFactory, operationalMode, scheduler, auxiliaryTransactionStateManager, log); string procedureRegistrationFailureMessage = "Failed to register the fulltext index procedures. The fulltext index provider will be loaded and " + "updated like normal, but it might not be possible to query any fulltext indexes. The reason given is: "; try { dependencies.Procedures().registerComponent(typeof(FulltextAdapter), procContext => provider, true); dependencies.Procedures().registerProcedure(typeof(FulltextProcedures)); } catch (KernelException e) { string message = procedureRegistrationFailureMessage + e.getUserMessage(new NonTransactionalTokenNameLookup(tokenHolders)); // We use the 'warn' logger in this case, because it can occur due to multi-database shenanigans, or due to internal restarts in HA. // These scenarios are less serious, and will _probably_ not prevent FTS from working. Hence we only warn about this. LogDependencyException(context, log.WarnLogger(), message); } catch (UnsatisfiedDependencyException e) { string message = procedureRegistrationFailureMessage + e.Message; LogDependencyException(context, log.ErrorLogger(), message); } return(provider); }
private LuceneIndexProvider GetLuceneIndexProvider(Config config, DirectoryFactory directoryFactory, FileSystemAbstraction fs, File graphDbDir) { return(new LuceneIndexProvider(fs, directoryFactory, defaultDirectoryStructure(graphDbDir), IndexProvider.Monitor_Fields.EMPTY, config, OperationalMode.single)); }
/// <summary> /// Visible <b>only</b> for testing. /// </summary> protected internal virtual IndexStorageFactory BuildIndexStorageFactory(FileSystemAbstraction fileSystem, DirectoryFactory directoryFactory) { return(new IndexStorageFactory(directoryFactory, fileSystem, DirectoryStructure())); }
/// <summary> /// Specify directory factory /// </summary> /// <param name="directoryFactory"> directory factory </param> /// <returns> index builder </returns> public virtual T WithDirectoryFactory(DirectoryFactory directoryFactory) { StorageBuilder.withDirectoryFactory(directoryFactory); return(( T )this); }