Example #1
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: IndexProxy createPopulatingIndexProxy(final org.neo4j.storageengine.api.schema.StoreIndexDescriptor descriptor, final boolean flipToTentative, final IndexingService.Monitor monitor, final IndexPopulationJob populationJob)
        internal virtual IndexProxy CreatePopulatingIndexProxy(StoreIndexDescriptor descriptor, bool flipToTentative, IndexingService.Monitor monitor, IndexPopulationJob populationJob)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final FlippableIndexProxy flipper = new FlippableIndexProxy();
            FlippableIndexProxy flipper = new FlippableIndexProxy();

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String indexUserDescription = indexUserDescription(descriptor);
            string                 indexUserDescription   = indexUserDescription(descriptor);
            IndexPopulator         populator              = PopulatorFromProvider(descriptor, _samplingConfig, populationJob.BufferFactory());
            CapableIndexDescriptor capableIndexDescriptor = _providerMap.withCapabilities(descriptor);

            FailedIndexProxyFactory failureDelegateFactory = new FailedPopulatingIndexProxyFactory(capableIndexDescriptor, populator, indexUserDescription, new IndexCountsRemover(_storeView, descriptor.Id), _logProvider);

            MultipleIndexPopulator.IndexPopulation indexPopulation = populationJob.AddPopulator(populator, capableIndexDescriptor, indexUserDescription, flipper, failureDelegateFactory);
            PopulatingIndexProxy populatingIndex = new PopulatingIndexProxy(capableIndexDescriptor, populationJob, indexPopulation);

            flipper.FlipTo(populatingIndex);

            // Prepare for flipping to online mode
            flipper.FlipTarget = () =>
            {
                monitor.PopulationCompleteOn(descriptor);
                IndexAccessor    accessor    = OnlineAccessorFromProvider(descriptor, _samplingConfig);
                OnlineIndexProxy onlineProxy = new OnlineIndexProxy(capableIndexDescriptor, accessor, _storeView, true);
                if (flipToTentative)
                {
                    return(new TentativeConstraintIndexProxy(flipper, onlineProxy));
                }
                return(onlineProxy);
            };

            return(new ContractCheckingIndexProxy(flipper, false));
        }
Example #2
0
//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();
        }
Example #3
0
//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);
        }
Example #4
0
 internal virtual IndexProxy CreateOnlineIndexProxy(StoreIndexDescriptor descriptor)
 {
     try
     {
         IndexAccessor          onlineAccessor         = OnlineAccessorFromProvider(descriptor, _samplingConfig);
         CapableIndexDescriptor capableIndexDescriptor = _providerMap.withCapabilities(descriptor);
         IndexProxy             proxy;
         proxy = new OnlineIndexProxy(capableIndexDescriptor, onlineAccessor, _storeView, false);
         proxy = new ContractCheckingIndexProxy(proxy, true);
         return(proxy);
     }
     catch (IOException e)
     {
         _logProvider.getLog(this.GetType()).error("Failed to open index: " + descriptor.Id + " (" + descriptor.UserDescription(_tokenNameLookup) + "), requesting re-population.", e);
         return(CreateRecoveringIndexProxy(descriptor));
     }
 }
 internal TrackingReadersIndexAccessor(IndexAccessor accessor)
 {
     this._accessor = accessor;
 }