예제 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: static org.neo4j.kernel.impl.transaction.log.files.LogFiles readLogFiles(org.neo4j.io.layout.DatabaseLayout databaseLayout) throws java.io.IOException
        internal static LogFiles ReadLogFiles(DatabaseLayout databaseLayout)
        {
            FileSystemAbstraction fileSystemAbstraction = new DefaultFileSystemAbstraction();
            PageCache             pageCache             = ConfigurableStandalonePageCacheFactory.createPageCache(fileSystemAbstraction, new ThreadPoolJobScheduler());

            return(LogFilesBuilder.activeFilesBuilder(databaseLayout, fileSystemAbstraction, pageCache).build());
        }
예제 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public ReadOnlyTransactionStore(org.neo4j.io.pagecache.PageCache pageCache, org.neo4j.io.fs.FileSystemAbstraction fs, org.neo4j.io.layout.DatabaseLayout fromDatabaseLayout, org.neo4j.kernel.configuration.Config config, org.neo4j.kernel.monitoring.Monitors monitors) throws java.io.IOException
        public ReadOnlyTransactionStore(PageCache pageCache, FileSystemAbstraction fs, DatabaseLayout fromDatabaseLayout, Config config, Monitors monitors)
        {
            TransactionMetadataCache transactionMetadataCache = new TransactionMetadataCache();
            LogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel>();
            LogFiles logFiles = LogFilesBuilder.activeFilesBuilder(fromDatabaseLayout, fs, pageCache).withLogEntryReader(logEntryReader).withConfig(config).build();

            _physicalStore = new PhysicalLogicalTransactionStore(logFiles, transactionMetadataCache, logEntryReader, monitors, true);
        }
예제 #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void writePartialTx(java.io.File storeDir) throws java.io.IOException
        private void WritePartialTx(File storeDir)
        {
            using (PageCache pageCache = this.PageCache.getPageCache(_fs))
            {
                LogFiles logFiles = LogFilesBuilder.activeFilesBuilder(DatabaseLayout.of(storeDir), _fs, pageCache).build();
                using (Lifespan ignored = new Lifespan(logFiles))
                {
                    LogEntryWriter writer = new LogEntryWriter(logFiles.LogFile.Writer);
                    writer.WriteStartEntry(0, 0, 0x123456789ABCDEFL, logFiles.LogFileInformation.LastEntryId + 1, new sbyte[] { 0 });
                }
            }
        }
예제 #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean isRecoveryRequiredAt(org.neo4j.io.layout.DatabaseLayout databaseLayout) throws java.io.IOException
        public virtual bool IsRecoveryRequiredAt(DatabaseLayout databaseLayout)
        {
            // We need config to determine where the logical log files are
            if (!NeoStores.isStorePresent(_pageCache, databaseLayout))
            {
                return(false);
            }

            LogEntryReader <ReadableClosablePositionAwareChannel> reader = new VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel>();
            LogFiles       logFiles    = LogFilesBuilder.activeFilesBuilder(databaseLayout, _fs, _pageCache).withConfig(_config).withLogEntryReader(reader).build();
            LogTailScanner tailScanner = new LogTailScanner(logFiles, reader, _monitors);

            return((new RecoveryStartInformationProvider(tailScanner, NO_MONITOR)).get().RecoveryRequired);
        }
예제 #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void appendCheckpoint(org.neo4j.kernel.impl.transaction.log.entry.LogEntryVersion logVersion) throws java.io.IOException
        private void AppendCheckpoint(LogEntryVersion logVersion)
        {
            PageCache pageCache = _pageCacheRule.getPageCache(_fs);
            VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel>();
            LogFiles       logFiles    = LogFilesBuilder.activeFilesBuilder(_storeDirectory.databaseLayout(), _fs, pageCache).withLogEntryReader(logEntryReader).build();
            LogTailScanner tailScanner = new LogTailScanner(logFiles, logEntryReader, new Monitors());

            LogTailScanner.LogTailInformation tailInformation = tailScanner.TailInformation;

            using (Lifespan lifespan = new Lifespan(logFiles))
            {
                FlushablePositionAwareChannel channel = logFiles.LogFile.Writer;

                LogPosition logPosition = tailInformation.LastCheckPoint.LogPosition;

                // Fake record
                channel.Put(logVersion.byteCode()).put(CHECK_POINT).putLong(logPosition.LogVersion).putLong(logPosition.ByteOffset);

                channel.PrepareForFlush().flush();
            }
        }
예제 #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean hasTxLogs(org.neo4j.io.layout.DatabaseLayout databaseLayout) throws java.io.IOException
        public virtual bool HasTxLogs(DatabaseLayout databaseLayout)
        {
            return(LogFilesBuilder.activeFilesBuilder(databaseLayout, _fs, _pageCache).withConfig(_config).build().logFiles().Length > 0);
        }