コード例 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void appendNullTransactionLogEntryToSetRaftIndexToMinusOne() throws java.io.IOException
        private void AppendNullTransactionLogEntryToSetRaftIndexToMinusOne()
        {
            ReadOnlyTransactionIdStore readOnlyTransactionIdStore = new ReadOnlyTransactionIdStore(_pageCache, _databaseLayout);
            LogFiles logFiles = LogFilesBuilder.activeFilesBuilder(_databaseLayout, _fs, _pageCache).withConfig(_config).withLastCommittedTransactionIdSupplier(() => readOnlyTransactionIdStore.LastClosedTransactionId - 1).build();

            long dummyTransactionId;

            using (Lifespan lifespan = new Lifespan(logFiles))
            {
                FlushableChannel     channel = logFiles.LogFile.Writer;
                TransactionLogWriter writer  = new TransactionLogWriter(new LogEntryWriter(channel));

                long lastCommittedTransactionId      = readOnlyTransactionIdStore.LastCommittedTransactionId;
                PhysicalTransactionRepresentation tx = new PhysicalTransactionRepresentation(Collections.emptyList());
                sbyte[] txHeaderBytes = LogIndexTxHeaderEncoding.encodeLogIndexAsTxHeader(-1);
                tx.SetHeader(txHeaderBytes, -1, -1, -1, lastCommittedTransactionId, -1, -1);

                dummyTransactionId = lastCommittedTransactionId + 1;
                writer.Append(tx, dummyTransactionId);
                channel.PrepareForFlush().flush();
            }

            File neoStoreFile = _databaseLayout.metadataStore();

            MetaDataStore.setRecord(_pageCache, neoStoreFile, LAST_TRANSACTION_ID, dummyTransactionId);
        }
コード例 #2
0
ファイル: LogFilesBuilder.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private System.Func<long> committingIdSupplier() throws java.io.IOException
        private System.Func <long> CommittingIdSupplier()
        {
            if (_transactionIdStore != null)
            {
                return(_transactionIdStore.committingTransactionId);
            }
            if (_fileBasedOperationsOnly)
            {
                return(() =>
                {
                    throw new System.NotSupportedException("Current version of log files can't perform any " + "operation that require availability of transaction id store. Please build full version of log files " + "to be able to use them.");
                });
            }
            if (_readOnly)
            {
                requireNonNull(_pageCache, "Read only log files require page cache to be able to read commited " + "transaction info from store store.");
                requireNonNull(_databaseLayout, "Store directory is required.");
                ReadOnlyTransactionIdStore transactionIdStore = new ReadOnlyTransactionIdStore(_pageCache, _databaseLayout);
                return(transactionIdStore.committingTransactionId);
            }
            else
            {
                requireNonNull(_dependencies, typeof(TransactionIdStore).Name + " is required. " + "Please provide an instance or a dependencies where it can be found.");
                return(() => ResolveDependency(typeof(TransactionIdStore)).committingTransactionId());
            }
        }