Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected void channelRead0(io.netty.channel.ChannelHandlerContext channelHandlerContext, PrepareStoreCopyRequest prepareStoreCopyRequest) throws java.io.IOException
        protected internal override void ChannelRead0(ChannelHandlerContext channelHandlerContext, PrepareStoreCopyRequest prepareStoreCopyRequest)
        {
            CloseablesListener       closeablesListener = new CloseablesListener();
            PrepareStoreCopyResponse response           = PrepareStoreCopyResponse.Error(PrepareStoreCopyResponse.Status.EListingStore);

            try
            {
                NeoStoreDataSource neoStoreDataSource = _dataSourceSupplier.get();
                if (!hasSameStoreId(prepareStoreCopyRequest.StoreId, neoStoreDataSource))
                {
                    channelHandlerContext.write(ResponseMessageType.PREPARE_STORE_COPY_RESPONSE);
                    response = PrepareStoreCopyResponse.Error(PrepareStoreCopyResponse.Status.EStoreIdMismatch);
                }
                else
                {
                    CheckPointer checkPointer = neoStoreDataSource.DependencyResolver.resolveDependency(typeof(CheckPointer));
                    closeablesListener.Add(TryCheckpointAndAcquireMutex(checkPointer));
                    PrepareStoreCopyFiles prepareStoreCopyFiles = closeablesListener.Add(_prepareStoreCopyFilesProvider.prepareStoreCopyFiles(neoStoreDataSource));

                    StoreResource[] nonReplayable = prepareStoreCopyFiles.AtomicFilesSnapshot;
                    foreach (StoreResource storeResource in nonReplayable)
                    {
                        _streamingProtocol.stream(channelHandlerContext, storeResource);
                    }
                    channelHandlerContext.write(ResponseMessageType.PREPARE_STORE_COPY_RESPONSE);
                    response = CreateSuccessfulResponse(checkPointer, prepareStoreCopyFiles);
                }
            }
            finally
            {
                channelHandlerContext.writeAndFlush(response).addListener(closeablesListener);
                _protocol.expect(CatchupServerProtocol.State.MESSAGE_TYPE);
            }
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            NeoStoreDataSource dataSource = mock(typeof(NeoStoreDataSource));

            _fileListingBuilder = mock(typeof(NeoStoreFileListing.StoreFileListingBuilder), CALLS_REAL_METHODS);
            _databaseLayout     = TestDirectory.databaseLayout();
            when(dataSource.DatabaseLayout).thenReturn(_databaseLayout);
            _indexListingMock = mock(typeof(NeoStoreFileIndexListing));
            when(_indexListingMock.IndexIds).thenReturn(new LongHashSet());
            NeoStoreFileListing storeFileListing = mock(typeof(NeoStoreFileListing));

            when(storeFileListing.NeoStoreFileIndexListing).thenReturn(_indexListingMock);
            when(storeFileListing.Builder()).thenReturn(_fileListingBuilder);
            when(dataSource.NeoStoreFileListing).thenReturn(storeFileListing);
            _prepareStoreCopyFiles = new PrepareStoreCopyFiles(dataSource, _fileSystemAbstraction);
        }
Beispiel #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private PrepareStoreCopyResponse createSuccessfulResponse(org.neo4j.kernel.impl.transaction.log.checkpoint.CheckPointer checkPointer, PrepareStoreCopyFiles prepareStoreCopyFiles) throws java.io.IOException
        private PrepareStoreCopyResponse CreateSuccessfulResponse(CheckPointer checkPointer, PrepareStoreCopyFiles prepareStoreCopyFiles)
        {
            LongSet indexIds = prepareStoreCopyFiles.NonAtomicIndexIds;

            File[] files             = prepareStoreCopyFiles.ListReplayableFiles();
            long   lastCommittedTxId = checkPointer.LastCheckPointedTransactionId();

            return(PrepareStoreCopyResponse.Success(files, indexIds, lastCommittedTxId));
        }