예제 #1
0
        public void SetMigrationStatus(Org.Neo4j.Io.fs.FileSystemAbstraction fs, java.io.File stateFile, string info)
        {
            if (fs.FileExists(stateFile))
            {
                try
                {
                    fs.Truncate(stateFile, 0);
                }
                catch (IOException e)
                {
                    throw new Exception(e);
                }
            }

            try
            {
                using (Writer writer = fs.OpenAsWriter(stateFile, StandardCharsets.UTF_8, false))
                {
                    writer.write(name());
                    writer.write('\n');
                    writer.write(info);
                    writer.flush();
                }
            }
            catch (IOException e)
            {
                throw new Exception(e);
            }
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCompleteInitializationOfStoresWithIncompleteHeaders() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCompleteInitializationOfStoresWithIncompleteHeaders()
        {
            StoreFactory storeFactory = storeFactory(Config.defaults());

            storeFactory.OpenAllNeoStores(true).close();
            FileSystemAbstraction fs = _fsRule.get();

            foreach (File f in fs.ListFiles(_testDirectory.databaseDir()))
            {
                fs.Truncate(f, 0);
            }
            storeFactory.OpenAllNeoStores(true).close();
        }
예제 #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static void removeCheckPointFromTxLog(org.neo4j.io.fs.FileSystemAbstraction fileSystem, java.io.File databaseDirectory) throws java.io.IOException
        public static void RemoveCheckPointFromTxLog(FileSystemAbstraction fileSystem, File databaseDirectory)
        {
            LogFiles logFiles = LogFilesBuilder.logFilesBasedOnlyBuilder(databaseDirectory, fileSystem).build();
            LogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel>();
            LogTailScanner tailScanner = new LogTailScanner(logFiles, logEntryReader, new Monitors());

            LogTailScanner.LogTailInformation logTailInformation = tailScanner.TailInformation;

            if (logTailInformation.CommitsAfterLastCheckpoint())
            {
                // done already
                return;
            }

            // let's assume there is at least a checkpoint
            assertNotNull(logTailInformation.LastCheckPoint);

            LogPosition logPosition = logTailInformation.LastCheckPoint.LogPosition;
            File        logFile     = logFiles.GetLogFileForVersion(logPosition.LogVersion);

            fileSystem.Truncate(logFile, logPosition.ByteOffset);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void truncate(java.io.File path, long size) throws java.io.IOException
        public override void Truncate(File path, long size)
        {
            @delegate.Truncate(path, size);
        }