コード例 #1
0
ファイル: IndexProxyCreator.cs プロジェクト: Neo4Net/Neo4Net
        internal virtual IndexProxy CreateRecoveringIndexProxy(StoreIndexDescriptor descriptor)
        {
            CapableIndexDescriptor capableIndexDescriptor = _providerMap.withCapabilities(descriptor);
            IndexProxy             proxy = new RecoveringIndexProxy(capableIndexDescriptor);

            return(new ContractCheckingIndexProxy(proxy, true));
        }
コード例 #2
0
ファイル: IndexProxyCreator.cs プロジェクト: Neo4Net/Neo4Net
//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));
        }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void before()
        public virtual void Before()
        {
            _indexMap = new IndexMap();

            _indexProxy1            = mock(typeof(IndexProxy));
            _schemaIndexDescriptor1 = forSchema(forLabel(2, 3), PROVIDER_DESCRIPTOR).withId(0).withoutCapabilities();
            _indexUpdater1          = mock(typeof(IndexUpdater));
            when(_indexProxy1.Descriptor).thenReturn(_schemaIndexDescriptor1);
            when(_indexProxy1.newUpdater(any(typeof(IndexUpdateMode)))).thenReturn(_indexUpdater1);

            _indexProxy2            = mock(typeof(IndexProxy));
            _schemaIndexDescriptor2 = forSchema(forLabel(5, 6), PROVIDER_DESCRIPTOR).withId(1).withoutCapabilities();
            IndexUpdater indexUpdater2 = mock(typeof(IndexUpdater));

            when(_indexProxy2.Descriptor).thenReturn(_schemaIndexDescriptor2);
            when(_indexProxy2.newUpdater(any(typeof(IndexUpdateMode)))).thenReturn(indexUpdater2);

            _indexProxy3            = mock(typeof(IndexProxy));
            _schemaIndexDescriptor3 = forSchema(forLabel(5, 7, 8), PROVIDER_DESCRIPTOR).withId(2).withoutCapabilities();
            IndexUpdater indexUpdater3 = mock(typeof(IndexUpdater));

            when(_indexProxy3.Descriptor).thenReturn(_schemaIndexDescriptor3);
            when(_indexProxy3.newUpdater(any(typeof(IndexUpdateMode)))).thenReturn(indexUpdater3);

            _updaterMap = new IndexUpdaterMap(_indexMap, IndexUpdateMode.Online);
        }
コード例 #4
0
ファイル: IndexProxyCreator.cs プロジェクト: Neo4Net/Neo4Net
        internal virtual IndexProxy CreateFailedIndexProxy(StoreIndexDescriptor descriptor, IndexPopulationFailure populationFailure)
        {
            // Note about the buffer factory instantiation here. Question is why an index populator is instantiated for a failed index proxy to begin with.
            // The byte buffer factory should not be used here anyway so the buffer size doesn't actually matter.
            IndexPopulator         indexPopulator         = PopulatorFromProvider(descriptor, _samplingConfig, heapBufferFactory(1024));
            CapableIndexDescriptor capableIndexDescriptor = _providerMap.withCapabilities(descriptor);
            string     indexUserDescription = indexUserDescription(descriptor);
            IndexProxy proxy;

            proxy = new FailedIndexProxy(capableIndexDescriptor, indexUserDescription, indexPopulator, populationFailure, new IndexCountsRemover(_storeView, descriptor.Id), _logProvider);
            proxy = new ContractCheckingIndexProxy(proxy, true);
            return(proxy);
        }
コード例 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRemoveIndexCountsWhenTheIndexItselfIsDropped() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRemoveIndexCountsWhenTheIndexItselfIsDropped()
        {
            // given
            CapableIndexDescriptor capableIndexDescriptor = _descriptor.withId(_indexId).withoutCapabilities();
            OnlineIndexProxy       index = new OnlineIndexProxy(capableIndexDescriptor, _accessor, _storeView, false);

            // when
            index.Drop();

            // then
            verify(_accessor).drop();
            verify(_storeView).replaceIndexCounts(_indexId, 0L, 0L, 0L);
            verifyNoMoreInteractions(_accessor, _storeView);
        }
コード例 #6
0
ファイル: IndexProxyCreator.cs プロジェクト: Neo4Net/Neo4Net
 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));
     }
 }