//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: static Fixture prepareDirectoryAndPageCache(Class testClass) throws java.io.IOException internal static Fixture PrepareDirectoryAndPageCache(Type testClass) { DefaultFileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction(); TestDirectory testDirectory = TestDirectory.testDirectory(testClass, fileSystem); File dir = testDirectory.PrepareDirectoryForTest("test"); ThreadPoolJobScheduler scheduler = new ThreadPoolJobScheduler(); PageCache pageCache = StandalonePageCacheFactory.createPageCache(fileSystem, scheduler); return(new Fixture(pageCache, fileSystem, dir, scheduler)); }
private GBPTreePlayground(FileSystemAbstraction fs, File indexFile) { this._indexFile = indexFile; this._layout = SimpleLongLayout.LongLayout().build(); this._pageCache = StandalonePageCacheFactory.createPageCache(fs, createInitialisedScheduler()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void execute(String[] args) throws org.neo4j.commandline.admin.IncorrectUsage, org.neo4j.commandline.admin.CommandFailed public override void Execute(string[] args) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.nio.file.Path databaseDirectory = arguments.parse(args).getMandatoryPath("store"); Path databaseDirectory = _arguments.parse(args).getMandatoryPath("store"); Validators.CONTAINS_EXISTING_DATABASE.validate(databaseDirectory.toFile()); DatabaseLayout databaseLayout = DatabaseLayout.of(databaseDirectory.toFile()); try { using (System.IDisposable ignored = StoreLockChecker.Check(databaseLayout.StoreLayout), DefaultFileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction(), JobScheduler jobScheduler = createInitialisedScheduler(), PageCache pageCache = StandalonePageCacheFactory.createPageCache(fileSystem, jobScheduler)) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String storeVersion = new org.neo4j.kernel.impl.storemigration.StoreVersionCheck(pageCache).getVersion(databaseLayout.metadataStore()).orElseThrow(() -> new org.neo4j.commandline.admin.CommandFailed(String.format("Could not find version metadata in store '%s'", databaseDirectory))); string storeVersion = (new StoreVersionCheck(pageCache)).getVersion(databaseLayout.MetadataStore()).orElseThrow(() => new CommandFailed(string.Format("Could not find version metadata in store '{0}'", databaseDirectory))); const string fmt = "%-30s%s"; @out.accept(string.format(fmt, "Store format version:", storeVersion)); RecordFormats format = RecordFormatSelector.selectForVersion(storeVersion); @out.accept(string.format(fmt, "Store format introduced in:", format.IntroductionVersion())); findSuccessor(format).map(next => string.format(fmt, "Store format superseded in:", next.introductionVersion())).ifPresent(@out); } } catch (StoreLockException e) { throw new CommandFailed("the database is in use -- stop Neo4j and try again", e); } catch (Exception e) { throw new CommandFailed(e.Message, e); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private long applyTransactions(java.io.File fromPath, org.neo4j.kernel.internal.GraphDatabaseAPI toDb, org.neo4j.kernel.configuration.Config toConfig, long fromTxExclusive, long toTxInclusive, java.io.PrintStream out) throws Exception private long ApplyTransactions( File fromPath, GraphDatabaseAPI toDb, Config toConfig, long fromTxExclusive, long toTxInclusive, PrintStream @out ) { DependencyResolver resolver = toDb.DependencyResolver; TransactionRepresentationCommitProcess commitProcess = new TransactionRepresentationCommitProcess( resolver.ResolveDependency( typeof( TransactionAppender ) ), resolver.ResolveDependency( typeof( StorageEngine ) ) ); LifeSupport life = new LifeSupport(); try { using ( DefaultFileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction(), JobScheduler jobScheduler = createInitialisedScheduler(), PageCache pageCache = StandalonePageCacheFactory.createPageCache(fileSystem, jobScheduler) ) { LogicalTransactionStore source = life.Add( new ReadOnlyTransactionStore( pageCache, fileSystem, DatabaseLayout.of( fromPath ), Config.defaults(), new Monitors() ) ); life.Start(); long lastAppliedTx = fromTxExclusive; // Some progress if there are more than a couple of transactions to apply ProgressListener progress = toTxInclusive - fromTxExclusive >= 100 ? textual( @out ).singlePart( "Application progress", toTxInclusive - fromTxExclusive ) : Org.Neo4j.Helpers.progress.ProgressListener_Fields.None; using ( IOCursor<CommittedTransactionRepresentation> cursor = source.GetTransactions( fromTxExclusive + 1 ) ) { while ( cursor.next() ) { CommittedTransactionRepresentation transaction = cursor.get(); TransactionRepresentation transactionRepresentation = transaction.TransactionRepresentation; try { commitProcess.Commit( new TransactionToApply( transactionRepresentation ), NULL, EXTERNAL ); progress.Add( 1 ); } //JAVA TO C# CONVERTER WARNING: 'final' catch parameters are not available in C#: //ORIGINAL LINE: catch (final Throwable e) catch ( Exception e ) { Console.Error.WriteLine( "ERROR applying transaction " + transaction.CommitEntry.TxId ); throw e; } lastAppliedTx = transaction.CommitEntry.TxId; if ( lastAppliedTx == toTxInclusive ) { break; } } } return lastAppliedTx; } } finally { life.Shutdown(); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void changeStoreId(org.neo4j.io.layout.DatabaseLayout databaseLayout) throws Exception private void ChangeStoreId(DatabaseLayout databaseLayout) { File neoStoreFile = databaseLayout.MetadataStore(); using (JobScheduler jobScheduler = new ThreadPoolJobScheduler(), PageCache pageCache = StandalonePageCacheFactory.createPageCache(_fs, jobScheduler)) { MetaDataStore.setRecord(pageCache, neoStoreFile, RANDOM_NUMBER, DateTimeHelper.CurrentUnixTimeMillis()); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: static void assertStoreConsistent(org.neo4j.io.fs.FileSystemAbstraction fs, java.io.File storeDir) throws Exception internal static void AssertStoreConsistent(FileSystemAbstraction fs, File storeDir) { File parent = storeDir.ParentFile; using (JobScheduler jobScheduler = new ThreadPoolJobScheduler(), PageCache pageCache = StandalonePageCacheFactory.createPageCache(fs, jobScheduler), TemporaryStoreDirectory tempStore = new TemporaryStoreDirectory(fs, pageCache, parent)) { fs.CopyRecursively(storeDir, tempStore.StoreDir()); (new CopiedStoreRecovery(Config.defaults(), newDependencies().kernelExtensions(), pageCache)).recoverCopiedStore(tempStore.DatabaseLayout()); ConsistencyCheckService.Result result = runConsistencyCheckTool(new string[] { storeDir.AbsolutePath }, new PrintStream(NULL_OUTPUT_STREAM), new PrintStream(NULL_OUTPUT_STREAM)); if (!result.Successful) { throw new Exception("Not consistent database in " + storeDir); } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static java.util.Set<org.neo4j.causalclustering.identity.StoreId> getStoreIds(java.util.List<java.io.File> coreStoreDirs, org.neo4j.io.fs.FileSystemAbstraction fs) throws Exception public static ISet <StoreId> GetStoreIds(IList <File> coreStoreDirs, FileSystemAbstraction fs) { ISet <StoreId> storeIds = new HashSet <StoreId>(); using (JobScheduler jobScheduler = new ThreadPoolJobScheduler(), PageCache pageCache = StandalonePageCacheFactory.createPageCache(fs, jobScheduler)) { foreach (File coreStoreDir in coreStoreDirs) { storeIds.Add(DoReadStoreId(coreStoreDir, pageCache)); } } return(storeIds); }